From python-checkins at python.org Tue May 1 00:44:40 2007 From: python-checkins at python.org (phillip.eby) Date: Tue, 1 May 2007 00:44:40 +0200 (CEST) Subject: [Python-checkins] r55028 - peps/trunk/pep-0000.txt peps/trunk/pep-3124.txt Message-ID: <20070430224440.756F01E4010@bag.python.org> Author: phillip.eby Date: Tue May 1 00:44:38 2007 New Revision: 55028 Added: peps/trunk/pep-3124.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Log: Rough first draft of generic function PEP Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 00:44:38 2007 @@ -120,6 +120,7 @@ S 3120 Using UTF-8 as the default source encoding von L?wis S 3121 Module Initialization and finalization von L?wis S 3123 Making PyObject_HEAD conform to standard C von L?wis + S 3124 Overloading, Generic Functions, Interfaces Eby S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -482,6 +483,7 @@ S 3121 Module Initialization and finalization von L?wis SR 3122 Delineation of the main module Cannon S 3123 Making PyObject_HEAD conform to standard C von L?wis + S 3124 Overloading, Generic Functions, Interfaces Eby S 3141 A Type Hierarchy for Numbers Yasskin Added: peps/trunk/pep-3124.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3124.txt Tue May 1 00:44:38 2007 @@ -0,0 +1,908 @@ +PEP: 3124 +Title: Overloading, Generic Functions, Interfaces, and Adaptation +Version: $Revision: 52916 $ +Last-Modified: $Date: 2006-12-04 14:59:42 -0500 (Mon, 04 Dec 2006) $ +Author: Phillip J. Eby +Discussions-To: Python 3000 List +Status: Draft +Type: Standards Track +Requires: 3107, 3115, 3119 +Replaces: 245, 246 +Content-Type: text/x-rst +Created: 28-Apr-2007 +Post-History: 30-Apr-2007 + + +Abstract +======== + +This PEP proposes a new standard library module, ``overloading``, to +provide generic programming features including dynamic overloading +(aka generic functions), interfaces, adaptation, method combining (ala +CLOS and AspectJ), and simple forms of aspect-oriented programming. + +The proposed API is also open to extension; that is, it will be +possible for library developers to implement their own specialized +interface types, generic function dispatchers, method combination +algorithms, etc., and those extensions will be treated as first-class +citizens by the proposed API. + +The API will be implemented in pure Python with no C, but may have +some dependency on CPython-specific features such as ``sys._getframe`` +and the ``func_code`` attribute of functions. It is expected that +e.g. Jython and IronPython will have other ways of implementing +similar functionality (perhaps using Java or C#). + + +Rationale and Goals +=================== + +Python has always provided a variety of built-in and standard-library +generic functions, such as ``len()``, ``iter()``, ``pprint.pprint()``, +and most of the functions in the ``operator`` module. However, it +currently: + +1. does not have a simple or straightforward way for developers to + create new generic functions, + +2. does not have a standard way for methods to be added to existing + generic functions (i.e., some are added using registration + functions, others require defining ``__special__`` methods, + possibly by monkeypatching), and + +3. does not allow dispatching on multiple argument types (except in + a limited form for arithmetic operators, where "right-hand" + (``__r*__``) methods can be used to do two-argument dispatch. + +In addition, it is currently a common anti-pattern for Python code +to inspect the types of received arguments, in order to decide what +to do with the objects. For example, code may wish to accept either +an object of some type, or a sequence of objects of that type. + +Currently, the "obvious way" to do this is by type inspection, but +this is brittle and closed to extension. A developer using an +already-written library may be unable to change how their objects are +treated by such code, especially if the objects they are using were +created by a third party. + +Therefore, this PEP proposes a standard library module to address +these, and related issues, using decorators and argument annotations +(PEP 3107). The primary features to be provided are: + +* a dynamic overloading facility, similar to the static overloading + found in languages such as Java and C++, but including optional + method combination features as found in CLOS and AspectJ. + +* a simple "interfaces and adaptation" library inspired by Haskell's + typeclasses (but more dynamic, and without any static type-checking), + with an extension API to allow registering user-defined interface + types such as those found in PyProtocols and Zope. + +* a simple "aspect" implementation to make it easy to create stateful + adapters and to do other stateful AOP. + +These features are to be provided in such a way that extended +implementations can be created and used. For example, it should be +possible for libraries to define new dispatching criteria for +generic functions, and new kinds of interfaces, and use them in +place of the predefined features. For example, it should be possible +to use a ``zope.interface`` interface object to specify the desired +type of a function argument, as long as the ``zope.interface`` +registered itself correctly (or a third party did the registration). + +In this way, the proposed API simply offers a uniform way of accessing +the functionality within its scope, rather than prescribing a single +implementation to be used for all libraries, frameworks, and +applications. + + +User API +======== + +The overloading API will be implemented as a single module, named +``overloading``, providing the following features: + + +Overloading/Generic Functions +----------------------------- + +The ``@overload`` decorator allows you to define alternate +implementations of a function, specialized by argument type(s). A +function with the same name must already exist in the local namespace. +The existing function is modified in-place by the decorator to add +the new implementation, and the modified function is returned by the +decorator. Thus, the following code:: + + from overloading import overload + from collections import Iterable + + def flatten(ob): + """Flatten an object to its component iterables""" + yield ob + + @overload + def flatten(ob: Iterable): + for o in ob: + for ob in flatten(o): + yield ob + + @overload + def flatten(ob: basestring): + yield ob + +creates a single ``flatten()`` function whose implementation roughly +equates to:: + + def flatten(ob): + if isinstance(ob, basestring) or not isinstance(ob, Iterable): + yield ob + else: + for o in ob: + for ob in flatten(o): + yield ob + +**except** that the ``flatten()`` function defined by overloading +remains open to extension by adding more overloads, while the +hardcoded version cannot be extended. + +For example, if someone wants to use ``flatten()`` with a string-like +type that doesn't subclass ``basestring``, they would be out of luck +with the second implementation. With the overloaded implementation, +however, they can either write this:: + + @overload + def flatten(ob: MyString): + yield ob + +or this (to avoid copying the implementation):: + + from overloading import RuleSet + RuleSet(flatten).copy_rules((basestring,), (MyString,)) + +(Note also that, although PEP 3119 proposes that it should be possible +for abstract base classes like ``Iterable`` to allow classes like +``MyString`` to claim subclass-hood, such a claim is *global*, +throughout the application. In contrast, adding a specific overload +or copying a rule is specific to an individual function, and therefore +less likely to have undesired side effects.) + + +``@overload`` vs. ``@when`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``@overload`` decorator is a common-case shorthand for the more +general ``@when`` decorator. It allows you to leave out the name of +the function you are overloading, at the expense of requiring the +target function to be in the local namespace. It also doesn't support +adding additional criteria besides the ones specified via argument +annotations. The following function definitions have identical +effects, except for name binding side-effects (which will be described +below):: + + @overload + def flatten(ob: basestring): + yield ob + + @when(flatten) + def flatten(ob: basestring): + yield ob + + @when(flatten) + def flatten_basestring(ob: basestring): + yield ob + + @when(flatten, (basestring,)) + def flatten_basestring(ob): + yield ob + +The first definition above will bind ``flatten`` to whatever it was +previously bound to. The second will do the same, if it was already +bound to the ``when`` decorator's first argument. If ``flatten`` is +unbound or bound to something else, it will be rebound to the function +definition as given. The last two definitions above will always bind +``flatten_basestring`` to the function definition as given. + +Using this approach allows you to both give a method a descriptive +name (often useful in tracebacks!) and to reuse the method later. + +Except as otherwise specified, all ``overloading`` decorators have the +same signature and binding rules as ``@when``. They accept a function +and an optional "predicate" object. + +The default predicate implementation is a tuple of types with +positional matching to the overloaded function's arguments. However, +an arbitrary number of other kinds of of predicates can be created and +registered using the `Extension API`_, and will then be usable with +``@when`` and other decorators created by this module (like +``@before``, ``@after``, and ``@around``). + + +Method Combination and Overriding +--------------------------------- + +When an overloaded function is invoked, the implementation with the +signature that *most specifically matches* the calling arguments is +the one used. If no implementation matches, a ``NoApplicableMethods`` +error is raised. If more than one implementation matches, but none of +the signatures are more specific than the others, an ``AmbiguousMethods`` +error is raised. + +For example, the following pair of implementations are ambiguous, if +the ``foo()`` function is ever called with two integer arguments, +because both signatures would apply, but neither signature is more +*specific* than the other (i.e., neither implies the other):: + + def foo(bar:int, baz:object): + pass + + @overload + def foo(bar:object, baz:int): + pass + +In contrast, the following pair of implementations can never be +ambiguous, because one signature always implies the other; the +``int/int`` signature is more specific than the ``object/object`` +signature:: + + def foo(bar:object, baz:object): + pass + + @overload + def foo(bar:int, baz:int): + pass + +A signature S1 implies another signature S2, if whenever S1 would +apply, S2 would also. A signature S1 is "more specific" than another +signature S2, if S1 implies S2, but S2 does not imply S1. + +Although the examples above have all used concrete or abstract types +as argument annotations, there is no requirement that the annotations +be such. They can also be "interface" objects (discussed in the +`Interfaces and Adaptation`_ section), including user-defined +interface types. (They can also be other objects whose types are +appropriately registered via the `Extension API`_.) + + +Proceeding to the "Next" Method +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If the first parameter of an overloaded function is named +``__proceed__``, it will be passed a callable representing the next +most-specific method. For example, this code:: + + def foo(bar:object, baz:object): + print "got objects!" + + @overload + def foo(__proceed__, bar:int, baz:int): + print "got integers!" + return __proceed__(bar, baz) + +Will print "got integers!" followed by "got objects!". + +If there is no next most-specific method, ``__proceed__`` will be +bound to a ``NoApplicableMethods`` instance. When called, a new +``NoApplicableMethods`` instance will be raised, with the arguments +passed to the first instance. + +Similarly, if the next most-specific methods have ambiguous precedence +with respect to each other, ``__proceed__`` will be bound to an +``AmbiguousMethods`` instance, and if called, it will raise a new +instance. + +Thus, a method can either check if ``__proceed__`` is an error +instance, or simply invoke it. The ``NoApplicableMethods`` and +``AmbiguousMethods`` error classes have a common ``DispatchError`` +base class, so ``isinstance(__proceed__, overloading.DispatchError)`` +is sufficient to identify whether ``__proceed__`` can be safely +called. + +(Implementation note: using a magic argument name like ``__proceed__`` +could potentially be replaced by a magic function that would be called +to obtain the next method. A magic function, however, would degrade +performance and might be more difficult to implement on non-CPython +platforms. Method chaining via magic argument names, however, can be +efficiently implemented on any Python platform that supports creating +bound methods from functions -- one simply recursively binds each +function to be chained, using the following function or error as the +``im_self`` of the bound method.) + + +"Before" and "After" Methods +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In addition to the simple next-method chaining shown above, it is +sometimes useful to have other ways of combining methods. For +example, the "observer pattern" can sometimes be implemented by adding +extra methods to a function, that execute before or after the normal +implementation. + +To support these use cases, the ``overloading`` module will supply +``@before``, ``@after``, and ``@around`` decorators, that roughly +correspond to the same types of methods in the Common Lisp Object +System (CLOS), or the corresponding "advice" types in AspectJ. + +Like ``@when``, all of these decorators must be passed the function to +be overloaded, and can optionally accept a predicate as well:: + + def begin_transaction(db): + print "Beginning the actual transaction" + + + @before(begin_transaction) + def check_single_access(db: SingletonDB): + if db.inuse: + raise TransactionError("Database already in use") + + @after(begin_transaction) + def start_logging(db: LoggableDB): + db.set_log_level(VERBOSE) + + +``@before`` and ``@after`` methods are invoked either before or after +the main function body, and are *never considered ambiguous*. That +is, it will not cause any errors to have multiple "before" or "after" +methods with identical or overlapping signatures. Ambiguities are +resolved using the order in which the methods were added to the +target function. + +"Before" methods are invoked most-specific method first, with +ambiguous methods being executed in the order they were added. All +"before" methods are called before any of the function's "primary" +methods (i.e. normal ``@overload`` methods) are executed. + +"After" methods are invoked in the *reverse* order, after all of the +function's "primary" methods are executed. That is, they are executed +least-specific methods first, with ambiguous methods being executed in +the reverse of the order in which they were added. + +The return values of both "before" and "after" methods are ignored, +and any uncaught exceptions raised by *any* methods (primary or other) +immediately end the dispatching process. "Before" and "after" methods +cannot have ``__proceed__`` arguments, as they are not responsible +for calling any other methods. They are simply called as a +notification before or after the primary methods. + +Thus, "before" and "after" methods can be used to check or establish +preconditions (e.g. by raising an error if the conditions aren't met) +or to ensure postconditions, without needing to duplicate any existing +functionality. + + +"Around" Methods +~~~~~~~~~~~~~~~~ + +The ``@around`` decorator declares a method as an "around" method. +"Around" methods are much like primary methods, except that the +least-specific "around" method has higher precedence than the +most-specific "before" or method. + +Unlike "before" and "after" methods, however, "Around" methods *are* +responsible for calling their ``__proceed__`` argument, in order to +continue the invocation process. "Around" methods are usually used +to transform input arguments or return values, or to wrap specific +cases with special error handling or try/finally conditions, e.g.:: + + @around(commit_transaction) + def lock_while_committing(__proceed__, db: SingletonDB): + with db.global_lock: + return __proceed__(db) + +They can also be used to replace the normal handling for a specific +case, by *not* invoking the ``__proceed__`` function. + +The ``__proceed__`` given to an "around" method will either be the +next applicable "around" method, a ``DispatchError`` instance, +or a synthetic method object that will call all the "before" methods, +followed by the primary method chain, followed by all the "after" +methods, and return the result from the primary method chain. + +Thus, just as with normal methods, ``__proceed__`` can be checked for +``DispatchError``-ness, or simply invoked. The "around" method should +return the value returned by ``__proceed__``, unless of course it +wishes to modify or replace it with a different return value for the +function as a whole. + + +Custom Combinations +~~~~~~~~~~~~~~~~~~~ + +The decorators described above (``@overload``, ``@when``, ``@before``, +``@after``, and ``@around``) collectively implement what in CLOS is +called the "standard method combination" -- the most common patterns +used in combining methods. + +Sometimes, however, an application or library may have use for a more +sophisticated type of method combination. For example, if you +would like to have "discount" methods that return a percentage off, +to be subtracted from the value returned by the primary method(s), +you might write something like this:: + + from overloading import always_overrides, merge_by_default + from overloading import Around, Before, After, Method, MethodList + + class Discount(MethodList): + """Apply return values as discounts""" + + def __call__(self, *args, **kw): + retval = self.tail(*args, **kw) + for sig, body in self.sorted(): + retval -= retval * body(*args, **kw) + return retval + + # merge discounts by priority + merge_by_default(Discount) + + # discounts have precedence over before/after/primary methods + always_overrides(Discount, Before) + always_overrides(Discount, After) + always_overrides(Discount, Method) + + # but not over "around" methods + always_overrides(Around, Discount) + + # Make a decorator called "discount" that works just like the + # standard decorators... + discount = Discount.make_decorator('discount') + + # and now let's use it... + def price(product): + return product.list_price + + @discount(price) + def ten_percent_off_shoes(product: Shoe) + return Decimal('0.1') + +Similar techniques can be used to implement a wide variety of +CLOS-style method qualifiers and combination rules. The process of +creating custom method combination objects and their corresponding +decorators is described in more detail under the `Extension API`_ +section. + +Note, by the way, that the ``@discount`` decorator shown will work +correctly with any new predicates defined by other code. For example, +if ``zope.interface`` were to register its interface types to work +correctly as argument annotations, you would be able to specify +discounts on the basis of its interface types, not just classes or +``overloading``-defined interface types. + +Similarly, if a library like RuleDispatch or PEAK-Rules were to +register an appropriate predicate implementation and dispatch engine, +one would then be able to use those predicates for discounts as well, +e.g.:: + + from somewhere import Pred # some predicate implementation + + @discount( + price, + Pred("isinstance(product,Shoe) and" + " product.material.name=='Blue Suede'") + ) + def forty_off_blue_suede_shoes(product): + return Decimal('0.4') + +The process of defining custom predicate types and dispatching engines +is also described in more detail under the `Extension API`_ section. + + +Overloading Inside Classes +-------------------------- + +All of the decorators above have a special additional behavior when +they are directly invoked within a class body: the first parameter +(other than ``__proceed__``, if present) of the decorated function +will be treated as though it had an annotation equal to the class +in which it was defined. + +That is, this code:: + + class And(object): + # ... + @when(get_conjuncts) + def __conjuncts(self): + return self.conjuncts + +produces the same effect as this (apart from the existence of a +private method):: + + class And(object): + # ... + + @when(get_conjuncts) + def get_conjuncts_of_and(ob: And): + return ob.conjuncts + +This behavior is both a convenience enhancement when defining lots of +methods, and a requirement for safely distinguishing multi-argument +overloads in subclasses. Consider, for example, the following code:: + + class A(object): + def foo(self, ob): + print "got an object" + + @overload + def foo(__proceed__, self, ob:Iterable): + print "it's iterable!" + return __proceed__(self, ob) + + + class B(A): + foo = A.foo # foo must be defined in local namespace + + @overload + def foo(__proceed__, self, ob:Iterable): + print "B got an iterable!" + return __proceed__(self, ob) + +Due to the implicit class rule, calling ``B().foo([])`` will print +"B got an iterable!" followed by "it's iterable!", and finally, +"got an object", while ``A().foo([])`` would print only the messages +defined in ``A``. + +Conversely, without the implicit class rule, the two "Iterable" +methods would have the exact same applicability conditions, so calling +either ``A().foo([])`` or ``B().foo([])`` would result in an +``AmbiguousMethods`` error. + +It is currently an open issue to determine the best way to implement +this rule in Python 3.0. Under Python 2.x, a class' metaclass was +not chosen until the end of the class body, which means that +decorators could insert a custom metaclass to do processing of this +sort. (This is how RuleDispatch, for example, implements the implicit +class rule.) + +PEP 3115, however, requires that a class' metaclass be determined +*before* the class body has executed, making it impossible to use this +technique for class decoration any more. + +At this writing, discussion on this issue is ongoing. + + +Interfaces and Adaptation +------------------------- + +The ``overloading`` module provides a simple implementation of +interfaces and adaptation. The following example defines an +``IStack`` interface, and declares that ``list`` objects support it:: + + from overloading import abstract, Interface + + class IStack(Interface): + @abstract + def push(self, ob) + """Push 'ob' onto the stack""" + + @abstract + def pop(self): + """Pop a value and return it""" + + + when(IStack.push, (list, object))(list.append) + when(IStack.pop, (list,))(list.pop) + + mylist = [] + mystack = IStack(mylist) + mystack.push(42) + assert mystack.pop()==42 + +The ``Interface`` class is a kind of "universal adapter". It accepts +a single argument: an object to adapt. It then binds all its methods +to the target object, in place of itself. Thus, calling +``mystack.push(42``) is the same as calling +``IStack.push(mylist, 42)``. + +The ``@abstract`` decorator marks a function as being abstract: i.e., +having no implementation. If an ``@abstract`` function is called, +it raises ``NoApplicableMethods``. To become executable, overloaded +methods must be added using the techniques previously described. (That +is, methods can be added using ``@when``, ``@before``, ``@after``, +``@around``, or any custom method combination decorators.) + +In the example above, the ``list.append`` method is added as a method +for ``IStack.push()`` when its arguments are a list and an arbitrary +object. Thus, ``IStack.push(mylist, 42)`` is translated to +``list.append(mylist, 42)``, thereby implementing the desired +operation. + +(Note: the ``@abstract`` decorator is not limited to use in interface +definitions; it can be used anywhere that you wish to create an +"empty" generic function that initially has no methods. In +particular, it need not be used inside a class.) + + +Subclassing and Re-assembly +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Interfaces can be subclassed:: + + class ISizedStack(IStack): + @abstract + def __len__(self): + """Return the number of items on the stack""" + + # define __len__ support for ISizedStack + when(ISizedStack.__len__, (list,))(list.__len__) + +Or assembled by combining functions from existing interfaces:: + + class Sizable(Interface): + __len__ = ISizedStack.__len__ + + # list now implements Sizable as well as ISizedStack, without + # making any new declarations! + +A class can be considered to "adapt to" an interface at a given +point in time, if no method defined in the interface is guaranteed to +raise a ``NoApplicableMethods`` error if invoked on an instance of +that class at that point in time. + +In normal usage, however, it is "easier to ask forgiveness than +permission". That is, it is easier to simply use an interface on +an object by adapting it to the interface (e.g. ``IStack(mylist)``) +or invoking interface methods directly (e.g. ``IStack.push(mylist, +42)``), than to try to figure out whether the object is adaptable to +(or directly implements) the interface. + + +Implementing an Interface in a Class +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +It is possible to declare that a class directly implements an +interface, using the ``declare_implementation()`` function:: + + from overloading import declare_implementation + + class Stack(object): + def __init__(self): + self.data = [] + def push(self, ob): + self.data.append(ob) + def pop(self): + return self.data.pop() + + declare_implementation(IStack, Stack) + +The ``declare_implementation()`` call above is roughly equivalent to +the following steps:: + + when(IStack.push, (Stack,object))(lambda self, ob: self.push(ob)) + when(IStack.pop, (Stack,))(lambda self, ob: self.pop()) + +That is, calling ``IStack.push()`` or ``IStack.pop()`` on an instance +of any subclass of ``Stack``, will simply delegate to the actual +``push()`` or ``pop()`` methods thereof. + +For the sake of efficiency, calling ``IStack(s)`` where ``s`` is an +instance of ``Stack``, **may** return ``s`` rather than an ``IStack`` +adapter. (Note that calling ``IStack(x)`` where ``x`` is already an +``IStack`` adapter will always return ``x`` unchanged; this is an +additional optimization allowed in cases where the adaptee is known +to *directly* implement the interface, without adaptation.) + +For convenience, it may be useful to declare implementations in the +class header, e.g.:: + + class Stack(metaclass=Implementer, implements=IStack): + ... + +Instead of calling ``declare_implementation()`` after the end of the +suite. + + +Interfaces as Type Specifiers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``Interface`` subclasses can be used as argument annotations to +indicate what type of objects are acceptable to an overload, e.g.:: + + @overload + def traverse(g: IGraph, s: IStack): + g = IGraph(g) + s = IStack(s) + # etc.... + +Note, however, that the actual arguments are *not* changed or adapted +in any way by the mere use of an interface as a type specifier. You +must explicitly cast the objects to the appropriate interface, as +shown above. + +Note, however, that other patterns of interface use are possible. +For example, other interface implementations might not support +adaptation, or might require that function arguments already be +adapted to the specified interface. So the exact semantics of using +an interface as a type specifier are dependent on the interface +objects you actually use. + +For the interface objects defined by this PEP, however, the semantics +are as described above. An interface I1 is considered "more specific" +than another interface I2, if the set of descriptors in I1's +inheritance hierarchy are a proper superset of the descriptors in I2's +inheritance hierarchy. + +So, for example, ``ISizedStack`` is more specific than both +``ISizable`` and ``ISizedStack``, irrespective of the inheritance +relationships between these interfaces. It is purely a question of +what operations are included within those interfaces -- and the +*names* of the operations are unimportant. + +Interfaces (at least the ones provided by ``overloading``) are always +considered less-specific than concrete classes. Other interface +implementations can decide on their own specificity rules, both +between interfaces and other interfaces, and between interfaces and +classes. + + +Non-Method Attributes in Interfaces +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``Interface`` implementation actually treats all attributes and +methods (i.e. descriptors) in the same way: their ``__get__`` (and +``__set__`` and ``__delete__``, if present) methods are called with +the wrapped (adapted) object as "self". For functions, this has the +effect of creating a bound method linking the generic function to the +wrapped object. + +For non-function attributes, it may be easiest to specify them using +the ``property`` built-in, and the corresponding ``fget``, ``fset``, +and ``fdel`` attributes:: + + class ILength(Interface): + @property + @abstract + def length(self): + """Read-only length attribute""" + + # ILength(aList).length == list.__len__(aList) + when(ILength.length.fget, (list,))(list.__len__) + +Alternatively, methods such as ``_get_foo()`` and ``_set_foo()`` +may be defined as part of the interface, and the property defined +in terms of those methods, but this a bit more difficult for users +to implement correctly when creating a class that directly implements +the interface, as they would then need to match all the individual +method names, not just the name of the property or attribute. + + +Aspects +------- + +The adaptation system provided assumes that adapters are "stateless", +which is to say that adapters have no attributes or storage apart from +those of the adapted object. This follows the "typeclass/instance" +model of Haskell, and the concept of "pure" (i.e., transitively +composable) adapters. + +However, there are occasionally cases where, to provide a complete +implementation of some interface, some sort of additional state is +required. + +One possibility of course, would be to attach monkeypatched "private" +attributes to the adaptee. But this is subject to name collisions, +and complicates the process of initialization. It also doesn't work +on objects that don't have a ``__dict__`` attribute. + +So the ``Aspect`` class is provided to make it easy to attach extra +information to objects that either: + +1. have a ``__dict__`` attribute (so aspect instances can be stored + in it, keyed by aspect class), + +2. support weak referencing (so aspect instances can be managed using + a global but thread-safe weak-reference dictionary), or + +3. implement or can be adapt to the ``overloading.IAspectOwner`` + interface (technically, #1 or #2 imply this) + +Subclassing ``Aspect`` creates an adapter class whose state is tied +to the life of the adapted object. + +For example, suppose you would like to count all the times a certain +method is called on instances of ``Target`` (a classic AOP example). +You might do something like:: + + from overloading import Aspect + + class Count(Aspect): + count = 0 + + @after(Target.some_method) + def count_after_call(self, *args, **kw): + Count(self).count += 1 + +The above code will keep track of the number of times that +``Target.some_method()`` is successfully called (i.e., it will not +count errors). Other code can then access the count using +``Count(someTarget).count``. + +``Aspect`` instances can of course have ``__init__`` methods, to +initialize any data structures. They can use either ``__slots__`` +or dictionary-based attributes for storage. + +While this facility is rather primitive compared to a full-featured +AOP tool like AspectJ, persons who wish to build pointcut libraries +or other AspectJ-like features can certainly use ``Aspect`` objects +and method-combination decorators as a base for more expressive AOP +tools. + +XXX spec out full aspect API, including keys, N-to-1 aspects, manual + attach/detach/delete of aspect instances, and the ``IAspectOwner`` + interface. + + +Extension API +============= + +TODO: explain how all of these work + +implies(o1, o2) + +declare_implementation(iface, class) + +predicate_signatures(ob) + +parse_rule(ruleset, body, predicate, actiontype, localdict, globaldict) + +combine_actions(a1, a2) + +rules_for(f) + +Rule objects + +ActionDef objects + +RuleSet objects + +Method objects + +MethodList objects + +IAspectOwner + + + +Implementation Notes +==================== + +Most of the functionality described in this PEP is already implemented +in the in-development version of the PEAK-Rules framework. In +particular, the basic overloading and method combination framework +(minus the ``@overload`` decorator) already exists there. The +implementation of all of these features in ``peak.rules.core`` is 656 +lines of Python at this writing. + +``peak.rules.core`` currently relies on the DecoratorTools and +BytecodeAssembler modules, but both of these dependencies can be +replaced, as DecoratorTools is used mainly for Python 2.3 +compatibility and to implement structure types (which can be done +with named tuples in later versions of Python). The use of +BytecodeAssembler can be replaced using an "exec" or "compile" +workaround, given a reasonable effort. (It would be easier to do this +if the ``func_closure`` attribute of function objects was writable.) + +The ``Interface`` class has been previously prototyped, but is not +included in PEAK-Rules at the present time. + +The "implicit class rule" has previously been implemented in the +RuleDispatch library. However, it relies on the ``__metaclass__`` +hook that is currently eliminated in PEP 3115. + +I don't currently know how to make ``@overload`` play nicely with +``classmethod`` and ``staticmethod`` in class bodies. It's not really +clear if it needs to, however. + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Tue May 1 00:48:11 2007 From: python-checkins at python.org (phillip.eby) Date: Tue, 1 May 2007 00:48:11 +0200 (CEST) Subject: [Python-checkins] r55029 - peps/trunk/pep-3124.txt Message-ID: <20070430224811.3FFCC1E4010@bag.python.org> Author: phillip.eby Date: Tue May 1 00:48:06 2007 New Revision: 55029 Modified: peps/trunk/pep-3124.txt (contents, props changed) Log: Fix svn:keyword properties Modified: peps/trunk/pep-3124.txt ============================================================================== --- peps/trunk/pep-3124.txt (original) +++ peps/trunk/pep-3124.txt Tue May 1 00:48:06 2007 @@ -1,7 +1,7 @@ PEP: 3124 Title: Overloading, Generic Functions, Interfaces, and Adaptation -Version: $Revision: 52916 $ -Last-Modified: $Date: 2006-12-04 14:59:42 -0500 (Mon, 04 Dec 2006) $ +Version: $Revision$ +Last-Modified: $Date$ Author: Phillip J. Eby Discussions-To: Python 3000 List Status: Draft From python-checkins at python.org Tue May 1 01:03:43 2007 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 1 May 2007 01:03:43 +0200 (CEST) Subject: [Python-checkins] r55030 - peps/trunk/pep-0000.txt peps/trunk/pep-3125.txt peps/trunk/pep-3126.txt Message-ID: <20070430230343.34F6D1E4010@bag.python.org> Author: guido.van.rossum Date: Tue May 1 01:03:34 2007 New Revision: 55030 Added: peps/trunk/pep-3125.txt (contents, props changed) peps/trunk/pep-3126.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Log: Two new peps: S 3125 Remove Backslash Continuation Jewett S 3126 Remove Implicit String Concatenation Jewett Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 01:03:34 2007 @@ -121,6 +121,8 @@ S 3121 Module Initialization and finalization von L?wis S 3123 Making PyObject_HEAD conform to standard C von L?wis S 3124 Overloading, Generic Functions, Interfaces Eby + S 3125 Remove Backslash Continuation Jewett + S 3126 Remove Implicit String Concatenation Jewett S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -484,6 +486,8 @@ SR 3122 Delineation of the main module Cannon S 3123 Making PyObject_HEAD conform to standard C von L?wis S 3124 Overloading, Generic Functions, Interfaces Eby + S 3125 Remove Backslash Continuation Jewett + S 3126 Remove Implicit String Concatenation Jewett S 3141 A Type Hierarchy for Numbers Yasskin Added: peps/trunk/pep-3125.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3125.txt Tue May 1 01:03:34 2007 @@ -0,0 +1,103 @@ +PEP: 3125 +Title: Remove Backslash Continuation +Version: $Revision$ +Last-Modified: $Date$ +Author: Jim J. Jewett +Status: Draft +Type: Standards Track +Content-Type: text/plain +Created: 29-Apr-2007 +Post-History: 29-Apr-2007, 30-Apr-2007 + + +Abstract + + Python initially inherited its parsing from C. While this has + been generally useful, there are some remnants which have been + less useful for python, and should be eliminated. + + This PEP proposes elimination of terminal "\" as a marker for + line continuation. + + +Rationale for Removing Explicit Line Continuation + + A terminal "\" indicates that the logical line is continued on the + following physical line (after whitespace). + + Note that a non-terminal "\" does not have this meaning, even if the + only additional characters are invisible whitespace. (Python depends + heavily on *visible* whitespace at the beginning of a line; it does + not otherwise depend on *invisible* terminal whitespace.) Adding + whitespace after a "\" will typically cause a syntax error rather + than a silent bug, but it still isn't desirable. + + The reason to keep "\" is that occasionally code looks better with + a "\" than with a () pair. + + assert True, ( + "This Paren is goofy") + + But realistically, that parenthesis is no worse than a "\". The + only advantage of "\" is that it is slightly more familiar to users of + C-based languages. These same languages all also support line + continuation with (), so reading code will not be a problem, and + there will be one less rule to learn for people entirely new to + programming. + + +Alternate proposal + + Several people have suggested alternative ways of marking the line + end. Most of these were rejected for not actually simplifying things. + + The one exception was to let any unfished expression signify a line + continuation, possibly in conjunction with increased indentation + + assert True, # comma implies tuple implies continue + "No goofy parens" + + The objections to this are: + + - The amount of whitespace may be contentious; expression + continuation should not be confused with opening a new + suite. + + - The "expression continuation" markers are not as clearly marked + in Python as the grouping punctuation "(), [], {}" marks are. + + "abc" + # Plus needs another operand, so it continues + "def" + + "abc" # String ends an expression, so + + "def" # this is a syntax error. + + - Guido says so. [1] His reasoning is that it may not even be + feasible. (See next reason.) + + - As a technical concern, supporting this would require allowing + INDENT or DEDENT tokens anywhere, or at least in a widely + expanded (and ill-defined) set of locations. While this is + in some sense a concern only for the internal parsing + implementation, it would be a major new source of complexity. [1] + + +References + + [1] PEP 30XZ: Simplified Parsing, van Rossum + http://mail.python.org/pipermail/python-3000/2007-April/007063.html + + +Copyright + + This document has been placed in the public domain. + + + +Local Variables: +mode: indented-text +indent-tabs-mode: nil +sentence-end-double-space: t +fill-column: 70 +coding: utf-8 +End: Added: peps/trunk/pep-3126.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3126.txt Tue May 1 01:03:34 2007 @@ -0,0 +1,112 @@ +PEP: 3126 +Title: Remove Implicit String Concatenation +Version: $Revision$ +Last-Modified: $Date$ +Author: Jim J. Jewett +Status: Draft +Type: Standards Track +Content-Type: text/plain +Created: 29-Apr-2007 +Post-History: 29-Apr-2007, 30-Apr-2007 + + +Abstract + + Python initially inherited its parsing from C. While this has + been generally useful, there are some remnants which have been + less useful for python, and should be eliminated. + + This PEP proposes to eliminate Implicit String concatenation + based on adjacency of literals. + + Instead of + + "abc" "def" == "abcdef" + + authors will need to be explicit, and add the strings + + "abc" + "def" == "abcdef" + + +Rationale for Removing Implicit String Concatenation + + Implicit String concatentation can lead to confusing, or even + silent, errors. + + def f(arg1, arg2=None): pass + + f("abc" "def") # forgot the comma, no warning ... + # silently becomes f("abcdef", None) + + or, using the scons build framework, + + sourceFiles = [ + 'foo.c' + 'bar.c', + #...many lines omitted... + 'q1000x.c'] + + It's a common mistake to leave off a comma, and then scons complains + that it can't find 'foo.cbar.c'. This is pretty bewildering behavior + even if you *are* a Python programmer, and not everyone here is. [1] + + Note that in C, the implicit concatenation is more justified; there + is no other way to join strings without (at least) a function call. + + In Python, strings are objects which support the __add__ operator; + it is possible to write: + + "abc" + "def" + + Because these are literals, this addition can still be optimized + away by the compiler. (The CPython compiler already does. [2]) + + Guido indicated [2] that this change should be handled by PEP, because + there were a few edge cases with other string operators, such as the %. + (Assuming that str % stays -- it may be eliminated in favor of + PEP 3101 -- Advanced String Formatting. [3] [4]) + + The resolution is to treat them the same as today. + + ("abc %s def" + "ghi" % var) # fails like today. + # raises TypeError because of + # precedence. (% before +) + + ("abc" + "def %s ghi" % var) # works like today; precedence makes + # the optimization more difficult to + # recognize, but does not change the + # semantics. + + ("abc %s def" + "ghi") % var # works like today, because of + # precedence: () before % + # CPython compiler can already + # add the literals at compile-time. + + +References + + [1] Implicit String Concatenation, Jewett, Orendorff + http://mail.python.org/pipermail/python-ideas/2007-April/000397.html + + [2] Reminder: Py3k PEPs due by April, Hettinger, van Rossum + http://mail.python.org/pipermail/python-3000/2007-April/006563.html + + [3] PEP 3101, Advanced String Formatting, Talin + http://www.python.org/peps/pep-3101.html + + [4] ps to question Re: Need help completing ABC pep, van Rossum + http://mail.python.org/pipermail/python-3000/2007-April/006737.html + +Copyright + + This document has been placed in the public domain. + + + +Local Variables: +mode: indented-text +indent-tabs-mode: nil +sentence-end-double-space: t +fill-column: 70 +coding: utf-8 +End: From python-checkins at python.org Tue May 1 02:19:55 2007 From: python-checkins at python.org (phillip.eby) Date: Tue, 1 May 2007 02:19:55 +0200 (CEST) Subject: [Python-checkins] r55031 - peps/trunk/pep-3124.txt Message-ID: <20070501001955.1202D1E4011@bag.python.org> Author: phillip.eby Date: Tue May 1 02:19:45 2007 New Revision: 55031 Modified: peps/trunk/pep-3124.txt Log: Fix typo Modified: peps/trunk/pep-3124.txt ============================================================================== --- peps/trunk/pep-3124.txt (original) +++ peps/trunk/pep-3124.txt Tue May 1 02:19:45 2007 @@ -87,7 +87,7 @@ generic functions, and new kinds of interfaces, and use them in place of the predefined features. For example, it should be possible to use a ``zope.interface`` interface object to specify the desired -type of a function argument, as long as the ``zope.interface`` +type of a function argument, as long as the ``zope.interface`` package registered itself correctly (or a third party did the registration). In this way, the proposed API simply offers a uniform way of accessing From python-checkins at python.org Tue May 1 02:24:54 2007 From: python-checkins at python.org (phillip.eby) Date: Tue, 1 May 2007 02:24:54 +0200 (CEST) Subject: [Python-checkins] r55032 - peps/trunk/pep-0000.txt peps/trunk/pep-0365.txt Message-ID: <20070501002454.4D4751E4010@bag.python.org> Author: phillip.eby Date: Tue May 1 02:24:48 2007 New Revision: 55032 Added: peps/trunk/pep-0365.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Log: Added pkg_resources PEP Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 02:24:48 2007 @@ -110,6 +110,7 @@ S 355 Path - Object oriented filesystem paths Lindqvist S 362 Function Signature Object Cannon, Seo S 364 Transitioning to the Py3K Standard Library Warsaw + S 365 Adding the pkg_resources module Eby S 754 IEEE 754 Floating Point Special Values Warnes S 3101 Advanced String Formatting Talin S 3108 Standard Library Reorganization Cannon @@ -455,6 +456,7 @@ S 362 Function Signature Object Cannon, Seo SR 363 Syntax For Dynamic Attribute Access North S 364 Transitioning to the Py3K Standard Library Warsaw + S 365 Adding the pkg_resources module Eby SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR Added: peps/trunk/pep-0365.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-0365.txt Tue May 1 02:24:48 2007 @@ -0,0 +1,127 @@ +PEP: 365 +Title: Adding the pkg_resources module +Version: $Revision$ +Last-Modified: $Date$ +Author: Phillip J. Eby +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 30-Apr-2007 +Post-History: 30-Apr-2007 + + +Abstract +======== + +This PEP proposes adding an enhanced version of the ``pkg_resources`` +module to the standard library. + +``pkg_resources`` is a module used to find and manage Python +package/version dependencies and access bundled files and resources, +including those inside of zipped ``.egg`` files. Currently, +``pkg_resources`` is only available through installing the entire +``setuptools`` distribution, but it does not depend on any other part +of setuptools; in effect, it comprises the entire runtime support +library for Python Eggs, and is independently useful. + +In addition, with one feature addition, this module could support +easy bootstrap installation of several Python package management +tools, including ``setuptools``, ``workingenv``, and ``zc.buildout``. + + +Proposal +======== + +Rather than proposing to include ``setuptools`` in the standard +library, this PEP proposes only that ``pkg_resources`` be added to the +standard library for Python 2.6 and 3.0. ``pkg_resources`` is +considerably more stable than the rest of setuptools, with virtually +no new features being added in the last 12 months. + +However, this PEP also proposes that a new feature be added to +``pkg_resources``, before being added to the stdlib. Specifically, it +should be possible to do something like:: + + python -m pkg_resources SomePackage==1.2 + +to request downloading and installation of ``SomePackage`` from PyPI. +This feature would *not* be a replacement for ``easy_install``; +instead, it would rely on ``SomePackage`` having pure-Python ``.egg`` +files listed for download via the PyPI XML-RPC API, and the eggs would +be placed in the ``$PYTHONEGGS`` cache, where they would **not** be +importable by default. (And no scripts would be installed) However, +if the download egg contains installation bootstrap code, it will be +given a chance to run. + +These restrictions would allow the code to be extremely simple, yet +still powerful enough to support users downloading package management +tools such as ``setuptools``, ``workingenv`` and ``zc.buildout``, +simply by supplying the tool's name on the command line. + + +Rationale +========= + +Many users have requested that ``setuptools`` be included in the +standard library, to save users needing to go through the awkward +process of bootstrapping it. However, most of the bootstrapping +complexity comes from the fact that setuptools-installed code cannot +use the ``pkg_resources`` runtime module unless setuptools is already +installed. Thus, installing setuptools requires (in a sense) that +setuptools already be installed. + +Other Python package management tools, such as ``workingenv`` and +``zc.buildout``, have similar bootstrapping issues, since they both +make use of setuptools, but also want to provide users with something +approaching a "one-step install". The complexity of creating bootstrap +utilities for these and any other such tools that arise in future, is +greatly reduced if ``pkg_resources`` is already present, and is also +able to download pre-packaged eggs from PyPI. + +(It would also mean that setuptools would not need to be installed +in order to simply *use* eggs, as opposed to building them.) + +Finally, in addition to providing access to eggs built via setuptools +or other packaging tools, it should be noted that since Python 2.5, +the distutils install package metadata (aka ``PKG-INFO``) files that +can be read by ``pkg_resources`` to identify what distributions are +already on ``sys.path``. In environments where Python packages are +installed using system package tools (like RPM), the ``pkg_resources`` +module provides an API for detecting what versions of what packages +are installed, even if those packages were installed via the distutils +instead of setuptools. + + +Implementation and Documentation +================================ + +The ``pkg_resources`` implementation is maintained in the Python +SVN repository under ``/sandbox/trunk/setuptools/``; see +``pkg_resources.py`` and ``pkg_resources.txt``. Documentation for the +egg format(s) supported by ``pkg_resources`` can be found in +``doc/formats.txt``. HTML versions of these documents are available +at: + +* http://peak.telecommunity.com/DevCenter/PkgResources and + +* http://peak.telecommunity.com/DevCenter/EggFormats + +(These HTML versions are for setuptools 0.6; they may not reflect all +of the changes found in the Subversion trunk's ``.txt`` versions.) + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Tue May 1 02:32:32 2007 From: python-checkins at python.org (phillip.eby) Date: Tue, 1 May 2007 02:32:32 +0200 (CEST) Subject: [Python-checkins] r55033 - peps/trunk/pep-3124.txt Message-ID: <20070501003232.5433F1E4010@bag.python.org> Author: phillip.eby Date: Tue May 1 02:32:18 2007 New Revision: 55033 Modified: peps/trunk/pep-3124.txt Log: Fix missing imports in examples Modified: peps/trunk/pep-3124.txt ============================================================================== --- peps/trunk/pep-3124.txt (original) +++ peps/trunk/pep-3124.txt Tue May 1 02:32:18 2007 @@ -179,6 +179,8 @@ effects, except for name binding side-effects (which will be described below):: + from overloading import when + @overload def flatten(ob: basestring): yield ob @@ -325,10 +327,11 @@ Like ``@when``, all of these decorators must be passed the function to be overloaded, and can optionally accept a predicate as well:: + from overloading import before, after + def begin_transaction(db): print "Beginning the actual transaction" - @before(begin_transaction) def check_single_access(db: SingletonDB): if db.inuse: @@ -383,6 +386,8 @@ to transform input arguments or return values, or to wrap specific cases with special error handling or try/finally conditions, e.g.:: + from overloading import around + @around(commit_transaction) def lock_while_committing(__proceed__, db: SingletonDB): with db.global_lock: From python-checkins at python.org Tue May 1 02:45:01 2007 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 1 May 2007 02:45:01 +0200 (CEST) Subject: [Python-checkins] r55034 - peps/trunk/pep-0000.txt Message-ID: <20070501004501.28ED51E4010@bag.python.org> Author: guido.van.rossum Date: Tue May 1 02:44:57 2007 New Revision: 55034 Modified: peps/trunk/pep-0000.txt Log: PEP 3127: Integer Literal Support and Syntax (Patrick Maupin) Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 02:44:57 2007 @@ -124,6 +124,7 @@ S 3124 Overloading, Generic Functions, Interfaces Eby S 3125 Remove Backslash Continuation Jewett S 3126 Remove Implicit String Concatenation Jewett + S 3127 Integer Literal Support and Syntax Maupin S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -490,6 +491,7 @@ S 3124 Overloading, Generic Functions, Interfaces Eby S 3125 Remove Backslash Continuation Jewett S 3126 Remove Implicit String Concatenation Jewett + S 3127 Integer Literal Support and Syntax Maupin S 3141 A Type Hierarchy for Numbers Yasskin @@ -565,6 +567,7 @@ von Loewis, Martin loewis at informatik.hu-berlin.de Lownds, Tony tony at pagedna.com Martelli, Alex aleax at aleax.it + Maupin, Patrick pmaupin at gmail.com McClelland, Andrew eternalsquire at comcast.net McMillan, Gordon gmcm at hypernet.com McNamara, Andrew andrewm at object-craft.com.au From python-checkins at python.org Tue May 1 06:00:56 2007 From: python-checkins at python.org (david.goodger) Date: Tue, 1 May 2007 06:00:56 +0200 (CEST) Subject: [Python-checkins] r55035 - peps/trunk/pep-0001.txt Message-ID: <20070501040056.711401E4003@bag.python.org> Author: david.goodger Date: Tue May 1 06:00:51 2007 New Revision: 55035 Modified: peps/trunk/pep-0001.txt Log: added "PEP Editor Reponsibilities & Workflow" section Modified: peps/trunk/pep-0001.txt ============================================================================== --- peps/trunk/pep-0001.txt (original) +++ peps/trunk/pep-0001.txt Tue May 1 06:00:51 2007 @@ -62,7 +62,8 @@ The PEP editors assign PEP numbers and change their status. The current PEP editors are David Goodger and Barry Warsaw. Please send -all PEP-related email to . +all PEP-related email to (no cross-posting please). +Also see `PEP Editor Reponsibilities & Workflow`_ below. The PEP process begins with a new idea for Python. It is highly recommended that a single PEP contain a single key proposal or new @@ -375,6 +376,80 @@ decision (it's not like such decisions can't be reversed :). +PEP Editor Reponsibilities & Workflow +===================================== + +A PEP editor must subscribe to the list. All +PEP-related correspondence should be sent (or CC'd) to + (but please do not cross-post!). + +For each new PEP that comes in an editor does the following: + +* Read the PEP to check if it is ready: sound and complete. The ideas + must make technical sense, even if they don't seem likely to be + accepted. + +* The title should accurately describe the content. + +* Edit the PEP for language (spelling, grammar, sentence structure, + etc.), markup (for reST PEPs), code style (examples should match PEP + 8 & 7). + +If the PEP isn't ready, the editor will send it back to the author for +revision, with specific instructions. + +Once the PEP is ready for the repository, the PEP editor will: + +* Assign a PEP number (almost always just the next available number, + but sometimes it's a special/joke number, like 666 or 3141). + +* List the PEP in PEP 0 (in two places: the categorized list, and the + numeric list). + +* Add the PEP to SVN. For Subversion repository instructions, see + `the FAQ for Developers + `_. + + The command to check out a read-only copy of the repository is:: + + svn checkout http://svn.python.org/projects/peps/trunk peps + + The command to check out a read-write copy of the repository is:: + + svn checkout svn+ssh://pythondev at svn.python.org/peps/trunk peps + +* Monitor python.org to make sure the PEP gets added to the site + properly. + +* Send email back to the PEP author with next steps (post to + python-list & -dev/-3000). + +Updates to existing PEPs also come in to peps at python.org. Many PEP +authors are not SVN committers yet, so we do the commits for them. + +Many PEPs are written and maintained by developers with write access +to the Python codebase. The PEP editors monitor the python-checkins +list for PEP changes, and correct any structure, grammar, spelling, or +markup mistakes we see. + +The editors don't pass judgment on PEPs. We merely do the +administrative & editorial part. Except for times like this, there's +relatively low volume. + +Resources: + +* `How Python is Developed `_ + +* `Python's Development Process `_ + +* `Why Develop Python? `_ + +* `Development Tools `_ + +* `Frequently Asked Questions for Developers + `_ + + References and Footnotes ======================== From collinw at gmail.com Tue May 1 06:03:20 2007 From: collinw at gmail.com (Collin Winter) Date: Mon, 30 Apr 2007 21:03:20 -0700 Subject: [Python-checkins] r55035 - peps/trunk/pep-0001.txt In-Reply-To: <20070501040056.711401E4003@bag.python.org> References: <20070501040056.711401E4003@bag.python.org> Message-ID: <43aa6ff70704302103v4a314ae4m29d61c1a268b5c6@mail.gmail.com> On 4/30/07, david.goodger wrote: > +The editors don't pass judgment on PEPs. We merely do the > +administrative & editorial part. Except for times like this, there's > +relatively low volume. "Times like this" won't make any sense in six months. Collin Winter From python-checkins at python.org Tue May 1 08:04:13 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 May 2007 08:04:13 +0200 (CEST) Subject: [Python-checkins] r55036 - python/trunk/Doc/tut/tut.tex Message-ID: <20070501060413.0B2FB1E4003@bag.python.org> Author: georg.brandl Date: Tue May 1 08:04:11 2007 New Revision: 55036 Modified: python/trunk/Doc/tut/tut.tex Log: Bug #1710295: exceptions are now new-style classes. Modified: python/trunk/Doc/tut/tut.tex ============================================================================== --- python/trunk/Doc/tut/tut.tex (original) +++ python/trunk/Doc/tut/tut.tex Tue May 1 08:04:11 2007 @@ -3556,7 +3556,7 @@ ... print 'x =', x ... print 'y =', y ... - + ('spam', 'eggs') ('spam', 'eggs') x = spam From python-checkins at python.org Tue May 1 08:04:21 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 May 2007 08:04:21 +0200 (CEST) Subject: [Python-checkins] r55037 - python/branches/release25-maint/Doc/tut/tut.tex Message-ID: <20070501060421.6B6571E4003@bag.python.org> Author: georg.brandl Date: Tue May 1 08:04:20 2007 New Revision: 55037 Modified: python/branches/release25-maint/Doc/tut/tut.tex Log: Bug #1710295: exceptions are now new-style classes. (backport from rev. 55036) Modified: python/branches/release25-maint/Doc/tut/tut.tex ============================================================================== --- python/branches/release25-maint/Doc/tut/tut.tex (original) +++ python/branches/release25-maint/Doc/tut/tut.tex Tue May 1 08:04:20 2007 @@ -3556,7 +3556,7 @@ ... print 'x =', x ... print 'y =', y ... - + ('spam', 'eggs') ('spam', 'eggs') x = spam From python-checkins at python.org Tue May 1 08:08:16 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 May 2007 08:08:16 +0200 (CEST) Subject: [Python-checkins] r55038 - python/trunk/Lib/locale.py Message-ID: <20070501060816.8E4341E4003@bag.python.org> Author: georg.brandl Date: Tue May 1 08:08:15 2007 New Revision: 55038 Modified: python/trunk/Lib/locale.py Log: Patch #1710352: add missing public functions to locale.__all__. Modified: python/trunk/Lib/locale.py ============================================================================== --- python/trunk/Lib/locale.py (original) +++ python/trunk/Lib/locale.py Tue May 1 08:08:15 2007 @@ -19,9 +19,11 @@ # Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before # trying the import. So __all__ is also fiddled at the end of the file. -__all__ = ["setlocale","Error","localeconv","strcoll","strxfrm", - "format","str","atof","atoi","LC_CTYPE","LC_COLLATE", - "LC_TIME","LC_MONETARY","LC_NUMERIC", "LC_ALL","CHAR_MAX"] +__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error", + "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm", + "str", "atof", "atoi", "format", "format_string", "currency", + "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY", + "LC_NUMERIC", "LC_ALL", "CHAR_MAX"] try: From python-checkins at python.org Tue May 1 08:08:20 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 May 2007 08:08:20 +0200 (CEST) Subject: [Python-checkins] r55039 - python/branches/release25-maint/Lib/locale.py Message-ID: <20070501060820.F01F91E4003@bag.python.org> Author: georg.brandl Date: Tue May 1 08:08:20 2007 New Revision: 55039 Modified: python/branches/release25-maint/Lib/locale.py Log: Patch #1710352: add missing public functions to locale.__all__. (backport from rev. 55038) Modified: python/branches/release25-maint/Lib/locale.py ============================================================================== --- python/branches/release25-maint/Lib/locale.py (original) +++ python/branches/release25-maint/Lib/locale.py Tue May 1 08:08:20 2007 @@ -19,9 +19,11 @@ # Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before # trying the import. So __all__ is also fiddled at the end of the file. -__all__ = ["setlocale","Error","localeconv","strcoll","strxfrm", - "format","str","atof","atoi","LC_CTYPE","LC_COLLATE", - "LC_TIME","LC_MONETARY","LC_NUMERIC", "LC_ALL","CHAR_MAX"] +__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error", + "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm", + "str", "atof", "atoi", "format", "format_string", "currency", + "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY", + "LC_NUMERIC", "LC_ALL", "CHAR_MAX"] try: From buildbot at python.org Tue May 1 08:17:46 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 May 2007 06:17:46 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070501061746.A91631E4003@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/497 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: make: *** [buildbottest] Aborted (core dumped) sincerely, -The Buildbot From buildbot at python.org Tue May 1 08:33:18 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 May 2007 06:33:18 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20070501063318.E647B1E4003@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/1990 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue May 1 12:20:03 2007 From: python-checkins at python.org (vinay.sajip) Date: Tue, 1 May 2007 12:20:03 +0200 (CEST) Subject: [Python-checkins] r55041 - python/trunk/Lib/logging/handlers.py Message-ID: <20070501102003.B2CCF1E4004@bag.python.org> Author: vinay.sajip Date: Tue May 1 12:20:03 2007 New Revision: 55041 Modified: python/trunk/Lib/logging/handlers.py Log: Added new optional credentials argument to SMTPHandler.__init__, and smtp.login() is now called in SMTPHandler.emit() if credentials are specified. Modified: python/trunk/Lib/logging/handlers.py ============================================================================== --- python/trunk/Lib/logging/handlers.py (original) +++ python/trunk/Lib/logging/handlers.py Tue May 1 12:20:03 2007 @@ -722,22 +722,25 @@ """ A handler class which sends an SMTP email for each logging event. """ - def __init__(self, mailhost, fromaddr, toaddrs, subject): + def __init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None): """ Initialize the handler. Initialize the instance with the from and to addresses and subject line of the email. To specify a non-standard SMTP port, use the - (host, port) tuple format for the mailhost argument. + (host, port) tuple format for the mailhost argument. To specify + authentication credentials, supply a (username, password) tuple + for the credentials argument. """ logging.Handler.__init__(self) if type(mailhost) == types.TupleType: - host, port = mailhost - self.mailhost = host - self.mailport = port + self.mailhost, self.mailport = mailhost else: - self.mailhost = mailhost - self.mailport = None + self.mailhost, self.mailport = mailhost, None + if type(credentials) == types.TupleType: + self.username, self.password = credentials + else: + self.username = None self.fromaddr = fromaddr if type(toaddrs) == types.StringType: toaddrs = [toaddrs] @@ -793,6 +796,8 @@ string.join(self.toaddrs, ","), self.getSubject(record), formatdate(), msg) + if self.username: + smtp.login(self.username, self.password) smtp.sendmail(self.fromaddr, self.toaddrs, msg) smtp.quit() except (KeyboardInterrupt, SystemExit): From python-checkins at python.org Tue May 1 12:21:45 2007 From: python-checkins at python.org (vinay.sajip) Date: Tue, 1 May 2007 12:21:45 +0200 (CEST) Subject: [Python-checkins] r55042 - python/trunk/Doc/lib/liblogging.tex Message-ID: <20070501102145.CBE5A1E4004@bag.python.org> Author: vinay.sajip Date: Tue May 1 12:21:45 2007 New Revision: 55042 Modified: python/trunk/Doc/lib/liblogging.tex Log: Added documentation for new optional credentials argument to SMTPHandler.__init__(). Modified: python/trunk/Doc/lib/liblogging.tex ============================================================================== --- python/trunk/Doc/lib/liblogging.tex (original) +++ python/trunk/Doc/lib/liblogging.tex Tue May 1 12:21:45 2007 @@ -1296,13 +1296,16 @@ \module{logging.handlers} module, supports sending logging messages to an email address via SMTP. -\begin{classdesc}{SMTPHandler}{mailhost, fromaddr, toaddrs, subject} +\begin{classdesc}{SMTPHandler}{mailhost, fromaddr, toaddrs, subject\optional{, + credentials}} Returns a new instance of the \class{SMTPHandler} class. The instance is initialized with the from and to addresses and subject line of the email. The \var{toaddrs} should be a list of strings. To specify a non-standard SMTP port, use the (host, port) tuple format for the \var{mailhost} argument. If you use a string, the standard SMTP port -is used. +is used. If your SMTP server requires authentication, you can specify a +(username, password) tuple for the \var{credentials} argument. +\versionchanged[\var{credentials} was added]{2.6} \end{classdesc} \begin{methoddesc}{emit}{record} From python-checkins at python.org Tue May 1 12:59:15 2007 From: python-checkins at python.org (nick.coghlan) Date: Tue, 1 May 2007 12:59:15 +0200 (CEST) Subject: [Python-checkins] r55045 - peps/trunk/pep-0366.txt Message-ID: <20070501105915.323E71E4004@bag.python.org> Author: nick.coghlan Date: Tue May 1 12:59:12 2007 New Revision: 55045 Added: peps/trunk/pep-0366.txt (contents, props changed) Log: Add PEP 366 proposing a low cost fix to the PEP 328/338 incompatibility Added: peps/trunk/pep-0366.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-0366.txt Tue May 1 12:59:12 2007 @@ -0,0 +1,187 @@ +PEP: 338 +Title: Executing modules as scripts +Version: $Revision:$ +Last-Modified: $Date:$ +Author: Nick Coghlan +Status: Final +Type: Standards Track +Content-Type: text/x-rst +Created: 1-May-2007 +Python-Version: 2.6 +Post-History: 1-May-2007 + + +Abstract +======== + +This PEP proposes a backwards compatible mechanism that permits +the use of explicit relative imports from executable modules within +packages. Such imports currently fail due to an awkward interaction +between PEP 328 and PEP 338 - this behaviour is the subject of at +least one open SF bug report (#1510172)[1]. + +With the proposed mechanism, relative imports will work automatically +if the module is executed using the ``-m`` switch. A small amount of +boilerplate will be needed in the module itself to allow the relative +imports to work when the file is executed by name. + + +Import Statements and the Main Module +===================================== + +(This section is taken from the final revision of PEP 338) + +The release of 2.5b1 showed a surprising (although obvious in +retrospect) interaction between PEP 338 and PEP 328 - explicit +relative imports don't work from a main module. This is due to +the fact that relative imports rely on ``__name__`` to determine +the current module's position in the package hierarchy. In a main +module, the value of ``__name__`` is always ``'__main__'``, so +explicit relative imports will always fail (as they only work for +a module inside a package). + +Investigation into why implicit relative imports *appear* to work when +a main module is executed directly but fail when executed using ``-m`` +showed that such imports are actually always treated as absolute +imports. Because of the way direct execution works, the package +containing the executed module is added to sys.path, so its sibling +modules are actually imported as top level modules. This can easily +lead to multiple copies of the sibling modules in the application if +implicit relative imports are used in modules that may be directly +executed (e.g. test modules or utility scripts). + +For the 2.5 release, the recommendation is to always use absolute +imports in any module that is intended to be used as a main module. +The ``-m`` switch already provides a benefit here, as it inserts the +current directory into ``sys.path``, instead of the directory contain the +main module. This means that it is possible to run a module from +inside a package using ``-m`` so long as the current directory contains +the top level directory for the package. Absolute imports will work +correctly even if the package isn't installed anywhere else on +sys.path. If the module is executed directly and uses absolute imports +to retrieve its sibling modules, then the top level package directory +needs to be installed somewhere on sys.path (since the current directory +won't be added automatically). + +Here's an example file layout:: + + devel/ + pkg/ + __init__.py + moduleA.py + moduleB.py + test/ + __init__.py + test_A.py + test_B.py + +So long as the current directory is ``devel``, or ``devel`` is already +on ``sys.path`` and the test modules use absolute imports (such as +``import pkg.moduleA`` to retrieve the module under test, PEP 338 +allows the tests to be run as:: + + python -m pkg.test.test_A + python -m pkg.test.test_B + +Rationale for Change +==================== + +In rejecting PEP 3122 (which proposed a higher impact solution to this +problem), Guido has indicated that he still isn't particularly keen on +the idea of executing modules inside packages as scripts [2]. Despite +these misgivings he has previously approved the addition of the ``-m`` +switch in Python 2.4, and the ``runpy`` module based enhancements +described in PEP 338 for Python 2.5. + +The philosophy that motivated those previous additions (i.e. access to +utility or testing scripts without needing to worry about name clashes in +either the OS executable namespace or the top level Python namespace) is +also the motivation behind fixing what I see as a bug in the current +implementation. + +This PEP is intended to provide a solution which permits explicit +relative imports from main modules, without incurring any significant +costs during interpreter startup or normal module import. + + +Proposed Solution +================= + +The heart of the proposed solution is a new module attribute +``__package_name__``. This attribute will be defined only in +the main module (i.e. modules where ``__name__ == "__main__"``). + +For a directly executed main module, this attribute will be set +to the empty string. For a module executed using +``runpy.run_module()`` with the ``run_name`` parameter set to +``"__main__"``, the attribute will be set to +``mod_name.rpartition('.')[0]`` (i.e., everything up to +but not including the last period). + +In the import machinery there is an error handling path which +deals with the case where an explicit relative reference attempts +to go higher than the top level in the package hierarchy. This +error path would be changed to fall back on the ``__package_name__`` +attribute for explicit relative imports when the importing module +is called ``"__main__"``. + +With this change, explicit relative imports will work automatically +from a script executed with the ``-m`` switch. To allow direct +execution of the module, the following boilerplate would be needed at +the top of the script:: + + if __name__ == "__main__" and not __package_name__: + __package_name__ = "" + +Note that this boilerplate has the same disadvantage as the use of +absolute imports of sibling modules - if the script is moved to a +different package or subpackage, the boilerplate will need to be +updated manually. + +With this feature in place, the test scripts in the package above +would be able to change their import lines to something along the +lines of ``import ..moduleA``. The scripts could then be +executed unmodified even if the name of the package was changed. + +(Rev 47142 in SVN implemented an early variant of this proposal +which stored the main module's real module name in the +'__module_name__' attribute. It was reverted due to the fact +that 2.5 was already in beta by that time.) + + +Alternative Proposals +===================== + +PEP 3122 proposed addressing this problem by changing the way +the main module is identified. That's a huge compatibility cost +to incur to fix something that is a pretty minor bug in the overall +scheme of things. + +The advantage of the proposal in this PEP is that its only impact on +normal code is the tiny amount of time needed at startup to set the extra +attribute in the main module. The changes to the import machinery are all +in an existing error handling path, so normal imports don't incur any +performance penalty at all. + + +References +========== + +.. [1] Absolute/relative import not working? + (http://www.python.org/sf/1510172) + +.. [2] Guido's rejection of PEP 3122 + (http://mail.python.org/pipermail/python-3000/2007-April/006793.html) + +Copyright +========= + +This document has been placed in the public domain. + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: From python-checkins at python.org Tue May 1 13:13:52 2007 From: python-checkins at python.org (nick.coghlan) Date: Tue, 1 May 2007 13:13:52 +0200 (CEST) Subject: [Python-checkins] r55046 - peps/trunk/pep-0000.txt peps/trunk/pep-0366.txt Message-ID: <20070501111352.09CD21E4004@bag.python.org> Author: nick.coghlan Date: Tue May 1 13:13:47 2007 New Revision: 55046 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-0366.txt Log: Fix metadata for PEP 366 Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 13:13:47 2007 @@ -111,6 +111,7 @@ S 362 Function Signature Object Cannon, Seo S 364 Transitioning to the Py3K Standard Library Warsaw S 365 Adding the pkg_resources module Eby + S 366 Main module explicit relative imports Coghlan S 754 IEEE 754 Floating Point Special Values Warnes S 3101 Advanced String Formatting Talin S 3108 Standard Library Reorganization Cannon @@ -458,6 +459,7 @@ SR 363 Syntax For Dynamic Attribute Access North S 364 Transitioning to the Py3K Standard Library Warsaw S 365 Adding the pkg_resources module Eby + S 366 Main module explicit relative imports Coghlan SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR Modified: peps/trunk/pep-0366.txt ============================================================================== --- peps/trunk/pep-0366.txt (original) +++ peps/trunk/pep-0366.txt Tue May 1 13:13:47 2007 @@ -1,7 +1,7 @@ -PEP: 338 -Title: Executing modules as scripts -Version: $Revision:$ -Last-Modified: $Date:$ +PEP: 366 +Title: Main module explicit relative imports +Version: $Revision$ +Last-Modified: $Date$ Author: Nick Coghlan Status: Final Type: Standards Track From python-checkins at python.org Tue May 1 17:20:06 2007 From: python-checkins at python.org (david.goodger) Date: Tue, 1 May 2007 17:20:06 +0200 (CEST) Subject: [Python-checkins] r55050 - peps/trunk/pep-0001.txt Message-ID: <20070501152006.9D4281E400F@bag.python.org> Author: david.goodger Date: Tue May 1 17:20:01 2007 New Revision: 55050 Modified: peps/trunk/pep-0001.txt Log: text tweak Modified: peps/trunk/pep-0001.txt ============================================================================== --- peps/trunk/pep-0001.txt (original) +++ peps/trunk/pep-0001.txt Tue May 1 17:20:01 2007 @@ -161,7 +161,7 @@ obsolete. This is intended for Informational PEPs, where version 2 of an API can replace version 1. -PEP work flow is as follows: +The possible paths of the status of PEPs are as follows: .. image:: pep-0001-1.png From python-checkins at python.org Tue May 1 17:37:46 2007 From: python-checkins at python.org (david.goodger) Date: Tue, 1 May 2007 17:37:46 +0200 (CEST) Subject: [Python-checkins] r55051 - peps/trunk/pep-0001.txt Message-ID: <20070501153746.72B201E4008@bag.python.org> Author: david.goodger Date: Tue May 1 17:37:43 2007 New Revision: 55051 Modified: peps/trunk/pep-0001.txt Log: spelling Modified: peps/trunk/pep-0001.txt ============================================================================== --- peps/trunk/pep-0001.txt (original) +++ peps/trunk/pep-0001.txt Tue May 1 17:37:43 2007 @@ -63,7 +63,7 @@ The PEP editors assign PEP numbers and change their status. The current PEP editors are David Goodger and Barry Warsaw. Please send all PEP-related email to (no cross-posting please). -Also see `PEP Editor Reponsibilities & Workflow`_ below. +Also see `PEP Editor Responsibilities & Workflow`_ below. The PEP process begins with a new idea for Python. It is highly recommended that a single PEP contain a single key proposal or new @@ -376,8 +376,8 @@ decision (it's not like such decisions can't be reversed :). -PEP Editor Reponsibilities & Workflow -===================================== +PEP Editor Responsibilities & Workflow +====================================== A PEP editor must subscribe to the list. All PEP-related correspondence should be sent (or CC'd) to @@ -432,7 +432,7 @@ list for PEP changes, and correct any structure, grammar, spelling, or markup mistakes we see. -The editors don't pass judgment on PEPs. We merely do the +The editors don't pass judgement on PEPs. We merely do the administrative & editorial part. Except for times like this, there's relatively low volume. From python-checkins at python.org Tue May 1 18:57:11 2007 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 1 May 2007 18:57:11 +0200 (CEST) Subject: [Python-checkins] r55053 - peps/trunk/pep-0000.txt peps/trunk/pep-3127.txt peps/trunk/pep-3128.txt Message-ID: <20070501165711.4D3A11E4008@bag.python.org> Author: guido.van.rossum Date: Tue May 1 18:57:09 2007 New Revision: 55053 Added: peps/trunk/pep-3127.txt (contents, props changed) peps/trunk/pep-3128.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Log: PEP 3127: Integer Literal Support and Syntax Maupin PEP 3128: BList: A Faster List-like Type Stutzbach Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 18:57:09 2007 @@ -126,6 +126,7 @@ S 3125 Remove Backslash Continuation Jewett S 3126 Remove Implicit String Concatenation Jewett S 3127 Integer Literal Support and Syntax Maupin + S 3128 BList: A Faster List-like Type Stutzbach S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -494,6 +495,7 @@ S 3125 Remove Backslash Continuation Jewett S 3126 Remove Implicit String Concatenation Jewett S 3127 Integer Literal Support and Syntax Maupin + S 3128 BList: A Faster List-like Type Stutzbach S 3141 A Type Hierarchy for Numbers Yasskin Added: peps/trunk/pep-3127.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3127.txt Tue May 1 18:57:09 2007 @@ -0,0 +1,518 @@ +PEP: 3127 +Title: Integer Literal Support and Syntax +Version: $Revision$ +Last-Modified: $Date$ +Author: Patrick Maupin +Discussions-To: Python-3000 at python.org +Status: Draft +Type: Standards Track +Python-Version: 3.0 +Content-Type: text/x-rst +Created: 14-Mar-2007 +Post-History: 18-Mar-2007 + + +Abstract +======== + +This PEP proposes changes to the Python core to rationalize +the treatment of string literal representations of integers +in different radices (bases). These changes are targeted at +Python 3.0, but the backward-compatible parts of the changes +should be added to Python 2.6, so that all valid 3.0 integer +literals will also be valid in 2.6. + +The proposal is that: + + a) octal literals must now be specified + with a leading "0o" or "0O" instead of "0"; + + b) binary literals are now supported via a + leading "0b" or "0B"; and + + c) provision will be made for binary numbers in + string formatting. + + +Motivation +========== + +This PEP was motivated by two different issues: + + - The default octal representation of integers is silently confusing + to people unfamiliar with C-like languages. It is extremely easy + to inadvertently create an integer object with the wrong value, + because '013' means 'decimal 11', not 'decimal 13', to the Python + language itself, which is not the meaning that most humans would + assign to this literal. + + - Some Python users have a strong desire for binary support in + the language. + + +Specification +============= + +Grammar specification +--------------------- + +The grammar will be changed. For Python 2.6, the changed and +new token definitions will be:: + + integer ::= decimalinteger | octinteger | hexinteger | + bininteger | oldoctinteger + + octinteger ::= "0" ("o" | "O") octdigit+ + + bininteger ::= "0" ("b" | "B") bindigit+ + + oldoctinteger ::= "0" octdigit+ + + bindigit ::= "0" | "1" + +For Python 3.0, "oldoctinteger" will not be supported, and +an exception will be raised if a literal has a leading "0" and +a second character which is a digit. + +For both versions, this will require changes to PyLong_FromString +as well as the grammar. + +The documentation will have to be changed as well: grammar.txt, +as well as the integer literal section of the reference manual. + +PEP 306 should be checked for other issues, and that PEP should +be updated if the procedure described therein is insufficient. + +int() specification +-------------------- + +int(s, 0) will also match the new grammar definition. + +This should happen automatically with the changes to +PyLong_FromString required for the grammar change. + +Also the documentation for int() should be changed to explain +that int(s) operates identically to int(s, 10), and the word +"guess" should be removed from the description of int(s, 0). + +long() specification +-------------------- + +For Python 2.6, the long() implementation and documentation +should be changed to reflect the new grammar. + +Tokenizer exception handling +---------------------------- + +If an invalid token contains a leading "0", the exception +error message should be more informative than the current +"SyntaxError: invalid token". It should explain that decimal +numbers may not have a leading zero, and that octal numbers +require an "o" after the leading zero. + +int() exception handling +------------------------ + +The ValueError raised for any call to int() with a string +should at least explicitly contain the base in the error +message, e.g.:: + + ValueError: invalid literal for base 8 int(): 09 + +oct() function +--------------- + +oct() should be updated to output '0o' in front of +the octal digits (for 3.0, and 2.6 compatibility mode). + +Output formatting +----------------- + +The string (and unicode in 2.6) % operator will have +'b' format specifier added for binary, and the alternate +syntax of the 'o' option will need to be updated to +add '0o' in front, instead of '0'. + +PEP 3101 already supports 'b' for binary output. + + +Transition from 2.6 to 3.0 +--------------------------- + +The 2to3 translator will have to insert 'o' into any +octal string literal. + +The Py3K compatible option to Python 2.6 should cause +attempts to use oldoctinteger literals to raise an +exception. + + +Rationale +========= + +Most of the discussion on these issues occurred on the Python-3000 +mailing list starting 14-Mar-2007, prompted by an observation that +the average human being would be completely mystified upon finding +that prepending a "0" to a string of digits changes the meaning of +that digit string entirely. + +It was pointed out during this discussion that a similar, but shorter, +discussion on the subject occurred in January of 2006, prompted by a +discovery of the same issue. + +Background +---------- + +For historical reasons, Python's string representation of integers +in different bases (radices), for string formatting and token +literals, borrows heavily from C. [1]_ [2]_ Usage has shown that +the historical method of specifying an octal number is confusing, +and also that it would be nice to have additional support for binary +literals. + +Throughout this document, unless otherwise noted, discussions about +the string representation of integers relate to these features: + + - Literal integer tokens, as used by normal module compilation, + by eval(), and by int(token, 0). (int(token) and int(token, 2-36) + are not modified by this proposal.) + + * Under 2.6, long() is treated the same as int() + + - Formatting of integers into strings, either via the % string + operator or the new PEP 3101 advanced string formatting method. + +It is presumed that: + + - All of these features should have an identical set + of supported radices, for consistency. + + - Python source code syntax and int(mystring, 0) should + continue to share identical behavior. + + +Removal of old octal syntax +---------------------------- + +This PEP proposes that the ability to specify an octal number by +using a leading zero will be removed from the language in Python 3.0 +(and the Python 3.0 preview mode of 2.6), and that a SyntaxError will +be raised whenever a leading "0" is immediately followed by another +digit. + +During the present discussion, it was almost universally agreed that:: + + eval('010') == 8 + +should no longer be true, because that is confusing to new users. +It was also proposed that:: + + eval('0010') == 10 + +should become true, but that is much more contentious, because it is so +inconsistent with usage in other computer languages that mistakes are +likely to be made. + +Almost all currently popular computer languages, including C/C++, +Java, Perl, and JavaScript, treat a sequence of digits with a +leading zero as an octal number. Proponents of treating these +numbers as decimal instead have a very valid point -- as discussed +in `Supported radices`_, below, the entire non-computer world uses +decimal numbers almost exclusively. There is ample anecdotal +evidence that many people are dismayed and confused if they +are confronted with non-decimal radices. + +However, in most situations, most people do not write gratuitous +zeros in front of their decimal numbers. The primary exception is +when an attempt is being made to line up columns of numbers. But +since PEP 8 specifically discourages the use of spaces to try to +align Python code, one would suspect the same argument should apply +to the use of leading zeros for the same purpose. + +Finally, although the email discussion often focused on whether anybody +actually *uses* octal any more, and whether we should cater to those +old-timers in any case, that is almost entirely besides the point. + +Assume the rare complete newcomer to computing who *does*, either +occasionally or as a matter of habit, use leading zeros for decimal +numbers. Python could either: + + a) silently do the wrong thing with his numbers, as it does now; + + b) immediately disabuse him of the notion that this is viable syntax + (and yes, the SyntaxWarning should be more gentle than it + currently is, but that is a subject for a different PEP); or + + c) let him continue to think that computers are happy with + multi-digit decimal integers which start with "0". + +Some people passionately believe that (c) is the correct answer, +and they would be absolutely right if we could be sure that new +users will never blossom and grow and start writing AJAX applications. + +So while a new Python user may (currently) be mystified at the +delayed discovery that his numbers don't work properly, we can +fix it by explaining to him immediately that Python doesn't like +leading zeros (hopefully with a reasonable message!), or we can +delegate this teaching experience to the JavaScript interpreter +in the Internet Explorer browser, and let him try to debug his +issue there. + +Supported radices +----------------- + +This PEP proposes that the supported radices for the Python +language will be 2, 8, 10, and 16. + +Once it is agreed that the old syntax for octal (radix 8) representation +of integers must be removed from the language, the next obvious +question is "Do we actually need a way to specify (and display) +numbers in octal?" + +This question is quickly followed by "What radices does the language +need to support?" Because computers are so adept at doing what you +tell them to, a tempting answer in the discussion was "all of them." +This answer has obviously been given before -- the int() constructor +will accept an explicit radix with a value between 2 and 36, inclusive, +with the latter number bearing a suspicious arithmetic similarity to +the sum of the number of numeric digits and the number of same-case +letters in the ASCII alphabet. + +But the best argument for inclusion will have a use-case to back +it up, so the idea of supporting all radices was quickly rejected, +and the only radices left with any real support were decimal, +hexadecimal, octal, and binary. + +Just because a particular radix has a vocal supporter on the +mailing list does not mean that it really should be in the +language, so the rest of this section is a treatise on the +utility of these particular radices, vs. other possible choices. + +Humans use other numeric bases constantly. If I tell you that +it is 12:30 PM, I have communicated quantitative information +arguably composed of *three* separate bases (12, 60, and 2), +only one of which is in the "agreed" list above. But the +*communication* of that information used two decimal digits +each for the base 12 and base 60 information, and, perversely, +two letters for information which could have fit in a single +decimal digit. + +So, in general, humans communicate "normal" (non-computer) +numerical information either via names (AM, PM, January, ...) +or via use of decimal notation. Obviously, names are +seldom used for large sets of items, so decimal is used for +everything else. There are studies which attempt to explain +why this is so, typically reaching the expected conclusion +that the Arabic numeral system is well-suited to human +cognition. [3]_ + +There is even support in the history of the design of +computers to indicate that decimal notation is the correct +way for computers to communicate with humans. One of +the first modern computers, ENIAC [4]_ computed in decimal, +even though there were already existing computers which +operated in binary. + +Decimal computer operation was important enough +that many computers, including the ubiquitous PC, have +instructions designed to operate on "binary coded decimal" +(BCD) [5]_ , a representation which devotes 4 bits to each +decimal digit. These instructions date from a time when the +most strenuous calculations ever performed on many numbers +were the calculations actually required to perform textual +I/O with them. It is possible to display BCD without having +to perform a divide/remainder operation on every displayed +digit, and this was a huge computational win when most +hardware didn't have fast divide capability. Another factor +contributing to the use of BCD is that, with BCD calculations, +rounding will happen exactly the same way that a human would +do it, so BCD is still sometimes used in fields like finance, +despite the computational and storage superiority of binary. + +So, if it weren't for the fact that computers themselves +normally use binary for efficient computation and data +storage, string representations of integers would probably +always be in decimal. + +Unfortunately, computer hardware doesn't think like humans, +so programmers and hardware engineers must often resort to +thinking like the computer, which means that it is important +for Python to have the ability to communicate binary data +in a form that is understandable to humans. + +The requirement that the binary data notation must be cognitively +easy for humans to process means that it should contain an integral +number of binary digits (bits) per symbol, while otherwise +conforming quite closely to the standard tried-and-true decimal +notation (position indicates power, larger magnitude on the left, +not too many symbols in the alphabet, etc.). + +The obvious "sweet spot" for this binary data notation is +thus octal, which packs the largest integral number of bits +possible into a single symbol chosen from the Arabic numeral +alphabet. + +In fact, some computer architectures, such as the PDP8 and the +8080/Z80, were defined in terms of octal, in the sense of arranging +the bitfields of instructions in groups of three, and using +octal representations to describe the instruction set. + +Even today, octal is important because of bit-packed structures +which consist of 3 bits per field, such as Unix file permission +masks. + +But octal has a drawback when used for larger numbers. The +number of bits per symbol, while integral, is not itself +a power of two. This limitation (given that the word size +of most computers these days is a power of two) has resulted +in hexadecimal, which is more popular than octal despite the +fact that it requires a 60% larger alphabet than decimal, +because each symbol contains 4 bits. + +Some numbers, such as Unix file permission masks, are easily +decoded by humans when represented in octal, but difficult to +decode in hexadecimal, while other numbers are much easier for +humans to handle in hexadecimal. + +Unfortunately, there are also binary numbers used in computers +which are not very well communicated in either hexadecimal or +octal. Thankfully, fewer people have to deal with these on a +regular basis, but on the other hand, this means that several +people on the discussion list questioned the wisdom of adding +a straight binary representation to Python. + +One example of where these numbers is very useful is in +reading and writing hardware registers. Sometimes hardware +designers will eschew human readability and opt for address +space efficiency, by packing multiple bit fields into a single +hardware register at unaligned bit locations, and it is tedious +and error-prone for a human to reconstruct a 5 bit field which +consists of the upper 3 bits of one hex digit, and the lower 2 +bits of the next hex digit. + +Even if the ability of Python to communicate binary information +to humans is only useful for a small technical subset of the +population, it is exactly that population subset which contains +most, if not all, members of the Python core team, so even straight +binary, the least useful of these notations, has several enthusiastic +supporters and few, if any, staunch opponents, among the Python community. + +Syntax for supported radices +----------------------------- + +This proposal is to to use a "0o" prefix with either uppercase +or lowercase "o" for octal, and a "0b" prefix with either +uppercase or lowercase "b" for binary. + +There was strong support for not supporting uppercase, but +this is a separate subject for a different PEP, as 'j' for +complex numbers, 'e' for exponent, and 'r' for raw string +(to name a few) already support uppercase. + +The syntax for delimiting the different radices received a lot of +attention in the discussion on Python-3000. There are several +(sometimes conflicting) requirements and "nice-to-haves" for +this syntax: + + - It should be as compatible with other languages and + previous versions of Python as is reasonable, both + for the input syntax and for the output (e.g. string + % operator) syntax. + + - It should be as obvious to the casual observer as + possible. + + - It should be easy to visually distinguish integers + formatted in the different bases. + + +Proposed syntaxes included things like arbitrary radix prefixes, +such as 16r100 (256 in hexadecimal), and radix suffixes, similar +to the 100h assembler-style suffix. The debate on whether the +letter "O" could be used for octal was intense -- an uppercase +"O" looks suspiciously similar to a zero in some fonts. Suggestions +were made to use a "c" (the second letter of "oCtal"), or even +to use a "t" for "ocTal" and an "n" for "biNary" to go along +with the "x" for "heXadecimal". + +For the string % operator, "o" was already being used to denote +octal, and "b" was not used for anything, so this works out +much better than, for example, using "c" (which means "character" +for the % operator). + +At the end of the day, since uppercase "O" can look like a zero +and uppercase "B" can look like an 8, it was decided that these +prefixes should be lowercase only, but, like 'r' for raw string, +that can be a preference or style-guide issue. + +Open Issues +=========== + +It was suggested in the discussion that lowercase should be used +for all numeric and string special modifiers, such as 'x' for +hexadecimal, 'r' for raw strings, 'e' for exponentiation, and +'j' for complex numbers. This is an issue for a separate PEP. + +This PEP takes no position on uppercase or lowercase for input, +just noting that, for consistency, if uppercase is not to be +removed from input parsing for other letters, it should be +added for octal and binary, and documenting the changes under +this assumption, as there is not yet a PEP about the case issue. + +Output formatting may be a different story -- there is already +ample precedence for case sensitivity in the output format string, +and there would need to be a consensus that there is a valid +use-case for the "alternate form" of the string % operator +to support uppercase 'B' or 'O' characters for binary or +octal output. Currently, PEP3101 does not even support this +alternate capability, and the hex() function does not allow +the programmer to specify the case of the 'x' character. + +There are still some strong feelings that '0123' should be +allowed as a literal decimal in Python 3.0. If this is the +right thing to do, this can easily be covered in an additional +PEP. This proposal only takes the first step of making '0123' +not be a valid octal number, for reasons covered in the rationale. + +Is there (or should there be) an option for the 2to3 translator +which only makes the 2.6 compatible changes? Should this be +run on 2.6 library code before the 2.6 release? + +Should a bin() function which matches hex() and oct() be added? + +Is hex() really that useful once we have advanced string formatting? + + +References +========== + +.. [1] GNU libc manual printf integer format conversions + (http://www.gnu.org/software/libc/manual/html_node/Integer-Conversions.html) + +.. [2] Python string formatting operations + (http://docs.python.org/lib/typesseq-strings.html) + +.. [3] The Representation of Numbers, Jiajie Zhang and Donald A. Norman + (http://acad88.sahs.uth.tmc.edu/research/publications/Number-Representation.pdf) + +.. [4] ENIAC page at wikipedia + (http://en.wikipedia.org/wiki/ENIAC) + +.. [5] BCD page at wikipedia + (http://en.wikipedia.org/wiki/Binary-coded_decimal) + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: Added: peps/trunk/pep-3128.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3128.txt Tue May 1 18:57:09 2007 @@ -0,0 +1,356 @@ +PEP: 3128 +Title: BList: A Faster List-like Type +Version: $Revision$ +Last-Modified: $Date$ +Author: Daniel Stutzbach +Discussions-To: Python 3000 List +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 30-Apr-2007 +Python-Version: 2.6 and/or 3.0 +Post-History: 30-Apr-2007 + + +Abstract +======== + +The common case for list operations is on small lists. The current +array-based list implementation excels at small lists due to the +strong locality of reference and infrequency of memory allocation +operations. However, an array takes O(n) time to insert and delete +elements, which can become problematic as the list gets large. + +This PEP introduces a new data type, the BList, that has array-like +and tree-like aspects. It enjoys the same good performance on small +lists as the existing array-based implementation, but offers superior +asymptotic performance for most operations. This PEP proposes +replacing the makes two mutually exclusive proposals for including the +BList type in Python: + +1. Add it to the collections module, or +2. Replace the existing list type + + +Motivation +========== + +The BList grew out of the frustration of needing to rewrite intuitive +algorithms that worked fine for small inputs but took O(n**2) time for +large inputs due to the underlying O(n) behavior of array-based lists. +The deque type, introduced in Python 2.4, solved the most common +problem of needing a fast FIFO queue. However, the deque type doesn't +help if we need to repeatedly insert or delete elements from the +middle of a long list. + +A wide variety of data structure provide good asymptotic performance +for insertions and deletions, but they either have O(n) performance +for other operations (e.g., linked lists) or have inferior performance +for small lists (e.g., binary trees and skip lists). + +The BList type proposed in this PEP is based on the principles of +B+Trees, which have array-like and tree-like aspects. The BList +offers array-like performance on small lists, while offering O(log n) +asymptotic performance for all insert and delete operations. +Additionally, the BList implements copy-on-write under-the-hood, so +even operations like getslice take O(log n) time. The table below +compares the asymptotic performance of the current array-based list +implementation with the asymptotic performance of the BList. + +========= ================ ==================== +Operation Array-based list BList +========= ================ ==================== +Copy O(n) **O(1)** +Append **O(1)** O(log n) +Insert O(n) **O(log n)** +Get Item **O(1)** O(log n) +Set Item **O(1)** **O(log n)** +Del Item O(n) **O(log n)** +Iteration O(n) O(n) +Get Slice O(k) **O(log n)** +Del Slice O(n) **O(log n)** +Set Slice O(n+k) **O(log k + log n)** +Extend O(k) **O(log k + log n)** +Sort O(n log n) O(n log n) +Multiply O(nk) **O(log k)** +========= ================ ==================== + +An extensive empirical comparison of Python's array-based list and the +BList are available at [2]_. + +Use Case Trade-offs +=================== + +The BList offers superior performance for many, but not all, +operations. Choosing the correct data type for a particular use case +depends on which operations are used. Choosing the correct data type +as a built-in depends on balancing the importance of different use +cases and the magnitude of the performance differences. + +For the common uses cases of small lists, the array-based list and the +BList have similar performance characteristics. + +For the slightly less common case of large lists, there are two common +uses cases where the existing array-based list outperforms the +existing BList reference implementation. These are: + +1. A large LIFO stack, where there are many .append() and .pop(-1) + operations. Each operation is O(1) for an array-based list, but + O(log n) for the BList. + +2. A large list that does not change size. The getitem and setitem + calls are O(1) for an array-based list, but O(log n) for the BList. + +In performance tests on a 10,000 element list, BLists exhibited a 50% +and 5% increase in execution time for these two uses cases, +respectively. + +The performance for the LIFO use case could be improved to O(n) time, +by caching a pointer to the right-most leaf within the root node. For +lists that do not change size, the common case of sequential access +could also be improved to O(n) time via caching in the root node. +However, the performance of these approaches has not been empirically +tested. + +Many operations exhibit a tremendous speed-up (O(n) to O(log n)) when +switching from the array-based list to BLists. In performance tests +on a 10,000 element list, operations such as getslice, setslice, and +FIFO-style insert and deletes on a BList take only 1% of the time +needed on array-based lists. + +In light of the large performance speed-ups for many operations, the +small performance costs for some operations will be worthwhile for +many (but not all) applications. + +Implementation +============== + +The BList is based on the B+Tree data structure. The BList is a wide, +bushy tree where each node contains an array of up to 128 pointers to +its children. If the node is a leaf, its children are the +user-visible objects that the user has placed in the list. If node is +not a leaf, its children are other BList nodes that are not +user-visible. If the list contains only a few elements, they will all +be a children of single node that is both the root and a leaf. Since +a node is little more than array of pointers, small lists operate in +effectively the same way as an array-based data type and share the +same good performance characteristics. + +The BList maintains a few invariants to ensure good (O(log n)) +asymptotic performance regardless of the sequence of insert and delete +operations. The principle invariants are as follows: + +1. Each node has at most 128 children. +2. Each non-root node has at least 64 children. +3. The root node has at least 2 children, unless the list contains + fewer than 2 elements. +4. The tree is of uniform depth. + +If an insert would cause a node to exceed 128 children, the node +spawns a sibling and transfers half of its children to the sibling. +The sibling is inserted into the node's parent. If the node is the +root node (and thus has no parent), a new parent is created and the +depth of the tree increases by one. + +If a deletion would cause a node to have fewer than 64 children, the +node moves elements from one of its siblings if possible. If both of +its siblings also only have 64 children, then two of the nodes merge +and the empty one is removed from its parent. If the root node is +reduced to only one child, its single child becomes the new root +(i.e., the depth of the tree is reduced by one). + +In addition to tree-like asymptotic performance and array-like +performance on small-lists, BLists support transparent +**copy-on-write**. If a non-root node needs to be copied (as part of +a getslice, copy, setslice, etc.), the node is shared between multiple +parents instead of being copied. If it needs to be modified later, it +will be copied at that time. This is completely behind-the-scenes; +from the user's point of view, the BList works just like a regular +Python list. + +Memory Usage +============ + +In the worst case, the leaf nodes of a BList have only 64 children +each, rather than a full 128, meaning that memory usage is around +twice that of a best-case array implementation. Non-leaf nodes use up +a negligible amount of additional memory, since there are at least 63 +times as many leaf nodes as non-leaf nodes. + +The existing array-based list implementation must grow and shrink as +items are added and removed. To be efficient, it grows and shrinks +only when the list has grow or shrunk exponentially. In the worst +case, it, too, uses twice as much memory as the best case. + +In summary, the BList's memory footprint is not significantly +different from the existing array-based implementation. + +Backwards Compatibility +======================= + +If the BList is added to the collections module, backwards +compatibility is not an issue. This section focuses on the option of +replacing the existing array-based list with the BList. For users of +the Python interpreter, a BList has an identical interface to the +current list-implementation. For virtually all operations, the +behavior is identical, aside from execution speed. + +For the C API, BList has a different interface than the existing +list-implementation. Due to its more complex structure, the BList +does not lend itself well to poking and prodding by external sources. +Thankfully, the existing list-implementation defines an API of +functions and macros for accessing data from list objects. Google +Code Search suggests that the majority of third-party modules uses the +well-defined API rather than relying on the list's structure +directly. The table below summarizes the search queries and results: + +======================== ================= +Search String Number of Results +======================== ================= +PyList_GetItem 2,000 +PySequence_GetItem 800 +PySequence_Fast_GET_ITEM 100 +PyList_GET_ITEM 400 +\[^a\-zA\-Z\_\]ob_item 100 +======================== ================= + + +This can be achieved in one of two ways: + +1. Redefine the various accessor functions and macros in listobject.h + to access a BList instead. The interface would be unchanged. The + functions can easily be redefined. The macros need a bit more care + and would have to resort to function calls for large lists. + + The macros would need to evaluate their arguments more than once, + which could be a problem if the arguments have side effects. A + Google Code Search for "PyList_GET_ITEM\(\[^)\]+\(" found only a + handful of cases where this occurs, so the impact appears to be + low. + + The few extension modules that use list's undocumented structure + directly, instead of using the API, would break. The core code + itself uses the accessor macros fairly consistently and should be + easy to port. + +2. Deprecate the existing list type, but continue to include it. + Extension modules wishing to use the new BList type must do so + explicitly. The BList C interface can be changed to match the + existing PyList interface so that a simple search-replace will be + sufficient for 99% of module writers. + + Existing modules would continue to compile and work without change, + but they would need to make a deliberate (but small) effort to + migrate to the BList. + + The downside of this approach is that mixing modules that use + BLists and array-based lists might lead to slow down if conversions + are frequently necessary. + +Reference Implementation +======================== + +A reference implementations of the BList is available for CPython at [1]_. + +The source package also includes a pure Python implementation, +originally developed as a prototype for the CPython version. +Naturally, the pure Python version is rather slow and the asymptotic +improvements don't win out until the list is quite large. + +When compiled with Py_DEBUG, the C implementation checks the +BList invariants when entering and exiting most functions. + +An extensive set of test cases is also included in the source package. +The test cases include the existing Python sequence and list test +cases as a subset. When the interpreter is built with Py_DEBUG, the +test cases also check for reference leaks. + +Porting to Other Python Variants +-------------------------------- + +If the BList is added to the collections module, other Python variants +can support it in one of three ways: + +1. Make blist an alias for list. The asymptotic performance won't be + as good, but it'll work. +2. Use the pure Python reference implementation. The performance for + small lists won't be as good, but it'll work. +3. Port the reference implementation. + +Discussion +========== + +This proposal has been discussed briefly on the Python-3000 mailing +list [3]_. Although a number of people favored the proposal, there +were also some objections. Below summarizes the pros and cons as +observed by posters to the thread. + +General comments: + +- Pro: Will outperform the array-based list in most cases +- Pro: "I've implemented variants of this ... a few different times" +- Con: Desirability and performance in actual applications is unproven + +Comments on adding BList to the collections module: + +- Pro: Matching the list-API reduces the learning curve to near-zero +- Pro: Useful for intermediate-level users; won't get in the way of beginners +- Con: Proliferation of data types makes the choices for developers harder. + +Comments on replacing the array-based list with the BList: + +- Con: Impact on extension modules (addressed in `Backwards + Compatibility`_) +- Con: The use cases where BLists are slower are important + (see `Use Case Trade-Offs`_ for how these might be addressed). +- Con: The array-based list code is simple and easy to maintain + +To assess the desirability and performance in actual applications, +Raymond Hettinger suggested releasing the BList as an extension module +(now available at [1]_). If it proves useful, he felt it would be a +strong candidate for inclusion in 2.6 as part of the collections +module. If widely popular, then it could be considered for replacing +the array-based list, but not otherwise. + +Guido van Rossum commented that he opposed the proliferation of data +types, but favored replacing the array-based list if backwards +compatibility could be addressed and the BList's performance was +uniformly better. + +On-going Tasks +============== + +- Reduce the memory footprint of small lists +- Implement TimSort for BLists, so that best-case sorting is O(n) + instead of O(log n). +- Implement __reversed__ +- Cache a pointer in the root to the rightmost leaf, to make LIFO + operation O(n) time. + +References +========== + +.. [1] Reference Implementations for C and Python: + http://www.python.org/pypi/blist/ + +.. [2] Empirical performance comparison between Python's array-based + list and the blist: http://stutzbachenterprises.com/blist/ + +.. [3] Discussion on python-3000 starting at post: + http://mail.python.org/pipermail/python-3000/2007-April/006757.html + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Tue May 1 20:31:52 2007 From: python-checkins at python.org (collin.winter) Date: Tue, 1 May 2007 20:31:52 +0200 (CEST) Subject: [Python-checkins] r55054 - peps/trunk/pep-0000.txt peps/trunk/pep-3129.txt Message-ID: <20070501183152.AEED91E4012@bag.python.org> Author: collin.winter Date: Tue May 1 20:31:51 2007 New Revision: 55054 Added: peps/trunk/pep-3129.txt Modified: peps/trunk/pep-0000.txt Log: Add PEP 3129, 'Class Decorators'. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 20:31:51 2007 @@ -127,6 +127,7 @@ S 3126 Remove Implicit String Concatenation Jewett S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach + S 3129 Class Decorators Winter S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -496,6 +497,7 @@ S 3126 Remove Implicit String Concatenation Jewett S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach + S 3129 Class Decorators Winter S 3141 A Type Hierarchy for Numbers Yasskin Added: peps/trunk/pep-3129.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3129.txt Tue May 1 20:31:51 2007 @@ -0,0 +1,117 @@ +PEP: 3129 +Title: Class Decorators +Version: $Revision: 53815 $ +Last-Modified: $Date: 2007-04-27 16:42:06 -0700 (Fri, 27 Apr 2007) $ +Author: Collin Winter +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 1-May-2007 +Python-Version: 3.0 +Post-History: + + +Abstract +======== + +This PEP proposes class decorators, an extension to the function +and method decorators introduced in PEP 318. + + +Rationale +========= + +When function decorators were originally debated for inclusion in +Python 2.4, class decorators were seen as obscure and unnecessary +[#obscure]_ thanks to metaclasses. After several years' experience +with the Python 2.4.x series of releases and an increasing +familiarity with function decorators and their uses, the BDFL and +the community re-evaluated class decorators and recommended their +inclusion in Python 3.0 [#approval]_. + +The motivating use-case was to make certain constructs more easily +expressed and less reliant on implementation details of the CPython +interpreter. While it is possible to express class decorator-like +functionality using metaclasses, the results are generally +unpleasant and the implementation highly fragile [#motivation]_. The +fact that large-scale Python projects like Zope were going through +these wild contortions to achieve something like class decorators won +over the BDFL. + + +Semantics +========= + +The semantics and design goals of class decorators are the same as +for function decorators ([#semantics]_, [#goals]_); the only +difference is that you're decorating a class instead of a function. +The following two snippets are semantically identical: :: + + class A: + pass + A = foo(bar(A)) + + + @foo + @bar + class A: + pass + +For a detailed examination of decorators, please refer to PEP 318. + + +Implementation +============== + +The grammar for class declarations changes from :: + + classdef: 'class' NAME ['(' [testlist] ')'] ':' suite + +to :: + + classdef: [decorators] 'class' NAME ['(' [testlist] ')'] ':' suite + +The Python AST and bytecode must be modified accordingly. + +A reference implementation [#implementation]_ has been provided by +Jack Diederich. + + +References +========== + +.. [#obscure] + http://www.python.org/dev/peps/pep-0318/#motivation + +.. [#approval] + http://mail.python.org/pipermail/python-dev/2006-March/062942.html + +.. [#motivation] + http://mail.python.org/pipermail/python-dev/2006-March/062888.html + +.. [#semantics] + http://www.python.org/dev/peps/pep-0318/#current-syntax + +.. [#goals] + http://www.python.org/dev/peps/pep-0318/#design-goals + +.. [#implementation] + http://python.org/sf/1671208 + + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Tue May 1 21:08:40 2007 From: python-checkins at python.org (collin.winter) Date: Tue, 1 May 2007 21:08:40 +0200 (CEST) Subject: [Python-checkins] r55055 - peps/trunk/pep-3129.txt Message-ID: <20070501190840.8CACC1E4008@bag.python.org> Author: collin.winter Date: Tue May 1 21:08:28 2007 New Revision: 55055 Modified: peps/trunk/pep-3129.txt Log: Add an additional motivation for class decorators. Modified: peps/trunk/pep-3129.txt ============================================================================== --- peps/trunk/pep-3129.txt (original) +++ peps/trunk/pep-3129.txt Tue May 1 21:08:28 2007 @@ -33,10 +33,12 @@ expressed and less reliant on implementation details of the CPython interpreter. While it is possible to express class decorator-like functionality using metaclasses, the results are generally -unpleasant and the implementation highly fragile [#motivation]_. The -fact that large-scale Python projects like Zope were going through -these wild contortions to achieve something like class decorators won -over the BDFL. +unpleasant and the implementation highly fragile [#motivation]_. In +addition, metaclasses are inherited, whereas class decorators are not, +making metaclasses unsuitable for some, single class-specific uses of +class decorators. The fact that large-scale Python projects like Zope +were going through these wild contortions to achieve something like +class decorators won over the BDFL. Semantics From python-checkins at python.org Tue May 1 21:35:51 2007 From: python-checkins at python.org (david.goodger) Date: Tue, 1 May 2007 21:35:51 +0200 (CEST) Subject: [Python-checkins] r55056 - peps/trunk/pep-0000.txt peps/trunk/pep-3130.txt Message-ID: <20070501193551.3E3FA1E4015@bag.python.org> Author: david.goodger Date: Tue May 1 21:35:45 2007 New Revision: 55056 Added: peps/trunk/pep-3130.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Log: added PEP 3130, Access to Current Module/Class/Function, by Jim J. Jewett Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 21:35:45 2007 @@ -78,7 +78,7 @@ Accepted PEPs (accepted; may not be implemented yet) SA 358 The "bytes" Object Schemenauer, GvR - SA 3106 Revamping dict.keys(), .values() and .items() GvR + SA 3106 Revamping dict.keys(), .values() & .items() GvR SA 3109 Raising Exceptions in Python 3000 Winter SA 3110 Catching Exceptions in Python 3000 Winter SA 3111 Simple input built-in in Python 3000 Roberge @@ -128,6 +128,7 @@ S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach S 3129 Class Decorators Winter + S 3130 Access to Current Module/Class/Function Jewett S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -193,7 +194,7 @@ SF 3104 Access to Names in Outer Scopes Yee SF 3105 Make print a function Brandl SF 3107 Function Annotations Winter, Lownds - SF 3114 Renaming iterator.next() to iterator.__next__() Yee + SF 3114 Renaming iterator.next() to .__next__() Yee Empty PEPs (or containing only an abstract) @@ -234,7 +235,7 @@ SW 274 Dict Comprehensions Warsaw SR 275 Switching on Multiple Values Lemburg SR 276 Simple Iterator for ints Althoff - SR 281 Loop Counter Iteration with range and xrange Hetland + SR 281 Loop Counter Iteration with range & xrange Hetland SR 284 Integer for-loops Eppstein, Ewing SW 288 Generators Attributes and Exceptions Hettinger SR 294 Type Names in the types Module Tirosh @@ -254,7 +255,7 @@ SW 321 Date/Time Parsing and Formatting Kuchling SR 325 Resource-Release Support for Generators Pedroni SR 326 A Case for Top and Bottom Values Carlson, Reedy - SR 329 Treating Builtins as Constants in the Standard Library Hettinger + SR 329 Treating Builtins as Constants in the StdLib Hettinger SR 330 Python Bytecode Verification Pelletier SR 332 Byte vectors and String/Unicode Unification Montanaro SW 334 Simple Coroutines via SuspendIteration Evans @@ -377,7 +378,7 @@ SF 278 Universal Newline Support Jansen SF 279 The enumerate() built-in function Hettinger S 280 Optimizing access to globals GvR - SR 281 Loop Counter Iteration with range and xrange Hetland + SR 281 Loop Counter Iteration with range & xrange Hetland SF 282 A Logging System Sajip, Mick IF 283 Python 2.3 Release Schedule GvR SR 284 Integer for-loops Eppstein, Ewing @@ -424,7 +425,7 @@ SR 326 A Case for Top and Bottom Values Carlson, Reedy SF 327 Decimal Data Type Batista SF 328 Imports: Multi-Line and Absolute/Relative Aahz - SR 329 Treating Builtins as Constants in the Standard Library Hettinger + SR 329 Treating Builtins as Constants in the StdLib Hettinger SR 330 Python Bytecode Verification Pelletier S 331 Locale-Independent Float/String Conversions Reis SR 332 Byte vectors and String/Unicode Unification Montanaro @@ -474,7 +475,7 @@ SR 3103 A Switch/Case Statement GvR SF 3104 Access to Names in Outer Scopes Yee SF 3105 Make print a function Brandl - SA 3106 Revamping dict.keys(), .values() and .items() GvR + SA 3106 Revamping dict.keys(), .values() & .items() GvR SF 3107 Function Annotations Winter, Lownds S 3108 Standard Library Reorganization Cannon SA 3109 Raising Exceptions in Python 3000 Winter @@ -482,7 +483,7 @@ SA 3111 Simple input built-in in Python 3000 Roberge SA 3112 Bytes literals in Python 3000 Orendorff SA 3113 Removal of Tuple Parameter Unpacking Cannon - SF 3114 Renaming iterator.next() to iterator.__next__() Yee + SF 3114 Renaming iterator.next() to .__next__() Yee SA 3115 Metaclasses in Python 3000 Talin S 3116 New I/O Stutzbach, Verdone, GvR S 3117 Postfix Type Declarations Brandl @@ -498,6 +499,7 @@ S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach S 3129 Class Decorators Winter + S 3130 Access to Current Module/Class/Function Jewett S 3141 A Type Hierarchy for Numbers Yasskin Added: peps/trunk/pep-3130.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3130.txt Tue May 1 21:35:45 2007 @@ -0,0 +1,206 @@ +PEP: 3130 +Title: Access to Current Module/Class/Function +Version: $Revision$ +Last-Modified: $Date$ +Author: Jim J. Jewett +Status: Draft +Type: Standards Track +Content-Type: text/plain +Created: 22-Apr-2007 +Python-Version: 3.0 +Post-History: 22-Apr-2007 + + +Abstract + + It is common to need a reference to the current module, class, + or function, but there is currently no entirely correct way to + do this. This PEP proposes adding the keywords __module__, + __class__, and __function__. + + +Rationale for __module__ + + Many modules export various functions, classes, and other objects, + but will perform additional activities (such as running unit + tests) when run as a script. The current idiom is to test whether + the module's name has been set to magic value. + + if __name__ == "__main__": ... + + More complicated introspection requires a module to (attempt to) + import itself. If importing the expected name actually produces + a different module, there is no good workaround. + + # __import__ lets you use a variable, but... it gets more + # complicated if the module is in a package. + __import__(__name__) + + # So just go to sys modules... and hope that the module wasn't + # hidden/removed (perhaps for security), that __name__ wasn't + # changed, and definitely hope that no other module with the + # same name is now available. + class X(object): + pass + + import sys + mod = sys.modules[__name__] + mod = sys.modules[X.__class__.__module__] + + Proposal: Add a __module__ keyword which refers to the module + currently being defined (executed). (But see open issues.) + + # XXX sys.main is still changing as draft progresses. May + # really need sys.modules[sys.main] + if __module__ is sys.main: # assumes PEP (3122), Cannon + ... + + +Rationale for __class__ + + Class methods are passed the current instance; from this they can + determine self.__class__ (or cls, for class methods). + Unfortunately, this reference is to the object's actual class, + which may be a subclass of the defining class. The current + workaround is to repeat the name of the class, and assume that the + name will not be rebound. + + class C(B): + + def meth(self): + super(C, self).meth() # Hope C is never rebound. + + class D(C): + + def meth(self): + # ?!? issubclass(D,C), so it "works": + super(C, self).meth() + + Proposal: Add a __class__ keyword which refers to the class + currently being defined (executed). (But see open issues.) + + class C(B): + def meth(self): + super(__class__, self).meth() + + Note that super calls may be further simplified by the "New Super" + PEP (Spealman). The __class__ (or __this_class__) attribute came + up in attempts to simplify the explanation and/or implementation + of that PEP, but was separated out as an independent decision. + + Note that __class__ (or __this_class__) is not quite the same as + the __thisclass__ property on bound super objects. The existing + super.__thisclass__ property refers to the class from which the + Method Resolution Order search begins. In the above class D, it + would refer to (the current reference of name) C. + + +Rationale for __function__ + + Functions (including methods) often want access to themselves, + usually for a private storage location or true recursion. While + there are several workarounds, all have their drawbacks. + + def counter(_total=[0]): + # _total shouldn't really appear in the + # signature at all; the list wrapping and + # [0] unwrapping obscure the code + _total[0] += 1 + return _total[0] + + @annotate(total=0) + def counter(): + # Assume name counter is never rebound: + counter.total += 1 + return counter.total + + # class exists only to provide storage: + class _wrap(object): + + __total = 0 + + def f(self): + self.__total += 1 + return self.__total + + # set module attribute to a bound method: + accum = _wrap().f + + # This function calls "factorial", which should be itself -- + # but the same programming styles that use heavy recursion + # often have a greater willingness to rebind function names. + def factorial(n): + return (n * factorial(n-1) if n else 1) + + Proposal: Add a __function__ keyword which refers to the function + (or method) currently being defined (executed). (But see open + issues.) + + @annotate(total=0) + def counter(): + # Always refers to this function obj: + __function__.total += 1 + return __function__.total + + def factorial(n): + return (n * __function__(n-1) if n else 1) + + +Backwards Compatibility + + While a user could be using these names already, double-underscore + names ( __anything__ ) are explicitly reserved to the interpreter. + It is therefore acceptable to introduce special meaning to these + names within a single feature release. + + +Implementation + + Ideally, these names would be keywords treated specially by the + bytecode compiler. + + Guido has suggested [1] using a cell variable filled in by the + metaclass. + + Michele Simionato has provided a prototype using bytecode hacks + [2]. This does not require any new bytecode operators; it just + modifies the which specific sequence of existing operators gets + run. + + +Open Issues + + - Are __module__, __class__, and __function__ the right names? In + particular, should the names include the word "this", either as + __this_module__, __this_class__, and __this_function__, (format + discussed on the python-3000 and python-ideas lists) or as + __thismodule__, __thisclass__, and __thisfunction__ (inspired + by, but conflicting with, current usage of super.__thisclass__). + + - Are all three keywords needed, or should this enhancement be + limited to a subset of the objects? Should methods be treated + separately from other functions? + + +References + + [1] Fixing super anyone? Guido van Rossum + http://mail.python.org/pipermail/python-3000/2007-April/006671.html + + [2] Descriptor/Decorator challenge, Michele Simionato + http://groups.google.com/group/comp.lang.python/browse_frm/thread/a6010c7494871bb1/62a2da68961caeb6?lnk=gst&q=simionato+challenge&rnum=1&hl=en#62a2da68961caeb6 + + +Copyright + + This document has been placed in the public domain. + + + +Local Variables: +mode: indented-text +indent-tabs-mode: nil +sentence-end-double-space: t +fill-column: 70 +coding: utf-8 +End: From python-checkins at python.org Tue May 1 21:53:17 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 May 2007 21:53:17 +0200 (CEST) Subject: [Python-checkins] r55057 - peps/trunk/pep-0001.txt Message-ID: <20070501195317.CF7C41E4008@bag.python.org> Author: georg.brandl Date: Tue May 1 21:53:12 2007 New Revision: 55057 Modified: peps/trunk/pep-0001.txt Log: Add a note about SVN keywords. Modified: peps/trunk/pep-0001.txt ============================================================================== --- peps/trunk/pep-0001.txt (original) +++ peps/trunk/pep-0001.txt Tue May 1 21:53:12 2007 @@ -418,6 +418,9 @@ svn checkout svn+ssh://pythondev at svn.python.org/peps/trunk peps + In particular, the ``svn:eol-style`` property should be set to ``native`` + and the ``svn:keywords`` property to ``Author Date Id Revision``. + * Monitor python.org to make sure the PEP gets added to the site properly. From python-checkins at python.org Tue May 1 22:14:29 2007 From: python-checkins at python.org (collin.winter) Date: Tue, 1 May 2007 22:14:29 +0200 (CEST) Subject: [Python-checkins] r55058 - peps/trunk/pep-3129.txt Message-ID: <20070501201429.AD1AB1E4008@bag.python.org> Author: collin.winter Date: Tue May 1 22:14:28 2007 New Revision: 55058 Modified: peps/trunk/pep-3129.txt Log: Fix the grammar in PEP 3129. Modified: peps/trunk/pep-3129.txt ============================================================================== --- peps/trunk/pep-3129.txt (original) +++ peps/trunk/pep-3129.txt Tue May 1 22:14:28 2007 @@ -65,13 +65,25 @@ Implementation ============== -The grammar for class declarations changes from :: +Adapating Python's grammar to support class decorators requires +modifying two rules and adding a new rule :: - classdef: 'class' NAME ['(' [testlist] ')'] ':' suite - -to :: + funcdef: [decorators] 'def' NAME parameters ['->' test] ':' suite + + compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | + with_stmt | funcdef | classdef + +need to be changed to :: + + decorated: decorators (classdef | funcdef) + + funcdef: 'def' NAME parameters ['->' test] ':' suite + + compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | + with_stmt | funcdef | classdef | decorated - classdef: [decorators] 'class' NAME ['(' [testlist] ')'] ':' suite +Adding ``decorated`` is necessary to avoid an ambiguity in the +grammar. The Python AST and bytecode must be modified accordingly. From python-checkins at python.org Tue May 1 22:34:28 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 May 2007 22:34:28 +0200 (CEST) Subject: [Python-checkins] r55059 - peps/trunk/pep-0000.txt peps/trunk/pep-3131.txt Message-ID: <20070501203428.82C631E4008@bag.python.org> Author: georg.brandl Date: Tue May 1 22:34:25 2007 New Revision: 55059 Added: peps/trunk/pep-3131.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Log: Add "Supporting Unicode Identifiers" by Martin v. L??wis as PEP 3131. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 22:34:25 2007 @@ -129,6 +129,7 @@ S 3128 BList: A Faster List-like Type Stutzbach S 3129 Class Decorators Winter S 3130 Access to Current Module/Class/Function Jewett + S 3131 Supporting Non-ASCII Identifiers von L?wis S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -500,6 +501,7 @@ S 3128 BList: A Faster List-like Type Stutzbach S 3129 Class Decorators Winter S 3130 Access to Current Module/Class/Function Jewett + S 3131 Supporting Non-ASCII Identifiers von L?wis S 3141 A Type Hierarchy for Numbers Yasskin Added: peps/trunk/pep-3131.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3131.txt Tue May 1 22:34:25 2007 @@ -0,0 +1,133 @@ +PEP: 3131 +Title: Supporting Non-ASCII Identifiers +Version: $Revision$ +Last-Modified: $Date$ +Author: Martin v. L?wis +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 1-May-2007 +Python-Version: 3.0 +Post-History: + + +Abstract +======== + +This PEP suggests to support non-ASCII letters (such as accented characters, +Cyrillic, Greek, Kanji, etc.) in Python identifiers. + +Rationale +========= + +Python code is written by many people in the world who are not familiar with the +English language, or even well-acquainted with the Latin writing system. Such +developers often desire to define classes and functions with names in their +native languages, rather than having to come up with an (often incorrect) +English translation of the concept they want to name. + +For some languages, common transliteration systems exist (in particular, for the +Latin-based writing systems). For other languages, users have larger +difficulties to use Latin to write their native words. + +Common Objections +================= + +Some objections are often raised against proposals similar to this one. + +People claim that they will not be able to use a library if to do so they have +to use characters they cannot type on their keyboards. However, it is the +choice of the designer of the library to decide on various constraints for using +the library: people may not be able to use the library because they cannot get +physical access to the source code (because it is not published), or because +licensing prohibits usage, or because the documentation is in a language they +cannot understand. A developer wishing to make a library widely available needs +to make a number of explicit choices (such as publication, licensing, language +of documentation, and language of identifiers). It should always be the choice +of the author to make these decisions - not the choice of the language +designers. + +In particular, projects wishing to have wide usage probably might want to +establish a policy that all identifiers, comments, and documentation is written +in English (see the GNU coding style guide for an example of such a policy). +Restricting the language to ASCII-only identifiers does not enforce comments and +documentation to be English, or the identifiers actually to be English words, so +an additional policy is necessary, anyway. + +Specification of Language Changes +================================= + +The syntax of identifiers in Python will be based on the Unicode standard annex +UAX-31 [1]_, with elaboration and changes as defined below. + +Within the ASCII range (U+0001..U+007F), the valid characters for identifiers +are the same as in Python 2.5. This specification only introduces additional +characters from outside the ASCII range. For other characters, the +classification uses the version of the Unicode Character Database as included in +the ``unicodedata`` module. + +The identifier syntax is `` *``. + +``ID_Start`` is defined as all characters having one of the general categories +uppercase letters (Lu), lowercase letters (Ll), titlecase letters (Lt), modifier +letters (Lm), other letters (Lo), letter numbers (Nl), plus the underscore (XXX +what are "stability extensions" listed in UAX 31). + +``ID_Continue`` is defined as all characters in ``ID_Start``, plus nonspacing +marks (Mn), spacing combining marks (Mc), decimal number (Nd), and connector +punctuations (Pc). + +All identifiers are converted into the normal form NFC while parsing; comparison +of identifiers is based on NFC. + +Policy Specification +==================== + +As an addition to the Python Coding style, the following policy is prescribed: +All identifiers in the Python standard library MUST use ASCII-only identifiers, +and SHOULD use English words wherever feasible. + +As an option, this specification can be applied to Python 2.x. In that case, +ASCII-only identifiers would continue to be represented as byte string objects +in namespace dictionaries; identifiers with non-ASCII characters would be +represented as Unicode strings. + +Implementation +============== + +The following changes will need to be made to the parser: + +1. If a non-ASCII character is found in the UTF-8 representation of the source + code, a forward scan is made to find the first ASCII non-identifier character + (e.g. a space or punctuation character) + +2. The entire UTF-8 string is passed to a function to normalize the string to + NFC, and then verify that it follows the identifier syntax. No such callout + is made for pure-ASCII identifiers, which continue to be parsed the way they + are today. + +3. If this specification is implemented for 2.x, reflective libraries (such as + pydoc) must be verified to continue to work when Unicode strings appear in + ``__dict__`` slots as keys. + +References +========== + +.. [1] http://www.unicode.org/reports/tr31/ + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Tue May 1 22:39:23 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 May 2007 22:39:23 +0200 (CEST) Subject: [Python-checkins] r55060 - peps/trunk/pep-0000.txt peps/trunk/pep-0341.txt peps/trunk/pep-3001.txt peps/trunk/pep-3099.txt peps/trunk/pep-3105.txt peps/trunk/pep-3117.txt Message-ID: <20070501203923.3B70A1E4008@bag.python.org> Author: georg.brandl Date: Tue May 1 22:39:17 2007 New Revision: 55060 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-0341.txt peps/trunk/pep-3001.txt peps/trunk/pep-3099.txt peps/trunk/pep-3105.txt peps/trunk/pep-3117.txt Log: Change my address. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 22:39:17 2007 @@ -534,7 +534,7 @@ Baxter, Anthony anthony at interlink.com.au Bellman, Thomas bellman+pep-divmod at lysator.liu.se Bethard, Steven steven.bethard at gmail.com - Brandl, Georg g.brandl at gmx.net + Brandl, Georg georg at python.org Cannon, Brett brett at python.org Carlson, Josiah jcarlson at uci.edu Carroll, W Isaac icarroll at pobox.com Modified: peps/trunk/pep-0341.txt ============================================================================== --- peps/trunk/pep-0341.txt (original) +++ peps/trunk/pep-0341.txt Tue May 1 22:39:17 2007 @@ -2,7 +2,7 @@ Title: Unifying try-except and try-finally Version: $Revision$ Last-Modified: $Date$ -Author: Georg Brandl +Author: Georg Brandl Status: Final Type: Standards Track Content-Type: text/plain Modified: peps/trunk/pep-3001.txt ============================================================================== --- peps/trunk/pep-3001.txt (original) +++ peps/trunk/pep-3001.txt Tue May 1 22:39:17 2007 @@ -2,7 +2,7 @@ Title: Procedure for reviewing and improving standard library modules Version: $Revision$ Last-Modified: $Date$ -Author: Georg Brandl +Author: Georg Brandl Status: Draft Type: Process Content-Type: text/x-rst Modified: peps/trunk/pep-3099.txt ============================================================================== --- peps/trunk/pep-3099.txt (original) +++ peps/trunk/pep-3099.txt Tue May 1 22:39:17 2007 @@ -2,7 +2,7 @@ Title: Things that will Not Change in Python 3000 Version: $Revision$ Last-Modified: $Date$ -Author: Georg Brandl +Author: Georg Brandl Status: Draft Type: Informational Content-Type: text/x-rst Modified: peps/trunk/pep-3105.txt ============================================================================== --- peps/trunk/pep-3105.txt (original) +++ peps/trunk/pep-3105.txt Tue May 1 22:39:17 2007 @@ -2,7 +2,7 @@ Title: Make print a function Version: $Revision$ Last-Modified: $Date$ -Author: Georg Brandl +Author: Georg Brandl Status: Final Type: Standards Track Content-Type: text/x-rst Modified: peps/trunk/pep-3117.txt ============================================================================== --- peps/trunk/pep-3117.txt (original) +++ peps/trunk/pep-3117.txt Tue May 1 22:39:17 2007 @@ -2,7 +2,7 @@ Title: Postfix type declarations Version: $Revision$ Last-Modified: $Date$ -Author: Georg Brandl +Author: Georg Brandl Status: Draft Type: Standards Track Content-Type: text/x-rst From python-checkins at python.org Tue May 1 23:11:55 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 May 2007 23:11:55 +0200 (CEST) Subject: [Python-checkins] r55061 - peps/trunk/pep-0000.txt peps/trunk/pep-0367.txt Message-ID: <20070501211155.E68A21E4009@bag.python.org> Author: georg.brandl Date: Tue May 1 23:11:53 2007 New Revision: 55061 Added: peps/trunk/pep-0367.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Log: Add PEP 367, "New Super" by Calvin Spealman. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 23:11:53 2007 @@ -112,6 +112,7 @@ S 364 Transitioning to the Py3K Standard Library Warsaw S 365 Adding the pkg_resources module Eby S 366 Main module explicit relative imports Coghlan + S 367 New Super Spealman S 754 IEEE 754 Floating Point Special Values Warnes S 3101 Advanced String Formatting Talin S 3108 Standard Library Reorganization Cannon @@ -464,6 +465,7 @@ S 364 Transitioning to the Py3K Standard Library Warsaw S 365 Adding the pkg_resources module Eby S 366 Main module explicit relative imports Coghlan + S 367 New Super Spealman SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR @@ -606,6 +608,7 @@ Schneider-Kamp, Peter nowonder at nowonder.de Seo, Jiwon seojiwon at gmail.com Smith, Kevin D. Kevin.Smith at theMorgue.org + Spealman, Calvin ironfroggy at gmail.com Stein, Greg gstein at lyra.org Stutzbach, Daniel daniel.stutzbach at gmail.com Suzi, Roman rnd at onego.ru Added: peps/trunk/pep-0367.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-0367.txt Tue May 1 23:11:53 2007 @@ -0,0 +1,360 @@ +PEP: 367 +Title: New Super +Version: $Revision$ +Last-Modified: $Date$ +Author: Calvin Spealman +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 28-Apr-2007 +Python-Version: 2.6 +Post-History: 28-Apr-2007, 29-Apr-2007 (1), 29-Apr-2007 (2) + + +Abstract +======== + +The PEP defines the proposal to enhance the ``super`` builtin to work +implicitly upon the class within which it is used and upon the +instance the current function was called on. The premise of the new +super usage suggested is as follows:: + + super.foo(1, 2) + +to replace the old :: + + super(Foo, self).foo(1, 2) + + +Rationale +========= + +The current usage of ``super`` requires an explicit passing of both +the class and instance it must operate from, requiring a breaking of +the *DRY* (Don't Repeat Yourself) rule. This hinders any change in +class name, and is often considered a wart by many. + + +Specification +============= + +Within the specification section, some special terminology will be +used to distinguish similar and closely related concepts. "Super +type" will refer to the actual builtin type named ``super``. "Next +Class/Type in the MRO" will refer to the class where attribute lookups +will be performed by ``super``, for example, in the following, ``A`` +is the "Next class in the MRO" for the use of ``super``. :: + + class A(object): + def f(self): + return 'A' + + class B(A): + def f(self): + super(B, self).f() # Here, A would be our "Next class + # in the MRO", of course. + +A "super object" is simply an instance of the super type, which is +associated with a class and possibly with an instance of that class. +Finally, "new super" refers to the new super type, which will replace +the original. + +Replacing the old usage of ``super``, calls to the next class in the +MRO (method resolution order) will be made without an explicit super +object creation, by simply accessing an attribute on the super type +directly, which will automatically apply the class and instance to +perform the proper lookup. The following example demonstrates the use +of this. :: + + class A(object): + def f(self): + return 'A' + + class B(A): + def f(self): + return 'B' + super.f() + + class C(A): + def f(self): + return 'C' + super.f() + + class D(B, C): + def f(self): + return 'D' + super.f() + + assert D().f() == 'DBCA' + +The proposal adds a dynamic attribute lookup to the super type, which +will automatically determine the proper class and instance parameters. +Each super attribute lookup identifies these parameters and performs +the super lookup on the instance, as the current super implementation +does with the explicit invocation of a super object upon a class and +instance. + +The enhancements to the super type will define a new ``__getattr__`` +classmethod of the super type, which must look backwards to the +previous frame and locate the instance object. This can be naively +determined by located the local named by the first argument to the +function. Using super outside of a function where this is a valid +lookup for the instance can be considered undocumented in its +behavior. This special method will actually be invoked on attribute +lookups to the super type itself, as opposed to super objects, as the +current implementation works. This may pose open issues, which are +detailed below. + +"Every class will gain a new special attribute, ``__super__``, which +refers to an instance of the associated super object for that class." +In this capacity, the new super also acts as its own descriptor, +create an instance-specific super upon lookup. + +Much of this was discussed in the thread of the python-dev list, +"Fixing super anyone?" [1]_. + +Open Issues +----------- + +__call__ methods +'''''''''''''''' + +Backward compatibility of the super type API raises some issues. +Names, the lookup of the ``__call__`` method of the super type itself, +which means a conflict with doing an actual super lookup of the +``__call__`` attribute. Namely, the following is ambiguous in the +current proposal:: + + super.__call__(arg) + +Which means the backward compatible API, which involves instantiating +the super type, will either not be possible, because it will actually +do a super lookup on the ``__call__`` attribute, or there will be no +way to perform a super lookup on the ``__call__`` attribute. Both +seem unacceptable, so any suggestions are welcome. + +Actually keeping the old super around in 2.x and creating a completely +new super type separately may be the best option. A future import or +even a simple import in 2.x of the new super type from some built-in +module may offer a way to choose which each module uses, even mixing +uses by binding to different names. Such a built-in module might be +called 'newsuper'. This module is also the reference implementation, +which I will present below. + +super type's new getattr +'''''''''''''''''''''''' + +To give the behavior needed, the super type either needs a way to do +dynamic lookup of attributes on the super type object itself or define +a metaclass for the built-in type. This author is unsure which, if +either, is possible with C-defined types. + +When should we create __super__ attributes? +''''''''''''''''''''''''''''''''''''''''''' + +They either need to be created on class creation or on ``__super__`` +attribute lookup. For the second, they could be cached, of course, +which seems like it may be the best idea, if implicit creation of a +super object for every class is considered too much overhead. + +How does it work in inner functions? +'''''''''''''''''''''''''''''''''''' + +If a method defines a function and super is used inside of it, how +does this work? The frame looking and instance detection breaks here. +However, if there can be some unambiguous way to use both the new +super form and still be able to explicitly name the type and instance, +I think its an acceptable tradeoff to simply be explicit in these +cases, rather than add weird super-specific lookup rules in these +cases. + +An example of such a problematic bit of code is:: + + class B(A): + def f(self): + def g(): + return super.f() + return g() + +Should super actually become a keyword? +''''''''''''''''''''''''''''''''''''''' + +This would solve many of the problems and allow more direct +implementation of super into the language proper. However, some are +against the actual keywordization of super. The simplest solution is +often the correct solution and the simplest solution may well not be +adding additional keywords to the language when they are not needed. +Still, it may solve many of the other open issues. + +Can we also allow super()? +'''''''''''''''''''''''''' + +There is strong sentiment for and against this, but implementation and +style concerns are obvious. Particularly, that it's "magical" and +that ``super()`` would differ from ``super.__call__()``, being very +unpythonic. + + +Reference Implementation +======================== + +This implementation was a cooperative contribution in the original thread [1]_. :: + + #!/usr/bin/env python + # + # newsuper.py + + import sys + + class SuperMetaclass(type): + def __getattr__(cls, attr): + calling_frame = sys._getframe().f_back + instance_name = calling_frame.f_code.co_varnames[0] + instance = calling_frame.f_locals[instance_name] + return getattr(instance.__super__, attr) + + class Super(object): + __metaclass__ = SuperMetaclass + def __init__(self, type, obj=None): + if isinstance(obj, Super): + obj = obj.__obj__ + self.__type__ = type + self.__obj__ = obj + def __get__(self, obj, cls=None): + if obj is None: + raise Exception('only supports instances') + else: + return Super(self.__type__, obj) + def __getattr__(self, attr): + mro = iter(self.__obj__.__class__.__mro__) + for cls in mro: + if cls is self.__type__: + break + for cls in mro: + if attr in cls.__dict__: + x = cls.__dict__[attr] + if hasattr(x, '__get__'): + x = x.__get__(self, cls) + return x + raise AttributeError, attr + + class autosuper(type): + def __init__(cls, name, bases, clsdict): + cls.__super__ = Super(cls) + + if __name__ == '__main__': + class A(object): + __metaclass__ = autosuper + def f(self): + return 'A' + + class B(A): + def f(self): + return 'B' + Super.f() + + class C(A): + def f(self): + return 'C' + Super.f() + + class D(B, C): + def f(self, arg=None): + var = None + return 'D' + Super.f() + + assert D().f() == 'DBCA' + + +Alternative Proposals +===================== + +No Changes +---------- + +Although its always attractive to just keep things how they are, +people have sought a change in the usage of super calling for some +time, and for good reason, all mentioned previously. + +* Decoupling from the class name (which might not even be bound to the + right class anymore!). + +* Simpler looking, cleaner super calls would be better. + +``super(__this_class__, self)`` +------------------------------- + +This is nearly an anti-proposal, as it basically relies on the +acceptance of the ``__this_class__`` PEP [#pep3130]_, which proposes a +special name that would always be bound to the class within which it +is used. If that is accepted, ``__this_class__`` could simply be used +instead of the class' name explicitly, solving the name binding issues. + +``self.__super__.foo(*args)`` +----------------------------- + +The ``__super__`` attribute is mentioned in this PEP in several +places, and could be a candidate for the complete solution, actually +using it explicitly instead of any super usage directly. However, +double-underscore names are usually an internal detail, and attempted +to be kept out of everyday code. + +``super(self, *args) or __super__(self, *args)`` +------------------------------------------------ + +This solution only solves the problem of the type indication, does not +handle differently named super methods, and is explicit about the name +of the instance. It is less flexible without being able to enacted on +other method names, in cases where that is needed. One use case where +this fails is when a base class has a factory classmethod and a +subclass has two factory classmethods, both of which need to properly +make super calls to the one in the base class. + +``super.foo(self, *args)`` +-------------------------- + +This variation actually eliminates the problems with locating the +proper instance, and if any of the alternatives were pushed into the +spotlight, I would want it to be this one. + +``super`` or ``super()`` +------------------------ + +This proposal leaves no room for different names, signatures, or +application to other classes, or instances. A way to allow some +similar use alongside the normal proposal would be favorable, +encouraging good design of multiple inheritance trees and compatible +methods. + + +History +======= + +29-Apr-2007: + +- Changed title from "Super As A Keyword" to "New Super" +- Updated much of the language and added a terminology section + for clarification in confusing places. +- Added reference implementation and history sections. + + +References +========== + +.. [1] Fixing super anyone? + (http://mail.python.org/pipermail/python-3000/2007-April/006667.html) + +.. [#pep3130] PEP 3130 (Access to Current Module/Class/Function) + http://www.python.org/dev/peps/pep-3130 + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Tue May 1 23:42:26 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 May 2007 23:42:26 +0200 (CEST) Subject: [Python-checkins] r55062 - peps/trunk/pep-0000.txt peps/trunk/pep-3132.txt Message-ID: <20070501214226.DE22A1E400E@bag.python.org> Author: georg.brandl Date: Tue May 1 23:42:23 2007 New Revision: 55062 Added: peps/trunk/pep-3132.txt Modified: peps/trunk/pep-0000.txt Log: Add PEP 3132, "Extended Iterable Unpacking", by me. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 1 23:42:23 2007 @@ -131,6 +131,7 @@ S 3129 Class Decorators Winter S 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis + S 3132 Extended Iterable Unpacking Brandl S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -504,6 +505,7 @@ S 3129 Class Decorators Winter S 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis + S 3132 Extended Iterable Unpacking Brandl S 3141 A Type Hierarchy for Numbers Yasskin Added: peps/trunk/pep-3132.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3132.txt Tue May 1 23:42:23 2007 @@ -0,0 +1,118 @@ +PEP: 3132 +Title: Extended Iterable Unpacking +Version: $Revision$ +Last-Modified: $Date$ +Author: Georg Brandl +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 30-Apr-2007 +Python-Version: 3.0 +Post-History: + + +Abstract +======== + +This PEP proposes a change to iterable unpacking syntax, allowing to +specify a "catch-all" name which will be assigned a list of all items +not assigned to a "regular" name. + +An example says more than a thousand words:: + + >>> a, *b, c = range(5) + >>> a + 0 + >>> c + 4 + >>> b + [1, 2, 3] + + +Rationale +========= + +Many algorithms require splitting a sequence in a "first, rest" pair. +With the new syntax, :: + + first, rest = seq[0], seq[1:] + +is replaced by the cleaner and probably more efficient:: + + first, *rest = seq + +For more complex unpacking patterns, the new syntax looks even +cleaner, and the clumsy index handling is not necessary anymore. + + +Specification +============= + +A tuple (or list) on the left side of a simple assignment (unpacking +is not defined for augmented assignment) may contain at most one +expression prepended with a single asterisk. For the rest of this +section, the other expressions in the list are called "mandatory". + +Note that this also refers to tuples in implicit assignment context, +such as in a ``for`` statement. + +This designates a subexpression that will be assigned a list of all +items from the iterable being unpacked that are not assigned to any +of the mandatory expressions, or an empty list if there are no such +items. + +It is an error (as it is currently) if the iterable doesn't contain +enough items to assign to all the mandatory expressions. + + +Implementation +============== + +The proposed implementation strategy is: + +- add a new grammar rule, ``star_test``, which consists of ``'*' + test`` and is used in test lists +- add a new ASDL type ``Starred`` to represent a starred expression +- catch all cases where starred expressions are not allowed in the AST + and symtable generation stage +- add a new opcode, ``UNPACK_EX``, which will only be used if a + list/tuple to be assigned to contains a starred expression +- change ``unpack_iterable()`` in ceval.c to handle the extended + unpacking case + +Note that the starred expression element introduced here is universal +and could be used for other purposes in non-assignment context, such +as the ``yield *iterable`` proposal. + +The author has written a draft implementation, but there are some open +issues which will be resolved in case this PEP is looked upon +benevolently. + + +Open Issues +=========== + +- Should the catch-all expression be assigned a list or a tuple of items? + + +References +========== + +None yet. + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Wed May 2 00:06:35 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 2 May 2007 00:06:35 +0200 (CEST) Subject: [Python-checkins] r55063 - peps/trunk/pep-0000.txt peps/trunk/pep-3133.txt Message-ID: <20070501220635.4B9BA1E400F@bag.python.org> Author: guido.van.rossum Date: Wed May 2 00:06:34 2007 New Revision: 55063 Added: peps/trunk/pep-3133.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Log: Add PEP 3133: New Super (Spealman). Remove outdated pepparade link. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Wed May 2 00:06:34 2007 @@ -17,10 +17,6 @@ once assigned are never changed. The SVN history[1] of the PEP texts represent their historical record. - The BDFL maintains his own Pronouncements page[2] at - http://www.python.org/doc/essays/pepparade.html which contains his - musings on the various outstanding PEPs. - Index by Category @@ -132,6 +128,7 @@ S 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis S 3132 Extended Iterable Unpacking Brandl + S 3133 New Super Spealman S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -506,6 +503,7 @@ S 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis S 3132 Extended Iterable Unpacking Brandl + S 3133 New Super Spealman S 3141 A Type Hierarchy for Numbers Yasskin @@ -635,10 +633,6 @@ [1] View PEP history online http://svn.python.org/projects/peps/trunk/ - [2] The Benevolent Dictator For Life's Parade of PEPs - http://www.python.org/doc/essays/pepparade.html - - Local Variables: mode: indented-text Added: peps/trunk/pep-3133.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3133.txt Wed May 2 00:06:34 2007 @@ -0,0 +1,254 @@ +PEP: 3133 +Title: New Super +Version: $Revision$ +Last-Modified: $Date$ +Author: Calvin Spealman +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 28-Apr-2007 +Python-Version: 2.6 +Post-History: 28-Apr-2007, 29-Apr-2007 + + +Abstract +======== + +The PEP defines the proposal to enhance the super builtin to work implicitly +upon the class within which it is used and upon the instance the current +function was called on. The premise of the new super usage suggested is as +follows: + + super.foo(1, 2) + +to replace the old: + + super(Foo, self).foo(1, 2) + + +Rationale +========= + +The current usage of super requires an explicit passing of both the class and +instance it must operate from, requiring a breaking of the DRY (Don't Repeat +Yourself) rule. This hinders any change in class name, and is often considered +a wart by many. + + +Specification +============= + +Within the specification section, some special terminology will be used to +distinguish similar and closely related concepts. "Super type" will refer to +the actual builtin type named "super". "Next Class/Type in the MRO" will refer +to the class where attribute lookups will be performed by super, for example, +in the following, A is the "Next class in the MRO" for the use of super. + + :: + + class A(object): + def f(self): + return 'A' + + class B(A): + def f(self): + super(B, self).f() # Here, A would be out "Next class in the + # MRO", of course. + +A "super object" is simply an instance of the super type, which is associated +with a class and possibly with an instance of that class. Finally, "new super" +refers to the new super type, which will replace the original. + +Replacing the old usage of super, calls to the next class in the MRO (method +resolution order) will be made without an explicit super object creation, +by simply accessing an attribute on the super type directly, which will +automatically apply the class and instance to perform the proper lookup. The +following example demonstrates the use of this. + + :: + + class A(object): + def f(self): + return 'A' + + class B(A): + def f(self): + return 'B' + super.f() + + class C(A): + def f(self): + return 'C' + super.f() + + class D(B, C): + def f(self): + return 'D' + super.f() + + assert D().f() == 'DBCA' + +The proposal adds a dynamic attribute lookup to the super type, which will +automatically determine the proper class and instance parameters. Each super +attribute lookup identifies these parameters and performs the super lookup on +the instance, as the current super implementation does with the explicit +invokation of a super object upon a class and instance. + +The enhancements to the super type will define a new __getattr__ classmethod +of the super type, which must look backwards to the previous frame and locate +the instance object. This can be naively determined by located the local named +by the first argument to the function. Using super outside of a function where +this is a valid lookup for the instance can be considered undocumented in its +behavior. This special method will actually be invoked on attribute lookups to +the super type itself, as opposed to super objects, as the current +implementation works. This may pose open issues, which are detailed below. + +"Every class will gain a new special attribute, __super__, which refers to an +instance of the associated super object for that class" In this capacity, the +new super also acts as its own descriptor, create an instance-specific super +upon lookup. + +Much of this was discussed in the thread of the python-dev list, "Fixing super +anyone?" [1]_. + +Open Issues +----------- + +__call__ methods +'''''''''''''''' + +Backward compatability of the super type API raises some issues. Names, the +lookup of the __call__ of the super type itself, which means a conflict with +doing an actual super lookup of the __call__ attribute. Namely, the following +is ambiguous in the current proposal: + + :: + + super.__call__(arg) + +Which means the backward compatible API, which involves instansiating the super +type, will either not be possible, because it will actually do a super lookup +on the __call__ attribute, or there will be no way to perform a super lookup on +the __call__ attribute. Both seem unacceptable, so any suggestions are welcome. + +Actually keeping the old super around in 2.x and creating a completely new super +type seperately may be the best option. A future import or even a simple import +in 2.x of the new super type from some builtin module may offer a way to choose +which each module uses, even mixing uses by binding to different names. Such a +builtin module might be called 'newsuper'. This module is also the reference +implementation, which I will present below. + +super type's new getattr +'''''''''''''''''''''''' + +To give the behavior needed, the super type either needs a way to do dynamic +lookup of attributes on the super type object itself or define a metaclass for +the builtin type. This author is unsure which, if either, is possible with C- +defined types. + +When should we create __super__ attributes? +''''''''''''''''''''''''''''''''''''''''''' + +They either need to be created on class creation or on __super__ attribute +lookup. For the second, they could be cached, of course, which seems like it +may be the best idea, if implicit creation of a super object for every class is +considered too much overhead. + + +Reference Implementation +======================== + +This implementation was a cooperative contribution in the original thread [1]_. + + :: + + #!/usr/bin/env python + # + # newsuper.py + + import sys + + class SuperMetaclass(type): + def __getattr__(cls, attr): + calling_frame = sys._getframe().f_back + instance_name = calling_frame.f_code.co_varnames[0] + instance = calling_frame.f_locals[instance_name] + return getattr(instance.__super__, attr) + + class Super(object): + __metaclass__ = SuperMetaclass + def __init__(self, type, obj=None): + if isinstance(obj, Super): + obj = obj.__obj__ + self.__type__ = type + self.__obj__ = obj + def __get__(self, obj, cls=None): + if obj is None: + raise Exception('only supports instances') + else: + return Super(self.__type__, obj) + def __getattr__(self, attr): + mro = iter(self.__obj__.__class__.__mro__) + for cls in mro: + if cls is self.__type__: + break + for cls in mro: + if attr in cls.__dict__: + x = cls.__dict__[attr] + if hasattr(x, '__get__'): + x = x.__get__(self, cls) + return x + raise AttributeError, attr + + class autosuper(type): + def __init__(cls, name, bases, clsdict): + cls.__super__ = Super(cls) + + if __name__ == '__main__': + class A(object): + __metaclass__ = autosuper + def f(self): + return 'A' + + class B(A): + def f(self): + return 'B' + Super.f() + + class C(A): + def f(self): + return 'C' + Super.f() + + class D(B, C): + def f(self, arg=None): + var = None + return 'D' + Super.f() + + assert D().f() == 'DBCA' + + +History +======= +29-Apr-2007 - Changed title from "Super As A Keyword" to "New Super" + - Updated much of the language and added a terminology section + for clarification in confusing places. + - Added reference implementation and history sections. + +References +========== + +.. [1] Fixing super anyone? + (http://mail.python.org/pipermail/python-3000/2007-April/006667.html) + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Wed May 2 00:29:39 2007 From: python-checkins at python.org (nick.coghlan) Date: Wed, 2 May 2007 00:29:39 +0200 (CEST) Subject: [Python-checkins] r55064 - peps/trunk/pep-0366.txt Message-ID: <20070501222939.E7B641E4009@bag.python.org> Author: nick.coghlan Date: Wed May 2 00:29:38 2007 New Revision: 55064 Modified: peps/trunk/pep-0366.txt Log: Fix PEP 366 status Modified: peps/trunk/pep-0366.txt ============================================================================== --- peps/trunk/pep-0366.txt (original) +++ peps/trunk/pep-0366.txt Wed May 2 00:29:38 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Nick Coghlan -Status: Final +Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 1-May-2007 From ncoghlan at gmail.com Wed May 2 00:58:32 2007 From: ncoghlan at gmail.com (Nick Coghlan) Date: Wed, 02 May 2007 08:58:32 +1000 Subject: [Python-checkins] r55063 - peps/trunk/pep-0000.txt peps/trunk/pep-3133.txt In-Reply-To: <20070501220635.4B9BA1E400F@bag.python.org> References: <20070501220635.4B9BA1E400F@bag.python.org> Message-ID: <4637C618.8080709@gmail.com> guido.van.rossum wrote: > Author: guido.van.rossum > Date: Wed May 2 00:06:34 2007 > New Revision: 55063 > > Added: > peps/trunk/pep-3133.txt (contents, props changed) > Modified: > peps/trunk/pep-0000.txt > Log: > Add PEP 3133: New Super (Spealman). Georg checked this in earlier as PEP 367... Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From python-checkins at python.org Wed May 2 02:16:44 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 2 May 2007 02:16:44 +0200 (CEST) Subject: [Python-checkins] r55065 - peps/trunk/pep-0000.txt peps/trunk/pep-3133.txt Message-ID: <20070502001644.525A11E4015@bag.python.org> Author: guido.van.rossum Date: Wed May 2 02:16:40 2007 New Revision: 55065 Removed: peps/trunk/pep-3133.txt Modified: peps/trunk/pep-0000.txt Log: Correct an oopsie -- Calvin's New Super PEP was already checked in as 367. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Wed May 2 02:16:40 2007 @@ -128,7 +128,6 @@ S 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis S 3132 Extended Iterable Unpacking Brandl - S 3133 New Super Spealman S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -503,7 +502,6 @@ S 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis S 3132 Extended Iterable Unpacking Brandl - S 3133 New Super Spealman S 3141 A Type Hierarchy for Numbers Yasskin Deleted: /peps/trunk/pep-3133.txt ============================================================================== --- /peps/trunk/pep-3133.txt Wed May 2 02:16:40 2007 +++ (empty file) @@ -1,254 +0,0 @@ -PEP: 3133 -Title: New Super -Version: $Revision$ -Last-Modified: $Date$ -Author: Calvin Spealman -Status: Draft -Type: Standards Track -Content-Type: text/x-rst -Created: 28-Apr-2007 -Python-Version: 2.6 -Post-History: 28-Apr-2007, 29-Apr-2007 - - -Abstract -======== - -The PEP defines the proposal to enhance the super builtin to work implicitly -upon the class within which it is used and upon the instance the current -function was called on. The premise of the new super usage suggested is as -follows: - - super.foo(1, 2) - -to replace the old: - - super(Foo, self).foo(1, 2) - - -Rationale -========= - -The current usage of super requires an explicit passing of both the class and -instance it must operate from, requiring a breaking of the DRY (Don't Repeat -Yourself) rule. This hinders any change in class name, and is often considered -a wart by many. - - -Specification -============= - -Within the specification section, some special terminology will be used to -distinguish similar and closely related concepts. "Super type" will refer to -the actual builtin type named "super". "Next Class/Type in the MRO" will refer -to the class where attribute lookups will be performed by super, for example, -in the following, A is the "Next class in the MRO" for the use of super. - - :: - - class A(object): - def f(self): - return 'A' - - class B(A): - def f(self): - super(B, self).f() # Here, A would be out "Next class in the - # MRO", of course. - -A "super object" is simply an instance of the super type, which is associated -with a class and possibly with an instance of that class. Finally, "new super" -refers to the new super type, which will replace the original. - -Replacing the old usage of super, calls to the next class in the MRO (method -resolution order) will be made without an explicit super object creation, -by simply accessing an attribute on the super type directly, which will -automatically apply the class and instance to perform the proper lookup. The -following example demonstrates the use of this. - - :: - - class A(object): - def f(self): - return 'A' - - class B(A): - def f(self): - return 'B' + super.f() - - class C(A): - def f(self): - return 'C' + super.f() - - class D(B, C): - def f(self): - return 'D' + super.f() - - assert D().f() == 'DBCA' - -The proposal adds a dynamic attribute lookup to the super type, which will -automatically determine the proper class and instance parameters. Each super -attribute lookup identifies these parameters and performs the super lookup on -the instance, as the current super implementation does with the explicit -invokation of a super object upon a class and instance. - -The enhancements to the super type will define a new __getattr__ classmethod -of the super type, which must look backwards to the previous frame and locate -the instance object. This can be naively determined by located the local named -by the first argument to the function. Using super outside of a function where -this is a valid lookup for the instance can be considered undocumented in its -behavior. This special method will actually be invoked on attribute lookups to -the super type itself, as opposed to super objects, as the current -implementation works. This may pose open issues, which are detailed below. - -"Every class will gain a new special attribute, __super__, which refers to an -instance of the associated super object for that class" In this capacity, the -new super also acts as its own descriptor, create an instance-specific super -upon lookup. - -Much of this was discussed in the thread of the python-dev list, "Fixing super -anyone?" [1]_. - -Open Issues ------------ - -__call__ methods -'''''''''''''''' - -Backward compatability of the super type API raises some issues. Names, the -lookup of the __call__ of the super type itself, which means a conflict with -doing an actual super lookup of the __call__ attribute. Namely, the following -is ambiguous in the current proposal: - - :: - - super.__call__(arg) - -Which means the backward compatible API, which involves instansiating the super -type, will either not be possible, because it will actually do a super lookup -on the __call__ attribute, or there will be no way to perform a super lookup on -the __call__ attribute. Both seem unacceptable, so any suggestions are welcome. - -Actually keeping the old super around in 2.x and creating a completely new super -type seperately may be the best option. A future import or even a simple import -in 2.x of the new super type from some builtin module may offer a way to choose -which each module uses, even mixing uses by binding to different names. Such a -builtin module might be called 'newsuper'. This module is also the reference -implementation, which I will present below. - -super type's new getattr -'''''''''''''''''''''''' - -To give the behavior needed, the super type either needs a way to do dynamic -lookup of attributes on the super type object itself or define a metaclass for -the builtin type. This author is unsure which, if either, is possible with C- -defined types. - -When should we create __super__ attributes? -''''''''''''''''''''''''''''''''''''''''''' - -They either need to be created on class creation or on __super__ attribute -lookup. For the second, they could be cached, of course, which seems like it -may be the best idea, if implicit creation of a super object for every class is -considered too much overhead. - - -Reference Implementation -======================== - -This implementation was a cooperative contribution in the original thread [1]_. - - :: - - #!/usr/bin/env python - # - # newsuper.py - - import sys - - class SuperMetaclass(type): - def __getattr__(cls, attr): - calling_frame = sys._getframe().f_back - instance_name = calling_frame.f_code.co_varnames[0] - instance = calling_frame.f_locals[instance_name] - return getattr(instance.__super__, attr) - - class Super(object): - __metaclass__ = SuperMetaclass - def __init__(self, type, obj=None): - if isinstance(obj, Super): - obj = obj.__obj__ - self.__type__ = type - self.__obj__ = obj - def __get__(self, obj, cls=None): - if obj is None: - raise Exception('only supports instances') - else: - return Super(self.__type__, obj) - def __getattr__(self, attr): - mro = iter(self.__obj__.__class__.__mro__) - for cls in mro: - if cls is self.__type__: - break - for cls in mro: - if attr in cls.__dict__: - x = cls.__dict__[attr] - if hasattr(x, '__get__'): - x = x.__get__(self, cls) - return x - raise AttributeError, attr - - class autosuper(type): - def __init__(cls, name, bases, clsdict): - cls.__super__ = Super(cls) - - if __name__ == '__main__': - class A(object): - __metaclass__ = autosuper - def f(self): - return 'A' - - class B(A): - def f(self): - return 'B' + Super.f() - - class C(A): - def f(self): - return 'C' + Super.f() - - class D(B, C): - def f(self, arg=None): - var = None - return 'D' + Super.f() - - assert D().f() == 'DBCA' - - -History -======= -29-Apr-2007 - Changed title from "Super As A Keyword" to "New Super" - - Updated much of the language and added a terminology section - for clarification in confusing places. - - Added reference implementation and history sections. - -References -========== - -.. [1] Fixing super anyone? - (http://mail.python.org/pipermail/python-3000/2007-April/006667.html) - - -Copyright -========= - -This document has been placed in the public domain. - - - -.. - Local Variables: - mode: indented-text - indent-tabs-mode: nil - sentence-end-double-space: t - fill-column: 70 - coding: utf-8 - End: From python-checkins at python.org Wed May 2 03:20:00 2007 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 2 May 2007 03:20:00 +0200 (CEST) Subject: [Python-checkins] r55066 - peps/trunk/pep-3141.txt Message-ID: <20070502012000.7A0BB1E4009@bag.python.org> Author: andrew.kuchling Date: Wed May 2 03:19:58 2007 New Revision: 55066 Modified: peps/trunk/pep-3141.txt Log: Fix typo, to test the PEP rebuild Modified: peps/trunk/pep-3141.txt ============================================================================== --- peps/trunk/pep-3141.txt (original) +++ peps/trunk/pep-3141.txt Wed May 2 03:19:58 2007 @@ -460,7 +460,7 @@ Acknowledgements ---------------- -Thanks to Neil Norwitz for helping me through the PEP process. +Thanks to Neal Norwitz for helping me through the PEP process. The Haskell Numeric Prelude [4]_ nicely condensed a lot of experience with the Haskell numeric hierarchy into a form that was From python-checkins at python.org Wed May 2 03:25:32 2007 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 2 May 2007 03:25:32 +0200 (CEST) Subject: [Python-checkins] r55067 - peps/trunk/pep-0283.txt Message-ID: <20070502012532.DAABB1E4009@bag.python.org> Author: andrew.kuchling Date: Wed May 2 03:25:31 2007 New Revision: 55067 Modified: peps/trunk/pep-0283.txt Log: Another typo fix Modified: peps/trunk/pep-0283.txt ============================================================================== --- peps/trunk/pep-0283.txt (original) +++ peps/trunk/pep-0283.txt Wed May 2 03:25:31 2007 @@ -235,7 +235,7 @@ instable, I'm inclined not to do this.) - Decide on a clearer deprecation policy (especially for modules) - and act on it. For a start, see this message from Neil Norwitz: + and act on it. For a start, see this message from Neal Norwitz: http://mail.python.org/pipermail/python-dev/2002-April/023165.html There seems insufficient interest in moving this further in an organized fashion, and it's not particularly important. From python-checkins at python.org Wed May 2 04:44:19 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 2 May 2007 04:44:19 +0200 (CEST) Subject: [Python-checkins] r55068 - peps/trunk/pep-3124.txt Message-ID: <20070502024419.61D0E1E4009@bag.python.org> Author: guido.van.rossum Date: Wed May 2 04:44:15 2007 New Revision: 55068 Modified: peps/trunk/pep-3124.txt (props changed) Log: PEPs aren't executable files. From python-checkins at python.org Wed May 2 05:07:03 2007 From: python-checkins at python.org (phillip.eby) Date: Wed, 2 May 2007 05:07:03 +0200 (CEST) Subject: [Python-checkins] r55069 - peps/trunk/pep-0365.txt Message-ID: <20070502030703.59C2E1E4019@bag.python.org> Author: phillip.eby Date: Wed May 2 05:06:55 2007 New Revision: 55069 Modified: peps/trunk/pep-0365.txt Log: Fix wrong environment variable name Modified: peps/trunk/pep-0365.txt ============================================================================== --- peps/trunk/pep-0365.txt (original) +++ peps/trunk/pep-0365.txt Wed May 2 05:06:55 2007 @@ -48,10 +48,10 @@ This feature would *not* be a replacement for ``easy_install``; instead, it would rely on ``SomePackage`` having pure-Python ``.egg`` files listed for download via the PyPI XML-RPC API, and the eggs would -be placed in the ``$PYTHONEGGS`` cache, where they would **not** be -importable by default. (And no scripts would be installed) However, -if the download egg contains installation bootstrap code, it will be -given a chance to run. +be placed in the ``$PYTHON_EGG_CACHE`` directory, where they would +**not** be importable by default. (And no scripts would be installed.) +However, if the download egg contains installation bootstrap code, it +will be given a chance to run. These restrictions would allow the code to be extremely simple, yet still powerful enough to support users downloading package management From python-checkins at python.org Wed May 2 06:48:01 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 2 May 2007 06:48:01 +0200 (CEST) Subject: [Python-checkins] r55070 - in python/trunk: Include/pymem.h Modules/posixmodule.c Message-ID: <20070502044801.52BFF1E4009@bag.python.org> Author: neal.norwitz Date: Wed May 2 06:47:55 2007 New Revision: 55070 Modified: python/trunk/Include/pymem.h python/trunk/Modules/posixmodule.c Log: Stop using PyMem_FREE while the GIL is not held. For details see: http://mail.python.org/pipermail/python-dev/2007-May/072896.html Modified: python/trunk/Include/pymem.h ============================================================================== --- python/trunk/Include/pymem.h (original) +++ python/trunk/Include/pymem.h Wed May 2 06:47:55 2007 @@ -30,6 +30,8 @@ debugging info to dynamic memory blocks. The system routines have no idea what to do with that stuff, and the Python wrappers have no idea what to do with raw blocks obtained directly by the system routines then. + + The GIL must be held when using these APIs. */ /* Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Wed May 2 06:47:55 2007 @@ -6296,8 +6296,8 @@ #else fp = fdopen(fd, mode); #endif - PyMem_FREE(mode); Py_END_ALLOW_THREADS + PyMem_FREE(mode); if (fp == NULL) return posix_error(); f = PyFile_FromFile(fp, "", orgmode, fclose); From python-checkins at python.org Wed May 2 09:14:16 2007 From: python-checkins at python.org (georg.brandl) Date: Wed, 2 May 2007 09:14:16 +0200 (CEST) Subject: [Python-checkins] r55071 - peps/trunk/pep-0318.txt Message-ID: <20070502071416.8CA881E4009@bag.python.org> Author: georg.brandl Date: Wed May 2 09:14:15 2007 New Revision: 55071 Modified: peps/trunk/pep-0318.txt Log: Update of PEP 318, by Jim Jewett. Modified: peps/trunk/pep-0318.txt ============================================================================== --- peps/trunk/pep-0318.txt (original) +++ peps/trunk/pep-0318.txt Wed May 2 09:14:15 2007 @@ -50,7 +50,7 @@ than pythonic to name the function three times for what is conceptually a single declaration. A solution to this problem is to move the transformation of the method closer to the method's own declaration. -While the new syntax is not yet final, the intent is to replace:: +The intent of the new syntax is to replace :: def foo(cls): pass @@ -72,6 +72,8 @@ to having an easier way to make simple modifications to classes. For Python 2.4, only function/method decorators are being added. +PEP 3129 [#PEP-3129] proposes to add class decorators as of Python 2.6. + Why Is This So Hard? -------------------- @@ -322,7 +324,8 @@ primary one is that it's the first real Python case where a line of code has an effect on a following line. The syntax available in 2.4a3 requires one decorator per line (in a2, multiple decorators could be -specified on the same line). +specified on the same line), and the final decision for 2.4 final stayed +one decorator per line. People also complained that the syntax quickly got unwieldy when multiple decorators were used. The point was made, though, that the @@ -820,8 +823,8 @@ syntactic support. -Open Issues -=========== +(No longer) Open Issues +======================= 1. It's not yet certain that class decorators will be incorporated into the language at a future point. Guido expressed skepticism about @@ -833,9 +836,21 @@ .. _strong arguments: http://mail.python.org/pipermail/python-dev/2004-March/thread.html + PEP 3129 [#PEP-3129] proposes to add class decorators as of Python 2.6. + 2. The choice of the ``@`` character will be re-examined before Python 2.4b1. + In the end, the ``@`` character was kept. + + +References +========== + +.. [#PEP-3129] PEP 3129, "Class Decorators", Winter + http://www.python.org/dev/peps/pep-3129 + + Copyright ========= From python-checkins at python.org Wed May 2 17:55:30 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 2 May 2007 17:55:30 +0200 (CEST) Subject: [Python-checkins] r55072 - in python/branches/release25-maint: Modules/datetimemodule.c Modules/getbuildinfo.c PC/make_versioninfo.c PCbuild8/PGInstrument.vsprops PCbuild8/PGUpdate.vsprops PCbuild8/Uninstal.wse PCbuild8/_bsddb PCbuild8/_bsddb.vcproj PCbuild8/_ctypes PCbuild8/_ctypes.vcproj PCbuild8/_ctypes_test PCbuild8/_ctypes_test.vcproj PCbuild8/_elementtree PCbuild8/_elementtree.vcproj PCbuild8/_msi PCbuild8/_msi.vcproj PCbuild8/_socket PCbuild8/_socket.vcproj PCbuild8/_sqlite3 PCbuild8/_sqlite3.vcproj PCbuild8/_ssl.mak PCbuild8/_ssl.vcproj PCbuild8/_testcapi PCbuild8/_testcapi.vcproj PCbuild8/_tkinter PCbuild8/_tkinter.vcproj PCbuild8/build.bat PCbuild8/build_pgo.bat PCbuild8/build_ssl.py PCbuild8/bz2 PCbuild8/bz2.vcproj PCbuild8/db.build PCbuild8/field3.py PCbuild8/make_buildinfo PCbuild8/make_buildinfo.c PCbuild8/make_buildinfo.vcproj PCbuild8/make_versioninfo PCbuild8/make_versioninfo.vcproj PCbuild8/pcbuild.sln PCbuild8/pyd.vsprops PCbuild8/pyd_d.vsprops PCbuild8/pyexpat PCbuild8/pyexpat.vcproj PCbuild8/pyproject.vsprops PCbuild8/python PCbuild8/python.build PCbuild8/python.iss PCbuild8/python.vcproj PCbuild8/python20.wse PCbuild8/pythoncore PCbuild8/pythoncore.vcproj PCbuild8/pythoncore/pythoncore.vcproj PCbuild8/pythonw PCbuild8/pythonw.vcproj PCbuild8/readme.txt PCbuild8/rmpyc.py PCbuild8/rt.bat PCbuild8/select PCbuild8/select.vcproj PCbuild8/unicodedata PCbuild8/unicodedata.vcproj PCbuild8/w9xpopen PCbuild8/w9xpopen.vcproj PCbuild8/w9xpopen/w9xpopen.vcproj PCbuild8/winsound PCbuild8/winsound.vcproj Message-ID: <20070502155530.CF7D61E4023@bag.python.org> Author: kristjan.jonsson Date: Wed May 2 17:55:14 2007 New Revision: 55072 Added: python/branches/release25-maint/PCbuild8/PGInstrument.vsprops - copied unchanged from r55024, python/trunk/PCbuild8/PGInstrument.vsprops python/branches/release25-maint/PCbuild8/PGUpdate.vsprops - copied unchanged from r55024, python/trunk/PCbuild8/PGUpdate.vsprops python/branches/release25-maint/PCbuild8/_bsddb/ - copied from r55024, python/trunk/PCbuild8/_bsddb/ python/branches/release25-maint/PCbuild8/_ctypes/ - copied from r55024, python/trunk/PCbuild8/_ctypes/ python/branches/release25-maint/PCbuild8/_ctypes_test/ - copied from r55024, python/trunk/PCbuild8/_ctypes_test/ python/branches/release25-maint/PCbuild8/_elementtree/ - copied from r55024, python/trunk/PCbuild8/_elementtree/ python/branches/release25-maint/PCbuild8/_msi/ - copied from r55024, python/trunk/PCbuild8/_msi/ python/branches/release25-maint/PCbuild8/_socket/ - copied from r55024, python/trunk/PCbuild8/_socket/ python/branches/release25-maint/PCbuild8/_sqlite3/ - copied from r55024, python/trunk/PCbuild8/_sqlite3/ python/branches/release25-maint/PCbuild8/_testcapi/ - copied from r55024, python/trunk/PCbuild8/_testcapi/ python/branches/release25-maint/PCbuild8/_tkinter/ - copied from r55024, python/trunk/PCbuild8/_tkinter/ python/branches/release25-maint/PCbuild8/build.bat - copied unchanged from r55024, python/trunk/PCbuild8/build.bat python/branches/release25-maint/PCbuild8/build_pgo.bat - copied unchanged from r55024, python/trunk/PCbuild8/build_pgo.bat python/branches/release25-maint/PCbuild8/bz2/ - copied from r55024, python/trunk/PCbuild8/bz2/ python/branches/release25-maint/PCbuild8/make_buildinfo/ - copied from r55024, python/trunk/PCbuild8/make_buildinfo/ python/branches/release25-maint/PCbuild8/make_versioninfo/ - copied from r55024, python/trunk/PCbuild8/make_versioninfo/ python/branches/release25-maint/PCbuild8/pyd.vsprops - copied unchanged from r55024, python/trunk/PCbuild8/pyd.vsprops python/branches/release25-maint/PCbuild8/pyd_d.vsprops - copied unchanged from r55024, python/trunk/PCbuild8/pyd_d.vsprops python/branches/release25-maint/PCbuild8/pyexpat/ - copied from r55024, python/trunk/PCbuild8/pyexpat/ python/branches/release25-maint/PCbuild8/pyproject.vsprops - copied unchanged from r55024, python/trunk/PCbuild8/pyproject.vsprops python/branches/release25-maint/PCbuild8/python/ - copied from r55024, python/trunk/PCbuild8/python/ python/branches/release25-maint/PCbuild8/pythoncore/ - copied from r55024, python/trunk/PCbuild8/pythoncore/ python/branches/release25-maint/PCbuild8/pythonw/ - copied from r55024, python/trunk/PCbuild8/pythonw/ python/branches/release25-maint/PCbuild8/select/ - copied from r55024, python/trunk/PCbuild8/select/ python/branches/release25-maint/PCbuild8/unicodedata/ - copied from r55024, python/trunk/PCbuild8/unicodedata/ python/branches/release25-maint/PCbuild8/w9xpopen/ python/branches/release25-maint/PCbuild8/w9xpopen/w9xpopen.vcproj python/branches/release25-maint/PCbuild8/winsound/ - copied from r55024, python/trunk/PCbuild8/winsound/ Removed: python/branches/release25-maint/PCbuild8/Uninstal.wse python/branches/release25-maint/PCbuild8/_bsddb.vcproj python/branches/release25-maint/PCbuild8/_ctypes.vcproj python/branches/release25-maint/PCbuild8/_ctypes_test.vcproj python/branches/release25-maint/PCbuild8/_elementtree.vcproj python/branches/release25-maint/PCbuild8/_msi.vcproj python/branches/release25-maint/PCbuild8/_socket.vcproj python/branches/release25-maint/PCbuild8/_sqlite3.vcproj python/branches/release25-maint/PCbuild8/_ssl.mak python/branches/release25-maint/PCbuild8/_ssl.vcproj python/branches/release25-maint/PCbuild8/_testcapi.vcproj python/branches/release25-maint/PCbuild8/_tkinter.vcproj python/branches/release25-maint/PCbuild8/build_ssl.py python/branches/release25-maint/PCbuild8/bz2.vcproj python/branches/release25-maint/PCbuild8/db.build python/branches/release25-maint/PCbuild8/field3.py python/branches/release25-maint/PCbuild8/make_buildinfo.c python/branches/release25-maint/PCbuild8/make_buildinfo.vcproj python/branches/release25-maint/PCbuild8/make_versioninfo.vcproj python/branches/release25-maint/PCbuild8/pyexpat.vcproj python/branches/release25-maint/PCbuild8/python.build python/branches/release25-maint/PCbuild8/python.iss python/branches/release25-maint/PCbuild8/python.vcproj python/branches/release25-maint/PCbuild8/python20.wse python/branches/release25-maint/PCbuild8/pythoncore.vcproj python/branches/release25-maint/PCbuild8/pythonw.vcproj python/branches/release25-maint/PCbuild8/select.vcproj python/branches/release25-maint/PCbuild8/unicodedata.vcproj python/branches/release25-maint/PCbuild8/w9xpopen.vcproj python/branches/release25-maint/PCbuild8/winsound.vcproj Modified: python/branches/release25-maint/Modules/datetimemodule.c python/branches/release25-maint/Modules/getbuildinfo.c python/branches/release25-maint/PC/make_versioninfo.c python/branches/release25-maint/PCbuild8/pcbuild.sln python/branches/release25-maint/PCbuild8/pythoncore/pythoncore.vcproj python/branches/release25-maint/PCbuild8/readme.txt python/branches/release25-maint/PCbuild8/rmpyc.py python/branches/release25-maint/PCbuild8/rt.bat Log: Merging of change 55024 from the truk to release25-maint branch. Complete revamp of PCBuild8 directory. Use subdirectories for each project under the main pcbuild solution. Now make extensive use of property sheets to simplify project configuration. x64 build fully supported, and the process for building PGO version (Profiler Guided Optimization) simplified. All projects are now present, except _ssl, which needs to be reimplemented. Also, some of the projects that require external libraries need extra work to fully compile on x64. Modified: python/branches/release25-maint/Modules/datetimemodule.c ============================================================================== --- python/branches/release25-maint/Modules/datetimemodule.c (original) +++ python/branches/release25-maint/Modules/datetimemodule.c Wed May 2 17:55:14 2007 @@ -13,7 +13,9 @@ /* Differentiate between building the core module and building extension * modules. */ +#ifndef Py_BUILD_CORE #define Py_BUILD_CORE +#endif #include "datetime.h" #undef Py_BUILD_CORE Modified: python/branches/release25-maint/Modules/getbuildinfo.c ============================================================================== --- python/branches/release25-maint/Modules/getbuildinfo.c (original) +++ python/branches/release25-maint/Modules/getbuildinfo.c Wed May 2 17:55:14 2007 @@ -20,10 +20,7 @@ #endif #endif -#ifdef SUBWCREV #define SVNVERSION "$WCRANGE$$WCMODS?M:$" -#endif - const char * Py_GetBuildInfo(void) { @@ -40,9 +37,9 @@ const char * _Py_svnversion(void) { -#ifdef SVNVERSION - return SVNVERSION; -#else + /* the following string can be modified by subwcrev.exe */ + static const char svnversion[] = SVNVERSION; + if (!strstr(svnversion, "$")) + return svnversion; /* it was interpolated */ return "exported"; -#endif } Modified: python/branches/release25-maint/PC/make_versioninfo.c ============================================================================== --- python/branches/release25-maint/PC/make_versioninfo.c (original) +++ python/branches/release25-maint/PC/make_versioninfo.c Wed May 2 17:55:14 2007 @@ -27,7 +27,12 @@ PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL); printf("#define MS_DLL_ID \"%d.%d\"\n", PY_MAJOR_VERSION, PY_MINOR_VERSION); + printf("#ifndef _DEBUG\n"); printf("#define PYTHON_DLL_NAME \"python%d%d.dll\"\n", PY_MAJOR_VERSION, PY_MINOR_VERSION); + printf("#else\n"); + printf("#define PYTHON_DLL_NAME \"python%d%d_d.dll\"\n", + PY_MAJOR_VERSION, PY_MINOR_VERSION); + printf("#endif\n"); return 0; } Deleted: /python/branches/release25-maint/PCbuild8/Uninstal.wse ============================================================================== --- /python/branches/release25-maint/PCbuild8/Uninstal.wse Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,514 +0,0 @@ -Document Type: WSE -item: Global - Version=8.14 - Flags=00000100 - Split=1420 - Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - Copy Default=1 - Japanese Font Name=MS Gothic - Japanese Font Size=10 - Start Gradient=0 0 255 - End Gradient=0 0 0 - Windows Flags=00000000000000000000101000001000 - Message Font=MS Sans Serif - Font Size=8 - Disk Label=GLBS - Disk Filename=INSTALL - Patch Flags=0000000000000001 - Patch Threshold=200 - Patch Memory=4096 - Per-User Version ID=1 - Crystal Format=10111100101100000010001001001001 - Step View=&Properties -end -item: Remark - Text=Note from Tim: This is a verbatim copy of Wise's Uninstal.wse, altered at the end to write -end -item: Remark - Text=uninstall info under HKCU instead of HKLM if our DOADMIN var is false. -end -item: Remark -end -item: Remark - Text= Install Support for uninstalling the application. -end -item: Remark -end -item: Set Variable - Variable=UNINSTALL_PATH - Value=%_LOGFILE_PATH_% - Flags=00000010 -end -item: Set Variable - Variable=UNINSTALL_PATH - Value=%UNINSTALL_PATH%\UNWISE.EXE -end -item: Compiler Variable If - Variable=_EXE_OS_TYPE_ - Value=WIN32 -end -item: Install File - Source=%_WISE_%\UNWISE32.EXE - Destination=%UNINSTALL_PATH% - Flags=0000000000000010 -end -item: Compiler Variable Else -end -item: Install File - Source=%_WISE_%\UNWISE.EXE - Destination=%UNINSTALL_PATH% - Flags=0000000000000010 -end -item: Compiler Variable End -end -item: Remark -end -item: Remark - Text= Install Support for multiple languages -end -item: Remark -end -item: Set Variable - Variable=UNINSTALL_LANG - Value=%UNINSTALL_PATH% - Flags=00000010 -end -item: Set Variable - Variable=UNINSTALL_LANG - Value=%UNINSTALL_LANG%\UNWISE.INI -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=C - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.FRA - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_C_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.FRA - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=D - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.FRA - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_D_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.FRA - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=E - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.DEU - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_E_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.DEU - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=F - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.PTG - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_F_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.PTG - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=G - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.ESP - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_G_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.ESP - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=H - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.ESP - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_H_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.ESP - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=I - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.ITA - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_I_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.ITA - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=J - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.DAN - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_J_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.DAN - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=K - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.FIN - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_K_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.FIN - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=L - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.ISL - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_L_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.ISL - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=M - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.NLD - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_M_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.NLD - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=N - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.NOR - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_N_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.NOR - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=O - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.SVE - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_O_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.SVE - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Compiler Variable If - Variable=_LANG_LIST_ - Value=P - Flags=00000010 -end -item: Compiler Variable If - Value=%_WISE_%\LANGUAGE\UNWISE.JPN - Flags=00000011 -end -item: If/While Statement - Variable=LANG - Value=%_LANG_P_NAME_% -end -item: Install File - Source=%_WISE_%\LANGUAGE\UNWISE.JPN - Destination=%UNINSTALL_LANG% - Flags=0000000000000010 -end -item: End Block -end -item: Compiler Variable End -end -item: Compiler Variable End -end -item: Remark -end -item: Remark - Text= Install the add/remove or uninstall icon -end -item: Remark -end -item: Set Variable - Variable=UNINSTALL_PATH - Value=%UNINSTALL_PATH% - Flags=00010100 -end -item: Set Variable - Variable=INST_LOG_PATH - Value=%_LOGFILE_PATH_% - Flags=00010100 -end -item: Check Configuration - Flags=10111011 -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Remark - Text=Write uninstall info under HKLM. This if/else/end block added by Tim. -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%APPTITLE% - Value Name=DisplayName - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%UNINSTALL_PATH% %INST_LOG_PATH% - New Value= - Value Name=UninstallString - Root=2 -end -item: Else Statement -end -item: Remark - Text=The same, but write under HKCU instead. -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%APPTITLE% - Value Name=DisplayName - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%UNINSTALL_PATH% %INST_LOG_PATH% - New Value= - Value Name=UninstallString - Root=1 -end -item: End Block -end -item: Else Statement -end -item: Add ProgMan Icon - Group=%GROUP% - Icon Name=Uninstall %APPTITLE% - Command Line=%UNINSTALL_PATH% %INST_LOG_PATH% -end -item: End Block -end -item: Check Configuration - Flags=11110010 -end -item: If/While Statement - Variable=DOBRAND - Value=1 -end -item: Edit Registry - Total Keys=2 - item: Key - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%COMPANY% - Value Name=RegCompany - Root=2 - end - item: Key - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%NAME% - Value Name=RegOwner - Root=2 - end -end -item: End Block -end -item: End Block -end Deleted: /python/branches/release25-maint/PCbuild8/_bsddb.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_bsddb.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,385 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/_ctypes.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_ctypes.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,412 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/_ctypes_test.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_ctypes_test.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,370 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/_elementtree.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_elementtree.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,390 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/_msi.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_msi.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,375 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/_socket.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_socket.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,381 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/_sqlite3.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_sqlite3.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,411 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/_ssl.mak ============================================================================== --- /python/branches/release25-maint/PCbuild8/_ssl.mak Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,21 +0,0 @@ - -!IFDEF DEBUG -MODULE=_ssl_d.pyd -TEMP_DIR=x86-temp-debug/_ssl -CFLAGS=/Od /Zi /MDd /LDd /DDEBUG /D_DEBUG /DWIN32 -SSL_LIB_DIR=$(SSL_DIR)/out32.dbg -!ELSE -MODULE=_ssl.pyd -TEMP_DIR=x86-temp-release/_ssl -CFLAGS=/Ox /MD /LD /DWIN32 -SSL_LIB_DIR=$(SSL_DIR)/out32 -!ENDIF - -INCLUDES=-I ../Include -I ../PC -I $(SSL_DIR)/inc32 -LIBS=gdi32.lib wsock32.lib user32.lib advapi32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib - -SOURCE=../Modules/_ssl.c $(SSL_LIB_DIR)/libeay32.lib $(SSL_LIB_DIR)/ssleay32.lib - -$(MODULE): $(SOURCE) ../PC/*.h ../Include/*.h - @if not exist "$(TEMP_DIR)/." mkdir "$(TEMP_DIR)" - cl /nologo $(SOURCE) $(CFLAGS) /Fo$(TEMP_DIR)\$*.obj $(INCLUDES) /link /out:$(MODULE) $(LIBS) Deleted: /python/branches/release25-maint/PCbuild8/_ssl.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_ssl.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/_testcapi.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_testcapi.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/_tkinter.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/_tkinter.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,389 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/build_ssl.py ============================================================================== --- /python/branches/release25-maint/PCbuild8/build_ssl.py Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,163 +0,0 @@ -# Script for building the _ssl module for Windows. -# Uses Perl to setup the OpenSSL environment correctly -# and build OpenSSL, then invokes a simple nmake session -# for _ssl.pyd itself. - -# THEORETICALLY, you can: -# * Unpack the latest SSL release one level above your main Python source -# directory. It is likely you will already find the zlib library and -# any other external packages there. -# * Install ActivePerl and ensure it is somewhere on your path. -# * Run this script from the PCBuild directory. -# -# it should configure and build SSL, then build the ssl Python extension -# without intervention. - -import os, sys, re - -# Find all "foo.exe" files on the PATH. -def find_all_on_path(filename, extras = None): - entries = os.environ["PATH"].split(os.pathsep) - ret = [] - for p in entries: - fname = os.path.abspath(os.path.join(p, filename)) - if os.path.isfile(fname) and fname not in ret: - ret.append(fname) - if extras: - for p in extras: - fname = os.path.abspath(os.path.join(p, filename)) - if os.path.isfile(fname) and fname not in ret: - ret.append(fname) - return ret - -# Find a suitable Perl installation for OpenSSL. -# cygwin perl does *not* work. ActivePerl does. -# Being a Perl dummy, the simplest way I can check is if the "Win32" package -# is available. -def find_working_perl(perls): - for perl in perls: - fh = os.popen(perl + ' -e "use Win32;"') - fh.read() - rc = fh.close() - if rc: - continue - return perl - print "Can not find a suitable PERL:" - if perls: - print " the following perl interpreters were found:" - for p in perls: - print " ", p - print " None of these versions appear suitable for building OpenSSL" - else: - print " NO perl interpreters were found on this machine at all!" - print " Please install ActivePerl and ensure it appears on your path" - print "The Python SSL module was not built" - return None - -# Locate the best SSL directory given a few roots to look into. -def find_best_ssl_dir(sources): - candidates = [] - for s in sources: - try: - s = os.path.abspath(s) - fnames = os.listdir(s) - except os.error: - fnames = [] - for fname in fnames: - fqn = os.path.join(s, fname) - if os.path.isdir(fqn) and fname.startswith("openssl-"): - candidates.append(fqn) - # Now we have all the candidates, locate the best. - best_parts = [] - best_name = None - for c in candidates: - parts = re.split("[.-]", os.path.basename(c))[1:] - # eg - openssl-0.9.7-beta1 - ignore all "beta" or any other qualifiers - if len(parts) >= 4: - continue - if parts > best_parts: - best_parts = parts - best_name = c - if best_name is not None: - print "Found an SSL directory at '%s'" % (best_name,) - else: - print "Could not find an SSL directory in '%s'" % (sources,) - return best_name - -def main(): - debug = "-d" in sys.argv - build_all = "-a" in sys.argv - make_flags = "" - if build_all: - make_flags = "-a" - # perl should be on the path, but we also look in "\perl" and "c:\\perl" - # as "well known" locations - perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"]) - perl = find_working_perl(perls) - if perl is None: - sys.exit(1) - - print "Found a working perl at '%s'" % (perl,) - # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live. - ssl_dir = find_best_ssl_dir(("../..",)) - if ssl_dir is None: - sys.exit(1) - - old_cd = os.getcwd() - try: - os.chdir(ssl_dir) - # If the ssl makefiles do not exist, we invoke Perl to generate them. - if not os.path.isfile(os.path.join(ssl_dir, "32.mak")) or \ - not os.path.isfile(os.path.join(ssl_dir, "d32.mak")): - print "Creating the makefiles..." - # Put our working Perl at the front of our path - os.environ["PATH"] = os.path.split(perl)[0] + \ - os.pathsep + \ - os.environ["PATH"] - # ms\32all.bat will reconfigure OpenSSL and then try to build - # all outputs (debug/nondebug/dll/lib). So we filter the file - # to exclude any "nmake" commands and then execute. - tempname = "ms\\32all_py.bat" - - in_bat = open("ms\\32all.bat") - temp_bat = open(tempname,"w") - while 1: - cmd = in_bat.readline() - print 'cmd', repr(cmd) - if not cmd: break - if cmd.strip()[:5].lower() == "nmake": - continue - temp_bat.write(cmd) - in_bat.close() - temp_bat.close() - os.system(tempname) - try: - os.remove(tempname) - except: - pass - - # Now run make. - print "Executing nmake over the ssl makefiles..." - if debug: - rc = os.system("nmake /nologo -f d32.mak") - if rc: - print "Executing d32.mak failed" - print rc - sys.exit(rc) - else: - rc = os.system("nmake /nologo -f 32.mak") - if rc: - print "Executing 32.mak failed" - print rc - sys.exit(rc) - finally: - os.chdir(old_cd) - # And finally, we can build the _ssl module itself for Python. - defs = "SSL_DIR=%s" % (ssl_dir,) - if debug: - defs = defs + " " + "DEBUG=1" - rc = os.system('nmake /nologo -f _ssl.mak ' + defs + " " + make_flags) - sys.exit(rc) - -if __name__=='__main__': - main() Deleted: /python/branches/release25-maint/PCbuild8/bz2.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/bz2.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,390 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/db.build ============================================================================== --- /python/branches/release25-maint/PCbuild8/db.build Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,10 +0,0 @@ - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/field3.py ============================================================================== --- /python/branches/release25-maint/PCbuild8/field3.py Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,35 +0,0 @@ -# An absurd workaround for the lack of arithmetic in MS's resource compiler. -# After building Python, run this, then paste the output into the appropriate -# part of PC\python_nt.rc. -# Example output: -# -# * For 2.3a0, -# * PY_MICRO_VERSION = 0 -# * PY_RELEASE_LEVEL = 'alpha' = 0xA -# * PY_RELEASE_SERIAL = 1 -# * -# * and 0*1000 + 10*10 + 1 = 101. -# */ -# #define FIELD3 101 - -import sys - -major, minor, micro, level, serial = sys.version_info -levelnum = {'alpha': 0xA, - 'beta': 0xB, - 'candidate': 0xC, - 'final': 0xF, - }[level] -string = sys.version.split()[0] # like '2.3a0' - -print " * For %s," % string -print " * PY_MICRO_VERSION = %d" % micro -print " * PY_RELEASE_LEVEL = %r = %s" % (level, hex(levelnum)) -print " * PY_RELEASE_SERIAL = %d" % serial -print " *" - -field3 = micro * 1000 + levelnum * 10 + serial - -print " * and %d*1000 + %d*10 + %d = %d" % (micro, levelnum, serial, field3) -print " */" -print "#define FIELD3", field3 Deleted: /python/branches/release25-maint/PCbuild8/make_buildinfo.c ============================================================================== --- /python/branches/release25-maint/PCbuild8/make_buildinfo.c Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,81 +0,0 @@ -#include -#include -#include -#include - -/* This file creates the getbuildinfo2.c file, by - invoking subwcrev.exe (if found). - If this isn't a subversion checkout, or subwcrev isn't - found, it copies ..\\Modules\\getbuildinfo.c instead. - - A file, getbuildinfo2.h is then updated to define - SUBWCREV if it was a subversion checkout. - - getbuildinfo2.c is part of the pythoncore project with - getbuildinfo2.h as a forced include. This helps - VisualStudio refrain from unnecessary compiles much of the - time. - - Currently, subwcrev.exe is found from the registry entries - of TortoiseSVN. - - make_buildinfo.exe is called as a pre-build step for pythoncore. - -*/ - -int make_buildinfo2() -{ - struct _stat st; - HKEY hTortoise; - char command[500]; - DWORD type, size; - if (_stat(".svn", &st) < 0) - return 0; - /* Allow suppression of subwcrev.exe invocation if a no_subwcrev file is present. */ - if (_stat("no_subwcrev", &st) == 0) - return 0; - if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS && - RegOpenKey(HKEY_CURRENT_USER, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS) - /* Tortoise not installed */ - return 0; - command[0] = '"'; /* quote the path to the executable */ - size = sizeof(command) - 1; - if (RegQueryValueEx(hTortoise, "Directory", 0, &type, command+1, &size) != ERROR_SUCCESS || - type != REG_SZ) - /* Registry corrupted */ - return 0; - strcat_s(command, sizeof(command), "bin\\subwcrev.exe"); - if (_stat(command+1, &st) < 0) - /* subwcrev.exe not part of the release */ - return 0; - strcat_s(command, sizeof(command), "\" .. ..\\Modules\\getbuildinfo.c getbuildinfo2.c"); - puts(command); fflush(stdout); - if (system(command) < 0) - return 0; - return 1; -} - -int main(int argc, char*argv[]) -{ - char command[500] = ""; - int svn; - FILE *f; - - if (fopen_s(&f, "getbuildinfo2.h", "w")) - return EXIT_FAILURE; - /* Get getbuildinfo.c from svn as getbuildinfo2.c */ - svn = make_buildinfo2(); - if (svn) { - puts("got getbuildinfo2.c from svn. Updating getbuildinfo2.h"); - /* yes. make sure SUBWCREV is defined */ - fprintf(f, "#define SUBWCREV\n"); - } else { - puts("didn't get getbuildinfo2.c from svn. Copying from Modules and clearing getbuildinfo2.h"); - strcat_s(command, sizeof(command), "copy ..\\Modules\\getbuildinfo.c getbuildinfo2.c"); - puts(command); fflush(stdout); - if (system(command) < 0) - return EXIT_FAILURE; - } - fclose(f); - return 0; -} \ No newline at end of file Deleted: /python/branches/release25-maint/PCbuild8/make_buildinfo.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/make_buildinfo.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/make_versioninfo.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/make_versioninfo.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: python/branches/release25-maint/PCbuild8/pcbuild.sln ============================================================================== --- python/branches/release25-maint/PCbuild8/pcbuild.sln (original) +++ python/branches/release25-maint/PCbuild8/pcbuild.sln Wed May 2 17:55:14 2007 @@ -1,304 +1,424 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore\pythoncore.vcproj", "{987306EC-6BAD-4440-B4FB-A699A1EE6A28}" ProjectSection(ProjectDependencies) = postProject - {F0E0541E-F17D-430B-97C4-93ADF0DD284E} = {F0E0541E-F17D-430B-97C4-93ADF0DD284E} - {C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD} + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} = {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} + {87AB87DB-B665-4621-A67B-878C15B93FF0} = {87AB87DB-B665-4621-A67B-878C15B93FF0} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo\make_versioninfo.vcproj", "{2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo\make_buildinfo.vcproj", "{87AB87DB-B665-4621-A67B-878C15B93FF0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes\_ctypes.vcproj", "{8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcproj", "{97239A56-DBC0-41D2-BC14-C87D9B97D63B}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test\_ctypes_test.vcproj", "{F548A318-960A-4B37-9CD6-86B1B0E33CC8}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unicodedata", "unicodedata.vcproj", "{FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree\_elementtree.vcproj", "{CB025148-F0A1-4B32-A669-19EE0534136D}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen.vcproj", "{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_msi", "_msi\_msi.vcproj", "{A25ADCC5-8DE1-4F88-B842-C287923280B1}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcproj", "{51F35FAE-FB92-4B2C-9187-1542C065AD77}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3\_sqlite3.vcproj", "{D50E5319-41CC-429A-8E81-B1CD391C3A7B}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree.vcproj", "{1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python\python.vcproj", "{AE617428-B823-4B87-BC6D-DC7C12C746D3}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo.vcproj", "{C73F0EC1-358B-4177-940F-0846AC8B04CD}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw\pythonw.vcproj", "{98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_msi", "_msi.vcproj", "{2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select\select.vcproj", "{0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes.vcproj", "{F22F40F4-D318-40DC-96B3-88DC81CE0894}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unicodedata", "unicodedata\unicodedata.vcproj", "{D04B2089-7DA9-4D92-B23F-07453BC46652}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test.vcproj", "{8CF334D9-4F82-42EB-97AF-83592C5AFD2F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound\winsound.vcproj", "{1015E3B4-FD3B-4402-AA6E-7806514156D6}" ProjectSection(ProjectDependencies) = postProject - {F22F40F4-D318-40DC-96B3-88DC81CE0894} = {F22F40F4-D318-40DC-96B3-88DC81CE0894} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3.vcproj", "{2FF0A312-22F9-4C34-B070-842916DE27A9}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket\_socket.vcproj", "{AE31A248-5367-4EB2-A511-8722BC351CB4}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8B172265-1F31-4880-A29C-11A4B7A80172}" - ProjectSection(SolutionItems) = preProject - ..\Modules\getbuildinfo.c = ..\Modules\getbuildinfo.c - readme.txt = readme.txt +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb\_bsddb.vcproj", "{E644B843-F7CA-4888-AA6D-653C77592856}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi\_testcapi.vcproj", "{1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter\_tkinter.vcproj", "{3A1515AF-3694-4222-91F2-9837BDF60F9A}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bz2", "bz2\bz2.vcproj", "{18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat\pyexpat.vcproj", "{80EBF51A-6018-4589-9A53-5AAF2872E230}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{310B6D98-CFE1-4215-97C1-E52989488A50}" + ProjectSection(SolutionItems) = preProject + readme.txt = readme.txt EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{F0E0541E-F17D-430B-97C4-93ADF0DD284E}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen\w9xpopen.vcproj", "{128AA855-8778-4F08-B001-FF79DC95F480}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 - PGIRelease|Win32 = PGIRelease|Win32 - PGIRelease|x64 = PGIRelease|x64 - PGORelease|Win32 = PGORelease|Win32 - PGORelease|x64 = PGORelease|x64 + PGInstrument|Win32 = PGInstrument|Win32 + PGInstrument|x64 = PGInstrument|x64 + PGUpdate|Win32 = PGUpdate|Win32 + PGUpdate|x64 = PGUpdate|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.ActiveCfg = Debug|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.Build.0 = Debug|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.ActiveCfg = Debug|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.Build.0 = Debug|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|Win32.ActiveCfg = PGIRelease|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|Win32.Build.0 = PGIRelease|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|x64.ActiveCfg = PGIRelease|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|x64.Build.0 = PGIRelease|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|Win32.ActiveCfg = PGORelease|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|Win32.Build.0 = PGORelease|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|x64.ActiveCfg = PGORelease|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|x64.Build.0 = PGORelease|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.ActiveCfg = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.Build.0 = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.ActiveCfg = Release|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.Build.0 = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.ActiveCfg = Debug|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.Build.0 = Debug|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.ActiveCfg = Debug|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.Build.0 = Debug|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|Win32.Build.0 = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|x64.ActiveCfg = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|x64.Build.0 = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|Win32.ActiveCfg = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|Win32.Build.0 = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|x64.ActiveCfg = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|x64.Build.0 = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.ActiveCfg = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.Build.0 = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.ActiveCfg = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.Build.0 = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|Win32.ActiveCfg = Debug|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|Win32.Build.0 = Debug|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|x64.ActiveCfg = Debug|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|x64.Build.0 = Debug|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|Win32.Build.0 = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|x64.ActiveCfg = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|x64.Build.0 = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|Win32.ActiveCfg = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|Win32.Build.0 = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|x64.ActiveCfg = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|x64.Build.0 = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|Win32.ActiveCfg = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|Win32.Build.0 = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|x64.ActiveCfg = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|x64.Build.0 = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|Win32.ActiveCfg = Debug|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|Win32.Build.0 = Debug|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|x64.ActiveCfg = Debug|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|x64.Build.0 = Debug|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|Win32.Build.0 = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|x64.ActiveCfg = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|x64.Build.0 = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|Win32.ActiveCfg = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|Win32.Build.0 = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|x64.ActiveCfg = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|x64.Build.0 = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|Win32.ActiveCfg = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|Win32.Build.0 = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|x64.ActiveCfg = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|x64.Build.0 = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.ActiveCfg = Debug|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.Build.0 = Debug|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.ActiveCfg = Debug|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.Build.0 = Debug|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|Win32.Build.0 = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|x64.ActiveCfg = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|x64.Build.0 = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|Win32.ActiveCfg = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|Win32.Build.0 = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|x64.ActiveCfg = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|x64.Build.0 = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.ActiveCfg = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.Build.0 = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.ActiveCfg = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.Build.0 = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|Win32.ActiveCfg = Debug|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|Win32.Build.0 = Debug|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|x64.ActiveCfg = Debug|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|x64.Build.0 = Debug|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|Win32.Build.0 = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|x64.ActiveCfg = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|x64.Build.0 = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|Win32.ActiveCfg = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|Win32.Build.0 = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|x64.ActiveCfg = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|x64.Build.0 = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|Win32.ActiveCfg = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|Win32.Build.0 = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|x64.ActiveCfg = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|x64.Build.0 = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|Win32.ActiveCfg = Debug|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|Win32.Build.0 = Debug|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|x64.ActiveCfg = Debug|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|x64.Build.0 = Debug|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|Win32.Build.0 = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|x64.ActiveCfg = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|x64.Build.0 = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|Win32.ActiveCfg = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|Win32.Build.0 = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|x64.ActiveCfg = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|x64.Build.0 = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|Win32.ActiveCfg = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|Win32.Build.0 = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|x64.ActiveCfg = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|x64.Build.0 = Release|x64 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGIRelease|Win32.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGIRelease|Win32.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGIRelease|x64.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGORelease|Win32.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGORelease|Win32.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGORelease|x64.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.Build.0 = Debug|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|Win32.ActiveCfg = Debug|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|Win32.Build.0 = Debug|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|x64.ActiveCfg = Debug|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|x64.Build.0 = Debug|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|Win32.Build.0 = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|x64.ActiveCfg = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|x64.Build.0 = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|Win32.ActiveCfg = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|Win32.Build.0 = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|x64.ActiveCfg = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|x64.Build.0 = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|Win32.ActiveCfg = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|Win32.Build.0 = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|x64.ActiveCfg = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|x64.Build.0 = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|Win32.ActiveCfg = Debug|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|Win32.Build.0 = Debug|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|x64.ActiveCfg = Debug|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|x64.Build.0 = Debug|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|Win32.Build.0 = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|x64.ActiveCfg = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|x64.Build.0 = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|Win32.ActiveCfg = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|Win32.Build.0 = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|x64.ActiveCfg = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|x64.Build.0 = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Release|Win32.ActiveCfg = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Release|Win32.Build.0 = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Release|x64.ActiveCfg = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|Win32.ActiveCfg = Debug|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|Win32.Build.0 = Debug|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|x64.ActiveCfg = Debug|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|x64.Build.0 = Debug|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|Win32.Build.0 = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|x64.ActiveCfg = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|x64.Build.0 = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|Win32.ActiveCfg = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|Win32.Build.0 = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|x64.ActiveCfg = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|x64.Build.0 = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|Win32.ActiveCfg = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|Win32.Build.0 = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|x64.ActiveCfg = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|x64.Build.0 = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|Win32.ActiveCfg = Debug|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|Win32.Build.0 = Debug|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|x64.ActiveCfg = Debug|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|x64.Build.0 = Debug|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|Win32.Build.0 = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|x64.ActiveCfg = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|x64.Build.0 = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|Win32.ActiveCfg = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|Win32.Build.0 = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|x64.ActiveCfg = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|x64.Build.0 = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|Win32.ActiveCfg = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|Win32.Build.0 = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|x64.ActiveCfg = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|x64.Build.0 = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.ActiveCfg = Debug|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.Build.0 = Debug|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.ActiveCfg = Debug|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.Build.0 = Debug|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|Win32.Build.0 = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|x64.ActiveCfg = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|x64.Build.0 = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|Win32.ActiveCfg = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|Win32.Build.0 = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|x64.ActiveCfg = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|x64.Build.0 = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.ActiveCfg = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.Build.0 = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.ActiveCfg = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.Build.0 = Release|x64 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGIRelease|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGIRelease|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGORelease|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGORelease|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGORelease|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.Build.0 = Release|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Debug|Win32.ActiveCfg = Debug|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Debug|Win32.Build.0 = Debug|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Debug|x64.ActiveCfg = Debug|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Debug|x64.Build.0 = Debug|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Release|Win32.ActiveCfg = Release|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Release|Win32.Build.0 = Release|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Release|x64.ActiveCfg = Release|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Release|x64.Build.0 = Release|x64 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Debug|Win32.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Debug|Win32.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Debug|x64.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Debug|x64.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGInstrument|Win32.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGInstrument|Win32.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGInstrument|x64.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGUpdate|Win32.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGUpdate|Win32.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGUpdate|x64.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Release|Win32.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Release|Win32.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Release|x64.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Debug|Win32.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Debug|Win32.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Debug|x64.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Debug|x64.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGInstrument|Win32.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGInstrument|Win32.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGInstrument|x64.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGUpdate|Win32.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGUpdate|Win32.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGUpdate|x64.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Release|Win32.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Release|Win32.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Release|x64.ActiveCfg = Debug|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Debug|Win32.ActiveCfg = Debug|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Debug|Win32.Build.0 = Debug|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Debug|x64.ActiveCfg = Debug|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Debug|x64.Build.0 = Debug|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Release|Win32.ActiveCfg = Release|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Release|Win32.Build.0 = Release|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Release|x64.ActiveCfg = Release|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Release|x64.Build.0 = Release|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Debug|Win32.ActiveCfg = Debug|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Debug|Win32.Build.0 = Debug|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Debug|x64.ActiveCfg = Debug|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Debug|x64.Build.0 = Debug|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Release|Win32.ActiveCfg = Release|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Release|Win32.Build.0 = Release|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Release|x64.ActiveCfg = Release|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Release|x64.Build.0 = Release|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Debug|Win32.ActiveCfg = Debug|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Debug|Win32.Build.0 = Debug|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Debug|x64.ActiveCfg = Debug|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Debug|x64.Build.0 = Debug|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Release|Win32.ActiveCfg = Release|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Release|Win32.Build.0 = Release|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Release|x64.ActiveCfg = Release|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Release|x64.Build.0 = Release|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Debug|Win32.Build.0 = Debug|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Debug|x64.ActiveCfg = Debug|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Debug|x64.Build.0 = Debug|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Release|Win32.ActiveCfg = Release|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Release|Win32.Build.0 = Release|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Release|x64.ActiveCfg = Release|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Release|x64.Build.0 = Release|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Debug|Win32.ActiveCfg = Debug|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Debug|Win32.Build.0 = Debug|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Debug|x64.ActiveCfg = Debug|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Debug|x64.Build.0 = Debug|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Release|Win32.ActiveCfg = Release|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Release|Win32.Build.0 = Release|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Release|x64.ActiveCfg = Release|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Release|x64.Build.0 = Release|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Debug|Win32.ActiveCfg = Debug|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Debug|Win32.Build.0 = Debug|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Debug|x64.ActiveCfg = Debug|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Debug|x64.Build.0 = Debug|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Release|Win32.ActiveCfg = Release|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Release|Win32.Build.0 = Release|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Release|x64.ActiveCfg = Release|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Release|x64.Build.0 = Release|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Debug|Win32.ActiveCfg = Debug|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Debug|Win32.Build.0 = Debug|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Debug|x64.ActiveCfg = Debug|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Debug|x64.Build.0 = Debug|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Release|Win32.ActiveCfg = Release|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Release|Win32.Build.0 = Release|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Release|x64.ActiveCfg = Release|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Release|x64.Build.0 = Release|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Debug|Win32.ActiveCfg = Debug|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Debug|Win32.Build.0 = Debug|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Debug|x64.ActiveCfg = Debug|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Debug|x64.Build.0 = Debug|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Release|Win32.ActiveCfg = Release|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Release|Win32.Build.0 = Release|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Release|x64.ActiveCfg = Release|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Release|x64.Build.0 = Release|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Debug|Win32.ActiveCfg = Debug|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Debug|Win32.Build.0 = Debug|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Debug|x64.ActiveCfg = Debug|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Debug|x64.Build.0 = Debug|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Release|Win32.ActiveCfg = Release|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Release|Win32.Build.0 = Release|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Release|x64.ActiveCfg = Release|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Release|x64.Build.0 = Release|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Debug|Win32.ActiveCfg = Debug|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Debug|Win32.Build.0 = Debug|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Debug|x64.ActiveCfg = Debug|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Debug|x64.Build.0 = Debug|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Release|Win32.ActiveCfg = Release|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Release|Win32.Build.0 = Release|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Release|x64.ActiveCfg = Release|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Release|x64.Build.0 = Release|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Debug|Win32.ActiveCfg = Debug|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Debug|Win32.Build.0 = Debug|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Debug|x64.ActiveCfg = Debug|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Debug|x64.Build.0 = Debug|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Release|Win32.ActiveCfg = Release|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Release|Win32.Build.0 = Release|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Release|x64.ActiveCfg = Release|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Release|x64.Build.0 = Release|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.Debug|Win32.ActiveCfg = Debug|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.Debug|Win32.Build.0 = Debug|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.Debug|x64.ActiveCfg = Debug|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.Debug|x64.Build.0 = Debug|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.Release|Win32.ActiveCfg = PGInstrument|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.Release|Win32.Build.0 = PGInstrument|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.Release|x64.ActiveCfg = Release|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.Release|x64.Build.0 = Release|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Debug|Win32.ActiveCfg = Debug|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Debug|Win32.Build.0 = Debug|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Debug|x64.ActiveCfg = Debug|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Debug|x64.Build.0 = Debug|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Release|Win32.ActiveCfg = Release|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Release|Win32.Build.0 = Release|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Release|x64.ActiveCfg = Release|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Release|x64.Build.0 = Release|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Debug|Win32.ActiveCfg = Debug|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Debug|Win32.Build.0 = Debug|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Debug|x64.ActiveCfg = Debug|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Debug|x64.Build.0 = Debug|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Release|Win32.ActiveCfg = Release|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Release|Win32.Build.0 = Release|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Release|x64.ActiveCfg = Release|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Release|x64.Build.0 = Release|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Debug|Win32.ActiveCfg = Debug|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Debug|Win32.Build.0 = Debug|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Debug|x64.ActiveCfg = Debug|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Debug|x64.Build.0 = Debug|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Release|Win32.ActiveCfg = Release|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Release|Win32.Build.0 = Release|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Release|x64.ActiveCfg = Release|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Release|x64.Build.0 = Release|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Debug|Win32.ActiveCfg = Debug|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Debug|Win32.Build.0 = Debug|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Debug|x64.ActiveCfg = Debug|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Debug|x64.Build.0 = Debug|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Release|Win32.ActiveCfg = Release|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Release|Win32.Build.0 = Release|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Release|x64.ActiveCfg = Release|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Release|x64.Build.0 = Release|x64 + {128AA855-8778-4F08-B001-FF79DC95F480}.Debug|Win32.ActiveCfg = Debug|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.Debug|Win32.Build.0 = Debug|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.Debug|x64.ActiveCfg = Debug|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.PGInstrument|Win32.Build.0 = Release|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.PGInstrument|x64.ActiveCfg = Release|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.PGUpdate|Win32.Build.0 = Release|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.PGUpdate|x64.ActiveCfg = Release|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.Release|Win32.ActiveCfg = Release|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.Release|Win32.Build.0 = Release|Win32 + {128AA855-8778-4F08-B001-FF79DC95F480}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Deleted: /python/branches/release25-maint/PCbuild8/pyexpat.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/pyexpat.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,393 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/python.build ============================================================================== --- /python/branches/release25-maint/PCbuild8/python.build Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/python.iss ============================================================================== --- /python/branches/release25-maint/PCbuild8/python.iss Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,346 +0,0 @@ -; Script generated by the Inno Setup Script Wizard. -; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! - -; This is the whole ball of wax for an Inno installer for Python. -; To use, download Inno Setup from http://www.jrsoftware.org/isdl.htm/, -; install it, and double-click on this file. That launches the Inno -; script compiler. The GUI is extemely simple, and has only one button -; you may not recognize instantly: click it. You're done. It builds -; the installer into PCBuild/Python-2.2a1.exe. Size and speed of the -; installer are competitive with the Wise installer; Inno uninstall -; seems much quicker than Wise (but also feebler, and the uninstall -; log is in some un(human)readable binary format). -; -; What's Done -; ----------- -; All the usual Windows Python files are installed by this now. -; All the usual Windows Python Start menu entries are created and -; work fine. -; .py, .pyw, .pyc and .pyo extensions are registered. -; PROBLEM: Inno uninstall does not restore their previous registry -; associations (if any). Wise did. This will make life -; difficult for alpha (etc) testers. -; The Python install is fully functional for "typical" uses. -; -; What's Not Done -; --------------- -; None of "Mark Hammond's" registry entries are written. -; No installation of files is done into the system dir: -; The MS DLLs aren't handled at all by this yet. -; Python22.dll is unpacked into the main Python dir. -; -; Inno can't do different things on NT/2000 depending on whether the user -; has Admin privileges, so I don't know how to "solve" either of those, -; short of building two installers (one *requiring* Admin privs, the -; other not doing anything that needs Admin privs). -; -; Inno has no concept of variables, so lots of lines in this file need -; to be fiddled by hand across releases. Simplest way out: stick this -; file in a giant triple-quoted r-string (note that backslashes are -; required all over the place here -- forward slashes DON'T WORK in -; Inno), and use %(yadda)s string interpolation to do substitutions; i.e., -; write a very simple Python program to *produce* this script. - -[Setup] -AppName=Python and combined Win32 Extensions -AppVerName=Python 2.2.2 and combined Win32 Extensions 150 -AppId=Python 2.2.2.150 -AppVersion=2.2.2.150 -AppCopyright=Python is Copyright ? 2001 Python Software Foundation. Win32 Extensions are Copyright ? 1996-2001 Greg Stein and Mark Hammond. - -; Default install dir; value of {app} later (unless user overrides). -; {sd} = system root drive, probably "C:". -DefaultDirName={sd}\Python22 -;DefaultDirName={pf}\Python - -; Start menu folder name; value of {group} later (unless user overrides). -DefaultGroupName=Python 2.2 - -; Point SourceDir to one above PCBuild = src. -; means this script can run unchanged from anyone's CVS tree, no matter -; what they called the top-level directories. -SourceDir=. -OutputDir=.. -OutputBaseFilename=Python-2.2.2-Win32-150-Setup - -AppPublisher=PythonLabs at Digital Creations -AppPublisherURL=http://www.python.org -AppSupportURL=http://www.python.org -AppUpdatesURL=http://www.python.org - -AlwaysCreateUninstallIcon=true -ChangesAssociations=true -UninstallLogMode=new -AllowNoIcons=true -AdminPrivilegesRequired=true -UninstallDisplayIcon={app}\pyc.ico -WizardDebug=false - -; The fewer screens the better; leave these commented. - -Compression=bzip -InfoBeforeFile=LICENSE.txt -;InfoBeforeFile=Misc\NEWS - -; uncomment the following line if you want your installation to run on NT 3.51 too. -; MinVersion=4,3.51 - -[Types] -Name: normal; Description: Select desired components; Flags: iscustom - -[Components] -Name: main; Description: Python and Win32 Extensions; Types: normal -Name: docs; Description: Python documentation (HTML); Types: normal -Name: tk; Description: TCL/TK, tkinter, and Idle; Types: normal -Name: tools; Description: Python utility scripts (Tools\); Types: normal -Name: test; Description: Python test suite (Lib\test\); Types: normal - -[Tasks] -Name: extensions; Description: Register file associations (.py, .pyw, .pyc, .pyo); Components: main; Check: IsAdminLoggedOn - -[Files] -; Caution: Using forward slashes instead screws up in amazing ways. -; Unknown: By the time Components (and other attrs) are added to these lines, they're -; going to get awfully long. But don't see a way to continue logical lines across -; physical lines. - -Source: LICENSE.txt; DestDir: {app}; CopyMode: alwaysoverwrite -Source: README.txt; DestDir: {app}; CopyMode: alwaysoverwrite -Source: News.txt; DestDir: {app}; CopyMode: alwaysoverwrite -Source: *.ico; DestDir: {app}; CopyMode: alwaysoverwrite; Components: main - -Source: python.exe; DestDir: {app}; CopyMode: alwaysoverwrite; Components: main -Source: pythonw.exe; DestDir: {app}; CopyMode: alwaysoverwrite; Components: main -Source: w9xpopen.exe; DestDir: {app}; CopyMode: alwaysoverwrite; Components: main - - -Source: DLLs\tcl83.dll; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: tk -Source: DLLs\tk83.dll; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: tk -Source: tcl\*.*; DestDir: {app}\tcl; CopyMode: alwaysoverwrite; Components: tk; Flags: recursesubdirs - -Source: sysdir\python22.dll; DestDir: {sys}; CopyMode: alwaysskipifsameorolder; Components: main; Flags: sharedfile restartreplace -Source: sysdir\PyWinTypes22.dll; DestDir: {sys}; CopyMode: alwaysskipifsameorolder; Components: main; Flags: restartreplace sharedfile -Source: sysdir\pythoncom22.dll; DestDir: {sys}; CopyMode: alwaysskipifsameorolder; Components: main; Flags: restartreplace sharedfile - -Source: DLLs\_socket.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_socket.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_sre.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_sre.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_symtable.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_symtable.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_testcapi.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_testcapi.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_tkinter.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: tk -Source: libs\_tkinter.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: tk - -Source: DLLs\bsddb.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\bsddb.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\mmap.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\mmap.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\parser.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\parser.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\pyexpat.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\pyexpat.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\select.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\select.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\unicodedata.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\unicodedata.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_winreg.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_winreg.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\winsound.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\winsound.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\zlib.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\zlib.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: libs\python22.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\expat.dll; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main - - - -Source: Lib\*.py; DestDir: {app}\Lib; CopyMode: alwaysoverwrite; Components: main -Source: Lib\compiler\*.*; DestDir: {app}\Lib\compiler; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\distutils\*.*; DestDir: {app}\Lib\distutils; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\email\*.*; DestDir: {app}\Lib\email; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\encodings\*.*; DestDir: {app}\Lib\encodings; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\hotshot\*.*; DestDir: {app}\Lib\hotshot; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\lib-old\*.*; DestDir: {app}\Lib\lib-old; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\xml\*.*; DestDir: {app}\Lib\xml; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\hotshot\*.*; DestDir: {app}\Lib\hotshot; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\test\*.*; DestDir: {app}\Lib\test; CopyMode: alwaysoverwrite; Components: test; Flags: recursesubdirs - -Source: Lib\site-packages\README.txt; DestDir: {app}\Lib\site-packages; CopyMode: alwaysoverwrite; Components: main - -Source: Lib\site-packages\PyWin32.chm; DestDir: {app}\Lib\site-packages; CopyMode: alwaysoverwrite; Components: docs -Source: Lib\site-packages\win32\*.*; DestDir: {app}\Lib\site-packages\win32; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\site-packages\win32com\*.*; DestDir: {app}\Lib\site-packages\win32com; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\site-packages\win32comext\*.*; DestDir: {app}\Lib\site-packages\win32comext; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs - -Source: Lib\lib-tk\*.py; DestDir: {app}\Lib\lib-tk; CopyMode: alwaysoverwrite; Components: tk; Flags: recursesubdirs - -Source: include\*.h; DestDir: {app}\include; CopyMode: alwaysoverwrite; Components: main - -Source: Tools\idle\*.*; DestDir: {app}\Tools\idle; CopyMode: alwaysoverwrite; Components: tk; Flags: recursesubdirs - -Source: Tools\pynche\*.*; DestDir: {app}\Tools\pynche; CopyMode: alwaysoverwrite; Components: tools; Flags: recursesubdirs -Source: Tools\scripts\*.*; DestDir: {app}\Tools\Scripts; CopyMode: alwaysoverwrite; Components: tools; Flags: recursesubdirs -Source: Tools\webchecker\*.*; DestDir: {app}\Tools\webchecker; CopyMode: alwaysoverwrite; Components: tools; Flags: recursesubdirs -Source: Tools\versioncheck\*.*; DestDir: {app}\Tools\versioncheck; CopyMode: alwaysoverwrite; Components: tools; Flags: recursesubdirs - -Source: Doc\*.*; DestDir: {app}\Doc; CopyMode: alwaysoverwrite; Flags: recursesubdirs; Components: docs - - -[Icons] -Name: {group}\Python (command line); Filename: {app}\python.exe; WorkingDir: {app}; Components: main -Name: {group}\Python Manuals; Filename: {app}\Doc\index.html; WorkingDir: {app}; Components: docs -Name: {group}\Win32 Extensions Help; Filename: {app}\Lib\site-packages\PyWin32.chm; WorkingDir: {app}\Lib\site-packages; Components: docs -Name: {group}\Module Docs; Filename: {app}\pythonw.exe; WorkingDir: {app}; Parameters: """{app}\Tools\Scripts\pydoc.pyw"""; Components: tools -Name: {group}\IDLE (Python GUI); Filename: {app}\pythonw.exe; WorkingDir: {app}; Parameters: """{app}\Tools\idle\idle.pyw"""; Components: tools - -[Registry] -; Register .py -Tasks: extensions; Root: HKCR; Subkey: .py; ValueType: string; ValueName: ; ValueData: Python File; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: .py; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: Python File; ValueType: string; ValueName: ; ValueData: Python File; Flags: uninsdeletekey -Tasks: extensions; Root: HKCR; Subkey: Python File\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\Py.ico -Tasks: extensions; Root: HKCR; Subkey: Python File\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\python.exe"" ""%1"" %*" - -; Register .pyc -Tasks: extensions; Root: HKCR; Subkey: .pyc; ValueType: string; ValueName: ; ValueData: Python CompiledFile; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: Python CompiledFile; ValueType: string; ValueName: ; ValueData: Compiled Python File; Flags: uninsdeletekey -Tasks: extensions; Root: HKCR; Subkey: Python CompiledFile\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\pyc.ico -Tasks: extensions; Root: HKCR; Subkey: Python CompiledFile\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\python.exe"" ""%1"" %*" - -; Register .pyo -Tasks: extensions; Root: HKCR; Subkey: .pyo; ValueType: string; ValueName: ; ValueData: Python CompiledFile; Flags: uninsdeletevalue - -; Register .pyw -Tasks: extensions; Root: HKCR; Subkey: .pyw; ValueType: string; ValueName: ; ValueData: Python NoConFile; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: .pyw; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: Python NoConFile; ValueType: string; ValueName: ; ValueData: Python File (no console); Flags: uninsdeletekey -Tasks: extensions; Root: HKCR; Subkey: Python NoConFile\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\Py.ico -Tasks: extensions; Root: HKCR; Subkey: Python NoConFile\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\pythonw.exe"" ""%1"" %*" - - -; Python Registry Keys -Root: HKLM; Subkey: SOFTWARE\Python; Flags: uninsdeletekeyifempty; Check: IsAdminLoggedOn -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\PythonPath; ValueData: "{app}\Lib;{app}\DLLs"; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\PythonPath\tk; ValueData: {app}\Lib\lib-tk; Flags: uninsdeletekey; Components: tk -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\PythonPath\win32; ValueData: "{app}\lib\site-packages\win32;{app}\lib\site-packages\win32\lib"; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\PythonPath\win32com; ValueData: C:\Python\lib\site-packages; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Modules; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Modules\pythoncom; ValueData: {sys}\pythoncom22.dll; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Modules\pywintypes; ValueData: {sys}\PyWinTypes22.dll; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\InstallPath; ValueData: {app}; Flags: uninsdeletekeyifempty; ValueType: string -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\InstallPath\InstallGroup; ValueData: {group}; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Help; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Help\Main Python Documentation; ValueType: string; ValueData: {app}\Doc\index.html; Flags: uninsdeletekey; Components: docs -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Help\Python Win32 Documentation; ValueType: string; ValueData: {app}\lib\site-packages\PyWin32.chm; Flags: uninsdeletekey; Components: docs - -[_ISTool] -EnableISX=true - - -[Code] -Program Setup; - -Function IsAdminNotLoggedOn(): Boolean; -begin - Result := Not IsAdminLoggedOn(); -end; - -begin -end. - - - - -[UninstallDelete] -Name: {app}\Lib\compiler\*.pyc; Type: files -Name: {app}\Lib\compiler\*.pyo; Type: files -Name: {app}\Lib\compiler; Type: dirifempty -Name: {app}\Lib\distutils\command\*.pyc; Type: files -Name: {app}\Lib\distutils\command\*.pyo; Type: files -Name: {app}\Lib\distutils\command; Type: dirifempty -Name: {app}\Lib\distutils\*.pyc; Type: files -Name: {app}\Lib\distutils\*.pyo; Type: files -Name: {app}\Lib\distutils; Type: dirifempty -Name: {app}\Lib\email\test\*.pyc; Type: files -Name: {app}\Lib\email\test\*.pyo; Type: files -Name: {app}\Lib\email\test; Type: dirifempty -Name: {app}\Lib\email\*.pyc; Type: files -Name: {app}\Lib\email\*.pyo; Type: files -Name: {app}\Lib\email; Type: dirifempty -Name: {app}\Lib\encodings\*.pyc; Type: files -Name: {app}\Lib\encodings\*.pyo; Type: files -Name: {app}\Lib\encodings; Type: dirifempty -Name: {app}\Lib\hotshot\*.pyc; Type: files -Name: {app}\Lib\hotshot\*.pyo; Type: files -Name: {app}\Lib\hotshot; Type: dirifempty -Name: {app}\Lib\lib-old\*.pyc; Type: files -Name: {app}\Lib\lib-old\*.pyo; Type: files -Name: {app}\Lib\lib-old; Type: dirifempty -Name: {app}\Lib\lib-tk\*.pyc; Type: files -Name: {app}\Lib\lib-tk\*.pyo; Type: files -Name: {app}\Lib\lib-tk; Type: dirifempty -Name: {app}\Lib\test\*.pyc; Type: files -Name: {app}\Lib\test\*.pyo; Type: files -Name: {app}\Lib\test; Type: dirifempty -Name: {app}\Lib\xml\dom\*.pyc; Type: files -Name: {app}\Lib\xml\dom\*.pyo; Type: files -Name: {app}\Lib\xml\dom; Type: dirifempty -Name: {app}\Lib\xml\parsers\*.pyc; Type: files -Name: {app}\Lib\xml\parsers\*.pyo; Type: files -Name: {app}\Lib\xml\parsers; Type: dirifempty -Name: {app}\Lib\xml\sax\*.pyc; Type: files -Name: {app}\Lib\xml\sax\*.pyo; Type: files -Name: {app}\Lib\xml\sax; Type: dirifempty -Name: {app}\Lib\xml\*.pyc; Type: files -Name: {app}\Lib\xml\*.pyo; Type: files -Name: {app}\Lib\xml; Type: dirifempty - -Name: {app}\Lib\site-packages\win32; Type: filesandordirs -Name: {app}\Lib\site-packages\win32com; Type: filesandordirs -Name: {app}\Lib\site-packages\win32comext; Type: filesandordirs -Name: {app}\Lib\site-packages\pythoncom.py*; Type: files -Name: {app}\Lib\site-packages; Type: dirifempty - -Name: {app}\Lib\*.pyc; Type: files -Name: {app}\Lib; Type: dirifempty - -Name: {app}\Tools\pynche\*.pyc; Type: files -Name: {app}\Tools\pynche\*.pyo; Type: files -Name: {app}\Tools\pynche; Type: dirifempty - -Name: {app}\Tools\idle\*.pyc; Type: files -Name: {app}\Tools\idle\*.pyo; Type: files -Name: {app}\Tools\idle; Type: dirifempty - -Name: {app}\Tools\scripts\*.pyc; Type: files -Name: {app}\Tools\scripts\*.pyo; Type: files -Name: {app}\Tools\scripts; Type: dirifempty - -Name: {app}\Tools\versioncheck\*.pyc; Type: files -Name: {app}\Tools\versioncheck\*.pyo; Type: files -Name: {app}\Tools\versioncheck; Type: dirifempty - -Name: {app}\Tools\webchecker\*.pyc; Type: files -Name: {app}\Tools\webchecker\*.pyo; Type: files -Name: {app}\Tools\webchecker; Type: dirifempty - -Name: {app}\Tools; Type: dirifempty - Deleted: /python/branches/release25-maint/PCbuild8/python.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/python.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,399 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/python20.wse ============================================================================== --- /python/branches/release25-maint/PCbuild8/python20.wse Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,3135 +0,0 @@ -Document Type: WSE -item: Global - Version=9.0 - Title=Python 2.4a1 - Flags=00010100 - Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - Japanese Font Name=MS Gothic - Japanese Font Size=10 - Start Gradient=0 255 0 - End Gradient=0 128 0 - Windows Flags=00000100000011010010010100001010 - Log Pathname=%MAINDIR%\INSTALL.LOG - Message Font=MS Sans Serif - Font Size=8 - Pages Modified=00010000011101000000000100000111 - Extra Pages=00000000000000000000000010110010 - Disk Filename=SETUP - Patch Flags=0000000000001001 - Patch Threshold=85 - Patch Memory=4000 - MIF PDF Version=1.0 - MIF SMS Version=2.0 - EXE Filename=Python-2.4a1.exe - Dialogs Version=8 - Version File=2.4a1 - Version Description=Python Programming Language - Version Copyright=?2001-2007 Python Software Foundation - Version Company=Python Software Foundation - Crystal Format=10111100101100000010001001001001 - Step View=&All - Variable Name1=_WISE_ - Variable Description1=WISE root directory - Variable Default1=C:\Programme\Wise Installation System - Variable Flags1=00001000 - Variable Name2=_TCLDIR_ - Variable Description2=The directory in which the Tcl/Tk installation - Variable Description2=lives. This must be a sibling of the Python - Variable Description2=directory. - Variable Default2=tcl84 - Variable Flags2=00001000 - Variable Name3=_DOC_ - Variable Description3=The unpacked HTML doc directory. - Variable Default3=..\html - Variable Flags3=00001001 - Variable Name4=_SYS_ - Variable Description4=System directory (where to find MSVCRT.DLL) - Variable Default4=C:\Windows\System - Variable Values4=C:\Windows\System - Variable Values4=C:\WINNT\System32 - Variable Values4=C:\Code\MSDLLs - Variable Values4=C:\Windows\System32 - Variable Flags4=00000010 - Variable Name5=_PYMAJOR_ - Variable Description5=Python major version number; the 2 in 2.3. - Variable Default5=2 - Variable Flags5=00001000 - Variable Name6=_PYMINOR_ - Variable Description6=Python minor version number; the 3 in 2.3 - Variable Default6=3 - Variable Flags6=00001000 - Variable Name7=_DOADMIN_ - Variable Description7=The initial value for %DOADMIN%. - Variable Description7=When 0, we never try to write under HKLM, - Variable Description7=and install the Python + MS runtime DLLs in - Variable Description7=the Python directory instead of the system dir. - Variable Default7=1 - Variable Values7=1 - Variable Values7=0 - Variable Flags7=00001010 - Variable Name8=_ALIASNAME_ - Variable Flags8=00001000 - Variable Name9=_ALIASPATH_ - Variable Flags9=00001000 - Variable Name10=_ALIASTYPE_ - Variable Flags10=00001000 -end -item: Set Variable - Variable=PYVER_STRING - Value=2.3 -end -item: Remark -end -item: Remark - Text=When the version number changes, set the compiler -end -item: Remark - Text=vrbls _PYMAJOR_ and _PYMINOR_. -end -item: Remark - Text=Nothing in the script below should need fiddling then. -end -item: Remark - Text=Other things that need fiddling: -end -item: Remark - Text= PYVER_STRING above. -end -item: Remark - Text= The "Title:" in the upper left corner of the GUI. -end -item: Remark - Text= Build Settings and Version Resource on step 6 (Finish) of the Installation Expert -end -item: Remark - Text= Be sure to select Steps->All or you may not see these! -end -item: Remark -end -item: Remark - Text=When the version of Tcl/Tk changes, the compiler vrbl -end -item: Remark - Text=_TCLDIR_ may also need to be changed. -end -item: Remark -end -item: Set Variable - Variable=APPTITLE - Value=Python %PYVER_STRING% -end -item: Remark - Text=PY_VERSION should be major.minor only; used to create the registry key; must match MS_DLL_ID in python_nt.rc -end -item: Set Variable - Variable=PY_VERSION - Value=%_PYMAJOR_%.%_PYMINOR_% -end -item: Remark - Text=GROUP is the Start menu group name; user can override. -end -item: Set Variable - Variable=GROUP - Value=Python %PY_VERSION% - Flags=10000000 -end -item: Remark - Text=MAINDIR is the app directory; user can override. -end -item: Set Variable - Variable=MAINDIR - Value=Python%_PYMAJOR_%%_PYMINOR_% -end -item: Remark -end -item: Set Variable - Variable=DOADMIN - Value=%_DOADMIN_% -end -item: Remark - Text=Give non-admin users a chance to abort. -end -item: Check Configuration - Flags=10011111 -end -item: Set Variable - Variable=DOADMIN - Value=0 -end -item: Display Message - Title=Doing non-admin install - Text=The current login does not have Administrator Privileges on this machine. Python will install its registry information into the per-user area only for the current login, instead of into the per-machine area for every account on this machine. Some advanced uses of Python may not work as a result (for example, running a Python script as a service). - Text= - Text=If this is not what you want, please click Cancel to abort this installation, log on as an Administrator, and start the installation again. - Flags=00001000 -end -item: End Block -end -item: Remark -end -item: Remark - Text=BEGIN WIZARD STUFF ----------------------------------------------------------------------------------------------------------------------------- -end -item: Remark - Text=Note from Tim: the "stop" on the next line is actually "pause". -end -item: Open/Close INSTALL.LOG - Flags=00000001 -end -item: Remark - Text=If the destination system does not have a writable Windows\System directory, system files will be written to the Windows\ directory -end -item: Check if File/Dir Exists - Pathname=%SYS% - Flags=10000100 -end -item: Set Variable - Variable=SYS - Value=%WIN% -end -item: End Block -end -item: Check Configuration - Flags=10111011 -end -item: Get Registry Key Value - Variable=COMMON - Key=SOFTWARE\Microsoft\Windows\CurrentVersion - Default=C:\Program Files\Common Files - Value Name=CommonFilesDir - Flags=00000100 -end -item: Get Registry Key Value - Variable=PROGRAM_FILES - Key=SOFTWARE\Microsoft\Windows\CurrentVersion - Default=C:\Program Files - Value Name=ProgramFilesDir - Flags=00000100 -end -item: Set Variable - Variable=EXPLORER - Value=1 -end -item: End Block -end -item: Remark - Text=Note from Tim: The Wizard hardcod "C:" at the start of the replacement text for MAINDIR. -end -item: Remark - Text=That's not appropriate if the system drive doesn't happen to be C:. -end -item: Remark - Text=I removed the "C:", and that did the right thing for two people who tested it on non-C: machines, -end -item: Remark - Text=but it's unclear whether it will always do the right thing. -end -item: Set Variable - Variable=MAINDIR - Value=\%MAINDIR% - Flags=00001100 -end -item: Remark - Text=BACKUP is the variable that holds the path that all backup files will be copied to when overwritten -end -item: Set Variable - Variable=BACKUP - Value=%MAINDIR%\BACKUP - Flags=10000000 -end -item: Remark - Text=DOBACKUP determines if a backup will be performed. The possible values are A (do backup) or B (do not do backup) -end -item: Set Variable - Variable=DOBACKUP - Value=A -end -item: Remark - Text=BRANDING determines if the installation will be branded with a name and company. By default, this is written to the INST directory (installation media). -end -item: Set Variable - Variable=BRANDING - Value=0 -end -item: If/While Statement - Variable=BRANDING - Value=1 -end -item: Read INI Value - Variable=NAME - Pathname=%INST%\CUSTDATA.INI - Section=Registration - Item=Name -end -item: Read INI Value - Variable=COMPANY - Pathname=%INST%\CUSTDATA.INI - Section=Registration - Item=Company -end -item: If/While Statement - Variable=NAME -end -item: Set Variable - Variable=DOBRAND - Value=1 -end -item: Get System Information - Variable=NAME - Flags=00000110 -end -item: Get System Information - Variable=COMPANY - Flags=00000111 -end -item: End Block -end -item: End Block -end -item: Remark - Text=END WIZARD STUFF ----------------------------------------------------------------------------------------------------------------------------- -end -item: Remark -end -item: Remark - Text=Set vrbls for the "Advanced Options" subdialog of Components. -end -item: Set Variable - Variable=SELECT_ADMIN - Value=A -end -item: If/While Statement - Variable=DOADMIN - Value=0 -end -item: Set Variable - Variable=SELECT_ADMIN - Value=B -end -item: End Block -end -item: Remark -end -item: Remark - Text=TASKS values: -end -item: Remark - Text=A: Register file extensions -end -item: Remark - Text=B: Create Start Menu shortcuts -end -item: Set Variable - Variable=TASKS - Value=AB -end -item: Remark -end -item: Remark - Text=COMPONENTS values: -end -item: Remark - Text=A: interpreter and libraries -end -item: Remark - Text=B: Tcl/Tk -end -item: Remark - Text=C: docs -end -item: Remark - Text=D: tools -end -item: Remark - Text=E: test suite -end -item: Set Variable - Variable=COMPONENTS - Value=ABCDE -end -item: Remark -end -item: Remark - Text=March thru the user GUI. -end -item: Wizard Block - Direction Variable=DIRECTION - Display Variable=DISPLAY - Bitmap Pathname=.\installer.bmp - X Position=9 - Y Position=10 - Filler Color=11173759 - Dialog=Select Destination Directory - Dialog=Backup Replaced Files - Dialog=Select Components - Dialog=Select Program Manager Group - Variable= - Variable= - Variable= - Variable=TASKS - Value= - Value= - Value= - Value=B - Compare=0 - Compare=0 - Compare=0 - Compare=3 - Flags=00000011 -end -item: If/While Statement - Variable=DISPLAY - Value=Start Installation -end -item: Set Variable - Variable=SUMMARY - Value=Install directory: %MAINDIR%%CRLF% -end -item: Remark -end -item: If/While Statement - Variable=SELECT_ADMIN - Value=A -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Doing admin install.%CRLF% - Flags=00000001 -end -item: Else Statement -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Doing non-admin install.%CRLF% - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=DOBACKUP - Value=A -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Make backups, into %BACKUP%%CRLF% - Flags=00000001 -end -item: Else Statement -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Don't make backups.%CRLF% - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Components:%CRLF% - Flags=00000001 -end -item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Python interpreter and libraries%CRLF% - Flags=00000001 -end -item: End Block -end -item: If/While Statement - Variable=COMPONENTS - Value=B - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Tcl/Tk (Tkinter, IDLE, pydoc)%CRLF% - Flags=00000001 -end -item: End Block -end -item: If/While Statement - Variable=COMPONENTS - Value=C - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Python documentation%CRLF% - Flags=00000001 -end -item: End Block -end -item: If/While Statement - Variable=COMPONENTS - Value=D - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Tool and utility scripts%CRLF% - Flags=00000001 -end -item: End Block -end -item: If/While Statement - Variable=COMPONENTS - Value=E - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Python test suite%CRLF% - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=TASKS - Value=A - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Register file extensions.%CRLF% - Flags=00000001 -end -item: Else Statement -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Don't register file extensions.%CRLF% - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=TASKS - Value=B - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Start Menu group: %GROUP%%CRLF% - Flags=00000001 -end -item: Else Statement -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%No Start Menu shortcuts.%CRLF% - Flags=00000001 -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Custom Dialog Set - Name=Select Destination Directory - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Push Button - Rectangle=264 234 320 253 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 11 323 33 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Select Destination Directory - Text French=S?lectionner le r?pertoire de destination - Text German=Zielverzeichnis w?hlen - Text Spanish=Seleccione el directorio de destino - Text Italian=Selezionare Directory di destinazione - end - item: Listbox - Rectangle=108 58 321 219 - Variable=MAINDIR - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000100000010000000101000001 - Flags=0000110000001010 - Text=%MAINDIR% - Text= - end - item: Static - Rectangle=108 40 313 58 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000000 - Text=Please select a directory for the %APPTITLE% files. - end - end - item: Dialog - Title=Select Destination Directory - Title French=S?lectionner le r?pertoire de destination - Title German=Zielverzeichnis w?hlen - Title Spanish=Seleccione el directorio de destino - Title Italian=Selezionare Directory di destinazione - Width=276 - Height=216 - Font Name=Helv - Font Size=8 - item: Listbox - Rectangle=6 6 204 186 - Variable=MAINDIR - Create Flags=01010000100000010000000101000000 - Flags=0000110000100010 - Text=%MAINDIR% - Text French=%MAINDIR% - Text German=%MAINDIR% - Text Spanish=%MAINDIR% - Text Italian=%MAINDIR% - end - item: Push Button - Rectangle=209 8 265 26 - Create Flags=01010000000000010000000000000001 - Text=OK - Text French=OK - Text German=OK - Text Spanish=Aceptar - Text Italian=OK - end - item: Push Button - Rectangle=209 31 265 50 - Variable=MAINDIR - Value=%MAINDIR_SAVE% - Create Flags=01010000000000010000000000000000 - Flags=0000000000000001 - Text=Cancel - Text French=Annuler - Text German=Abbrechen - Text Spanish=Cancelar - Text Italian=Annulla - end - end -end -item: Custom Dialog Set - Name=Backup Replaced Files - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Fichiers de Sauvegarde Remplac?s - Title German=Sicherungskopie von ersetzten Dateien erstellen - Title Portuguese=Ficheiros substitu?dos de seguran?a - Title Spanish=Copias de seguridad de los archivos reemplazados - Title Italian=Backup file sostituiti - Title Danish=Sikkerhedskopiering af erstattede filer - Title Dutch=Vervangen bestanden kopi?ren - Title Norwegian=Sikkerhetskopiere erstattede filer - Title Swedish=S?kerhetskopiera utbytta filer - Width=350 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 251 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suivant> - Text German=&Weiter> - Text Portuguese=&Pr?ximo> - Text Spanish=&Siguiente > - Text Italian=&Avanti > - Text Danish=&N?ste> - Text Dutch=&Volgende> - Text Norwegian=&Neste> - Text Swedish=&N?sta > - end - item: Push Button - Rectangle=131 234 188 251 - Variable=DIRECTION - Value=B - Create Flags=01010000000000010000000000000000 - Text=< &Back - Text French=<&Retour - Text German=<&Zur?ck - Text Portuguese=<&Retornar - Text Spanish=<&Retroceder - Text Italian=< &Indietro - Text Danish=<&Tilbage - Text Dutch=<&Terug - Text Norwegian=<&Tilbake - Text Swedish=< &Tillbaka - end - item: Push Button - Rectangle=278 234 330 251 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=Cancel - Text French=Annuler - Text German=Abbrechen - Text Portuguese=Cancelar - Text Spanish=Cancelar - Text Italian=Annulla - Text Danish=Annuller - Text Dutch=Annuleren - Text Norwegian=Avbryt - Text Swedish=Avbryt - end - item: Static - Rectangle=11 221 329 223 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 46 320 98 - Create Flags=01010000000000000000000000000000 - Text=This installation program can create backup copies of all files replaced during the installation. These files will be used when the software is uninstalled and a rollback is requested. If backup copies are not created, you will only be able to uninstall the software and not roll the system back to a previous state. - Text= - Text=Do you want to create backups of replaced files? - Text French=Le programme d'installation peut cr?er des copies de sauvegarde de tous les fichiers remplac?s pendant l'installation. Ces fichiers sont utilis?s au cas o? le logiciel est d?sinstall? et que l'on proc?de ? la reprise du syst?me. Si les copies de sauvegarde ne sont pas cr??es, on ne pourra que d?sinstaller le logiciel sans reprendre le syst?me ? un ?tat pr?c?dent. Voulez-vous cr?er une sauvegarde des fichiers remplac?s ? - Text German=Dieses Installationsprogramm kann Sicherungskopien von allen w?hrend der Installation ersetzten Dateien erstellen. Diese Dateien werden zur R?ckg?ngigmachung der Installation und bei Anforderung eines Rollbacks verwendet. Ohne Sicherungskopien ist nur eine R?ckg?ngigmachung der Installation m?glich, nicht aber ein Rollback des Systems. Sicherungskopien der ersetzten Dateien erstellen? - Text Portuguese=Este programa de instala??o pode criar c?pias de seguran?a de todos os ficheiros substitu?dos durante a instala??o. Estes ficheiros ser?o utilizados quando o programa for desinstalado e for requisitada uma retomada. Se as c?pias de seguran?a n?o forem criadas, s? poder? desinstalar o programa e n?o pode retomar um estado anterior do sistema. Deseja criar c?pias de seguran?a dos ficheiros substitu?dos? - Text Spanish=Este programa de instalaci?n puede crear copias de seguridad de todos los archivos reemplazados durante la instalaci?n. Estos archivos se utilizar?n cuando se desinstale el software y se solicite volver al estado anterior. Si no se crean copias de seguridad, ?nicamente podr? desinstalar el software y no podr? devolver el sistema al estado anterior. ?Desea crear archivos de seguridad de los archivos reemplazados? - Text Italian=Questo programma di installazione pu? creare copie di backup di tutti i file sostituiti durante l?installazione. Questi file saranno usati quando il software sar? disinstallato e sar? richiesto un ritorno allo stato precedente. Se non crei le copie di backup, potrai solo disinstallare il software, ma non potrai riportare il sistema allo stato precedente. Vuoi creare i file di backup dei file sostituiti? - Text Danish=Dette installationsprogram kan oprette sikkerhedskopier af alle filer, som erstattes under installationen. Disse filer benyttes, n?r softwaren fjernes, og den tidligere systemkonfiguration genetableres. Hvis der ikke oprettes sikkerhedskopier, kan du kun fjerne den installerede software og ikke genetablere den tidligere systemkonfiguration. Vil du oprette sikkerhedskopier af filer, som erstattes? - Text Dutch=Dit installatieprogramma kan kopie?n maken van alle bestanden die tijdens de installatie worden vervangen. Deze worden dan gebruikt als de software-installatie ongedaan wordt gemaakt en u het systeem wilt laten terugkeren naar de oorspronkelijke staat. Als er geen back-up kopie?n worden gemaakt, kunt u de software enkel verwijderen maar het systeem niet in de oorspronkelijke staat terugbrengen. Wilt u een back-up maken van de vervangen bestanden? - Text Norwegian=Dette installasjonsprogrammet kan lage sikkerhetskopier av alle filer som blir erstattet under installasjonen. Disse filene vil tas i bruk n?r programvaren er avinstallert og det er behov for tilbakestilling. Hvis det ikke er laget sikkerhetskopier, kan du kun avinstallere programvaren og ikke stille systemet tilbake til tidligere status. ?nsker du ? lage sikkerhetskopier av de filene som blir erstattet n?? - Text Swedish=Installationsprogrammet kan skapa s?kerhetskopior av alla filer som byts ut under installationen. Dessa filer kan sedan anv?ndas n?r programvaran avinstalleras och du beg?r rollback. Om du d? inte har n?gra s?kerhetskopior kan du bara avinstallera programvaran, inte ?terskapa systemet i dess tidigare skick. Vill du g?ra s?kerhetskopior av de ersatta filerna? - end - item: Radio Button - Rectangle=141 106 265 136 - Variable=DOBACKUP - Create Flags=01010000000000010000000000001001 - Text=&Yes, make backups - Text=N&o, do not make backups - Text= - Text French=&Oui - Text French=N&on - Text French= - Text German=&Ja - Text German=N&ein - Text German= - Text Portuguese=&Sim - Text Portuguese=N?&o - Text Portuguese= - Text Spanish=&S? - Text Spanish=N&o - Text Spanish= - Text Italian=&S? - Text Italian=N&o - Text Italian= - Text Danish=&Ja - Text Danish=&Nej - Text Danish= - Text Dutch=&Ja - Text Dutch=N&ee - Text Dutch= - Text Norwegian=&Ja - Text Norwegian=&Nei - Text Norwegian= - Text Swedish=&Ja - Text Swedish=N&ej - Text Swedish= - end - item: Static - Control Name=BACK2 - Rectangle=108 173 320 208 - Action=1 - Create Flags=01010000000000000000000000000111 - Text=Backup File Destination Directory - Text French=R?pertoire de destination des fichiers de sauvegarde - Text German=Zielverzeichnis f?r die Sicherungsdatei - Text Portuguese=Direct?rio de destino de ficheiro de seguran?a - Text Spanish=Directorio de Destino de los Archivos de Seguridad - Text Italian=Directory di destinazione dei file di backup - Text Danish=Destinationsbibliotek til sikkerhedskopier - Text Dutch=Doeldirectory backup-bestand - Text Norwegian=M?lkatalog for sikkerhetskopier - Text Swedish=Katalog f?r s?kerhetskopierade filer - end - item: Push Button - Control Name=BACK3 - Rectangle=265 185 318 203 - Variable=BACKUP_SAVE - Value=%BACKUP% - Destination Dialog=1 - Action=2 - Create Flags=01010000000000010000000000000000 - Text=B&rowse... - Text French=P&arcourir - Text German=B&l?ttern... - Text Portuguese=P&rocurar - Text Spanish=V&isualizar... - Text Italian=Sfoglia... - Text Danish=&Gennemse... - Text Dutch=B&laderen... - Text Norwegian=Bla igjennom - Text Swedish=&Bl?ddra - end - item: Static - Control Name=BACK4 - Rectangle=129 188 254 200 - Destination Dialog=2 - Create Flags=01010000000000000000000000000000 - Text=%BACKUP% - Text French=%BACKUP% - Text German=%BACKUP% - Text Portuguese=%BACKUP% - Text Spanish=%BACKUP% - Text Italian=%BACKUP% - Text Danish=%BACKUP% - Text Dutch=%BACKUP% - Text Norwegian=%BACKUP% - Text Swedish=%BACKUP% - end - item: Static - Rectangle=108 11 323 36 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Backup Replaced Files - Text French=S?lectionner les composants - Text German=Komponenten ausw?hlen - Text Spanish=Seleccione componentes - Text Italian=Selezionare i componenti - end - item: If/While Statement - Variable=DOBACKUP - Value=B - end - item: Set Control Attribute - Control Name=BACK3 - Operation=1 - end - item: Set Control Attribute - Control Name=BACK4 - Operation=1 - end - item: Else Statement - end - item: Set Control Attribute - Control Name=BACK3 - end - item: Set Control Attribute - Control Name=BACK4 - end - item: End Block - end - end - item: Dialog - Title=Select Destination Directory - Title French=Choisissez le r?pertoire de destination - Title German=Zielverzeichnis w?hlen - Title Portuguese=Seleccionar Direct?rio de Destino - Title Spanish=Seleccione el Directorio de Destino - Title Italian=Seleziona Directory di destinazione - Title Danish=V?lg Destinationsbibliotek - Title Dutch=Kies Doeldirectory - Title Norwegian=Velg m?lkatalog - Title Swedish=V?lj destinationskalatog - Width=276 - Height=216 - Font Name=Helv - Font Size=8 - item: Listbox - Rectangle=6 3 200 186 - Variable=BACKUP - Create Flags=01010000100000010000000101000000 - Flags=0000110000100010 - Text=%BACKUP% - Text= - Text French=%BACKUP% - Text French= - Text German=%BACKUP% - Text German= - Text Portuguese=%BACKUP% - Text Portuguese= - Text Spanish=%BACKUP% - Text Spanish= - Text Italian=%BACKUP% - Text Italian= - Text Danish=%BACKUP% - Text Danish= - Text Dutch=%BACKUP% - Text Dutch= - Text Norwegian=%BACKUP% - Text Norwegian= - Text Swedish=%BACKUP% - Text Swedish= - end - item: Push Button - Rectangle=209 8 265 26 - Create Flags=01010000000000010000000000000001 - Text=OK - Text French=OK - Text German=OK - Text Portuguese=OK - Text Spanish=ACEPTAR - Text Italian=OK - Text Danish=OK - Text Dutch=OK - Text Norwegian=OK - Text Swedish=OK - end - item: Push Button - Rectangle=209 31 265 50 - Variable=BACKUP - Value=%BACKUP_SAVE% - Create Flags=01010000000000010000000000000000 - Flags=0000000000000001 - Text=Cancel - Text French=Annuler - Text German=Abbrechen - Text Portuguese=Cancelar - Text Spanish=Cancelar - Text Italian=Annulla - Text Danish=Slet - Text Dutch=Annuleren - Text Norwegian=Avbryt - Text Swedish=Avbryt - end - end -end -item: Custom Dialog Set - Name=Select Components - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Push Button - Rectangle=131 234 188 253 - Variable=DIRECTION - Value=B - Create Flags=01010000000000010000000000000000 - Text=< &Back - Text French=< &Retour - Text German=< &Zur?ck - Text Spanish=< &Atr?s - Text Italian=< &Indietro - end - item: Push Button - Rectangle=264 234 320 253 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Checkbox - Rectangle=108 66 313 156 - Variable=COMPONENTS - Create Flags=01010000000000010000000000000011 - Flags=0000000000000110 - Text=Python interpreter and libraries - Text=Tcl/Tk (Tkinter, IDLE, pydoc) - Text=Python HTML docs - Text=Python utility scripts (Tools/) - Text=Python test suite (Lib/test/) - Text= - Text French=Python interpreter, library and IDLE - Text French=Python HTML docs - Text French=Python utility scripts (Tools/) - Text French=Python test suite (Lib/test/) - Text French= - Text German=Python interpreter, library and IDLE - Text German=Python HTML docs - Text German=Python utility scripts (Tools/) - Text German=Python test suite (Lib/test/) - Text German= - Text Spanish=Python interpreter, library and IDLE - Text Spanish=Python HTML docs - Text Spanish=Python utility scripts (Tools/) - Text Spanish=Python test suite (Lib/test/) - Text Spanish= - Text Italian=Python interpreter, library and IDLE - Text Italian=Python HTML docs - Text Italian=Python utility scripts (Tools/) - Text Italian=Python test suite (Lib/test/) - Text Italian= - end - item: Static - Rectangle=108 45 320 63 - Create Flags=01010000000000000000000000000000 - Text=Choose which components to install by checking the boxes below. - Text French=Choisissez les composants que vous voulez installer en cochant les cases ci-dessous. - Text German=W?hlen Sie die zu installierenden Komponenten, indem Sie in die entsprechenden K?stchen klicken. - Text Spanish=Elija los componentes que desee instalar marcando los cuadros de abajo. - Text Italian=Scegliere quali componenti installare selezionando le caselle sottostanti. - end - item: Push Button - Rectangle=188 203 269 220 - Destination Dialog=1 - Action=2 - Enabled Color=00000000000000000000000011111111 - Create Flags=01010000000000010000000000000000 - Text=Advanced Options ... - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 10 323 43 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Select Components - Text French=S?lectionner les composants - Text German=Komponenten ausw?hlen - Text Spanish=Seleccione componentes - Text Italian=Selezionare i componenti - end - item: Static - Rectangle=251 180 311 193 - Variable=COMPONENTS - Value=MAINDIR - Create Flags=01010000000000000000000000000010 - end - item: Static - Rectangle=251 168 311 179 - Variable=COMPONENTS - Create Flags=01010000000000000000000000000010 - end - item: Static - Rectangle=123 168 234 181 - Create Flags=01010000000000000000000000000000 - Text=Disk Space Required: - Text French=Espace disque requis : - Text German=Notwendiger Speicherplatz: - Text Spanish=Espacio requerido en el disco: - Text Italian=Spazio su disco necessario: - end - item: Static - Rectangle=123 180 234 193 - Create Flags=01010000000000000000000000000000 - Text=Disk Space Remaining: - Text French=Espace disque disponible : - Text German=Verbleibender Speicherplatz: - Text Spanish=Espacio en disco disponible: - Text Italian=Spazio su disco disponibile: - end - item: Static - Rectangle=108 158 320 196 - Action=1 - Create Flags=01010000000000000000000000000111 - end - item: If/While Statement - Variable=DLG_EVENT_TYPE - Value=VERIFY - end - item: Remark - Text=If they're installing Tcl/Tk, Tools, or the test suite, doesn't make much sense unless they're installing Python too. - end - item: If/While Statement - Variable=COMPONENTS - Value=BDE - Flags=00001010 - end - item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000011 - end - item: Display Message - Title=Are you sure? - Text=Installing Tcl/Tk, Tools or the test suite doesn't make much sense unless you install the Python interpreter and libraries too. - Text= - Text=Click Yes if that's really what you want. - Flags=00101101 - end - item: Remark - Text=Nothing -- just proceed to the next dialog. - end - item: Else Statement - end - item: Remark - Text=Return to the dialog. - end - item: Set Variable - Variable=DLG_EVENT_TYPE - end - item: End Block - end - item: End Block - end - item: End Block - end - item: End Block - end - end - item: Dialog - Title=Advanced Options - Width=339 - Height=213 - Font Name=Helv - Font Size=8 - item: Radio Button - Control Name=ADMIN2 - Rectangle=11 46 90 76 - Variable=SELECT_ADMIN - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000010000000000001001 - Text=Admin install - Text=Non-Admin installl - Text= - end - item: Push Button - Rectangle=188 170 244 189 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=OK - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Static - Rectangle=5 3 326 83 - Action=1 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000111 - end - item: Static - Control Name=ADMIN1 - Rectangle=11 11 321 45 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000000 - Text=By default, the install records settings in the per-machine area of the registry (HKLM), and installs the Python and C runtime DLLs to %SYS32%. Choose "Non-Admin install" if you would prefer settings made in the per-user registry (HKCU), and DLLs installed in %MAINDIR%. - end - item: Static - Rectangle=5 90 326 157 - Action=1 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000111 - end - item: Checkbox - Rectangle=11 121 243 151 - Variable=TASKS - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000010000000000000011 - Text=Register file extensions (.py, .pyw, .pyc, .pyo) - Text=Create Start Menu shortcuts - Text= - end - item: Static - Rectangle=11 103 320 121 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000000 - Text=Choose tasks to perform by checking the boxes below. - end - item: If/While Statement - Variable=DLG_EVENT_TYPE - Value=INIT - end - item: If/While Statement - Variable=DOADMIN - Value=1 - end - item: Set Control Attribute - Control Name=ADMIN2 - end - item: Else Statement - end - item: Set Control Text - Control Name=ADMIN1 - Control Text=This section is available only if logged in to an account with Administrator privileges. - end - item: Set Control Attribute - Control Name=ADMIN2 - Operation=1 - end - item: End Block - end - item: End Block - end - end -end -item: Custom Dialog Set - Name=Select Program Manager Group - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Push Button - Rectangle=131 234 188 253 - Variable=DIRECTION - Value=B - Create Flags=01010000000000010000000000000000 - Flags=0000000000000001 - Text=< &Back - Text French=< &Retour - Text German=< &Zur?ck - Text Spanish=< &Atr?s - Text Italian=< &Indietro - end - item: Push Button - Rectangle=264 234 320 253 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 10 323 53 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Select Start Menu Group - Text French=S?lectionner le groupe du Gestionnaire de programme - Text German=Bestimmung der Programm-Managergruppe - Text Spanish=Seleccione grupo del Administrador de programas - Text Italian=Selezionare il gruppo ProgMan - end - item: Static - Rectangle=108 35 320 65 - Create Flags=01010000000000000000000000000000 - Text=Enter the name of the Start Menu program group to which to add the %APPTITLE% icons: - Text French=Entrez le nom du groupe du Gestionnaire de programme dans lequel vous souhaitez ajouter les ic?nes de %APPTITLE% : - Text German=Geben Sie den Namen der Programmgruppe ein, der das Symbol %APPTITLE% hinzugef?gt werden soll: - Text Spanish=Escriba el nombre del grupo del Administrador de programas en el que desea agregar los iconos de %APPTITLE%: - Text Italian=Inserire il nome del gruppo Program Manager per aggiungere le icone %APPTITLE% a: - end - item: Combobox - Rectangle=108 56 320 219 - Variable=GROUP - Create Flags=01010000001000010000001100000001 - Flags=0000000000000001 - Text=%GROUP% - Text= - Text French=%GROUP% - Text German=%GROUP% - Text Spanish=%GROUP% - Text Italian=%GROUP% - end - end -end -item: Custom Dialog Set - Name=Start Installation - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Push Button - Rectangle=131 234 188 253 - Variable=DIRECTION - Value=B - Create Flags=01010000000000010000000000000000 - Text=< &Back - Text French=< &Retour - Text German=< &Zur?ck - Text Spanish=< &Atr?s - Text Italian=< &Indietro - end - item: Push Button - Rectangle=264 234 320 253 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 10 323 53 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Ready to Install! - Text French=Pr?t ? installer ! - Text German=Installationsbereit! - Text Spanish=?Preparado para la instalaci?n! - Text Italian=Pronto per l'installazione! - end - item: Static - Rectangle=108 40 320 62 - Create Flags=01010000000000000000000000000000 - Text=Click the Next button to install %APPTITLE%, or the Back button to change choices: - Text French=Vous ?tes maintenant pr?t ? installer les fichiers %APPTITLE%. - Text French= - Text French=Cliquez sur le bouton Suite pour commencer l'installation ou sur le bouton Retour pour entrer les informations d'installation ? nouveau. - Text German=Sie k?nnen %APPTITLE% nun installieren. - Text German= - Text German=Klicken Sie auf "Weiter", um mit der Installation zu beginnen. Klicken Sie auf "Zur?ck", um die Installationsinformationen neu einzugeben. - Text Spanish=Ya est? listo para instalar %APPTITLE%. - Text Spanish= - Text Spanish=Presione el bot?n Siguiente para comenzar la instalaci?n o presione Atr?s para volver a ingresar la informaci?n para la instalaci?n. - Text Italian=Ora ? possibile installare %APPTITLE%. - Text Italian= - Text Italian=Premere il pulsante Avanti per avviare l'installazione o il pulsante Indietro per reinserire le informazioni di installazione. - end - item: Editbox - Rectangle=108 66 324 219 - Help Context=16711681 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000100000000001100011000100 - Text=%SUMMARY% - end - end -end -item: Remark -end -item: If/While Statement - Variable=DISPLAY - Value=Select Destination Directory -end -item: Remark - Text=User may have changed MAINDIR, so reset BACKUP to match. -end -item: Set Variable - Variable=BACKUP - Value=%MAINDIR%\BACKUP -end -item: End Block -end -item: Remark -end -item: End Block -end -item: Remark -end -item: Remark - Text=BEGIN WIZARD STUFF ----------------------------------------------------------------------------------------------------------------------------- -end -item: Remark - Text=When the BACKUP feature is enabled, the BACKUPDIR is initialized -end -item: If/While Statement - Variable=DOBACKUP - Value=A -end -item: Set Variable - Variable=BACKUPDIR - Value=%BACKUP% -end -item: End Block -end -item: Remark - Text=The BRANDING information is written to the INI file on the installation media. -end -item: If/While Statement - Variable=BRANDING - Value=1 -end -item: If/While Statement - Variable=DOBRAND - Value=1 -end -item: Edit INI File - Pathname=%INST%\CUSTDATA.INI - Settings=[Registration] - Settings=NAME=%NAME% - Settings=COMPANY=%COMPANY% - Settings= -end -item: End Block -end -item: End Block -end -item: Remark - Text=Begin writing to the INSTALL.LOG -end -item: Open/Close INSTALL.LOG -end -item: Remark - Text=Check free disk space calculates free disk space as well as component sizes. -end -item: Remark - Text=It should be located before all Install File actions. -end -item: Check Disk Space - Component=COMPONENTS -end -item: Remark - Text=This include script allows uninstall support -end -item: Remark - Text=Note from Tim: this is our own Uninstal.wse, a copy of Wise's except -end -item: Remark - Text=it writes to HKCU (instead of HKLM) if the user doesn't have admin privs. -end -item: Include Script - Pathname=.\Uninstal.wse -end -item: Remark - Text=Note from Tim: these seeming no-ops actually convert to short filenames. -end -item: Set Variable - Variable=COMMON - Value=%COMMON% - Flags=00010100 -end -item: Set Variable - Variable=MAINDIR - Value=%MAINDIR% - Flags=00010100 -end -item: Remark - Text=This IF/THEN/ELSE reads the correct registry entries for shortcut/icon placement -end -item: Check Configuration - Flags=10111011 -end -item: Get Registry Key Value - Variable=STARTUPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%WIN%\Start Menu\Programs\StartUp - Value Name=StartUp - Flags=00000010 -end -item: Get Registry Key Value - Variable=DESKTOPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%WIN%\Desktop - Value Name=Desktop - Flags=00000010 -end -item: Get Registry Key Value - Variable=STARTMENUDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%WIN%\Start Menu - Value Name=Start Menu - Flags=00000010 -end -item: Get Registry Key Value - Variable=GROUPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%WIN%\Start Menu\Programs - Value Name=Programs - Flags=00000010 -end -item: Get Registry Key Value - Variable=CSTARTUPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%STARTUPDIR% - Value Name=Common Startup - Flags=00000100 -end -item: Get Registry Key Value - Variable=CDESKTOPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%DESKTOPDIR% - Value Name=Common Desktop - Flags=00000100 -end -item: Get Registry Key Value - Variable=CSTARTMENUDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%STARTMENUDIR% - Value Name=Common Start Menu - Flags=00000100 -end -item: Get Registry Key Value - Variable=CGROUPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%GROUPDIR% - Value Name=Common Programs - Flags=00000100 -end -item: Else Statement -end -item: Remark - Text=Note from Tim: the Wizard left this block empty! -end -item: Remark - Text=Perhaps it's only relevant on Windows 3.1. -end -item: End Block -end -item: Remark - Text=END WIZARD STUFF ----------------------------------------------------------------------------------------------------------------------------- -end -item: Remark -end -item: If/While Statement - Variable=SELECT_ADMIN - Value=B -end -item: Remark - Text=The user chose a non-admin install in "Advanced Options". -end -item: Remark - Text=This should come after the include of Uninstal.wse above, because -end -item: Remark - Text=writing uninstall info to HKCU is ineffective except under Win2K. -end -item: Set Variable - Variable=DOADMIN - Value=0 -end -item: End Block -end -item: Remark -end -item: Set Variable - Variable=CGROUP_SAVE - Value=%GROUP% -end -item: If/While Statement - Variable=TASKS - Value=B - Flags=00000010 -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Set Variable - Variable=GROUP - Value=%CGROUPDIR%\%GROUP% -end -item: Else Statement -end -item: Set Variable - Variable=GROUP - Value=%GROUPDIR%\%GROUP% -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=Long section to install files. -end -item: Remark -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Set Variable - Variable=DLLDEST - Value=%SYS32% -end -item: Else Statement -end -item: Set Variable - Variable=DLLDEST - Value=%MAINDIR% -end -item: End Block -end -item: Remark -end -item: Remark - Text=Install the license even if they deselect everything . -end -item: Install File - Source=..\license - Destination=%MAINDIR%\LICENSE.txt - Flags=0000000000000010 -end -item: Install File - Source=..\readme - Destination=%MAINDIR%\README.txt - Flags=0000000000000010 -end -item: Install File - Source=..\misc\news - Destination=%MAINDIR%\NEWS.txt - Flags=0000000000000010 -end -item: Remark - Text=Icons -- always install so that the uninstaller can use them for its own display. -end -item: Install File - Source=..\pc\pycon.ico - Destination=%MAINDIR%\pycon.ico - Flags=0000000010000010 -end -item: Install File - Source=..\pc\pyc.ico - Destination=%MAINDIR%\pyc.ico - Flags=0000000010000010 -end -item: Install File - Source=..\pc\py.ico - Destination=%MAINDIR%\py.ico - Flags=0000000010000010 -end -item: Remark -end -item: Remark - Text=These arrange to (recursively!) delete all .pyc and .pyo files at uninstall time. -end -item: Remark - Text=This "does the right thing": any directories left empty at the end are removed. -end -item: Add Text to INSTALL.LOG - Text=File Tree: %MAINDIR%\*.pyc -end -item: Add Text to INSTALL.LOG - Text=File Tree: %MAINDIR%\*.pyo -end -item: Remark -end -item: Remark - Text=A: interpreter and libraries -end -item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000010 -end -item: Remark - Text=Executables -end -item: Install File - Source=.\python.exe - Destination=%MAINDIR%\python.exe - Flags=0000000000000010 -end -item: Install File - Source=.\pythonw.exe - Destination=%MAINDIR%\pythonw.exe - Flags=0000000000000010 -end -item: Install File - Source=.\w9xpopen.exe - Destination=%MAINDIR%\w9xpopen.exe - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Extension module DLLs (.pyd); keep in synch with libs directory next -end -item: Install File - Source=.\_winreg.pyd - Destination=%MAINDIR%\DLLs\_winreg.pyd - Description=Extension modules - Flags=0000000000000010 -end -item: Install File - Source=.\_csv.pyd - Destination=%MAINDIR%\DLLs\_csv.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_sre.pyd - Destination=%MAINDIR%\DLLs\_sre.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_ssl.pyd - Destination=%MAINDIR%\DLLs\_ssl.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_symtable.pyd - Destination=%MAINDIR%\DLLs\_symtable.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_testcapi.pyd - Destination=%MAINDIR%\DLLs\_testcapi.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_tkinter.pyd - Destination=%MAINDIR%\DLLs\_tkinter.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_socket.pyd - Destination=%MAINDIR%\DLLs\_socket.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_bsddb.pyd - Destination=%MAINDIR%\DLLs\_bsddb.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\bz2.pyd - Destination=%MAINDIR%\DLLs\bz2.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\datetime.pyd - Destination=%MAINDIR%\DLLs\datetime.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\mmap.pyd - Destination=%MAINDIR%\DLLs\mmap.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\parser.pyd - Destination=%MAINDIR%\DLLs\parser.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\pyexpat.pyd - Destination=%MAINDIR%\DLLs\pyexpat.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\select.pyd - Destination=%MAINDIR%\DLLs\select.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\unicodedata.pyd - Destination=%MAINDIR%\DLLs\unicodedata.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\winsound.pyd - Destination=%MAINDIR%\DLLs\winsound.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\zlib.pyd - Destination=%MAINDIR%\DLLs\zlib.pyd - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Link libraries (.lib); keep in synch with DLLs above, except that the Python lib lives here. -end -item: Install File - Source=.\_winreg.lib - Destination=%MAINDIR%\libs\_winreg.lib - Description=Link library files - Flags=0000000000000010 -end -item: Install File - Source=.\_csv.lib - Destination=%MAINDIR%\libs\_csv.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_sre.lib - Destination=%MAINDIR%\libs\_sre.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_ssl.lib - Destination=%MAINDIR%\libs\_ssl.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_symtable.lib - Destination=%MAINDIR%\libs\_symtable.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_testcapi.lib - Destination=%MAINDIR%\libs\_testcapi.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_tkinter.lib - Destination=%MAINDIR%\libs\_tkinter.lib - Description=Extension modules - Flags=0000000000000010 -end -item: Install File - Source=.\_socket.lib - Destination=%MAINDIR%\libs\_socket.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_bsddb.lib - Destination=%MAINDIR%\libs\_bsddb.lib - Flags=0000000000000010 -end -item: Install File - Source=.\bz2.lib - Destination=%MAINDIR%\libs\bz2.lib - Flags=0000000000000010 -end -item: Install File - Source=.\datetime.lib - Destination=%MAINDIR%\libs\datetime.lib - Flags=0000000000000010 -end -item: Install File - Source=.\mmap.lib - Destination=%MAINDIR%\libs\mmap.lib - Flags=0000000000000010 -end -item: Install File - Source=.\parser.lib - Destination=%MAINDIR%\libs\parser.lib - Flags=0000000000000010 -end -item: Install File - Source=.\pyexpat.lib - Destination=%MAINDIR%\libs\pyexpat.lib - Flags=0000000000000010 -end -item: Install File - Source=.\select.lib - Destination=%MAINDIR%\libs\select.lib - Flags=0000000000000010 -end -item: Install File - Source=.\unicodedata.lib - Destination=%MAINDIR%\libs\unicodedata.lib - Flags=0000000000000010 -end -item: Install File - Source=.\winsound.lib - Destination=%MAINDIR%\libs\winsound.lib - Flags=0000000000000010 -end -item: Install File - Source=.\zlib.lib - Destination=%MAINDIR%\libs\zlib.lib - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=.\python%_pymajor_%%_pyminor_%.lib - Destination=%MAINDIR%\libs\python%_PYMAJOR_%%_PYMINOR_%.lib - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Main Python DLL -end -item: Remark - Text=Tell Wise it's OK to delete the Python DLL at uninstall time, -end -item: Remark - Text=despite that we (may) write it into a system directory. -end -item: Add Text to INSTALL.LOG - Text=Non-System File: -end -item: Install File - Source=.\python%_pymajor_%%_pyminor_%.dll - Destination=%DLLDEST%\python%_PYMAJOR_%%_PYMINOR_%.dll - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Libraries (Lib/) -end -item: Install File - Source=..\lib\*.py - Destination=%MAINDIR%\Lib - Description=Library Modules - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\bsddb\*.py - Destination=%MAINDIR%\Lib\bsddb - Description=Berkeley database package - Flags=0000000100000010 -end -item: Remark -end -item: Install File - Source=..\lib\compiler\*.py - Destination=%MAINDIR%\Lib\compiler - Description=Python compiler written in Python - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\distutils\*.py - Destination=%MAINDIR%\Lib\distutils - Description=Distribution utility modules - Flags=0000000000000010 -end -item: Install File - Source=..\lib\distutils\readme - Destination=%MAINDIR%\Lib\distutils\README.txt - Flags=0000000000000010 -end -item: Install File - Source=..\lib\distutils\command\*.py - Destination=%MAINDIR%\Lib\distutils\command - Flags=0000000000000010 -end -item: Install File - Source=..\lib\distutils\command\wininst.exe - Destination=%MAINDIR%\Lib\distutils\command\wininst.exe - Flags=0000000000000010 -end -item: Install File - Source=..\lib\distutils\command\command_template - Destination=%MAINDIR%\Lib\distutils\command\command_template - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\email\*.py - Destination=%MAINDIR%\Lib\email - Description=Library email package - Flags=0000000000000010 -end -item: Install File - Source=..\lib\email\test\*.py - Destination=%MAINDIR%\Lib\email\test - Description=email tests - Flags=0000000000000010 -end -item: Install File - Source=..\lib\email\test\data\*.txt - Destination=%MAINDIR%\Lib\email\test\data - Description=email test data - Flags=0000000000000010 -end -item: Install File - Source=..\lib\email\test\data\*.gif - Destination=%MAINDIR%\Lib\email\test\data - Description=email test data - Flags=0000000000000010 -end -item: Install File - Source=..\lib\email\test\data\*.au - Destination=%MAINDIR%\Lib\email\test\data - Description=email test data - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\encodings\*.py - Destination=%MAINDIR%\Lib\encodings - Description=Unicode encoding tables - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\hotshot\*.py - Destination=%MAINDIR%\Lib\hotshot - Description=Fast Python profiler - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\lib-old\*.py - Destination=%MAINDIR%\Lib\lib-old - Description=Obsolete modules - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\lib-tk\*.py - Destination=%MAINDIR%\Lib\lib-tk - Description=Tkinter related library modules - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\logging\*.py - Destination=%MAINDIR%\Lib\logging - Description=Logging package - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\site-packages\readme - Destination=%MAINDIR%\Lib\site-packages\README.txt - Description=Site packages - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\xml\*.py - Destination=%MAINDIR%\Lib\xml - Description=XML support packages - Flags=0000000000000010 -end -item: Install File - Source=..\lib\xml\dom\*.py - Destination=%MAINDIR%\Lib\xml\dom - Flags=0000000000000010 -end -item: Install File - Source=..\lib\xml\parsers\*.py - Destination=%MAINDIR%\Lib\xml\parsers - Flags=0000000000000010 -end -item: Install File - Source=..\lib\xml\sax\*.py - Destination=%MAINDIR%\Lib\xml\sax - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=C Include files -end -item: Install File - Source=..\include\*.h - Destination=%MAINDIR%\include - Description=Header files - Flags=0000000000000010 -end -item: Install File - Source=..\pc\pyconfig.h - Destination=%MAINDIR%\include\pyconfig.h - Description=Header files (pyconfig.h) - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Microsoft C runtime libraries -end -item: Install File - Source=%_SYS_%\MSVCIRT.DLL - Destination=%DLLDEST%\MSVCIRT.DLL - Description=Visual C++ Runtime DLLs - Flags=0000011000010011 -end -item: Install File - Source=%_SYS_%\MSVCRT.DLL - Destination=%DLLDEST%\MSVCRT.DLL - Description=Visual C++ Runtime DLLs - Flags=0000011000010011 -end -item: End Block -end -item: Remark -end -item: Remark - Text=B: Tcl/Tk (Tkinter, IDLE, pydoc) -end -item: If/While Statement - Variable=COMPONENTS - Value=B - Flags=00000010 -end -item: Remark - Text=Tcl/Tk -end -item: Install File - Source=..\..\%_tcldir_%\bin\*.dll - Destination=%MAINDIR%\DLLs - Description=Tcl/Tk binaries and libraries - Flags=0000000000000010 -end -item: Install File - Source=..\..\%_tcldir_%\lib\*.* - Destination=%MAINDIR%\tcl - Description=Tcl/Tk binaries and libraries - Flags=0000000100000010 -end -item: Remark -end -item: Remark - Text=IDLE -end -item: Install File - Source=..\Lib\idlelib\*.py - Destination=%MAINDIR%\Lib\idlelib - Description=Integrated DeveLopment Environment for Python - Flags=0000000000000010 -end -item: Install File - Source=..\Lib\idlelib\*.txt - Destination=%MAINDIR%\Lib\idlelib - Description=Integrated DeveLopment Environment for Python - Flags=0000000000000010 -end -item: Install File - Source=..\Lib\idlelib\*.def - Destination=%MAINDIR%\Lib\idlelib - Description=Integrated DeveLopment Environment for Python - Flags=0000000000000010 -end -item: Install File - Source=..\Lib\idlelib\Icons\* - Destination=%MAINDIR%\Lib\idlelib\Icons - Description=Integrated DeveLopment Environment for Python - Flags=0000000000000010 -end -item: Install File - Source=..\Tools\scripts\idle - Destination=%MAINDIR%\Lib\idlelib\idle.pyw - Description=IDLE bootstrap script - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Windows pydoc driver -end -item: Install File - Source=..\tools\scripts\*.pyw - Destination=%MAINDIR%\Tools\Scripts - Description=Windows pydoc driver - Flags=0000000000000010 -end -item: End Block -end -item: Remark -end -item: Remark - Text=C: docs -end -item: If/While Statement - Variable=COMPONENTS - Value=C - Flags=00000010 -end -item: Install File - Source=%_DOC_%\*.* - Destination=%MAINDIR%\Doc - Description=Python Documentation (HTML) - Flags=0000000100000010 -end -item: End Block -end -item: Remark -end -item: Remark - Text=D: tools -end -item: If/While Statement - Variable=COMPONENTS - Value=D - Flags=00000010 -end -item: Install File - Source=..\tools\scripts\*.py - Destination=%MAINDIR%\Tools\Scripts - Description=Utility Scripts - Flags=0000000000000010 -end -item: Install File - Source=..\tools\scripts\*.doc - Destination=%MAINDIR%\Tools\Scripts - Description=Utility Scripts - Flags=0000000000000010 -end -item: Install File - Source=..\tools\scripts\readme - Destination=%MAINDIR%\Tools\Scripts\README.txt - Description=Utility Scripts - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\tools\webchecker\*.py - Destination=%MAINDIR%\Tools\webchecker - Description=Web checker tool - Flags=0000000000000010 -end -item: Install File - Source=..\tools\webchecker\readme - Destination=%MAINDIR%\Tools\webchecker\README.txt - Description=Web checker tool - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\tools\versioncheck\*.py - Destination=%MAINDIR%\Tools\versioncheck - Description=Version checker tool - Flags=0000000000000010 -end -item: Install File - Source=..\tools\versioncheck\readme - Destination=%MAINDIR%\Tools\versioncheck\README.txt - Description=Version checker tool - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\tools\pynche\*.py - Destination=%MAINDIR%\Tools\pynche - Description=pynche color editor - Flags=0000000000000010 -end -item: Install File - Source=..\tools\pynche\*.txt - Destination=%MAINDIR%\Tools\pynche - Description=pynche color editor - Flags=0000000000000010 -end -item: Install File - Source=..\tools\pynche\x\*.txt - Destination=%MAINDIR%\Tools\pynche\X - Description=pynche color editor - X files - Flags=0000000000000010 -end -item: Install File - Source=..\tools\pynche\readme - Destination=%MAINDIR%\Tools\pynche\README.txt - Description=pynche color editor - README - Flags=0000000100000010 -end -item: Install File - Source=..\tools\pynche\pynche - Destination=%MAINDIR%\Tools\pynche\pynche.py - Description=pynche color editor - main - Flags=0000000100000010 -end -item: Install File - Source=..\tools\pynche\pynche.pyw - Destination=%MAINDIR%\Tools\pynche\pynche.pyw - Description=pynche color editor - noconsole main - Flags=0000000100000010 -end -item: Remark -end -item: Install File - Source=..\tools\i18n\*.py - Destination=%MAINDIR%\Tools\i18n - Description=Internationalization helpers - Flags=0000000000000010 -end -item: End Block -end -item: Remark -end -item: Remark - Text=E: test suite -end -item: If/While Statement - Variable=COMPONENTS - Value=E - Flags=00000010 -end -item: Install File - Source=..\lib\test\audiotest.au - Destination=%MAINDIR%\Lib\test\audiotest.au - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.uue - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.py - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.xml - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.out - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.bz2 - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.tar - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.gz - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.txt - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\test\output\*.* - Destination=%MAINDIR%\Lib\test\output - Description=Python Test output files - Flags=0000000000000010 -end -item: End Block -end -item: Remark -end -item: Remark - Text=DONE with file copying. -end -item: Remark - Text=The rest is registry and Start Menu fiddling. -end -item: Remark -end -item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000010 -end -item: If/While Statement - Variable=TASKS - Value=A - Flags=00000010 -end -item: Remark - Text=Register file extensions. As usual, Admin privs get in the way, but with a twist: -end -item: Remark - Text=You don't need admin privs to write to HKEY_CLASSES_ROOT *except* under Win2K. -end -item: Remark - Text=On Win2K, a user without Admin privs has to register extensions under HKCU\Software\CLASSES instead. -end -item: Remark - Text=But while you can *do* that under other flavors of Windows too, it has no useful effect except in Win2K. -end -item: Set Variable - Variable=USE_HKCR - Value=1 -end -item: Check Configuration - Flags=11110010 -end -item: If/While Statement - Variable=DOADMIN - Value=0 -end -item: Set Variable - Variable=USE_HKCR - Value=0 -end -item: End Block -end -item: End Block -end -item: If/While Statement - Variable=USE_HKCR - Value=1 -end -item: Remark - Text=File types. -end -item: Edit Registry - Total Keys=1 - Key=Python.File - New Value=Python File -end -item: Edit Registry - Total Keys=1 - Key=Python.File\shell\open\command - New Value=%MAINDIR%\python.exe "%%1" %%* -end -item: Edit Registry - Total Keys=1 - Key=Python.File\DefaultIcon - New Value=%MAINDIR%\Py.ico -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Python.NoConFile - New Value=Python File (no console) -end -item: Edit Registry - Total Keys=1 - Key=Python.NoConFile\shell\open\command - New Value=%MAINDIR%\pythonw.exe "%%1" %%* -end -item: Edit Registry - Total Keys=1 - Key=Python.NoConFile\DefaultIcon - New Value=%MAINDIR%\Py.ico -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Python.CompiledFile - New Value=Compiled Python File -end -item: Edit Registry - Total Keys=1 - Key=Python.CompiledFile\shell\open\command - New Value=%MAINDIR%\python.exe "%%1" %%* -end -item: Edit Registry - Total Keys=1 - Key=Python.CompiledFile\DefaultIcon - New Value=%MAINDIR%\pyc.ico -end -item: Remark -end -item: Remark - Text=File extensions. -end -item: Edit Registry - Total Keys=1 - Key=.py - New Value=Python.File -end -item: Edit Registry - Total Keys=1 - Key=.py - New Value=text/plain - Value Name=Content Type -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=.pyw - New Value=Python.NoConFile -end -item: Edit Registry - Total Keys=1 - Key=.pyw - New Value=text/plain - Value Name=Content Type -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=.pyc - New Value=Python.CompiledFile -end -item: Edit Registry - Total Keys=1 - Key=.pyo - New Value=Python.CompiledFile -end -item: Else Statement -end -item: Remark - Text=File types. -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.File - New Value=Python File - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.File\shell\open\command - New Value=%MAINDIR%\python.exe "%%1" %%* - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.File\DefaultIcon - New Value=%MAINDIR%\Py.ico - Root=1 -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.NoConFile - New Value=Python File (no console) - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.NoConFile\shell\open\command - New Value=%MAINDIR%\pythonw.exe "%%1" %%* - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.NoConFile\DefaultIcon - New Value=%MAINDIR%\Py.ico - Root=1 -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.CompiledFile - New Value=Compiled Python File - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.CompiledFile\shell\open\command - New Value=%MAINDIR%\python.exe "%%1" %%* - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.CompiledFile\DefaultIcon - New Value=%MAINDIR%\pyc.ico - Root=1 -end -item: Remark -end -item: Remark - Text=File extensions. -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.py - New Value=Python.File - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.py - New Value=text/plain - Value Name=Content Type - Root=1 -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.pyw - New Value=Python.NoConFile - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.pyw - New Value=text/plain - Value Name=Content Type - Root=1 -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.pyc - New Value=Python.CompiledFile - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.pyo - New Value=Python.CompiledFile - Root=1 -end -item: End Block -end -item: Remark -end -item: Remark - Text=If we're installing IDLE, also set an Edit context menu action to use IDLE, for .py and .pyw files. -end -item: If/While Statement - Variable=COMPONENTS - Value=B - Flags=00000010 -end -item: If/While Statement - Variable=USE_HKCR - Value=1 -end -item: Edit Registry - Total Keys=1 - Key=Python.NoConFile\shell\Edit with IDLE\command - New Value=%MAINDIR%\pythonw.exe %MAINDIR%\Lib\idlelib\idle.pyw -n -e "%%1" -end -item: Edit Registry - Total Keys=1 - Key=Python.File\shell\Edit with IDLE\command - New Value=%MAINDIR%\pythonw.exe %MAINDIR%\Lib\idlelib\idle.pyw -n -e "%%1" -end -item: Else Statement -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.NoConFile\shell\Edit with IDLE\command - New Value=%MAINDIR%\pythonw.exe %MAINDIR%\Lib\idlelib\idle.pyw -n -e "%%1" - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.File\shell\Edit with IDLE\command - New Value=%MAINDIR%\pythonw.exe %MAINDIR%\Lib\idlelib\idle.pyw -n -e "%%1" - Root=1 -end -item: End Block -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=Register Python paths. -end -item: Remark - Text=Write to HKLM for admin, else HKCU. Keep these blocks otherwise identical! -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\CurrentVersion - Root=130 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\InstallPath - New Value=%MAINDIR% - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\InstallPath\InstallGroup - New Value=%CGROUP_SAVE% - New Value= - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\PythonPath - New Value=%MAINDIR%\Lib;%MAINDIR%\DLLs;%MAINDIR%\Lib\lib-tk - New Value= - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\Modules - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe - New Value=%MAINDIR%\Python.exe - Root=2 -end -item: Else Statement -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\CurrentVersion - Root=129 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\InstallPath - New Value=%MAINDIR% - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\InstallPath\InstallGroup - New Value=%CGROUP_SAVE% - New Value= - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\PythonPath - New Value=%MAINDIR%\Lib;%MAINDIR%\DLLs;%MAINDIR%\Lib\lib-tk - New Value= - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\Modules - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe - New Value=%MAINDIR%\Python.exe - Root=1 -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=Registry fiddling for docs. -end -item: Remark - Text=Write to HKLM for admin, else HKCU. Keep these blocks otherwise identical! -end -item: If/While Statement - Variable=COMPONENTS - Value=C - Flags=00000010 -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\Help\Main Python Documentation - New Value=%MAINDIR%\Doc\index.html - Root=2 -end -item: Else Statement -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\Help\Main Python Documentation - New Value=%MAINDIR%\Doc\index.html - Root=1 -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=Set the app publisher and URL entries for Win2K add/remove. -end -item: Remark - Text=It doesn't hurt on other systems. -end -item: Remark - Text=As usual, write to HKLM or HKCU depending on Admin privs. -end -item: Remark - Text=CAUTION: If you set this info on the "Windows 2000" page (step 6) of the -end -item: Remark - Text=Installation Expert, it only shows up in the "If" block below. Keep in synch! -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=http://www.python.org/ - Value Name=HelpLink - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=PythonLabs at Zope Corporation - Value Name=Publisher - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=http://www.python.org/ - Value Name=URLInfoAbout - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%PYVER_STRING% - Value Name=DisplayVersion - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%MAINDIR%\py.ico,-0 - Value Name=DisplayIcon - Root=2 -end -item: Else Statement -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=http://www.python.org/ - Value Name=HelpLink - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=PythonLabs at Zope Corporation - Value Name=Publisher - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=http://www.python.org/ - Value Name=URLInfoAbout - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%PYVER_STRING% - Value Name=DisplayVersion - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%MAINDIR%\py.ico,-0 - Value Name=DisplayIcon - Root=1 -end -item: End Block -end -item: Remark -end -item: Remark - Text=Populate Start Menu group -end -item: If/While Statement - Variable=TASKS - Value=B - Flags=00000010 -end -item: Remark - Text=Shortcut to installer no matter what. -end -item: Create Shortcut - Source=%MAINDIR%\unwise.exe - Destination=%GROUP%\Uninstall Python.lnk - Working Directory=%MAINDIR% - Key Type=1536 - Flags=00000001 -end -item: Remark -end -item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000010 -end -item: Create Shortcut - Source=%MAINDIR%\python.exe - Destination=%GROUP%\Python (command line).lnk - Working Directory=%MAINDIR% - Icon Pathname=%MAINDIR%\pycon.ico - Key Type=1536 - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=COMPONENTS - Value=B - Flags=00000010 -end -item: Create Shortcut - Source=%MAINDIR%\pythonw.exe - Destination=%GROUP%\IDLE (Python GUI).lnk - Command Options="%MAINDIR%\Lib\idlelib\idle.pyw" - Working Directory=%MAINDIR% - Key Type=1536 - Flags=00000001 -end -item: Create Shortcut - Source=%MAINDIR%\pythonw.exe - Destination=%GROUP%\Module Docs.lnk - Command Options="%MAINDIR%\Tools\Scripts\pydocgui.pyw" - Working Directory=%MAINDIR% - Key Type=1536 - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=COMPONENTS - Value=C - Flags=00000010 -end -item: Create Shortcut - Source=%MAINDIR%\Doc\index.html - Destination=%GROUP%\Python Manuals.lnk - Working Directory=%MAINDIR% - Key Type=1536 - Flags=00000001 -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=I don't think we need this, but have always done it. -end -item: Self-Register OCXs/DLLs - Description=Updating System Configuration, Please Wait... -end -item: Remark -end -remarked item: Remark - Text=Don't enable "Delete in-use files". Here's what happens: -end -remarked item: Remark - Text=Install Python; uninstall Python; install Python again. Reboot the machine. -end -remarked item: Remark - Text=Now UNWISE.EXE is missing. I think this is a Wise bug, but so it goes. -end -remarked item: Add Text to INSTALL.LOG - Text=Delete in-use files: On -end -item: Remark -end -item: Wizard Block - Direction Variable=DIRECTION - Display Variable=DISPLAY - Bitmap Pathname=.\installer.bmp - X Position=9 - Y Position=10 - Filler Color=11173759 - Flags=00000011 -end -item: Custom Dialog Set - Name=Finished - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Finish - Text French=&Fin - Text German=&Weiter - Text Spanish=&Terminar - Text Italian=&Fine - end - item: Push Button - Rectangle=264 234 320 253 - Variable=DISABLED - Value=! - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Static - Rectangle=108 10 323 48 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Installation Completed! - Text French=Installation termin?e ! - Text German=Die Installation ist abgeschlossen! - Text Spanish=?Instalaci?n terminada! - Text Italian=Installazione completata! - end - item: Static - Rectangle=108 44 320 82 - Create Flags=01010000000000000000000000000000 - Text=%APPTITLE% has been successfully installed. - Text= - Text=Press the Finish button to exit this installation. - Text French=%APPTITLE% est maintenant install?. - Text French= - Text French=Cliquez sur le bouton Fin pour quitter l'installation. - Text German=%APPTITLE% wurde erfolgreich installiert. - Text German= - Text German=Klicken Sie auf "Weiter", um die Installation zu beenden. - Text Spanish=%APPTITLE% se ha instalado con ?xito. - Text Spanish= - Text Spanish=Presione el bot?n Terminar para salir de esta instalaci?n. - Text Italian=L'installazione %APPTITLE% ? stata portata a termine con successo. - Text Italian= - Text Italian=Premere il pulsante Fine per uscire dall'installazione. - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=106 105 312 210 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000000 - Text=Special Windows thanks to: - Text= - Text=Wise Solutions, for the use of InstallMaster 8.1. - Text= http://www.wisesolutions.com/ - Text= - Text= - Text=LettError, Erik van Blokland, for the Python for Windows graphic. - Text= http://www.letterror.com/ - Text= - Text= - Text=Mark Hammond, without whose years of freely shared Windows expertise, Python for Windows would still be Python for DOS. - end - item: Static - Rectangle=106 95 312 96 - Action=3 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000001001 - end - end -end -item: End Block -end -item: New Event - Name=Cancel -end -item: Remark - Text=This include script supports a rollback to preinstallation state if the user chooses to cancel before the installation is complete. -end -item: Include Script - Pathname=%_WISE_%\INCLUDE\rollback.wse -end Deleted: /python/branches/release25-maint/PCbuild8/pythoncore.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/pythoncore.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,1938 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: python/branches/release25-maint/PCbuild8/pythoncore/pythoncore.vcproj ============================================================================== --- python/trunk/PCbuild8/pythoncore/pythoncore.vcproj (original) +++ python/branches/release25-maint/PCbuild8/pythoncore/pythoncore.vcproj Wed May 2 17:55:14 2007 @@ -720,10 +720,6 @@ > - - @@ -1386,10 +1382,6 @@ > - - @@ -1450,6 +1442,10 @@ > + + Deleted: /python/branches/release25-maint/PCbuild8/pythonw.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/pythonw.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,383 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: python/branches/release25-maint/PCbuild8/readme.txt ============================================================================== --- python/branches/release25-maint/PCbuild8/readme.txt (original) +++ python/branches/release25-maint/PCbuild8/readme.txt Wed May 2 17:55:14 2007 @@ -2,55 +2,66 @@ ------------------------------------- This directory is used to build Python for Win32 platforms, e.g. Windows 95, 98 and NT. It requires Microsoft Visual C++ 8.0 -(a.k.a. Visual Studio 2005). +(a.k.a. Visual Studio 2005). There are two Platforms defined, Win32 +and x64. (For other Windows platforms and compilers, see ../PC/readme.txt.) -All you need to do is open the workspace "pcbuild.sln" in VisualStudio 2005, -select the platform, select the Debug or Release setting -(using "Solution Configuration" from the "Standard" toolbar"), and build the -solution. - -The proper order to build subprojects: - -1) pythoncore (this builds the main Python DLL and library files, - python25.{dll, lib} in Release mode) - NOTE: in previous releases, this subproject was - named after the release number, e.g. python20. - -2) python (this builds the main Python executable, - python.exe in Release mode) - -3) the other subprojects, as desired or needed (note: you probably don't - want to build most of the other subprojects, unless you're building an - entire Python distribution from scratch, or specifically making changes - to the subsystems they implement, or are running a Python core buildbot - test slave; see SUBPROJECTS below) +All you need to do is open the workspace "pcbuild.sln" in MSVC++, select +the Debug or Release setting (using "Solution Configuration" from +the "Standard" toolbar"), and build the solution. -Binary files go into PCBuild8\Win32 or \x64 directories and don't -interfere with each other. +A .bat file, build.bat, is provided to simplify command line builds. + +Some of the subprojects rely on external libraries and won't build +unless you have them installed. + +Binary files go into PCBuild8\$(PlatformName)($ConfigurationName), +which will be something like Win32Debug, Win32Release, x64Release, etc. When using the Debug setting, the output files have a _d added to their name: python25_d.dll, python_d.exe, parser_d.pyd, and so on. -Profile guided Optimization: +PROFILER GUIDED OPTIMIZATION +---------------------------- +There are two special solution configurations for Profiler Guided +Optimization. Careful use of this has been shown to yield more than +10% extra speed. +1) Build the PGInstrument solution configuration. This will yield +binaries in the win32PGO or x64PGO folders. (You may want do start +by erasing any .pgc files there, present from earlier runs.) +2) Instrument the binaries. Do this by for example running the test +suite: win32PGO\python.exe ..\lib\test\regrtest.py. This will excercise +python thoroughly. +3) Build the PGUpdate solution configuration (You may need to ask it +to rebuild.) This will incorporate the information gathered in step 2 +and produce new binaries in the same win32PGO or x64pPGO folders. +4) (optional) You can continue to build the PGUpdate configuration as +you work on python. It will continue to use the data from step 2, even +if you add or modify files as part of your work. Thus, it makes sense to +run steps 1 and 2 maybe once a week, and then use step 3) for all regular +work. + +A .bat file, build_pgo.bat is included to automate this process + +You can convince yourself of the benefits of the PGO by comparing the +results of the python testsuite with the regular Release build. + + +C RUNTIME +--------- +Visual Studio 2005 uses version 8 of the C runtime. The executables are +linked to a CRT "side by side" assembly which must be present on the target +machine. This is avalible under the VC/Redist folder of your visual studio +distribution. Note that ServicePack1 of Visual Studio 2005 has a different +version than the original. On XP and later operating systems that support +side-by-side assemblies it is not enough to have the msvcrt80.dll present, +it has to be there as a whole assembly, that is, a folder with the .dll +and a .manifest. Also, a check is made for the correct version. +Therefore, one should distribute this assembly with the dlls, and keep +it in the same directory. For compatibility with older systems, one should +also set the PATH to this directory so that the dll can be found. +For more info, see the Readme in the VC/Redist folder. -There are two special configurations for the pythoncore project and -the solution. These are PGIRelease and PGORelease. They are for -creating profile-guided optimized versions of python.dll. -The former creates the instrumented binaries, and the latter -runs python.exe with the instrumented python.dll on the performance -testsuite, and creates a new, optimized, python.dll in -PCBuild8\Win32\PGORelease, or in the x64 folder. Note that although -we can cross-compile x64 binaries on a 32 bit machine, we cannot -create the PGO binaries, since they require actually running the code. - -To create the PGO binaries, first build the Release configuration, then -build the PGIRelease configuration and finally build the PGORelease -configuration. The last stage can take a while to complete as the -testsuite runs. -Note that the profile runs are stored in files such as -Win32\PGIRelease\pythoncore\python25!1.pgc which may -need to be cleared for fresh builds. SUBPROJECTS ----------- @@ -278,164 +289,22 @@ build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do this by hand. -Building for Itanium --------------------- - -The project files support a ReleaseItanium configuration which creates -Win64/Itanium binaries. For this to work, you need to install the Platform -SDK, in particular the 64-bit support. This includes an Itanium compiler -(future releases of the SDK likely include an AMD64 compiler as well). -In addition, you need the Visual Studio plugin for external C compilers, -from http://sf.net/projects/vsextcomp. The plugin will wrap cl.exe, to -locate the proper target compiler, and convert compiler options -accordingly. The project files require atleast version 0.8. Building for AMD64 ------------------ -The build process for the ReleaseAMD64 configuration is very similar -to the Itanium configuration; make sure you use the latest version of -vsextcomp. - -Building Python Using the free MS Toolkit Compiler --------------------------------------------------- - -The build process for Visual C++ can be used almost unchanged with the free MS -Toolkit Compiler. This provides a way of building Python using freely -available software. - -Requirements - - To build Python, the following tools are required: - - * The Visual C++ Toolkit Compiler - from http://msdn.microsoft.com/visualc/vctoolkit2003/ - * A recent Platform SDK - from http://www.microsoft.com/downloads/details.aspx?FamilyID=484269e2-3b89-47e3-8eb7-1f2be6d7123a - * The .NET 1.1 SDK - from http://www.microsoft.com/downloads/details.aspx?FamilyID=9b3a2ca6-3647-4070-9f41-a333c6b9181d - - [Does anyone have better URLs for the last 2 of these?] - - The toolkit compiler is needed as it is an optimising compiler (the - compiler supplied with the .NET SDK is a non-optimising version). The - platform SDK is needed to provide the Windows header files and libraries - (the Windows 2003 Server SP1 edition, typical install, is known to work - - other configurations or versions are probably fine as well). The .NET 1.1 - SDK is needed because it contains a version of msvcrt.dll which links to - the msvcr71.dll CRT. Note that the .NET 2.0 SDK is NOT acceptable, as it - references msvcr80.dll. - - All of the above items should be installed as normal. - - If you intend to build the openssl (needed for the _ssl extension) you - will need the C runtime sources installed as part of the platform SDK. - - In addition, you will need Nant, available from - http://nant.sourceforge.net. The 0.85 release candidate 3 version is known - to work. This is the latest released version at the time of writing. Later - "nightly build" versions are known NOT to work - it is not clear at - present whether future released versions will work. - -Setting up the environment - - Start a platform SDK "build environment window" from the start menu. The - "Windows XP 32-bit retail" version is known to work. - - Add the following directories to your PATH: - * The toolkit compiler directory - * The SDK "Win64" binaries directory - * The Nant directory - Add to your INCLUDE environment variable: - * The toolkit compiler INCLUDE directory - Add to your LIB environment variable: - * The toolkit compiler LIB directory - * The .NET SDK Visual Studio 2003 VC7\lib directory - - The following commands should set things up as you need them: - - rem Set these values according to where you installed the software - set TOOLKIT=C:\Program Files\Microsoft Visual C++ Toolkit 2003 - set SDK=C:\Program Files\Microsoft Platform SDK - set NET=C:\Program Files\Microsoft Visual Studio .NET 2003 - set NANT=C:\Utils\Nant - - set PATH=%TOOLKIT%\bin;%PATH%;%SDK%\Bin\win64;%NANT%\bin - set INCLUDE=%TOOLKIT%\include;%INCLUDE% - set LIB=%TOOLKIT%\lib;%NET%\VC7\lib;%LIB% - - The "win64" directory from the SDK is added to supply executables such as - "cvtres" and "lib", which are not available elsewhere. The versions in the - "win64" directory are 32-bit programs, so they are fine to use here. - - That's it. To build Python (the core only, no binary extensions which - depend on external libraries) you just need to issue the command - - nant -buildfile:python.build all - - from within the PCBuild directory. - -Extension modules - - To build those extension modules which require external libraries - (_tkinter, bz2, _bsddb, _sqlite3, _ssl) you can follow the instructions - for the Visual Studio build above, with a few minor modifications. These - instructions have only been tested using the sources in the Python - subversion repository - building from original sources should work, but - has not been tested. - - For each extension module you wish to build, you should remove the - associated include line from the excludeprojects section of pc.build. - - The changes required are: - - _tkinter - The tix makefile (tix-8.4.0\win\makefile.vc) must be modified to - remove references to TOOLS32. The relevant lines should be changed to - read: - cc32 = cl.exe - link32 = link.exe - include32 = - The remainder of the build instructions will work as given. - - bz2 - No changes are needed - - _bsddb - The file db.build should be copied from the Python PCBuild directory - to the directory db-4.4.20\build_win32. - - The file db_static.vcproj in db-4.4.20\build_win32 should be edited to - remove the string "$(SolutionDir)" - this occurs in 2 places, only - relevant for 64-bit builds. (The edit is required as otherwise, nant - wants to read the solution file, which is not in a suitable form). - - The bsddb library can then be build with the command - nant -buildfile:db.build all - run from the db-4.4.20\build_win32 directory. - - _sqlite3 - No changes are needed. However, in order for the tests to succeed, a - copy of sqlite3.dll must be downloaded, and placed alongside - python.exe. - - _ssl - The documented build process works as written. However, it needs a - copy of the file setargv.obj, which is not supplied in the platform - SDK. However, the sources are available (in the crt source code). To - build setargv.obj, proceed as follows: - - Copy setargv.c, cruntime.h and internal.h from %SDK%\src\crt to a - temporary directory. - Compile using "cl /c /I. /MD /D_CRTBLD setargv.c" - Copy the resulting setargv.obj to somewhere on your LIB environment - (%SDK%\lib is a reasonable place). +Select x64 as the destination platform. - With setargv.obj in place, the standard build process should work - fine. YOUR OWN EXTENSION DLLs ----------------------- If you want to create your own extension module DLL, there's an example with easy-to-follow instructions in ../PC/example/; read the file readme.txt there first. +Also, you can simply use Visual Studio to "Add new project to solution". +Elect to create a win32 project, .dll, empty project. +This will create a subdirectory with a .vcproj file in it. Now, You can +simply copy most of another .vcproj, like _test_capi/_test_capi.vcproj over +(you can't just copy and rename it, since the target will have a unique GUID.) +At some point we want to be able to provide a template for creating a +project. Modified: python/branches/release25-maint/PCbuild8/rmpyc.py ============================================================================== --- python/branches/release25-maint/PCbuild8/rmpyc.py (original) +++ python/branches/release25-maint/PCbuild8/rmpyc.py Wed May 2 17:55:14 2007 @@ -1,4 +1,5 @@ # Remove all the .pyc and .pyo files under ../Lib. +import sys def deltree(root): @@ -21,5 +22,9 @@ return npyc, npyo -npyc, npyo = deltree("../Lib") +path = "../Lib" +if len(sys.argv) > 1: + path = sys.argv[1] + +npyc, npyo = deltree(path) print npyc, ".pyc deleted,", npyo, ".pyo deleted" Modified: python/branches/release25-maint/PCbuild8/rt.bat ============================================================================== --- python/branches/release25-maint/PCbuild8/rt.bat (original) +++ python/branches/release25-maint/PCbuild8/rt.bat Wed May 2 17:55:14 2007 @@ -2,6 +2,8 @@ rem Run Tests. Run the regression test suite. rem Usage: rt [-d] [-O] [-q] regrtest_args rem -d Run Debug build (python_d.exe). Else release build. +rem -pgo Run PGO build, e.g. for instrumentation +rem -x64 Run the x64 version, otherwise win32 rem -O Run python.exe or python_d.exe (see -d) with -O. rem -q "quick" -- normally the tests are run twice, the first time rem after deleting all the .py[co] files reachable from Lib/. @@ -24,16 +26,21 @@ setlocal -set exe=python +set platf=win32 +set exe=python.exe set qmode= set dashO= +set conf=Release PATH %PATH%;..\..\tcltk\bin :CheckOpts if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts -if "%1"=="-d" (set exe=python_d) & shift & goto CheckOpts +if "%1"=="-d" (set exe=python_d.exe) & (set conf=Debug) & shift & goto CheckOpts +if "%1"=="-x64" (set platf=x64) & shift & goto CheckOpts +if "%1"=="-pgo" (set conf=PGO) & shift & goto CheckOpts +set exe=%platf%%conf%\%exe% set cmd=%exe% %dashO% -E -tt ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 if defined qmode goto Qmode Deleted: /python/branches/release25-maint/PCbuild8/select.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/select.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,379 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/unicodedata.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/unicodedata.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,371 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/release25-maint/PCbuild8/w9xpopen.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/w9xpopen.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Added: python/branches/release25-maint/PCbuild8/w9xpopen/w9xpopen.vcproj ============================================================================== --- (empty file) +++ python/branches/release25-maint/PCbuild8/w9xpopen/w9xpopen.vcproj Wed May 2 17:55:14 2007 @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deleted: /python/branches/release25-maint/PCbuild8/winsound.vcproj ============================================================================== --- /python/branches/release25-maint/PCbuild8/winsound.vcproj Wed May 2 17:55:14 2007 +++ (empty file) @@ -1,375 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From python-checkins at python.org Wed May 2 18:02:57 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 2 May 2007 18:02:57 +0200 (CEST) Subject: [Python-checkins] r55073 - python/branches/release25-maint/Python/import.c python/branches/release25-maint/Python/pythonrun.c Message-ID: <20070502160257.249361E4009@bag.python.org> Author: kristjan.jonsson Date: Wed May 2 18:02:48 2007 New Revision: 55073 Modified: python/branches/release25-maint/Python/import.c python/branches/release25-maint/Python/pythonrun.c Log: Undefine the Yield macro after including Python_ast.h where it may cause conflicts with winbase.h on Windows. Modified: python/branches/release25-maint/Python/import.c ============================================================================== --- python/branches/release25-maint/Python/import.c (original) +++ python/branches/release25-maint/Python/import.c Wed May 2 18:02:48 2007 @@ -4,6 +4,8 @@ #include "Python.h" #include "Python-ast.h" +#undef Yield /* to avoid conflict with winbase.h */ + #include "pyarena.h" #include "pythonrun.h" #include "errcode.h" Modified: python/branches/release25-maint/Python/pythonrun.c ============================================================================== --- python/branches/release25-maint/Python/pythonrun.c (original) +++ python/branches/release25-maint/Python/pythonrun.c Wed May 2 18:02:48 2007 @@ -4,6 +4,8 @@ #include "Python.h" #include "Python-ast.h" +#undef Yield /* to avoid conflict with winbase.h */ + #include "grammar.h" #include "node.h" #include "token.h" From python-checkins at python.org Wed May 2 18:08:55 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 2 May 2007 18:08:55 +0200 (CEST) Subject: [Python-checkins] r55074 - python/branches/release25-maint/PCbuild8/pyd.vsprops python/branches/release25-maint/PCbuild8/pyd_d.vsprops python/branches/release25-maint/PCbuild8/pyproject.vsprops Message-ID: <20070502160855.193061E4009@bag.python.org> Author: kristjan.jonsson Date: Wed May 2 18:08:51 2007 New Revision: 55074 Modified: python/branches/release25-maint/PCbuild8/pyd.vsprops python/branches/release25-maint/PCbuild8/pyd_d.vsprops python/branches/release25-maint/PCbuild8/pyproject.vsprops Log: Additional changes to the property sheets in PCBuild8. Visual Studio doesn's save those when it builds, unlike the .vcproj files, so I chekced in out-of-date versions. Modified: python/branches/release25-maint/PCbuild8/pyd.vsprops ============================================================================== --- python/branches/release25-maint/PCbuild8/pyd.vsprops (original) +++ python/branches/release25-maint/PCbuild8/pyd.vsprops Wed May 2 18:08:51 2007 @@ -8,6 +8,7 @@ Modified: python/branches/release25-maint/PCbuild8/pyd_d.vsprops ============================================================================== --- python/branches/release25-maint/PCbuild8/pyd_d.vsprops (original) +++ python/branches/release25-maint/PCbuild8/pyd_d.vsprops Wed May 2 18:08:51 2007 @@ -8,7 +8,7 @@ Modified: python/branches/release25-maint/PCbuild8/pyproject.vsprops ============================================================================== --- python/branches/release25-maint/PCbuild8/pyproject.vsprops (original) +++ python/branches/release25-maint/PCbuild8/pyproject.vsprops Wed May 2 18:08:51 2007 @@ -17,7 +17,7 @@ /> Author: andrew.kuchling Date: Wed May 2 19:49:05 2007 New Revision: 55075 Modified: peps/trunk/pep-3002.txt Log: Typo fix Modified: peps/trunk/pep-3002.txt ============================================================================== --- peps/trunk/pep-3002.txt (original) +++ peps/trunk/pep-3002.txt Wed May 2 19:49:05 2007 @@ -39,7 +39,7 @@ problematic in Python 3000 -Python Enchancement Proposals +Python Enhancement Proposals ============================= Every backwards-incompatible change must be accompanied by a PEP. From python-checkins at python.org Wed May 2 20:40:08 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 2 May 2007 20:40:08 +0200 (CEST) Subject: [Python-checkins] r55076 - in sandbox/trunk/2to3: example.py fixes/fix_unicode.py tests/test_fixers.py Message-ID: <20070502184008.8C25C1E4010@bag.python.org> Author: guido.van.rossum Date: Wed May 2 20:40:02 2007 New Revision: 55076 Added: sandbox/trunk/2to3/fixes/fix_unicode.py (contents, props changed) Modified: sandbox/trunk/2to3/example.py sandbox/trunk/2to3/tests/test_fixers.py Log: Bare-bones fixer to get rid of u"..." and unicode(x). Modified: sandbox/trunk/2to3/example.py ============================================================================== --- sandbox/trunk/2to3/example.py (original) +++ sandbox/trunk/2to3/example.py Wed May 2 20:40:02 2007 @@ -30,6 +30,16 @@ import sys +def unicode_examples(): + a = unicode(b) + a = u"xxx" + a = U"""xxx""" + a = ur'xxx' + a = UR'''xxx''' + a = Ur"xxx" + a = uR"""xxx""" + b = u"..." u'...' + def ne_examples(): if x <> y: pass Added: sandbox/trunk/2to3/fixes/fix_unicode.py ============================================================================== --- (empty file) +++ sandbox/trunk/2to3/fixes/fix_unicode.py Wed May 2 20:40:02 2007 @@ -0,0 +1,26 @@ +"""Fixer that changes unicode to str and u"..." into "...". + +""" + +import re +import pytree +from pgen2 import token +from fixes import basefix + +class FixUnicode(basefix.BaseFix): + + PATTERN = "STRING | NAME<'unicode'>" + + def transform(self, node): + if node.type == token.NAME: + if node.value == "unicode": + new = node.clone() + new.value = "str" + return new + # XXX Warn when __unicode__ found? + elif node.type == token.STRING: + if re.match(r"[uU][rR]?[\'\"]", node.value): + new = node.clone() + new.value = new.value[1:] + return new + return None Modified: sandbox/trunk/2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/tests/test_fixers.py Wed May 2 20:40:02 2007 @@ -25,7 +25,7 @@ def __getattr__(self, attr): return getattr(self.fixer, attr) - + def start_tree(self, tree, filename): self.fixer.start_tree(tree, filename) self.fixer.logger.handlers[:] = [self.handler] @@ -616,32 +616,32 @@ b = """raise Exception, (5, 6, 7)""" a = """raise Exception(5, 6, 7)""" self.check(b, a) - + def test_tuple_detection(self): b = """raise E, (5, 6) % (a, b)""" a = """raise E((5, 6) % (a, b))""" self.check(b, a) - + def test_tuple_exc_1(self): b = """raise (((E1, E2), E3), E4), V""" a = """raise E1(V)""" self.check(b, a) - + def test_tuple_exc_2(self): b = """raise (E1, (E2, E3), E4), V""" a = """raise E1(V)""" self.check(b, a) - + # These should produce a warning - + def test_string_exc(self): s = """raise 'foo'""" self.warns(s, s, "Python 3 does not support string exceptions") - + def test_string_exc_val(self): s = """raise "foo", 5""" self.warns(s, s, "Python 3 does not support string exceptions") - + def test_string_exc_val_tb(self): s = """raise "foo", 5, 6""" self.warns(s, s, "Python 3 does not support string exceptions") @@ -725,7 +725,7 @@ b = """5 + g.throw(Exception, 5)""" a = """5 + g.throw(Exception(5))""" self.check(b, a) - + # These should produce warnings def test_warn_1(self): @@ -1030,22 +1030,22 @@ class Test_xrange(FixerTestCase): fixer = "xrange" - + def test_1(self): b = """x = xrange(10)""" a = """x = range(10)""" self.check(b, a) - + def test_2(self): b = """x = xrange(1, 10)""" a = """x = range(1, 10)""" self.check(b, a) - + def test_3(self): b = """x = xrange(0, 10, 2)""" a = """x = range(0, 10, 2)""" self.check(b, a) - + def test_4(self): b = """for i in xrange(10):\n j=i""" a = """for i in range(10):\n j=i""" @@ -1054,17 +1054,17 @@ class Test_raw_input(FixerTestCase): fixer = "raw_input" - + def test_1(self): b = """x = raw_input()""" a = """x = input()""" self.check(b, a) - + def test_2(self): b = """x = raw_input('')""" a = """x = input('')""" self.check(b, a) - + def test_3(self): b = """x = raw_input('prompt')""" a = """x = input('prompt')""" @@ -1073,131 +1073,131 @@ class Test_input(FixerTestCase): fixer = "input" - + def test_1(self): b = """x = input()""" a = """x = eval(input())""" self.check(b, a) - + def test_2(self): b = """x = input('')""" a = """x = eval(input(''))""" self.check(b, a) - + def test_3(self): b = """x = input('prompt')""" a = """x = eval(input('prompt'))""" self.check(b, a) - - + + class Test_tuple_params(FixerTestCase): fixer = "tuple_params" - + def test_unchanged_1(self): s = """def foo(): pass""" self.check(s, s) - + def test_unchanged_2(self): s = """def foo(a, b, c): pass""" self.check(s, s) - + def test_unchanged_3(self): s = """def foo(a=3, b=4, c=5): pass""" self.check(s, s) - + def test_1(self): b = """ def foo(((a, b), c)): x = 5""" - + a = """ def foo(xxx_todo_changeme): ((a, b), c) = xxx_todo_changeme x = 5""" self.check(b, a) - + def test_2(self): b = """ def foo(((a, b), c), d): x = 5""" - + a = """ def foo(xxx_todo_changeme, d): ((a, b), c) = xxx_todo_changeme x = 5""" self.check(b, a) - + def test_3(self): b = """ def foo(((a, b), c), d) -> e: x = 5""" - + a = """ def foo(xxx_todo_changeme, d) -> e: ((a, b), c) = xxx_todo_changeme x = 5""" self.check(b, a) - + def test_semicolon(self): b = """ def foo(((a, b), c)): x = 5; y = 7""" - + a = """ def foo(xxx_todo_changeme): ((a, b), c) = xxx_todo_changeme; x = 5; y = 7""" self.check(b, a) - + def test_keywords(self): b = """ def foo(((a, b), c), d, e=5) -> z: x = 5""" - + a = """ def foo(xxx_todo_changeme, d, e=5) -> z: ((a, b), c) = xxx_todo_changeme x = 5""" self.check(b, a) - + def test_varargs(self): b = """ def foo(((a, b), c), d, *vargs, **kwargs) -> z: x = 5""" - + a = """ def foo(xxx_todo_changeme, d, *vargs, **kwargs) -> z: ((a, b), c) = xxx_todo_changeme x = 5""" self.check(b, a) - + def test_multi_1(self): b = """ def foo(((a, b), c), (d, e, f)) -> z: x = 5""" - + a = """ def foo(xxx_todo_changeme, xxx_todo_changeme1) -> z: ((a, b), c) = xxx_todo_changeme (d, e, f) = xxx_todo_changeme1 x = 5""" self.check(b, a) - + def test_multi_2(self): b = """ def foo(x, ((a, b), c), d, (e, f, g), y) -> z: x = 5""" - + a = """ def foo(x, xxx_todo_changeme, d, xxx_todo_changeme1, y) -> z: ((a, b), c) = xxx_todo_changeme (e, f, g) = xxx_todo_changeme1 x = 5""" self.check(b, a) - + def test_docstring(self): b = """ def foo(((a, b), c), (d, e, f)) -> z: "foo foo foo foo" x = 5""" - + a = """ def foo(xxx_todo_changeme, xxx_todo_changeme1) -> z: "foo foo foo foo" @@ -1205,64 +1205,64 @@ (d, e, f) = xxx_todo_changeme1 x = 5""" self.check(b, a) - + def test_lambda_no_change(self): s = """lambda x: x + 5""" self.check(s, s) - + def test_lambda_simple(self): b = """lambda (x, y): x + f(y)""" a = """lambda x_y: x_y[0] + f(x_y[1])""" self.check(b, a) - + def test_lambda_simple_multi_use(self): b = """lambda (x, y): x + x + f(x) + x""" a = """lambda x_y: x_y[0] + x_y[0] + f(x_y[0]) + x_y[0]""" self.check(b, a) - + def test_lambda_simple_reverse(self): b = """lambda (x, y): y + x""" a = """lambda x_y: x_y[1] + x_y[0]""" self.check(b, a) - + def test_lambda_nested(self): b = """lambda (x, (y, z)): x + y + z""" a = """lambda x_y_z: x_y_z[0] + x_y_z[1][0] + x_y_z[1][1]""" self.check(b, a) - + def test_lambda_nested_multi_use(self): b = """lambda (x, (y, z)): x + y + f(y)""" a = """lambda x_y_z: x_y_z[0] + x_y_z[1][0] + f(x_y_z[1][0])""" self.check(b, a) - + class Test_next(FixerTestCase): fixer = "next" - + def test_1(self): b = """it.next()""" a = """next(it)""" self.check(b, a) - + def test_2(self): b = """a.b.c.d.next()""" a = """next(a.b.c.d)""" self.check(b, a) - + def test_3(self): b = """(a + b).next()""" a = """next((a + b))""" self.check(b, a) - + def test_4(self): b = """a().next()""" a = """next(a())""" self.check(b, a) - + def test_5(self): b = """a().next() + b""" a = """next(a()) + b""" self.check(b, a) - + def test_method_1(self): b = """ class A: @@ -1275,7 +1275,7 @@ pass """ self.check(b, a) - + def test_method_2(self): b = """ class A(object): @@ -1288,7 +1288,7 @@ pass """ self.check(b, a) - + def test_method_3(self): b = """ class A: @@ -1301,16 +1301,16 @@ pass """ self.check(b, a) - + def test_method_4(self): b = """ class A: def __init__(self, foo): self.foo = foo - + def next(self): pass - + def __iter__(self): return self """ @@ -1318,15 +1318,15 @@ class A: def __init__(self, foo): self.foo = foo - + def __next__(self): pass - + def __iter__(self): return self """ self.check(b, a) - + def test_method_unchanged(self): s = """ class A: @@ -1334,227 +1334,227 @@ pass """ self.check(s, s) - + def test_shadowing_assign_simple(self): s = """ next = foo - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_assign_tuple_1(self): s = """ (next, a) = foo - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_assign_tuple_2(self): s = """ (a, (b, (next, c)), a) = foo - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_assign_list_1(self): s = """ [next, a] = foo - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_assign_list_2(self): s = """ [a, [b, [next, c]], a] = foo - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_builtin_assign(self): s = """ def foo(): __builtin__.next = foo - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_builtin_assign_in_tuple(self): s = """ def foo(): (a, __builtin__.next) = foo - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_builtin_assign_in_list(self): s = """ def foo(): [a, __builtin__.next] = foo - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_assign_to_next(self): s = """ def foo(): A.next = foo - + class A: def next(self, a, b): pass """ self.check(s, s) - + def test_assign_to_next_in_tuple(self): s = """ def foo(): (a, A.next) = foo - + class A: def next(self, a, b): pass """ self.check(s, s) - + def test_assign_to_next_in_list(self): s = """ def foo(): [a, A.next] = foo - + class A: def next(self, a, b): pass """ self.check(s, s) - + def test_shadowing_import_1(self): s = """ import foo.bar as next - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_import_2(self): s = """ import bar, bar.foo as next - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_import_3(self): s = """ import bar, bar.foo as next, baz - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_import_from_1(self): s = """ from x import next - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_import_from_2(self): s = """ from x.a import next - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_import_from_3(self): s = """ from x import a, next, b - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_import_from_4(self): s = """ from x.a import a, next, b - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_funcdef_1(self): s = """ def next(a): pass - + class A: def next(self, a, b): pass """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_funcdef_2(self): b = """ def next(a): pass - + class A: def next(self): pass - + it.next() """ a = """ def next(a): pass - + class A: def __next__(self): pass - + it.__next__() """ self.warns(b, a, "Calls to builtin next() possibly shadowed") - + def test_shadowing_global_1(self): s = """ def f(): @@ -1562,7 +1562,7 @@ next = 5 """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_global_2(self): s = """ def f(): @@ -1570,55 +1570,55 @@ next = 5 """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_for_simple(self): s = """ for next in it(): pass - + b = 5 c = 6 """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_for_tuple_1(self): s = """ for next, b in it(): pass - + b = 5 c = 6 """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_shadowing_for_tuple_2(self): s = """ for a, (next, c), b in it(): pass - + b = 5 c = 6 """ self.warns(s, s, "Calls to builtin next() possibly shadowed") - + def test_noncall_access_1(self): b = """gnext = g.next""" a = """gnext = g.__next__""" self.check(b, a) - + def test_noncall_access_2(self): b = """f(g.next + 5)""" a = """f(g.__next__ + 5)""" self.check(b, a) - + def test_noncall_access_3(self): b = """f(g().next + 5)""" a = """f(g().__next__ + 5)""" self.check(b, a) - + class Test_nonzero(FixerTestCase): fixer = "nonzero" - + def test_1(self): b = """ class A: @@ -1631,7 +1631,7 @@ pass """ self.check(b, a) - + def test_2(self): b = """ class A(object): @@ -1644,7 +1644,7 @@ pass """ self.check(b, a) - + def test_unchanged_1(self): s = """ class A(object): @@ -1652,7 +1652,7 @@ pass """ self.check(s, s) - + def test_unchanged_2(self): s = """ class A(object): @@ -1660,52 +1660,52 @@ pass """ self.check(s, s) - + def test_unchanged_func(self): s = """ def __nonzero__(self): pass """ self.check(s, s) - + class Test_numliterals(FixerTestCase): fixer = "numliterals" - + def test_complex_bare_int(self): b = """4J""" a = """4j""" self.check(b, a) - + def test_complex_bare_float(self): b = """4.4J""" a = """4.4j""" self.check(b, a) - + def test_complex_int(self): b = """5 + 4J""" a = """5 + 4j""" self.check(b, a) - + def test_complex_float(self): b = """5.4 + 4.9J""" a = """5.4 + 4.9j""" self.check(b, a) - + def test_exp_1(self): b = """5E10""" a = """5e10""" self.check(b, a) - + def test_exp_2(self): b = """5.0E10""" a = """5.0e10""" self.check(b, a) - + def test_octal_1(self): b = """0755""" a = """0o755""" self.check(b, a) - + def test_hex_1(self): b = """0XABC""" a = """0xABC""" @@ -1725,41 +1725,64 @@ b = """b = 0x12l""" a = """b = 0x12""" self.check(b, a) - + def test_unchanged_int(self): s = """5""" self.check(s, s) - + def test_unchanged_float(self): s = """5.0""" self.check(s, s) - + def test_unchanged_octal(self): s = """0o755""" self.check(s, s) - + def test_unchanged_hex(self): s = """0xABC""" self.check(s, s) - + def test_unchanged_exp(self): s = """5.0e10""" self.check(s, s) - + def test_unchanged_complex_int(self): s = """5 + 4j""" self.check(s, s) - + def test_unchanged_complex_float(self): s = """5.4 + 4.9j""" self.check(s, s) - + def test_unchanged_complex_bare(self): s = """4j""" self.check(s, s) s = """4.4j""" self.check(s, s) +class Test_unicode(FixerTestCase): + fixer = "unicode" + + def test_unicode_call(self): + b = """unicode(x, y, z)""" + a = """str(x, y, z)""" + self.check(b, a) + + def test_unicode_literal_1(self): + b = '''u"x"''' + a = '''"x"''' + self.check(b, a) + + def test_unicode_literal_2(self): + b = """ur'x'""" + a = """r'x'""" + self.check(b, a) + + def test_unicode_literal_3(self): + b = """UR'''x'''""" + a = """R'''x'''""" + self.check(b, a) + if __name__ == "__main__": import __main__ From python-checkins at python.org Wed May 2 21:02:12 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 2 May 2007 21:02:12 +0200 (CEST) Subject: [Python-checkins] r55078 - in sandbox/trunk/2to3: Grammar.txt pgen2/tokenize.py Message-ID: <20070502190212.6B5C91E4010@bag.python.org> Author: guido.van.rossum Date: Wed May 2 21:02:07 2007 New Revision: 55078 Modified: sandbox/trunk/2to3/Grammar.txt sandbox/trunk/2to3/pgen2/tokenize.py Log: Hack the grammar to support nonlocal. Add b"..." support to the tokenizer. Modified: sandbox/trunk/2to3/Grammar.txt ============================================================================== --- sandbox/trunk/2to3/Grammar.txt (original) +++ sandbox/trunk/2to3/Grammar.txt Wed May 2 21:02:07 2007 @@ -76,7 +76,7 @@ import_as_names: import_as_name (',' import_as_name)* [','] dotted_as_names: dotted_as_name (',' dotted_as_name)* dotted_name: NAME ('.' NAME)* -global_stmt: 'global' NAME (',' NAME)* +global_stmt: ('global' | 'nonlocal') NAME (',' NAME)* exec_stmt: 'exec' expr ['in' test [',' test]] assert_stmt: 'assert' test [',' test] Modified: sandbox/trunk/2to3/pgen2/tokenize.py ============================================================================== --- sandbox/trunk/2to3/pgen2/tokenize.py (original) +++ sandbox/trunk/2to3/pgen2/tokenize.py Wed May 2 21:02:07 2007 @@ -87,9 +87,9 @@ Token = Ignore + PlainToken # First (or only) line of ' or " string. -ContStr = group(r"[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*" + +ContStr = group(r"[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*" + group("'", r'\\\r?\n'), - r'[uU]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*' + + r'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*' + group('"', r'\\\r?\n')) PseudoExtras = group(r'\\\r?\n', Comment, Triple) PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name) @@ -100,13 +100,21 @@ "'''": single3prog, '"""': double3prog, "r'''": single3prog, 'r"""': double3prog, "u'''": single3prog, 'u"""': double3prog, + "b'''": single3prog, 'b"""': double3prog, "ur'''": single3prog, 'ur"""': double3prog, + "br'''": single3prog, 'br"""': double3prog, "R'''": single3prog, 'R"""': double3prog, "U'''": single3prog, 'U"""': double3prog, + "B'''": single3prog, 'B"""': double3prog, "uR'''": single3prog, 'uR"""': double3prog, "Ur'''": single3prog, 'Ur"""': double3prog, "UR'''": single3prog, 'UR"""': double3prog, - 'r': None, 'R': None, 'u': None, 'U': None} + "bR'''": single3prog, 'bR"""': double3prog, + "Br'''": single3prog, 'Br"""': double3prog, + "BR'''": single3prog, 'BR"""': double3prog, + 'r': None, 'R': None, + 'u': None, 'U': None, + 'b': None, 'B': None} triple_quoted = {} for t in ("'''", '"""', From python-checkins at python.org Wed May 2 21:10:59 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 2 May 2007 21:10:59 +0200 (CEST) Subject: [Python-checkins] r55079 - in python/branches/py3k-struni/Lib: HTMLParser.py codecs.py compiler/transformer.py cookielib.py copy.py ctypes/__init__.py ctypes/macholib/dyld.py ctypes/test/test_as_parameter.py ctypes/test/test_buffers.py ctypes/test/test_functions.py ctypes/test/test_parameters.py ctypes/test/test_prototypes.py ctypes/test/test_slicing.py ctypes/test/test_strings.py ctypes/test/test_structures.py ctypes/test/test_unicode.py distutils/command/bdist_wininst.py distutils/command/build_clib.py distutils/command/register.py doctest.py email/charset.py email/generator.py email/header.py email/message.py email/test/test_email.py email/test/test_email_codecs.py email/test/test_email_codecs_renamed.py email/test/test_email_renamed.py email/utils.py encodings/__init__.py encodings/cp037.py encodings/cp1006.py encodings/cp1026.py encodings/cp1140.py encodings/cp1250.py encodings/cp1251.py encodings/cp1252.py encodings/cp1253.py encodings/cp1254.py encodings/cp1255.py encodings/cp1256.py encodings/cp1257.py encodings/cp1258.py encodings/cp424.py encodings/cp437.py encodings/cp500.py encodings/cp737.py encodings/cp775.py encodings/cp850.py encodings/cp852.py encodings/cp855.py encodings/cp856.py encodings/cp857.py encodings/cp860.py encodings/cp861.py encodings/cp862.py encodings/cp863.py encodings/cp864.py encodings/cp865.py encodings/cp866.py encodings/cp869.py encodings/cp874.py encodings/cp875.py encodings/idna.py encodings/iso8859_1.py encodings/iso8859_10.py encodings/iso8859_11.py encodings/iso8859_13.py encodings/iso8859_14.py encodings/iso8859_15.py encodings/iso8859_16.py encodings/iso8859_2.py encodings/iso8859_3.py encodings/iso8859_4.py encodings/iso8859_5.py encodings/iso8859_6.py encodings/iso8859_7.py encodings/iso8859_8.py encodings/iso8859_9.py encodings/koi8_r.py encodings/koi8_u.py encodings/mac_arabic.py encodings/mac_centeuro.py encodings/mac_croatian.py encodings/mac_cyrillic.py encodings/mac_farsi.py encodings/mac_greek.py encodings/mac_iceland.py encodings/mac_roman.py encodings/mac_romanian.py encodings/mac_turkish.py encodings/punycode.py encodings/tis_620.py encodings/utf_8_sig.py gettext.py glob.py idlelib/EditorWindow.py idlelib/IOBinding.py idlelib/OutputWindow.py idlelib/PyParse.py idlelib/PyShell.py lib-tk/Tkinter.py msilib/schema.py msilib/sequence.py msilib/text.py pickle.py pickletools.py plat-mac/EasyDialogs.py plat-mac/FrameWork.py plat-mac/aepack.py plat-mac/buildtools.py plat-mac/macostools.py plat-mac/macresource.py plat-mac/plistlib.py sqlite3/test/dbapi.py sqlite3/test/factory.py sqlite3/test/types.py sqlite3/test/userfunctions.py stringprep.py tarfile.py test/bad_coding2.py test/pickletester.py test/string_tests.py test/test_StringIO.py test/test_array.py test/test_bigmem.py test/test_binascii.py test/test_bool.py test/test_builtin.py test/test_bytes.py test/test_cfgparser.py test/test_charmapcodec.py test/test_codeccallbacks.py test/test_codecencodings_cn.py test/test_codecencodings_hk.py test/test_codecencodings_jp.py test/test_codecencodings_kr.py test/test_codecencodings_tw.py test/test_codecmaps_jp.py test/test_codecmaps_kr.py test/test_codecmaps_tw.py test/test_codecs.py test/test_compile.py test/test_complex.py test/test_contains.py test/test_cookielib.py test/test_copy.py test/test_descr.py test/test_doctest2.py test/test_exceptions.py test/test_file.py test/test_fileinput.py test/test_fileio.py test/test_format.py test/test_getargs.py test/test_gettext.py test/test_glob.py test/test_htmlparser.py test/test_index.py test/test_io.py test/test_isinstance.py test/test_iter.py test/test_macfs.py test/test_marshal.py test/test_minidom.py test/test_module.py test/test_multibytecodec.py test/test_multibytecodec_support.py test/test_normalization.py test/test_optparse.py test/test_pep263.py test/test_pep277.py test/test_pep292.py test/test_pep352.py test/test_plistlib.py test/test_pprint.py test/test_pyexpat.py test/test_re.py test/test_set.py test/test_startfile.py test/test_str.py test/test_stringprep.py test/test_support.py test/test_tarfile.py test/test_textwrap.py test/test_timeout.py test/test_types.py test/test_ucn.py test/test_unicode.py test/test_unicode_file.py test/test_unicodedata.py test/test_urllib.py test/test_winreg.py test/test_xmlrpc.py test/testcodec.py textwrap.py types.py urllib.py xml/dom/minicompat.py xmlrpclib.py Message-ID: <20070502191059.A48491E4010@bag.python.org> Author: guido.van.rossum Date: Wed May 2 21:09:54 2007 New Revision: 55079 Modified: python/branches/py3k-struni/Lib/HTMLParser.py python/branches/py3k-struni/Lib/codecs.py python/branches/py3k-struni/Lib/compiler/transformer.py python/branches/py3k-struni/Lib/cookielib.py python/branches/py3k-struni/Lib/copy.py python/branches/py3k-struni/Lib/ctypes/__init__.py python/branches/py3k-struni/Lib/ctypes/macholib/dyld.py python/branches/py3k-struni/Lib/ctypes/test/test_as_parameter.py python/branches/py3k-struni/Lib/ctypes/test/test_buffers.py python/branches/py3k-struni/Lib/ctypes/test/test_functions.py python/branches/py3k-struni/Lib/ctypes/test/test_parameters.py python/branches/py3k-struni/Lib/ctypes/test/test_prototypes.py python/branches/py3k-struni/Lib/ctypes/test/test_slicing.py python/branches/py3k-struni/Lib/ctypes/test/test_strings.py python/branches/py3k-struni/Lib/ctypes/test/test_structures.py python/branches/py3k-struni/Lib/ctypes/test/test_unicode.py python/branches/py3k-struni/Lib/distutils/command/bdist_wininst.py python/branches/py3k-struni/Lib/distutils/command/build_clib.py python/branches/py3k-struni/Lib/distutils/command/register.py python/branches/py3k-struni/Lib/doctest.py python/branches/py3k-struni/Lib/email/charset.py python/branches/py3k-struni/Lib/email/generator.py python/branches/py3k-struni/Lib/email/header.py python/branches/py3k-struni/Lib/email/message.py python/branches/py3k-struni/Lib/email/test/test_email.py python/branches/py3k-struni/Lib/email/test/test_email_codecs.py python/branches/py3k-struni/Lib/email/test/test_email_codecs_renamed.py python/branches/py3k-struni/Lib/email/test/test_email_renamed.py python/branches/py3k-struni/Lib/email/utils.py python/branches/py3k-struni/Lib/encodings/__init__.py python/branches/py3k-struni/Lib/encodings/cp037.py python/branches/py3k-struni/Lib/encodings/cp1006.py python/branches/py3k-struni/Lib/encodings/cp1026.py python/branches/py3k-struni/Lib/encodings/cp1140.py python/branches/py3k-struni/Lib/encodings/cp1250.py python/branches/py3k-struni/Lib/encodings/cp1251.py python/branches/py3k-struni/Lib/encodings/cp1252.py python/branches/py3k-struni/Lib/encodings/cp1253.py python/branches/py3k-struni/Lib/encodings/cp1254.py python/branches/py3k-struni/Lib/encodings/cp1255.py python/branches/py3k-struni/Lib/encodings/cp1256.py python/branches/py3k-struni/Lib/encodings/cp1257.py python/branches/py3k-struni/Lib/encodings/cp1258.py python/branches/py3k-struni/Lib/encodings/cp424.py python/branches/py3k-struni/Lib/encodings/cp437.py python/branches/py3k-struni/Lib/encodings/cp500.py python/branches/py3k-struni/Lib/encodings/cp737.py python/branches/py3k-struni/Lib/encodings/cp775.py python/branches/py3k-struni/Lib/encodings/cp850.py python/branches/py3k-struni/Lib/encodings/cp852.py python/branches/py3k-struni/Lib/encodings/cp855.py python/branches/py3k-struni/Lib/encodings/cp856.py python/branches/py3k-struni/Lib/encodings/cp857.py python/branches/py3k-struni/Lib/encodings/cp860.py python/branches/py3k-struni/Lib/encodings/cp861.py python/branches/py3k-struni/Lib/encodings/cp862.py python/branches/py3k-struni/Lib/encodings/cp863.py python/branches/py3k-struni/Lib/encodings/cp864.py python/branches/py3k-struni/Lib/encodings/cp865.py python/branches/py3k-struni/Lib/encodings/cp866.py python/branches/py3k-struni/Lib/encodings/cp869.py python/branches/py3k-struni/Lib/encodings/cp874.py python/branches/py3k-struni/Lib/encodings/cp875.py python/branches/py3k-struni/Lib/encodings/idna.py python/branches/py3k-struni/Lib/encodings/iso8859_1.py python/branches/py3k-struni/Lib/encodings/iso8859_10.py python/branches/py3k-struni/Lib/encodings/iso8859_11.py python/branches/py3k-struni/Lib/encodings/iso8859_13.py python/branches/py3k-struni/Lib/encodings/iso8859_14.py python/branches/py3k-struni/Lib/encodings/iso8859_15.py python/branches/py3k-struni/Lib/encodings/iso8859_16.py python/branches/py3k-struni/Lib/encodings/iso8859_2.py python/branches/py3k-struni/Lib/encodings/iso8859_3.py python/branches/py3k-struni/Lib/encodings/iso8859_4.py python/branches/py3k-struni/Lib/encodings/iso8859_5.py python/branches/py3k-struni/Lib/encodings/iso8859_6.py python/branches/py3k-struni/Lib/encodings/iso8859_7.py python/branches/py3k-struni/Lib/encodings/iso8859_8.py python/branches/py3k-struni/Lib/encodings/iso8859_9.py python/branches/py3k-struni/Lib/encodings/koi8_r.py python/branches/py3k-struni/Lib/encodings/koi8_u.py python/branches/py3k-struni/Lib/encodings/mac_arabic.py python/branches/py3k-struni/Lib/encodings/mac_centeuro.py python/branches/py3k-struni/Lib/encodings/mac_croatian.py python/branches/py3k-struni/Lib/encodings/mac_cyrillic.py python/branches/py3k-struni/Lib/encodings/mac_farsi.py python/branches/py3k-struni/Lib/encodings/mac_greek.py python/branches/py3k-struni/Lib/encodings/mac_iceland.py python/branches/py3k-struni/Lib/encodings/mac_roman.py python/branches/py3k-struni/Lib/encodings/mac_romanian.py python/branches/py3k-struni/Lib/encodings/mac_turkish.py python/branches/py3k-struni/Lib/encodings/punycode.py python/branches/py3k-struni/Lib/encodings/tis_620.py python/branches/py3k-struni/Lib/encodings/utf_8_sig.py python/branches/py3k-struni/Lib/gettext.py python/branches/py3k-struni/Lib/glob.py python/branches/py3k-struni/Lib/idlelib/EditorWindow.py python/branches/py3k-struni/Lib/idlelib/IOBinding.py python/branches/py3k-struni/Lib/idlelib/OutputWindow.py python/branches/py3k-struni/Lib/idlelib/PyParse.py python/branches/py3k-struni/Lib/idlelib/PyShell.py python/branches/py3k-struni/Lib/lib-tk/Tkinter.py python/branches/py3k-struni/Lib/msilib/schema.py python/branches/py3k-struni/Lib/msilib/sequence.py python/branches/py3k-struni/Lib/msilib/text.py python/branches/py3k-struni/Lib/pickle.py python/branches/py3k-struni/Lib/pickletools.py python/branches/py3k-struni/Lib/plat-mac/EasyDialogs.py python/branches/py3k-struni/Lib/plat-mac/FrameWork.py python/branches/py3k-struni/Lib/plat-mac/aepack.py python/branches/py3k-struni/Lib/plat-mac/buildtools.py python/branches/py3k-struni/Lib/plat-mac/macostools.py python/branches/py3k-struni/Lib/plat-mac/macresource.py python/branches/py3k-struni/Lib/plat-mac/plistlib.py python/branches/py3k-struni/Lib/sqlite3/test/dbapi.py python/branches/py3k-struni/Lib/sqlite3/test/factory.py python/branches/py3k-struni/Lib/sqlite3/test/types.py python/branches/py3k-struni/Lib/sqlite3/test/userfunctions.py python/branches/py3k-struni/Lib/stringprep.py python/branches/py3k-struni/Lib/tarfile.py python/branches/py3k-struni/Lib/test/bad_coding2.py python/branches/py3k-struni/Lib/test/pickletester.py python/branches/py3k-struni/Lib/test/string_tests.py python/branches/py3k-struni/Lib/test/test_StringIO.py python/branches/py3k-struni/Lib/test/test_array.py python/branches/py3k-struni/Lib/test/test_bigmem.py python/branches/py3k-struni/Lib/test/test_binascii.py python/branches/py3k-struni/Lib/test/test_bool.py python/branches/py3k-struni/Lib/test/test_builtin.py python/branches/py3k-struni/Lib/test/test_bytes.py python/branches/py3k-struni/Lib/test/test_cfgparser.py python/branches/py3k-struni/Lib/test/test_charmapcodec.py python/branches/py3k-struni/Lib/test/test_codeccallbacks.py python/branches/py3k-struni/Lib/test/test_codecencodings_cn.py python/branches/py3k-struni/Lib/test/test_codecencodings_hk.py python/branches/py3k-struni/Lib/test/test_codecencodings_jp.py python/branches/py3k-struni/Lib/test/test_codecencodings_kr.py python/branches/py3k-struni/Lib/test/test_codecencodings_tw.py python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py python/branches/py3k-struni/Lib/test/test_codecmaps_kr.py python/branches/py3k-struni/Lib/test/test_codecmaps_tw.py python/branches/py3k-struni/Lib/test/test_codecs.py python/branches/py3k-struni/Lib/test/test_compile.py python/branches/py3k-struni/Lib/test/test_complex.py python/branches/py3k-struni/Lib/test/test_contains.py python/branches/py3k-struni/Lib/test/test_cookielib.py python/branches/py3k-struni/Lib/test/test_copy.py python/branches/py3k-struni/Lib/test/test_descr.py python/branches/py3k-struni/Lib/test/test_doctest2.py python/branches/py3k-struni/Lib/test/test_exceptions.py python/branches/py3k-struni/Lib/test/test_file.py python/branches/py3k-struni/Lib/test/test_fileinput.py python/branches/py3k-struni/Lib/test/test_fileio.py python/branches/py3k-struni/Lib/test/test_format.py python/branches/py3k-struni/Lib/test/test_getargs.py python/branches/py3k-struni/Lib/test/test_gettext.py python/branches/py3k-struni/Lib/test/test_glob.py python/branches/py3k-struni/Lib/test/test_htmlparser.py python/branches/py3k-struni/Lib/test/test_index.py python/branches/py3k-struni/Lib/test/test_io.py python/branches/py3k-struni/Lib/test/test_isinstance.py python/branches/py3k-struni/Lib/test/test_iter.py python/branches/py3k-struni/Lib/test/test_macfs.py python/branches/py3k-struni/Lib/test/test_marshal.py python/branches/py3k-struni/Lib/test/test_minidom.py python/branches/py3k-struni/Lib/test/test_module.py python/branches/py3k-struni/Lib/test/test_multibytecodec.py python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py python/branches/py3k-struni/Lib/test/test_normalization.py python/branches/py3k-struni/Lib/test/test_optparse.py python/branches/py3k-struni/Lib/test/test_pep263.py python/branches/py3k-struni/Lib/test/test_pep277.py python/branches/py3k-struni/Lib/test/test_pep292.py python/branches/py3k-struni/Lib/test/test_pep352.py python/branches/py3k-struni/Lib/test/test_plistlib.py python/branches/py3k-struni/Lib/test/test_pprint.py python/branches/py3k-struni/Lib/test/test_pyexpat.py python/branches/py3k-struni/Lib/test/test_re.py python/branches/py3k-struni/Lib/test/test_set.py python/branches/py3k-struni/Lib/test/test_startfile.py python/branches/py3k-struni/Lib/test/test_str.py python/branches/py3k-struni/Lib/test/test_stringprep.py python/branches/py3k-struni/Lib/test/test_support.py python/branches/py3k-struni/Lib/test/test_tarfile.py python/branches/py3k-struni/Lib/test/test_textwrap.py python/branches/py3k-struni/Lib/test/test_timeout.py python/branches/py3k-struni/Lib/test/test_types.py python/branches/py3k-struni/Lib/test/test_ucn.py python/branches/py3k-struni/Lib/test/test_unicode.py python/branches/py3k-struni/Lib/test/test_unicode_file.py python/branches/py3k-struni/Lib/test/test_unicodedata.py python/branches/py3k-struni/Lib/test/test_urllib.py python/branches/py3k-struni/Lib/test/test_winreg.py python/branches/py3k-struni/Lib/test/test_xmlrpc.py python/branches/py3k-struni/Lib/test/testcodec.py python/branches/py3k-struni/Lib/textwrap.py python/branches/py3k-struni/Lib/types.py python/branches/py3k-struni/Lib/urllib.py python/branches/py3k-struni/Lib/xml/dom/minicompat.py python/branches/py3k-struni/Lib/xmlrpclib.py Log: Rip out all the u"..." literals and calls to unicode(). Modified: python/branches/py3k-struni/Lib/HTMLParser.py ============================================================================== --- python/branches/py3k-struni/Lib/HTMLParser.py (original) +++ python/branches/py3k-struni/Lib/HTMLParser.py Wed May 2 21:09:54 2007 @@ -376,7 +376,7 @@ # which is not part of HTML 4 import htmlentitydefs if HTMLParser.entitydefs is None: - entitydefs = HTMLParser.entitydefs = {'apos':u"'"} + entitydefs = HTMLParser.entitydefs = {'apos':"'"} for k, v in htmlentitydefs.name2codepoint.items(): entitydefs[k] = unichr(v) try: Modified: python/branches/py3k-struni/Lib/codecs.py ============================================================================== --- python/branches/py3k-struni/Lib/codecs.py (original) +++ python/branches/py3k-struni/Lib/codecs.py Wed May 2 21:09:54 2007 @@ -589,7 +589,7 @@ """ self.bytebuffer = "" - self.charbuffer = u"" + self.charbuffer = "" self.linebuffer = None def seek(self, offset, whence=0): Modified: python/branches/py3k-struni/Lib/compiler/transformer.py ============================================================================== --- python/branches/py3k-struni/Lib/compiler/transformer.py (original) +++ python/branches/py3k-struni/Lib/compiler/transformer.py Wed May 2 21:09:54 2007 @@ -740,7 +740,7 @@ # hack... changes in compile.c:parsestr and # tokenizer.c must be reflected here. if self.encoding not in ['utf-8', 'iso-8859-1']: - lit = unicode(lit, 'utf-8').encode(self.encoding) + lit = str(lit, 'utf-8').encode(self.encoding) return eval("# coding: %s\n%s" % (self.encoding, lit)) else: return eval(lit) @@ -750,7 +750,7 @@ for node in nodelist[1:]: k += self.decode_literal(node[1]) if isinstance(k, bytes): - return Bytes(str(k), lineno=nodelist[0][2]) + return Bytes(str(k), lineno=nodelist[0][2]) return Const(k, lineno=nodelist[0][2]) def atom_ellipsis(self, nodelist): @@ -825,7 +825,7 @@ else: annotation = None return SimpleArg(name, annotation, lineno) - + def com_arglist(self, nodelist): # varargslist: # (fpdef ['=' test] ',')* Modified: python/branches/py3k-struni/Lib/cookielib.py ============================================================================== --- python/branches/py3k-struni/Lib/cookielib.py (original) +++ python/branches/py3k-struni/Lib/cookielib.py Wed May 2 21:09:54 2007 @@ -644,7 +644,7 @@ # And here, kind of: draft-fielding-uri-rfc2396bis-03 # (And in draft IRI specification: draft-duerst-iri-05) # (And here, for new URI schemes: RFC 2718) - if isinstance(path, unicode): + if isinstance(path, str): path = path.encode("utf-8") path = urllib.quote(path, HTTP_PATH_SAFE) path = ESCAPED_CHAR_RE.sub(uppercase_escaped_char, path) Modified: python/branches/py3k-struni/Lib/copy.py ============================================================================== --- python/branches/py3k-struni/Lib/copy.py (original) +++ python/branches/py3k-struni/Lib/copy.py Wed May 2 21:09:54 2007 @@ -186,7 +186,7 @@ pass d[str] = _deepcopy_atomic try: - d[unicode] = _deepcopy_atomic + d[str] = _deepcopy_atomic except NameError: pass try: Modified: python/branches/py3k-struni/Lib/ctypes/__init__.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/__init__.py (original) +++ python/branches/py3k-struni/Lib/ctypes/__init__.py Wed May 2 21:09:54 2007 @@ -59,7 +59,7 @@ create_string_buffer(anInteger) -> character array create_string_buffer(aString, anInteger) -> character array """ - if isinstance(init, (str, unicode)): + if isinstance(init, (str, str)): if size is None: size = len(init)+1 buftype = c_char * size @@ -281,7 +281,7 @@ create_unicode_buffer(anInteger) -> character array create_unicode_buffer(aString, anInteger) -> character array """ - if isinstance(init, (str, unicode)): + if isinstance(init, (str, str)): if size is None: size = len(init)+1 buftype = c_wchar * size Modified: python/branches/py3k-struni/Lib/ctypes/macholib/dyld.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/macholib/dyld.py (original) +++ python/branches/py3k-struni/Lib/ctypes/macholib/dyld.py Wed May 2 21:09:54 2007 @@ -33,7 +33,7 @@ def ensure_utf8(s): """Not all of PyObjC and Python understand unicode paths very well yet""" - if isinstance(s, unicode): + if isinstance(s, str): return s.encode('utf8') return s Modified: python/branches/py3k-struni/Lib/ctypes/test/test_as_parameter.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_as_parameter.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_as_parameter.py Wed May 2 21:09:54 2007 @@ -24,7 +24,7 @@ return f = dll._testfunc_i_bhilfd f.argtypes = [c_byte, c_wchar, c_int, c_long, c_float, c_double] - result = f(self.wrap(1), self.wrap(u"x"), self.wrap(3), self.wrap(4), self.wrap(5.0), self.wrap(6.0)) + result = f(self.wrap(1), self.wrap("x"), self.wrap(3), self.wrap(4), self.wrap(5.0), self.wrap(6.0)) self.failUnlessEqual(result, 139) self.failUnless(type(result), int) Modified: python/branches/py3k-struni/Lib/ctypes/test/test_buffers.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_buffers.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_buffers.py Wed May 2 21:09:54 2007 @@ -17,7 +17,7 @@ self.failUnlessEqual(b[:], "abc\0") def test_string_conversion(self): - b = create_string_buffer(u"abc") + b = create_string_buffer("abc") self.failUnlessEqual(len(b), 4) # trailing nul char self.failUnlessEqual(sizeof(b), 4 * sizeof(c_char)) self.failUnless(type(b[0]) is str) @@ -33,21 +33,21 @@ b = create_unicode_buffer(32) self.failUnlessEqual(len(b), 32) self.failUnlessEqual(sizeof(b), 32 * sizeof(c_wchar)) - self.failUnless(type(b[0]) is unicode) + self.failUnless(type(b[0]) is str) - b = create_unicode_buffer(u"abc") + b = create_unicode_buffer("abc") self.failUnlessEqual(len(b), 4) # trailing nul char self.failUnlessEqual(sizeof(b), 4 * sizeof(c_wchar)) - self.failUnless(type(b[0]) is unicode) - self.failUnlessEqual(b[0], u"a") + self.failUnless(type(b[0]) is str) + self.failUnlessEqual(b[0], "a") self.failUnlessEqual(b[:], "abc\0") def test_unicode_conversion(self): b = create_unicode_buffer("abc") self.failUnlessEqual(len(b), 4) # trailing nul char self.failUnlessEqual(sizeof(b), 4 * sizeof(c_wchar)) - self.failUnless(type(b[0]) is unicode) - self.failUnlessEqual(b[0], u"a") + self.failUnless(type(b[0]) is str) + self.failUnlessEqual(b[0], "a") self.failUnlessEqual(b[:], "abc\0") if __name__ == "__main__": Modified: python/branches/py3k-struni/Lib/ctypes/test/test_functions.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_functions.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_functions.py Wed May 2 21:09:54 2007 @@ -70,7 +70,7 @@ return f = dll._testfunc_i_bhilfd f.argtypes = [c_byte, c_wchar, c_int, c_long, c_float, c_double] - result = f(1, u"x", 3, 4, 5.0, 6.0) + result = f(1, "x", 3, 4, 5.0, 6.0) self.failUnlessEqual(result, 139) self.failUnlessEqual(type(result), int) @@ -83,7 +83,7 @@ f.argtypes = [c_byte, c_short, c_int, c_long, c_float, c_double] f.restype = c_wchar result = f(0, 0, 0, 0, 0, 0) - self.failUnlessEqual(result, u'\x00') + self.failUnlessEqual(result, '\x00') def test_voidresult(self): f = dll._testfunc_v Modified: python/branches/py3k-struni/Lib/ctypes/test/test_parameters.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_parameters.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_parameters.py Wed May 2 21:09:54 2007 @@ -58,8 +58,8 @@ self.failUnless(c_char_p.from_param(s)._obj is s) # new in 0.9.1: convert (encode) unicode to ascii - self.failUnlessEqual(c_char_p.from_param(u"123")._obj, "123") - self.assertRaises(UnicodeEncodeError, c_char_p.from_param, u"123\377") + self.failUnlessEqual(c_char_p.from_param("123")._obj, "123") + self.assertRaises(UnicodeEncodeError, c_char_p.from_param, "123\377") self.assertRaises(TypeError, c_char_p.from_param, 42) @@ -75,16 +75,16 @@ except ImportError: ## print "(No c_wchar_p)" return - s = u"123" + s = "123" if sys.platform == "win32": self.failUnless(c_wchar_p.from_param(s)._obj is s) self.assertRaises(TypeError, c_wchar_p.from_param, 42) # new in 0.9.1: convert (decode) ascii to unicode - self.failUnlessEqual(c_wchar_p.from_param("123")._obj, u"123") + self.failUnlessEqual(c_wchar_p.from_param("123")._obj, "123") self.assertRaises(UnicodeDecodeError, c_wchar_p.from_param, "123\377") - pa = c_wchar_p.from_param(c_wchar_p(u"123")) + pa = c_wchar_p.from_param(c_wchar_p("123")) self.failUnlessEqual(type(pa), c_wchar_p) def test_int_pointers(self): Modified: python/branches/py3k-struni/Lib/ctypes/test/test_prototypes.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_prototypes.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_prototypes.py Wed May 2 21:09:54 2007 @@ -123,7 +123,7 @@ pass else: self.failUnlessEqual(None, func(c_wchar_p(None))) - self.failUnlessEqual(u"123", func(c_wchar_p(u"123"))) + self.failUnlessEqual("123", func(c_wchar_p("123"))) def test_instance(self): func = testdll._testfunc_p_p @@ -157,24 +157,24 @@ func.argtypes = POINTER(c_wchar), self.failUnlessEqual(None, func(None)) - self.failUnlessEqual(u"123", func(u"123")) + self.failUnlessEqual("123", func("123")) self.failUnlessEqual(None, func(c_wchar_p(None))) - self.failUnlessEqual(u"123", func(c_wchar_p(u"123"))) + self.failUnlessEqual("123", func(c_wchar_p("123"))) - self.failUnlessEqual(u"123", func(c_wbuffer(u"123"))) + self.failUnlessEqual("123", func(c_wbuffer("123"))) ca = c_wchar("a") - self.failUnlessEqual(u"a", func(pointer(ca))[0]) - self.failUnlessEqual(u"a", func(byref(ca))[0]) + self.failUnlessEqual("a", func(pointer(ca))[0]) + self.failUnlessEqual("a", func(byref(ca))[0]) def test_c_wchar_p_arg(self): func = testdll._testfunc_p_p func.restype = c_wchar_p func.argtypes = c_wchar_p, - c_wchar_p.from_param(u"123") + c_wchar_p.from_param("123") self.failUnlessEqual(None, func(None)) - self.failUnlessEqual("123", func(u"123")) + self.failUnlessEqual("123", func("123")) self.failUnlessEqual(None, func(c_wchar_p(None))) self.failUnlessEqual("123", func(c_wchar_p("123"))) Modified: python/branches/py3k-struni/Lib/ctypes/test/test_slicing.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_slicing.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_slicing.py Wed May 2 21:09:54 2007 @@ -45,7 +45,7 @@ import operator self.assertRaises(TypeError, operator.setslice, - res, 0, 5, u"abcde") + res, 0, 5, "abcde") dll.my_free(res) dll.my_strdup.restype = POINTER(c_byte) @@ -88,7 +88,7 @@ pass else: def test_wchar_ptr(self): - s = u"abcdefghijklmnopqrstuvwxyz\0" + s = "abcdefghijklmnopqrstuvwxyz\0" dll = CDLL(_ctypes_test.__file__) dll.my_wcsdup.restype = POINTER(c_wchar) @@ -99,7 +99,7 @@ import operator self.assertRaises(TypeError, operator.setslice, - res, 0, 5, u"abcde") + res, 0, 5, "abcde") dll.my_free(res) if sizeof(c_wchar) == sizeof(c_short): Modified: python/branches/py3k-struni/Lib/ctypes/test/test_strings.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_strings.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_strings.py Wed May 2 21:09:54 2007 @@ -62,17 +62,17 @@ def test(self): BUF = c_wchar * 4 - buf = BUF(u"a", u"b", u"c") - self.failUnlessEqual(buf.value, u"abc") + buf = BUF("a", "b", "c") + self.failUnlessEqual(buf.value, "abc") - buf.value = u"ABCD" - self.failUnlessEqual(buf.value, u"ABCD") + buf.value = "ABCD" + self.failUnlessEqual(buf.value, "ABCD") - buf.value = u"x" - self.failUnlessEqual(buf.value, u"x") + buf.value = "x" + self.failUnlessEqual(buf.value, "x") - buf[1] = u"Z" - self.failUnlessEqual(buf.value, u"xZCD") + buf[1] = "Z" + self.failUnlessEqual(buf.value, "xZCD") class StringTestCase(unittest.TestCase): def XX_test_basic_strings(self): @@ -99,7 +99,7 @@ self.failUnlessEqual(cs.value, "XY") self.failUnlessEqual(cs.raw, "XY\000\000\000\000\000") - self.assertRaises(TypeError, c_string, u"123") + self.assertRaises(TypeError, c_string, "123") def XX_test_sized_strings(self): @@ -142,13 +142,13 @@ else: class WStringTestCase(unittest.TestCase): def test_wchar(self): - c_wchar(u"x") - repr(byref(c_wchar(u"x"))) + c_wchar("x") + repr(byref(c_wchar("x"))) c_wchar("x") def X_test_basic_wstrings(self): - cs = c_wstring(u"abcdef") + cs = c_wstring("abcdef") # XXX This behaviour is about to change: # len returns the size of the internal buffer in bytes. @@ -156,30 +156,30 @@ self.failUnless(sizeof(cs) == 14) # The value property is the string up to the first terminating NUL. - self.failUnless(cs.value == u"abcdef") - self.failUnless(c_wstring(u"abc\000def").value == u"abc") + self.failUnless(cs.value == "abcdef") + self.failUnless(c_wstring("abc\000def").value == "abc") - self.failUnless(c_wstring(u"abc\000def").value == u"abc") + self.failUnless(c_wstring("abc\000def").value == "abc") # The raw property is the total buffer contents: - self.failUnless(cs.raw == u"abcdef\000") - self.failUnless(c_wstring(u"abc\000def").raw == u"abc\000def\000") + self.failUnless(cs.raw == "abcdef\000") + self.failUnless(c_wstring("abc\000def").raw == "abc\000def\000") # We can change the value: - cs.value = u"ab" - self.failUnless(cs.value == u"ab") - self.failUnless(cs.raw == u"ab\000\000\000\000\000") + cs.value = "ab" + self.failUnless(cs.value == "ab") + self.failUnless(cs.raw == "ab\000\000\000\000\000") self.assertRaises(TypeError, c_wstring, "123") self.assertRaises(ValueError, c_wstring, 0) def X_test_toolong(self): - cs = c_wstring(u"abcdef") + cs = c_wstring("abcdef") # Much too long string: - self.assertRaises(ValueError, setattr, cs, "value", u"123456789012345") + self.assertRaises(ValueError, setattr, cs, "value", "123456789012345") # One char too long values: - self.assertRaises(ValueError, setattr, cs, "value", u"1234567") + self.assertRaises(ValueError, setattr, cs, "value", "1234567") def run_test(rep, msg, func, arg): Modified: python/branches/py3k-struni/Lib/ctypes/test/test_structures.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_structures.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_structures.py Wed May 2 21:09:54 2007 @@ -269,15 +269,15 @@ _fields_ = [("name", c_wchar * 12), ("age", c_int)] - p = PersonW(u"Someone") + p = PersonW("Someone") self.failUnlessEqual(p.name, "Someone") - self.failUnlessEqual(PersonW(u"1234567890").name, u"1234567890") - self.failUnlessEqual(PersonW(u"12345678901").name, u"12345678901") + self.failUnlessEqual(PersonW("1234567890").name, "1234567890") + self.failUnlessEqual(PersonW("12345678901").name, "12345678901") # exact fit - self.failUnlessEqual(PersonW(u"123456789012").name, u"123456789012") + self.failUnlessEqual(PersonW("123456789012").name, "123456789012") #too long - self.assertRaises(ValueError, PersonW, u"1234567890123") + self.assertRaises(ValueError, PersonW, "1234567890123") def test_init_errors(self): class Phone(Structure): Modified: python/branches/py3k-struni/Lib/ctypes/test/test_unicode.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_unicode.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_unicode.py Wed May 2 21:09:54 2007 @@ -23,31 +23,31 @@ def test_ascii_strict(self): ctypes.set_conversion_mode("ascii", "strict") # no conversions take place with unicode arguments - self.failUnlessEqual(wcslen(u"abc"), 3) - self.failUnlessEqual(wcslen(u"ab\u2070"), 3) + self.failUnlessEqual(wcslen("abc"), 3) + self.failUnlessEqual(wcslen("ab\u2070"), 3) # string args are converted self.failUnlessEqual(wcslen("abc"), 3) self.failUnlessRaises(ctypes.ArgumentError, wcslen, "ab?") def test_ascii_replace(self): ctypes.set_conversion_mode("ascii", "replace") - self.failUnlessEqual(wcslen(u"abc"), 3) - self.failUnlessEqual(wcslen(u"ab\u2070"), 3) + self.failUnlessEqual(wcslen("abc"), 3) + self.failUnlessEqual(wcslen("ab\u2070"), 3) self.failUnlessEqual(wcslen("abc"), 3) self.failUnlessEqual(wcslen("ab?"), 3) def test_ascii_ignore(self): ctypes.set_conversion_mode("ascii", "ignore") - self.failUnlessEqual(wcslen(u"abc"), 3) - self.failUnlessEqual(wcslen(u"ab\u2070"), 3) + self.failUnlessEqual(wcslen("abc"), 3) + self.failUnlessEqual(wcslen("ab\u2070"), 3) # ignore error mode skips non-ascii characters self.failUnlessEqual(wcslen("abc"), 3) self.failUnlessEqual(wcslen("????"), 0) def test_latin1_strict(self): ctypes.set_conversion_mode("latin-1", "strict") - self.failUnlessEqual(wcslen(u"abc"), 3) - self.failUnlessEqual(wcslen(u"ab\u2070"), 3) + self.failUnlessEqual(wcslen("abc"), 3) + self.failUnlessEqual(wcslen("ab\u2070"), 3) self.failUnlessEqual(wcslen("abc"), 3) self.failUnlessEqual(wcslen("????"), 4) @@ -58,12 +58,12 @@ ctypes.set_conversion_mode("ascii", "replace") buf = ctypes.create_unicode_buffer("ab???") - self.failUnlessEqual(buf[:], u"ab\uFFFD\uFFFD\uFFFD\0") + self.failUnlessEqual(buf[:], "ab\uFFFD\uFFFD\uFFFD\0") ctypes.set_conversion_mode("ascii", "ignore") buf = ctypes.create_unicode_buffer("ab???") # is that correct? not sure. But with 'ignore', you get what you pay for.. - self.failUnlessEqual(buf[:], u"ab\0\0\0\0") + self.failUnlessEqual(buf[:], "ab\0\0\0\0") import _ctypes_test func = ctypes.CDLL(_ctypes_test.__file__)._testfunc_p_p @@ -82,32 +82,32 @@ def test_ascii_replace(self): ctypes.set_conversion_mode("ascii", "strict") self.failUnlessEqual(func("abc"), "abc") - self.failUnlessEqual(func(u"abc"), "abc") - self.assertRaises(ctypes.ArgumentError, func, u"ab?") + self.failUnlessEqual(func("abc"), "abc") + self.assertRaises(ctypes.ArgumentError, func, "ab?") def test_ascii_ignore(self): ctypes.set_conversion_mode("ascii", "ignore") self.failUnlessEqual(func("abc"), "abc") - self.failUnlessEqual(func(u"abc"), "abc") - self.failUnlessEqual(func(u"????"), "") + self.failUnlessEqual(func("abc"), "abc") + self.failUnlessEqual(func("????"), "") def test_ascii_replace(self): ctypes.set_conversion_mode("ascii", "replace") self.failUnlessEqual(func("abc"), "abc") - self.failUnlessEqual(func(u"abc"), "abc") - self.failUnlessEqual(func(u"????"), "????") + self.failUnlessEqual(func("abc"), "abc") + self.failUnlessEqual(func("????"), "????") def test_buffers(self): ctypes.set_conversion_mode("ascii", "strict") - buf = ctypes.create_string_buffer(u"abc") + buf = ctypes.create_string_buffer("abc") self.failUnlessEqual(len(buf), 3+1) ctypes.set_conversion_mode("ascii", "replace") - buf = ctypes.create_string_buffer(u"ab???") + buf = ctypes.create_string_buffer("ab???") self.failUnlessEqual(buf[:], "ab???\0") ctypes.set_conversion_mode("ascii", "ignore") - buf = ctypes.create_string_buffer(u"ab???") + buf = ctypes.create_string_buffer("ab???") # is that correct? not sure. But with 'ignore', you get what you pay for.. self.failUnlessEqual(buf[:], "ab\0\0\0\0") Modified: python/branches/py3k-struni/Lib/distutils/command/bdist_wininst.py ============================================================================== --- python/branches/py3k-struni/Lib/distutils/command/bdist_wininst.py (original) +++ python/branches/py3k-struni/Lib/distutils/command/bdist_wininst.py Wed May 2 21:09:54 2007 @@ -247,11 +247,11 @@ # Convert cfgdata from unicode to ascii, mbcs encoded try: - unicode + str except NameError: pass else: - if isinstance(cfgdata, unicode): + if isinstance(cfgdata, str): cfgdata = cfgdata.encode("mbcs") # Append the pre-install script Modified: python/branches/py3k-struni/Lib/distutils/command/build_clib.py ============================================================================== --- python/branches/py3k-struni/Lib/distutils/command/build_clib.py (original) +++ python/branches/py3k-struni/Lib/distutils/command/build_clib.py Wed May 2 21:09:54 2007 @@ -147,7 +147,7 @@ raise DistutilsSetupError, \ "each element of 'libraries' must a 2-tuple" - if isinstance(lib[0], basestring) StringType: + if isinstance(lib[0], basestring): raise DistutilsSetupError, \ "first element of each tuple in 'libraries' " + \ "must be a string (the library name)" Modified: python/branches/py3k-struni/Lib/distutils/command/register.py ============================================================================== --- python/branches/py3k-struni/Lib/distutils/command/register.py (original) +++ python/branches/py3k-struni/Lib/distutils/command/register.py Wed May 2 21:09:54 2007 @@ -259,7 +259,7 @@ if type(value) not in (type([]), type( () )): value = [value] for value in value: - value = unicode(value).encode("utf-8") + value = str(value).encode("utf-8") body.write(sep_boundary) body.write('\nContent-Disposition: form-data; name="%s"'%key) body.write("\n\n") Modified: python/branches/py3k-struni/Lib/doctest.py ============================================================================== --- python/branches/py3k-struni/Lib/doctest.py (original) +++ python/branches/py3k-struni/Lib/doctest.py Wed May 2 21:09:54 2007 @@ -196,7 +196,7 @@ """ if inspect.ismodule(module): return module - elif isinstance(module, (str, unicode)): + elif isinstance(module, (str, str)): return __import__(module, globals(), locals(), ["*"]) elif module is None: return sys.modules[sys._getframe(depth).f_globals['__name__']] Modified: python/branches/py3k-struni/Lib/email/charset.py ============================================================================== --- python/branches/py3k-struni/Lib/email/charset.py (original) +++ python/branches/py3k-struni/Lib/email/charset.py Wed May 2 21:09:54 2007 @@ -202,10 +202,10 @@ # is already a unicode, we leave it at that, but ensure that the # charset is ASCII, as the standard (RFC XXX) requires. try: - if isinstance(input_charset, unicode): + if isinstance(input_charset, str): input_charset.encode('ascii') else: - input_charset = unicode(input_charset, 'ascii') + input_charset = str(input_charset, 'ascii') except UnicodeError: raise errors.CharsetError(input_charset) input_charset = input_charset.lower() @@ -264,7 +264,7 @@ def convert(self, s): """Convert a string from the input_codec to the output_codec.""" if self.input_codec != self.output_codec: - return unicode(s, self.input_codec).encode(self.output_codec) + return str(s, self.input_codec).encode(self.output_codec) else: return s @@ -281,10 +281,10 @@ Characters that could not be converted to Unicode will be replaced with the Unicode replacement character U+FFFD. """ - if isinstance(s, unicode) or self.input_codec is None: + if isinstance(s, str) or self.input_codec is None: return s try: - return unicode(s, self.input_codec, 'replace') + return str(s, self.input_codec, 'replace') except LookupError: # Input codec not installed on system, so return the original # string unchanged. @@ -307,7 +307,7 @@ codec = self.output_codec else: codec = self.input_codec - if not isinstance(ustr, unicode) or codec is None: + if not isinstance(ustr, str) or codec is None: return ustr try: return ustr.encode(codec, 'replace') Modified: python/branches/py3k-struni/Lib/email/generator.py ============================================================================== --- python/branches/py3k-struni/Lib/email/generator.py (original) +++ python/branches/py3k-struni/Lib/email/generator.py Wed May 2 21:09:54 2007 @@ -23,7 +23,7 @@ def _is8bitstring(s): if isinstance(s, str): try: - unicode(s, 'us-ascii') + str(s, 'us-ascii') except UnicodeError: return True return False Modified: python/branches/py3k-struni/Lib/email/header.py ============================================================================== --- python/branches/py3k-struni/Lib/email/header.py (original) +++ python/branches/py3k-struni/Lib/email/header.py Wed May 2 21:09:54 2007 @@ -21,9 +21,9 @@ NL = '\n' SPACE = ' ' -USPACE = u' ' +USPACE = ' ' SPACE8 = ' ' * 8 -UEMPTYSTRING = u'' +UEMPTYSTRING = '' MAXLINELEN = 76 @@ -210,7 +210,7 @@ elif nextcs not in (None, 'us-ascii'): uchunks.append(USPACE) lastcs = nextcs - uchunks.append(unicode(s, str(charset))) + uchunks.append(str(s, str(charset))) return UEMPTYSTRING.join(uchunks) # Rich comparison operators for equality only. BAW: does it make sense to @@ -257,13 +257,13 @@ # Possibly raise UnicodeError if the byte string can't be # converted to a unicode with the input codec of the charset. incodec = charset.input_codec or 'us-ascii' - ustr = unicode(s, incodec, errors) + ustr = str(s, incodec, errors) # Now make sure that the unicode could be converted back to a # byte string with the output codec, which may be different # than the iput coded. Still, use the original byte string. outcodec = charset.output_codec or 'us-ascii' ustr.encode(outcodec, errors) - elif isinstance(s, unicode): + elif isinstance(s, str): # Now we have to be sure the unicode string can be converted # to a byte string with a reasonable output codec. We want to # use the byte string in the chunk. Modified: python/branches/py3k-struni/Lib/email/message.py ============================================================================== --- python/branches/py3k-struni/Lib/email/message.py (original) +++ python/branches/py3k-struni/Lib/email/message.py Wed May 2 21:09:54 2007 @@ -751,13 +751,13 @@ # LookupError will be raised if the charset isn't known to # Python. UnicodeError will be raised if the encoded text # contains a character not in the charset. - charset = unicode(charset[2], pcharset).encode('us-ascii') + charset = str(charset[2], pcharset).encode('us-ascii') except (LookupError, UnicodeError): charset = charset[2] # charset character must be in us-ascii range try: if isinstance(charset, str): - charset = unicode(charset, 'us-ascii') + charset = str(charset, 'us-ascii') charset = charset.encode('us-ascii') except UnicodeError: return failobj Modified: python/branches/py3k-struni/Lib/email/test/test_email.py ============================================================================== --- python/branches/py3k-struni/Lib/email/test/test_email.py (original) +++ python/branches/py3k-struni/Lib/email/test/test_email.py Wed May 2 21:09:54 2007 @@ -505,7 +505,7 @@ msg = Message() msg.set_charset('us-ascii') self.assertEqual('us-ascii', msg.get_content_charset()) - msg.set_charset(u'us-ascii') + msg.set_charset('us-ascii') self.assertEqual('us-ascii', msg.get_content_charset()) @@ -583,7 +583,7 @@ utf8 = Charset("utf-8") g_head = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " - utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") + utf8_head = "\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") h = Header(g_head, g, header_name='Subject') h.append(cz_head, cz) h.append(utf8_head, utf8) @@ -1514,7 +1514,7 @@ s = '=?ISO-8859-1?Q?Andr=E9?= Pirard ' dh = decode_header(s) eq(dh, [('Andr\xe9', 'iso-8859-1'), ('Pirard ', None)]) - hu = unicode(make_header(dh)).encode('latin-1') + hu = str(make_header(dh)).encode('latin-1') eq(hu, 'Andr\xe9 Pirard ') def test_whitespace_eater_unicode_2(self): @@ -1524,7 +1524,7 @@ eq(dh, [('The', None), ('quick brown fox', 'iso-8859-1'), ('jumped over the', None), ('lazy dog', 'iso-8859-1')]) hu = make_header(dh).__unicode__() - eq(hu, u'The quick brown fox jumped over the lazy dog') + eq(hu, 'The quick brown fox jumped over the lazy dog') def test_rfc2047_without_whitespace(self): s = 'Sm=?ISO-8859-1?B?9g==?=rg=?ISO-8859-1?B?5Q==?=sbord' @@ -2770,7 +2770,7 @@ eq('hello w\xf6rld', c.body_encode('hello w\xf6rld')) def test_unicode_charset_name(self): - charset = Charset(u'us-ascii') + charset = Charset('us-ascii') self.assertEqual(str(charset), 'us-ascii') self.assertRaises(Errors.CharsetError, Charset, 'asc\xffii') @@ -2809,7 +2809,7 @@ utf8 = Charset("utf-8") g_head = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " - utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") + utf8_head = "\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") h = Header(g_head, g) h.append(cz_head, cz) h.append(utf8_head, utf8) @@ -2829,7 +2829,7 @@ eq(decode_header(enc), [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), (utf8_head, "utf-8")]) - ustr = unicode(h) + ustr = str(h) eq(ustr.encode('utf-8'), 'Die Mieter treten hier ein werden mit einem Foerderband ' 'komfortabel den Korridor entlang, an s\xc3\xbcdl\xc3\xbcndischen ' @@ -2897,9 +2897,9 @@ def test_utf8_shortest(self): eq = self.assertEqual - h = Header(u'p\xf6stal', 'utf-8') + h = Header('p\xf6stal', 'utf-8') eq(h.encode(), '=?utf-8?q?p=C3=B6stal?=') - h = Header(u'\u83ca\u5730\u6642\u592b', 'utf-8') + h = Header('\u83ca\u5730\u6642\u592b', 'utf-8') eq(h.encode(), '=?utf-8?b?6I+K5Zyw5pmC5aSr?=') def test_bad_8bit_header(self): @@ -3152,7 +3152,7 @@ ''' msg = email.message_from_string(m) self.assertEqual(msg.get_filename(), - u'This is even more ***fun*** is it not.pdf\ufffd') + 'This is even more ***fun*** is it not.pdf\ufffd') def test_rfc2231_unknown_encoding(self): m = """\ Modified: python/branches/py3k-struni/Lib/email/test/test_email_codecs.py ============================================================================== --- python/branches/py3k-struni/Lib/email/test/test_email_codecs.py (original) +++ python/branches/py3k-struni/Lib/email/test/test_email_codecs.py Wed May 2 21:09:54 2007 @@ -13,7 +13,7 @@ # We're compatible with Python 2.3, but it doesn't have the built-in Asian # codecs, so we have to skip all these tests. try: - unicode('foo', 'euc-jp') + str('foo', 'euc-jp') except LookupError: raise TestSkipped @@ -57,7 +57,7 @@ jcode = 'euc-jp' msg = Message() msg.set_payload(jhello, jcode) - ustr = unicode(msg.get_payload(), msg.get_content_charset()) + ustr = str(msg.get_payload(), msg.get_content_charset()) self.assertEqual(jhello, ustr.encode(jcode)) Modified: python/branches/py3k-struni/Lib/email/test/test_email_codecs_renamed.py ============================================================================== --- python/branches/py3k-struni/Lib/email/test/test_email_codecs_renamed.py (original) +++ python/branches/py3k-struni/Lib/email/test/test_email_codecs_renamed.py Wed May 2 21:09:54 2007 @@ -13,7 +13,7 @@ # We're compatible with Python 2.3, but it doesn't have the built-in Asian # codecs, so we have to skip all these tests. try: - unicode('foo', 'euc-jp') + str('foo', 'euc-jp') except LookupError: raise TestSkipped @@ -57,7 +57,7 @@ jcode = 'euc-jp' msg = Message() msg.set_payload(jhello, jcode) - ustr = unicode(msg.get_payload(), msg.get_content_charset()) + ustr = str(msg.get_payload(), msg.get_content_charset()) self.assertEqual(jhello, ustr.encode(jcode)) Modified: python/branches/py3k-struni/Lib/email/test/test_email_renamed.py ============================================================================== --- python/branches/py3k-struni/Lib/email/test/test_email_renamed.py (original) +++ python/branches/py3k-struni/Lib/email/test/test_email_renamed.py Wed May 2 21:09:54 2007 @@ -564,7 +564,7 @@ utf8 = Charset("utf-8") g_head = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " - utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") + utf8_head = "\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") h = Header(g_head, g, header_name='Subject') h.append(cz_head, cz) h.append(utf8_head, utf8) @@ -1512,7 +1512,7 @@ s = '=?ISO-8859-1?Q?Andr=E9?= Pirard ' dh = decode_header(s) eq(dh, [('Andr\xe9', 'iso-8859-1'), ('Pirard ', None)]) - hu = unicode(make_header(dh)).encode('latin-1') + hu = str(make_header(dh)).encode('latin-1') eq(hu, 'Andr\xe9 Pirard ') def test_whitespace_eater_unicode_2(self): @@ -1522,7 +1522,7 @@ eq(dh, [('The', None), ('quick brown fox', 'iso-8859-1'), ('jumped over the', None), ('lazy dog', 'iso-8859-1')]) hu = make_header(dh).__unicode__() - eq(hu, u'The quick brown fox jumped over the lazy dog') + eq(hu, 'The quick brown fox jumped over the lazy dog') def test_rfc2047_missing_whitespace(self): s = 'Sm=?ISO-8859-1?B?9g==?=rg=?ISO-8859-1?B?5Q==?=sbord' @@ -2769,7 +2769,7 @@ eq('hello w\xf6rld', c.body_encode('hello w\xf6rld')) def test_unicode_charset_name(self): - charset = Charset(u'us-ascii') + charset = Charset('us-ascii') self.assertEqual(str(charset), 'us-ascii') self.assertRaises(errors.CharsetError, Charset, 'asc\xffii') @@ -2808,7 +2808,7 @@ utf8 = Charset("utf-8") g_head = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " - utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") + utf8_head = "\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") h = Header(g_head, g) h.append(cz_head, cz) h.append(utf8_head, utf8) @@ -2828,7 +2828,7 @@ eq(decode_header(enc), [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), (utf8_head, "utf-8")]) - ustr = unicode(h) + ustr = str(h) eq(ustr.encode('utf-8'), 'Die Mieter treten hier ein werden mit einem Foerderband ' 'komfortabel den Korridor entlang, an s\xc3\xbcdl\xc3\xbcndischen ' @@ -2896,9 +2896,9 @@ def test_utf8_shortest(self): eq = self.assertEqual - h = Header(u'p\xf6stal', 'utf-8') + h = Header('p\xf6stal', 'utf-8') eq(h.encode(), '=?utf-8?q?p=C3=B6stal?=') - h = Header(u'\u83ca\u5730\u6642\u592b', 'utf-8') + h = Header('\u83ca\u5730\u6642\u592b', 'utf-8') eq(h.encode(), '=?utf-8?b?6I+K5Zyw5pmC5aSr?=') def test_bad_8bit_header(self): @@ -3151,7 +3151,7 @@ ''' msg = email.message_from_string(m) self.assertEqual(msg.get_filename(), - u'This is even more ***fun*** is it not.pdf\ufffd') + 'This is even more ***fun*** is it not.pdf\ufffd') def test_rfc2231_unknown_encoding(self): m = """\ Modified: python/branches/py3k-struni/Lib/email/utils.py ============================================================================== --- python/branches/py3k-struni/Lib/email/utils.py (original) +++ python/branches/py3k-struni/Lib/email/utils.py Wed May 2 21:09:54 2007 @@ -44,7 +44,7 @@ COMMASPACE = ', ' EMPTYSTRING = '' -UEMPTYSTRING = u'' +UEMPTYSTRING = '' CRLF = '\r\n' TICK = "'" @@ -315,9 +315,9 @@ rawval = unquote(value[2]) charset = value[0] or 'us-ascii' try: - return unicode(rawval, charset, errors) + return str(rawval, charset, errors) except LookupError: # XXX charset is unknown to Python. - return unicode(rawval, fallback_charset, errors) + return str(rawval, fallback_charset, errors) else: return unquote(value) Modified: python/branches/py3k-struni/Lib/encodings/__init__.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/__init__.py (original) +++ python/branches/py3k-struni/Lib/encodings/__init__.py Wed May 2 21:09:54 2007 @@ -60,7 +60,7 @@ """ # Make sure we have an 8-bit string, because .translate() works # differently for Unicode strings. - if isinstance(encoding, unicode): + if isinstance(encoding, str): # Note that .encode('latin-1') does *not* use the codec # registry, so this call doesn't recurse. (See unicodeobject.c # PyUnicode_AsEncodedString() for details) Modified: python/branches/py3k-struni/Lib/encodings/cp037.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp037.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp037.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\xa0' # 0x41 -> NO-BREAK SPACE - u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE - u'\xa2' # 0x4A -> CENT SIGN - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'|' # 0x4F -> VERTICAL LINE - u'&' # 0x50 -> AMPERSAND - u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE - u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE - u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'!' # 0x5A -> EXCLAMATION MARK - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'\xac' # 0x5F -> NOT SIGN - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xa6' # 0x6A -> BROKEN BAR - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE - u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) - u'\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR - u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE - u'\xb8' # 0x9D -> CEDILLA - u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE - u'\xa4' # 0x9F -> CURRENCY SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK - u'\xbf' # 0xAB -> INVERTED QUESTION MARK - u'\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) - u'\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) - u'\xae' # 0xAF -> REGISTERED SIGN - u'^' # 0xB0 -> CIRCUMFLEX ACCENT - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'[' # 0xBA -> LEFT SQUARE BRACKET - u']' # 0xBB -> RIGHT SQUARE BRACKET - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE - u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE - u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE - u'\x9f' # 0xFF -> CONTROL + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x9c' # 0x04 -> CONTROL + '\t' # 0x05 -> HORIZONTAL TABULATION + '\x86' # 0x06 -> CONTROL + '\x7f' # 0x07 -> DELETE + '\x97' # 0x08 -> CONTROL + '\x8d' # 0x09 -> CONTROL + '\x8e' # 0x0A -> CONTROL + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x9d' # 0x14 -> CONTROL + '\x85' # 0x15 -> CONTROL + '\x08' # 0x16 -> BACKSPACE + '\x87' # 0x17 -> CONTROL + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x92' # 0x1A -> CONTROL + '\x8f' # 0x1B -> CONTROL + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + '\x80' # 0x20 -> CONTROL + '\x81' # 0x21 -> CONTROL + '\x82' # 0x22 -> CONTROL + '\x83' # 0x23 -> CONTROL + '\x84' # 0x24 -> CONTROL + '\n' # 0x25 -> LINE FEED + '\x17' # 0x26 -> END OF TRANSMISSION BLOCK + '\x1b' # 0x27 -> ESCAPE + '\x88' # 0x28 -> CONTROL + '\x89' # 0x29 -> CONTROL + '\x8a' # 0x2A -> CONTROL + '\x8b' # 0x2B -> CONTROL + '\x8c' # 0x2C -> CONTROL + '\x05' # 0x2D -> ENQUIRY + '\x06' # 0x2E -> ACKNOWLEDGE + '\x07' # 0x2F -> BELL + '\x90' # 0x30 -> CONTROL + '\x91' # 0x31 -> CONTROL + '\x16' # 0x32 -> SYNCHRONOUS IDLE + '\x93' # 0x33 -> CONTROL + '\x94' # 0x34 -> CONTROL + '\x95' # 0x35 -> CONTROL + '\x96' # 0x36 -> CONTROL + '\x04' # 0x37 -> END OF TRANSMISSION + '\x98' # 0x38 -> CONTROL + '\x99' # 0x39 -> CONTROL + '\x9a' # 0x3A -> CONTROL + '\x9b' # 0x3B -> CONTROL + '\x14' # 0x3C -> DEVICE CONTROL FOUR + '\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE + '\x9e' # 0x3E -> CONTROL + '\x1a' # 0x3F -> SUBSTITUTE + ' ' # 0x40 -> SPACE + '\xa0' # 0x41 -> NO-BREAK SPACE + '\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE + '\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA + '\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE + '\xa2' # 0x4A -> CENT SIGN + '.' # 0x4B -> FULL STOP + '<' # 0x4C -> LESS-THAN SIGN + '(' # 0x4D -> LEFT PARENTHESIS + '+' # 0x4E -> PLUS SIGN + '|' # 0x4F -> VERTICAL LINE + '&' # 0x50 -> AMPERSAND + '\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE + '\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE + '\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) + '!' # 0x5A -> EXCLAMATION MARK + '$' # 0x5B -> DOLLAR SIGN + '*' # 0x5C -> ASTERISK + ')' # 0x5D -> RIGHT PARENTHESIS + ';' # 0x5E -> SEMICOLON + '\xac' # 0x5F -> NOT SIGN + '-' # 0x60 -> HYPHEN-MINUS + '/' # 0x61 -> SOLIDUS + '\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE + '\xa6' # 0x6A -> BROKEN BAR + ',' # 0x6B -> COMMA + '%' # 0x6C -> PERCENT SIGN + '_' # 0x6D -> LOW LINE + '>' # 0x6E -> GREATER-THAN SIGN + '?' # 0x6F -> QUESTION MARK + '\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE + '\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE + '`' # 0x79 -> GRAVE ACCENT + ':' # 0x7A -> COLON + '#' # 0x7B -> NUMBER SIGN + '@' # 0x7C -> COMMERCIAL AT + "'" # 0x7D -> APOSTROPHE + '=' # 0x7E -> EQUALS SIGN + '"' # 0x7F -> QUOTATION MARK + '\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE + 'a' # 0x81 -> LATIN SMALL LETTER A + 'b' # 0x82 -> LATIN SMALL LETTER B + 'c' # 0x83 -> LATIN SMALL LETTER C + 'd' # 0x84 -> LATIN SMALL LETTER D + 'e' # 0x85 -> LATIN SMALL LETTER E + 'f' # 0x86 -> LATIN SMALL LETTER F + 'g' # 0x87 -> LATIN SMALL LETTER G + 'h' # 0x88 -> LATIN SMALL LETTER H + 'i' # 0x89 -> LATIN SMALL LETTER I + '\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) + '\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE + '\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) + '\xb1' # 0x8F -> PLUS-MINUS SIGN + '\xb0' # 0x90 -> DEGREE SIGN + 'j' # 0x91 -> LATIN SMALL LETTER J + 'k' # 0x92 -> LATIN SMALL LETTER K + 'l' # 0x93 -> LATIN SMALL LETTER L + 'm' # 0x94 -> LATIN SMALL LETTER M + 'n' # 0x95 -> LATIN SMALL LETTER N + 'o' # 0x96 -> LATIN SMALL LETTER O + 'p' # 0x97 -> LATIN SMALL LETTER P + 'q' # 0x98 -> LATIN SMALL LETTER Q + 'r' # 0x99 -> LATIN SMALL LETTER R + '\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR + '\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR + '\xe6' # 0x9C -> LATIN SMALL LIGATURE AE + '\xb8' # 0x9D -> CEDILLA + '\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE + '\xa4' # 0x9F -> CURRENCY SIGN + '\xb5' # 0xA0 -> MICRO SIGN + '~' # 0xA1 -> TILDE + 's' # 0xA2 -> LATIN SMALL LETTER S + 't' # 0xA3 -> LATIN SMALL LETTER T + 'u' # 0xA4 -> LATIN SMALL LETTER U + 'v' # 0xA5 -> LATIN SMALL LETTER V + 'w' # 0xA6 -> LATIN SMALL LETTER W + 'x' # 0xA7 -> LATIN SMALL LETTER X + 'y' # 0xA8 -> LATIN SMALL LETTER Y + 'z' # 0xA9 -> LATIN SMALL LETTER Z + '\xa1' # 0xAA -> INVERTED EXCLAMATION MARK + '\xbf' # 0xAB -> INVERTED QUESTION MARK + '\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) + '\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) + '\xae' # 0xAF -> REGISTERED SIGN + '^' # 0xB0 -> CIRCUMFLEX ACCENT + '\xa3' # 0xB1 -> POUND SIGN + '\xa5' # 0xB2 -> YEN SIGN + '\xb7' # 0xB3 -> MIDDLE DOT + '\xa9' # 0xB4 -> COPYRIGHT SIGN + '\xa7' # 0xB5 -> SECTION SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF + '\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS + '[' # 0xBA -> LEFT SQUARE BRACKET + ']' # 0xBB -> RIGHT SQUARE BRACKET + '\xaf' # 0xBC -> MACRON + '\xa8' # 0xBD -> DIAERESIS + '\xb4' # 0xBE -> ACUTE ACCENT + '\xd7' # 0xBF -> MULTIPLICATION SIGN + '{' # 0xC0 -> LEFT CURLY BRACKET + 'A' # 0xC1 -> LATIN CAPITAL LETTER A + 'B' # 0xC2 -> LATIN CAPITAL LETTER B + 'C' # 0xC3 -> LATIN CAPITAL LETTER C + 'D' # 0xC4 -> LATIN CAPITAL LETTER D + 'E' # 0xC5 -> LATIN CAPITAL LETTER E + 'F' # 0xC6 -> LATIN CAPITAL LETTER F + 'G' # 0xC7 -> LATIN CAPITAL LETTER G + 'H' # 0xC8 -> LATIN CAPITAL LETTER H + 'I' # 0xC9 -> LATIN CAPITAL LETTER I + '\xad' # 0xCA -> SOFT HYPHEN + '\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE + '\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE + '}' # 0xD0 -> RIGHT CURLY BRACKET + 'J' # 0xD1 -> LATIN CAPITAL LETTER J + 'K' # 0xD2 -> LATIN CAPITAL LETTER K + 'L' # 0xD3 -> LATIN CAPITAL LETTER L + 'M' # 0xD4 -> LATIN CAPITAL LETTER M + 'N' # 0xD5 -> LATIN CAPITAL LETTER N + 'O' # 0xD6 -> LATIN CAPITAL LETTER O + 'P' # 0xD7 -> LATIN CAPITAL LETTER P + 'Q' # 0xD8 -> LATIN CAPITAL LETTER Q + 'R' # 0xD9 -> LATIN CAPITAL LETTER R + '\xb9' # 0xDA -> SUPERSCRIPT ONE + '\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE + '\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\\' # 0xE0 -> REVERSE SOLIDUS + '\xf7' # 0xE1 -> DIVISION SIGN + 'S' # 0xE2 -> LATIN CAPITAL LETTER S + 'T' # 0xE3 -> LATIN CAPITAL LETTER T + 'U' # 0xE4 -> LATIN CAPITAL LETTER U + 'V' # 0xE5 -> LATIN CAPITAL LETTER V + 'W' # 0xE6 -> LATIN CAPITAL LETTER W + 'X' # 0xE7 -> LATIN CAPITAL LETTER X + 'Y' # 0xE8 -> LATIN CAPITAL LETTER Y + 'Z' # 0xE9 -> LATIN CAPITAL LETTER Z + '\xb2' # 0xEA -> SUPERSCRIPT TWO + '\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE + '0' # 0xF0 -> DIGIT ZERO + '1' # 0xF1 -> DIGIT ONE + '2' # 0xF2 -> DIGIT TWO + '3' # 0xF3 -> DIGIT THREE + '4' # 0xF4 -> DIGIT FOUR + '5' # 0xF5 -> DIGIT FIVE + '6' # 0xF6 -> DIGIT SIX + '7' # 0xF7 -> DIGIT SEVEN + '8' # 0xF8 -> DIGIT EIGHT + '9' # 0xF9 -> DIGIT NINE + '\xb3' # 0xFA -> SUPERSCRIPT THREE + '\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE + '\x9f' # 0xFF -> CONTROL ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1006.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1006.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1006.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u06f0' # 0xA1 -> EXTENDED ARABIC-INDIC DIGIT ZERO - u'\u06f1' # 0xA2 -> EXTENDED ARABIC-INDIC DIGIT ONE - u'\u06f2' # 0xA3 -> EXTENDED ARABIC-INDIC DIGIT TWO - u'\u06f3' # 0xA4 -> EXTENDED ARABIC-INDIC DIGIT THREE - u'\u06f4' # 0xA5 -> EXTENDED ARABIC-INDIC DIGIT FOUR - u'\u06f5' # 0xA6 -> EXTENDED ARABIC-INDIC DIGIT FIVE - u'\u06f6' # 0xA7 -> EXTENDED ARABIC-INDIC DIGIT SIX - u'\u06f7' # 0xA8 -> EXTENDED ARABIC-INDIC DIGIT SEVEN - u'\u06f8' # 0xA9 -> EXTENDED ARABIC-INDIC DIGIT EIGHT - u'\u06f9' # 0xAA -> EXTENDED ARABIC-INDIC DIGIT NINE - u'\u060c' # 0xAB -> ARABIC COMMA - u'\u061b' # 0xAC -> ARABIC SEMICOLON - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u061f' # 0xAE -> ARABIC QUESTION MARK - u'\ufe81' # 0xAF -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM - u'\ufe8d' # 0xB0 -> ARABIC LETTER ALEF ISOLATED FORM - u'\ufe8e' # 0xB1 -> ARABIC LETTER ALEF FINAL FORM - u'\ufe8e' # 0xB2 -> ARABIC LETTER ALEF FINAL FORM - u'\ufe8f' # 0xB3 -> ARABIC LETTER BEH ISOLATED FORM - u'\ufe91' # 0xB4 -> ARABIC LETTER BEH INITIAL FORM - u'\ufb56' # 0xB5 -> ARABIC LETTER PEH ISOLATED FORM - u'\ufb58' # 0xB6 -> ARABIC LETTER PEH INITIAL FORM - u'\ufe93' # 0xB7 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM - u'\ufe95' # 0xB8 -> ARABIC LETTER TEH ISOLATED FORM - u'\ufe97' # 0xB9 -> ARABIC LETTER TEH INITIAL FORM - u'\ufb66' # 0xBA -> ARABIC LETTER TTEH ISOLATED FORM - u'\ufb68' # 0xBB -> ARABIC LETTER TTEH INITIAL FORM - u'\ufe99' # 0xBC -> ARABIC LETTER THEH ISOLATED FORM - u'\ufe9b' # 0xBD -> ARABIC LETTER THEH INITIAL FORM - u'\ufe9d' # 0xBE -> ARABIC LETTER JEEM ISOLATED FORM - u'\ufe9f' # 0xBF -> ARABIC LETTER JEEM INITIAL FORM - u'\ufb7a' # 0xC0 -> ARABIC LETTER TCHEH ISOLATED FORM - u'\ufb7c' # 0xC1 -> ARABIC LETTER TCHEH INITIAL FORM - u'\ufea1' # 0xC2 -> ARABIC LETTER HAH ISOLATED FORM - u'\ufea3' # 0xC3 -> ARABIC LETTER HAH INITIAL FORM - u'\ufea5' # 0xC4 -> ARABIC LETTER KHAH ISOLATED FORM - u'\ufea7' # 0xC5 -> ARABIC LETTER KHAH INITIAL FORM - u'\ufea9' # 0xC6 -> ARABIC LETTER DAL ISOLATED FORM - u'\ufb84' # 0xC7 -> ARABIC LETTER DAHAL ISOLATED FORMN - u'\ufeab' # 0xC8 -> ARABIC LETTER THAL ISOLATED FORM - u'\ufead' # 0xC9 -> ARABIC LETTER REH ISOLATED FORM - u'\ufb8c' # 0xCA -> ARABIC LETTER RREH ISOLATED FORM - u'\ufeaf' # 0xCB -> ARABIC LETTER ZAIN ISOLATED FORM - u'\ufb8a' # 0xCC -> ARABIC LETTER JEH ISOLATED FORM - u'\ufeb1' # 0xCD -> ARABIC LETTER SEEN ISOLATED FORM - u'\ufeb3' # 0xCE -> ARABIC LETTER SEEN INITIAL FORM - u'\ufeb5' # 0xCF -> ARABIC LETTER SHEEN ISOLATED FORM - u'\ufeb7' # 0xD0 -> ARABIC LETTER SHEEN INITIAL FORM - u'\ufeb9' # 0xD1 -> ARABIC LETTER SAD ISOLATED FORM - u'\ufebb' # 0xD2 -> ARABIC LETTER SAD INITIAL FORM - u'\ufebd' # 0xD3 -> ARABIC LETTER DAD ISOLATED FORM - u'\ufebf' # 0xD4 -> ARABIC LETTER DAD INITIAL FORM - u'\ufec1' # 0xD5 -> ARABIC LETTER TAH ISOLATED FORM - u'\ufec5' # 0xD6 -> ARABIC LETTER ZAH ISOLATED FORM - u'\ufec9' # 0xD7 -> ARABIC LETTER AIN ISOLATED FORM - u'\ufeca' # 0xD8 -> ARABIC LETTER AIN FINAL FORM - u'\ufecb' # 0xD9 -> ARABIC LETTER AIN INITIAL FORM - u'\ufecc' # 0xDA -> ARABIC LETTER AIN MEDIAL FORM - u'\ufecd' # 0xDB -> ARABIC LETTER GHAIN ISOLATED FORM - u'\ufece' # 0xDC -> ARABIC LETTER GHAIN FINAL FORM - u'\ufecf' # 0xDD -> ARABIC LETTER GHAIN INITIAL FORM - u'\ufed0' # 0xDE -> ARABIC LETTER GHAIN MEDIAL FORM - u'\ufed1' # 0xDF -> ARABIC LETTER FEH ISOLATED FORM - u'\ufed3' # 0xE0 -> ARABIC LETTER FEH INITIAL FORM - u'\ufed5' # 0xE1 -> ARABIC LETTER QAF ISOLATED FORM - u'\ufed7' # 0xE2 -> ARABIC LETTER QAF INITIAL FORM - u'\ufed9' # 0xE3 -> ARABIC LETTER KAF ISOLATED FORM - u'\ufedb' # 0xE4 -> ARABIC LETTER KAF INITIAL FORM - u'\ufb92' # 0xE5 -> ARABIC LETTER GAF ISOLATED FORM - u'\ufb94' # 0xE6 -> ARABIC LETTER GAF INITIAL FORM - u'\ufedd' # 0xE7 -> ARABIC LETTER LAM ISOLATED FORM - u'\ufedf' # 0xE8 -> ARABIC LETTER LAM INITIAL FORM - u'\ufee0' # 0xE9 -> ARABIC LETTER LAM MEDIAL FORM - u'\ufee1' # 0xEA -> ARABIC LETTER MEEM ISOLATED FORM - u'\ufee3' # 0xEB -> ARABIC LETTER MEEM INITIAL FORM - u'\ufb9e' # 0xEC -> ARABIC LETTER NOON GHUNNA ISOLATED FORM - u'\ufee5' # 0xED -> ARABIC LETTER NOON ISOLATED FORM - u'\ufee7' # 0xEE -> ARABIC LETTER NOON INITIAL FORM - u'\ufe85' # 0xEF -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM - u'\ufeed' # 0xF0 -> ARABIC LETTER WAW ISOLATED FORM - u'\ufba6' # 0xF1 -> ARABIC LETTER HEH GOAL ISOLATED FORM - u'\ufba8' # 0xF2 -> ARABIC LETTER HEH GOAL INITIAL FORM - u'\ufba9' # 0xF3 -> ARABIC LETTER HEH GOAL MEDIAL FORM - u'\ufbaa' # 0xF4 -> ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM - u'\ufe80' # 0xF5 -> ARABIC LETTER HAMZA ISOLATED FORM - u'\ufe89' # 0xF6 -> ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM - u'\ufe8a' # 0xF7 -> ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM - u'\ufe8b' # 0xF8 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM - u'\ufef1' # 0xF9 -> ARABIC LETTER YEH ISOLATED FORM - u'\ufef2' # 0xFA -> ARABIC LETTER YEH FINAL FORM - u'\ufef3' # 0xFB -> ARABIC LETTER YEH INITIAL FORM - u'\ufbb0' # 0xFC -> ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM - u'\ufbae' # 0xFD -> ARABIC LETTER YEH BARREE ISOLATED FORM - u'\ufe7c' # 0xFE -> ARABIC SHADDA ISOLATED FORM - u'\ufe7d' # 0xFF -> ARABIC SHADDA MEDIAL FORM + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u06f0' # 0xA1 -> EXTENDED ARABIC-INDIC DIGIT ZERO + '\u06f1' # 0xA2 -> EXTENDED ARABIC-INDIC DIGIT ONE + '\u06f2' # 0xA3 -> EXTENDED ARABIC-INDIC DIGIT TWO + '\u06f3' # 0xA4 -> EXTENDED ARABIC-INDIC DIGIT THREE + '\u06f4' # 0xA5 -> EXTENDED ARABIC-INDIC DIGIT FOUR + '\u06f5' # 0xA6 -> EXTENDED ARABIC-INDIC DIGIT FIVE + '\u06f6' # 0xA7 -> EXTENDED ARABIC-INDIC DIGIT SIX + '\u06f7' # 0xA8 -> EXTENDED ARABIC-INDIC DIGIT SEVEN + '\u06f8' # 0xA9 -> EXTENDED ARABIC-INDIC DIGIT EIGHT + '\u06f9' # 0xAA -> EXTENDED ARABIC-INDIC DIGIT NINE + '\u060c' # 0xAB -> ARABIC COMMA + '\u061b' # 0xAC -> ARABIC SEMICOLON + '\xad' # 0xAD -> SOFT HYPHEN + '\u061f' # 0xAE -> ARABIC QUESTION MARK + '\ufe81' # 0xAF -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM + '\ufe8d' # 0xB0 -> ARABIC LETTER ALEF ISOLATED FORM + '\ufe8e' # 0xB1 -> ARABIC LETTER ALEF FINAL FORM + '\ufe8e' # 0xB2 -> ARABIC LETTER ALEF FINAL FORM + '\ufe8f' # 0xB3 -> ARABIC LETTER BEH ISOLATED FORM + '\ufe91' # 0xB4 -> ARABIC LETTER BEH INITIAL FORM + '\ufb56' # 0xB5 -> ARABIC LETTER PEH ISOLATED FORM + '\ufb58' # 0xB6 -> ARABIC LETTER PEH INITIAL FORM + '\ufe93' # 0xB7 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM + '\ufe95' # 0xB8 -> ARABIC LETTER TEH ISOLATED FORM + '\ufe97' # 0xB9 -> ARABIC LETTER TEH INITIAL FORM + '\ufb66' # 0xBA -> ARABIC LETTER TTEH ISOLATED FORM + '\ufb68' # 0xBB -> ARABIC LETTER TTEH INITIAL FORM + '\ufe99' # 0xBC -> ARABIC LETTER THEH ISOLATED FORM + '\ufe9b' # 0xBD -> ARABIC LETTER THEH INITIAL FORM + '\ufe9d' # 0xBE -> ARABIC LETTER JEEM ISOLATED FORM + '\ufe9f' # 0xBF -> ARABIC LETTER JEEM INITIAL FORM + '\ufb7a' # 0xC0 -> ARABIC LETTER TCHEH ISOLATED FORM + '\ufb7c' # 0xC1 -> ARABIC LETTER TCHEH INITIAL FORM + '\ufea1' # 0xC2 -> ARABIC LETTER HAH ISOLATED FORM + '\ufea3' # 0xC3 -> ARABIC LETTER HAH INITIAL FORM + '\ufea5' # 0xC4 -> ARABIC LETTER KHAH ISOLATED FORM + '\ufea7' # 0xC5 -> ARABIC LETTER KHAH INITIAL FORM + '\ufea9' # 0xC6 -> ARABIC LETTER DAL ISOLATED FORM + '\ufb84' # 0xC7 -> ARABIC LETTER DAHAL ISOLATED FORMN + '\ufeab' # 0xC8 -> ARABIC LETTER THAL ISOLATED FORM + '\ufead' # 0xC9 -> ARABIC LETTER REH ISOLATED FORM + '\ufb8c' # 0xCA -> ARABIC LETTER RREH ISOLATED FORM + '\ufeaf' # 0xCB -> ARABIC LETTER ZAIN ISOLATED FORM + '\ufb8a' # 0xCC -> ARABIC LETTER JEH ISOLATED FORM + '\ufeb1' # 0xCD -> ARABIC LETTER SEEN ISOLATED FORM + '\ufeb3' # 0xCE -> ARABIC LETTER SEEN INITIAL FORM + '\ufeb5' # 0xCF -> ARABIC LETTER SHEEN ISOLATED FORM + '\ufeb7' # 0xD0 -> ARABIC LETTER SHEEN INITIAL FORM + '\ufeb9' # 0xD1 -> ARABIC LETTER SAD ISOLATED FORM + '\ufebb' # 0xD2 -> ARABIC LETTER SAD INITIAL FORM + '\ufebd' # 0xD3 -> ARABIC LETTER DAD ISOLATED FORM + '\ufebf' # 0xD4 -> ARABIC LETTER DAD INITIAL FORM + '\ufec1' # 0xD5 -> ARABIC LETTER TAH ISOLATED FORM + '\ufec5' # 0xD6 -> ARABIC LETTER ZAH ISOLATED FORM + '\ufec9' # 0xD7 -> ARABIC LETTER AIN ISOLATED FORM + '\ufeca' # 0xD8 -> ARABIC LETTER AIN FINAL FORM + '\ufecb' # 0xD9 -> ARABIC LETTER AIN INITIAL FORM + '\ufecc' # 0xDA -> ARABIC LETTER AIN MEDIAL FORM + '\ufecd' # 0xDB -> ARABIC LETTER GHAIN ISOLATED FORM + '\ufece' # 0xDC -> ARABIC LETTER GHAIN FINAL FORM + '\ufecf' # 0xDD -> ARABIC LETTER GHAIN INITIAL FORM + '\ufed0' # 0xDE -> ARABIC LETTER GHAIN MEDIAL FORM + '\ufed1' # 0xDF -> ARABIC LETTER FEH ISOLATED FORM + '\ufed3' # 0xE0 -> ARABIC LETTER FEH INITIAL FORM + '\ufed5' # 0xE1 -> ARABIC LETTER QAF ISOLATED FORM + '\ufed7' # 0xE2 -> ARABIC LETTER QAF INITIAL FORM + '\ufed9' # 0xE3 -> ARABIC LETTER KAF ISOLATED FORM + '\ufedb' # 0xE4 -> ARABIC LETTER KAF INITIAL FORM + '\ufb92' # 0xE5 -> ARABIC LETTER GAF ISOLATED FORM + '\ufb94' # 0xE6 -> ARABIC LETTER GAF INITIAL FORM + '\ufedd' # 0xE7 -> ARABIC LETTER LAM ISOLATED FORM + '\ufedf' # 0xE8 -> ARABIC LETTER LAM INITIAL FORM + '\ufee0' # 0xE9 -> ARABIC LETTER LAM MEDIAL FORM + '\ufee1' # 0xEA -> ARABIC LETTER MEEM ISOLATED FORM + '\ufee3' # 0xEB -> ARABIC LETTER MEEM INITIAL FORM + '\ufb9e' # 0xEC -> ARABIC LETTER NOON GHUNNA ISOLATED FORM + '\ufee5' # 0xED -> ARABIC LETTER NOON ISOLATED FORM + '\ufee7' # 0xEE -> ARABIC LETTER NOON INITIAL FORM + '\ufe85' # 0xEF -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM + '\ufeed' # 0xF0 -> ARABIC LETTER WAW ISOLATED FORM + '\ufba6' # 0xF1 -> ARABIC LETTER HEH GOAL ISOLATED FORM + '\ufba8' # 0xF2 -> ARABIC LETTER HEH GOAL INITIAL FORM + '\ufba9' # 0xF3 -> ARABIC LETTER HEH GOAL MEDIAL FORM + '\ufbaa' # 0xF4 -> ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM + '\ufe80' # 0xF5 -> ARABIC LETTER HAMZA ISOLATED FORM + '\ufe89' # 0xF6 -> ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM + '\ufe8a' # 0xF7 -> ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM + '\ufe8b' # 0xF8 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM + '\ufef1' # 0xF9 -> ARABIC LETTER YEH ISOLATED FORM + '\ufef2' # 0xFA -> ARABIC LETTER YEH FINAL FORM + '\ufef3' # 0xFB -> ARABIC LETTER YEH INITIAL FORM + '\ufbb0' # 0xFC -> ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM + '\ufbae' # 0xFD -> ARABIC LETTER YEH BARREE ISOLATED FORM + '\ufe7c' # 0xFE -> ARABIC SHADDA ISOLATED FORM + '\ufe7d' # 0xFF -> ARABIC SHADDA MEDIAL FORM ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1026.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1026.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1026.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\xa0' # 0x41 -> NO-BREAK SPACE - u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE - u'{' # 0x48 -> LEFT CURLY BRACKET - u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE - u'\xc7' # 0x4A -> LATIN CAPITAL LETTER C WITH CEDILLA - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'!' # 0x4F -> EXCLAMATION MARK - u'&' # 0x50 -> AMPERSAND - u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE - u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE - u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'\u011e' # 0x5A -> LATIN CAPITAL LETTER G WITH BREVE - u'\u0130' # 0x5B -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'^' # 0x5F -> CIRCUMFLEX ACCENT - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'[' # 0x68 -> LEFT SQUARE BRACKET - u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE - u'\u015f' # 0x6A -> LATIN SMALL LETTER S WITH CEDILLA - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE - u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE - u'\u0131' # 0x79 -> LATIN SMALL LETTER DOTLESS I - u':' # 0x7A -> COLON - u'\xd6' # 0x7B -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\u015e' # 0x7C -> LATIN CAPITAL LETTER S WITH CEDILLA - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'\xdc' # 0x7F -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'}' # 0x8C -> RIGHT CURLY BRACKET - u'`' # 0x8D -> GRAVE ACCENT - u'\xa6' # 0x8E -> BROKEN BAR - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR - u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE - u'\xb8' # 0x9D -> CEDILLA - u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE - u'\xa4' # 0x9F -> CURRENCY SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'\xf6' # 0xA1 -> LATIN SMALL LETTER O WITH DIAERESIS - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK - u'\xbf' # 0xAB -> INVERTED QUESTION MARK - u']' # 0xAC -> RIGHT SQUARE BRACKET - u'$' # 0xAD -> DOLLAR SIGN - u'@' # 0xAE -> COMMERCIAL AT - u'\xae' # 0xAF -> REGISTERED SIGN - u'\xa2' # 0xB0 -> CENT SIGN - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'\xac' # 0xBA -> NOT SIGN - u'|' # 0xBB -> VERTICAL LINE - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'\xe7' # 0xC0 -> LATIN SMALL LETTER C WITH CEDILLA - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'~' # 0xCC -> TILDE - u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE - u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE - u'\u011f' # 0xD0 -> LATIN SMALL LETTER G WITH BREVE - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\\' # 0xDC -> REVERSE SOLIDUS - u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE - u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xfc' # 0xE0 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'#' # 0xEC -> NUMBER SIGN - u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'"' # 0xFC -> QUOTATION MARK - u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE - u'\x9f' # 0xFF -> CONTROL + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x9c' # 0x04 -> CONTROL + '\t' # 0x05 -> HORIZONTAL TABULATION + '\x86' # 0x06 -> CONTROL + '\x7f' # 0x07 -> DELETE + '\x97' # 0x08 -> CONTROL + '\x8d' # 0x09 -> CONTROL + '\x8e' # 0x0A -> CONTROL + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x9d' # 0x14 -> CONTROL + '\x85' # 0x15 -> CONTROL + '\x08' # 0x16 -> BACKSPACE + '\x87' # 0x17 -> CONTROL + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x92' # 0x1A -> CONTROL + '\x8f' # 0x1B -> CONTROL + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + '\x80' # 0x20 -> CONTROL + '\x81' # 0x21 -> CONTROL + '\x82' # 0x22 -> CONTROL + '\x83' # 0x23 -> CONTROL + '\x84' # 0x24 -> CONTROL + '\n' # 0x25 -> LINE FEED + '\x17' # 0x26 -> END OF TRANSMISSION BLOCK + '\x1b' # 0x27 -> ESCAPE + '\x88' # 0x28 -> CONTROL + '\x89' # 0x29 -> CONTROL + '\x8a' # 0x2A -> CONTROL + '\x8b' # 0x2B -> CONTROL + '\x8c' # 0x2C -> CONTROL + '\x05' # 0x2D -> ENQUIRY + '\x06' # 0x2E -> ACKNOWLEDGE + '\x07' # 0x2F -> BELL + '\x90' # 0x30 -> CONTROL + '\x91' # 0x31 -> CONTROL + '\x16' # 0x32 -> SYNCHRONOUS IDLE + '\x93' # 0x33 -> CONTROL + '\x94' # 0x34 -> CONTROL + '\x95' # 0x35 -> CONTROL + '\x96' # 0x36 -> CONTROL + '\x04' # 0x37 -> END OF TRANSMISSION + '\x98' # 0x38 -> CONTROL + '\x99' # 0x39 -> CONTROL + '\x9a' # 0x3A -> CONTROL + '\x9b' # 0x3B -> CONTROL + '\x14' # 0x3C -> DEVICE CONTROL FOUR + '\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE + '\x9e' # 0x3E -> CONTROL + '\x1a' # 0x3F -> SUBSTITUTE + ' ' # 0x40 -> SPACE + '\xa0' # 0x41 -> NO-BREAK SPACE + '\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE + '\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE + '{' # 0x48 -> LEFT CURLY BRACKET + '\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE + '\xc7' # 0x4A -> LATIN CAPITAL LETTER C WITH CEDILLA + '.' # 0x4B -> FULL STOP + '<' # 0x4C -> LESS-THAN SIGN + '(' # 0x4D -> LEFT PARENTHESIS + '+' # 0x4E -> PLUS SIGN + '!' # 0x4F -> EXCLAMATION MARK + '&' # 0x50 -> AMPERSAND + '\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE + '\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE + '\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) + '\u011e' # 0x5A -> LATIN CAPITAL LETTER G WITH BREVE + '\u0130' # 0x5B -> LATIN CAPITAL LETTER I WITH DOT ABOVE + '*' # 0x5C -> ASTERISK + ')' # 0x5D -> RIGHT PARENTHESIS + ';' # 0x5E -> SEMICOLON + '^' # 0x5F -> CIRCUMFLEX ACCENT + '-' # 0x60 -> HYPHEN-MINUS + '/' # 0x61 -> SOLIDUS + '\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '[' # 0x68 -> LEFT SQUARE BRACKET + '\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE + '\u015f' # 0x6A -> LATIN SMALL LETTER S WITH CEDILLA + ',' # 0x6B -> COMMA + '%' # 0x6C -> PERCENT SIGN + '_' # 0x6D -> LOW LINE + '>' # 0x6E -> GREATER-THAN SIGN + '?' # 0x6F -> QUESTION MARK + '\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE + '\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE + '\u0131' # 0x79 -> LATIN SMALL LETTER DOTLESS I + ':' # 0x7A -> COLON + '\xd6' # 0x7B -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\u015e' # 0x7C -> LATIN CAPITAL LETTER S WITH CEDILLA + "'" # 0x7D -> APOSTROPHE + '=' # 0x7E -> EQUALS SIGN + '\xdc' # 0x7F -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE + 'a' # 0x81 -> LATIN SMALL LETTER A + 'b' # 0x82 -> LATIN SMALL LETTER B + 'c' # 0x83 -> LATIN SMALL LETTER C + 'd' # 0x84 -> LATIN SMALL LETTER D + 'e' # 0x85 -> LATIN SMALL LETTER E + 'f' # 0x86 -> LATIN SMALL LETTER F + 'g' # 0x87 -> LATIN SMALL LETTER G + 'h' # 0x88 -> LATIN SMALL LETTER H + 'i' # 0x89 -> LATIN SMALL LETTER I + '\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '}' # 0x8C -> RIGHT CURLY BRACKET + '`' # 0x8D -> GRAVE ACCENT + '\xa6' # 0x8E -> BROKEN BAR + '\xb1' # 0x8F -> PLUS-MINUS SIGN + '\xb0' # 0x90 -> DEGREE SIGN + 'j' # 0x91 -> LATIN SMALL LETTER J + 'k' # 0x92 -> LATIN SMALL LETTER K + 'l' # 0x93 -> LATIN SMALL LETTER L + 'm' # 0x94 -> LATIN SMALL LETTER M + 'n' # 0x95 -> LATIN SMALL LETTER N + 'o' # 0x96 -> LATIN SMALL LETTER O + 'p' # 0x97 -> LATIN SMALL LETTER P + 'q' # 0x98 -> LATIN SMALL LETTER Q + 'r' # 0x99 -> LATIN SMALL LETTER R + '\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR + '\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR + '\xe6' # 0x9C -> LATIN SMALL LIGATURE AE + '\xb8' # 0x9D -> CEDILLA + '\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE + '\xa4' # 0x9F -> CURRENCY SIGN + '\xb5' # 0xA0 -> MICRO SIGN + '\xf6' # 0xA1 -> LATIN SMALL LETTER O WITH DIAERESIS + 's' # 0xA2 -> LATIN SMALL LETTER S + 't' # 0xA3 -> LATIN SMALL LETTER T + 'u' # 0xA4 -> LATIN SMALL LETTER U + 'v' # 0xA5 -> LATIN SMALL LETTER V + 'w' # 0xA6 -> LATIN SMALL LETTER W + 'x' # 0xA7 -> LATIN SMALL LETTER X + 'y' # 0xA8 -> LATIN SMALL LETTER Y + 'z' # 0xA9 -> LATIN SMALL LETTER Z + '\xa1' # 0xAA -> INVERTED EXCLAMATION MARK + '\xbf' # 0xAB -> INVERTED QUESTION MARK + ']' # 0xAC -> RIGHT SQUARE BRACKET + '$' # 0xAD -> DOLLAR SIGN + '@' # 0xAE -> COMMERCIAL AT + '\xae' # 0xAF -> REGISTERED SIGN + '\xa2' # 0xB0 -> CENT SIGN + '\xa3' # 0xB1 -> POUND SIGN + '\xa5' # 0xB2 -> YEN SIGN + '\xb7' # 0xB3 -> MIDDLE DOT + '\xa9' # 0xB4 -> COPYRIGHT SIGN + '\xa7' # 0xB5 -> SECTION SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF + '\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS + '\xac' # 0xBA -> NOT SIGN + '|' # 0xBB -> VERTICAL LINE + '\xaf' # 0xBC -> MACRON + '\xa8' # 0xBD -> DIAERESIS + '\xb4' # 0xBE -> ACUTE ACCENT + '\xd7' # 0xBF -> MULTIPLICATION SIGN + '\xe7' # 0xC0 -> LATIN SMALL LETTER C WITH CEDILLA + 'A' # 0xC1 -> LATIN CAPITAL LETTER A + 'B' # 0xC2 -> LATIN CAPITAL LETTER B + 'C' # 0xC3 -> LATIN CAPITAL LETTER C + 'D' # 0xC4 -> LATIN CAPITAL LETTER D + 'E' # 0xC5 -> LATIN CAPITAL LETTER E + 'F' # 0xC6 -> LATIN CAPITAL LETTER F + 'G' # 0xC7 -> LATIN CAPITAL LETTER G + 'H' # 0xC8 -> LATIN CAPITAL LETTER H + 'I' # 0xC9 -> LATIN CAPITAL LETTER I + '\xad' # 0xCA -> SOFT HYPHEN + '\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '~' # 0xCC -> TILDE + '\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE + '\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE + '\u011f' # 0xD0 -> LATIN SMALL LETTER G WITH BREVE + 'J' # 0xD1 -> LATIN CAPITAL LETTER J + 'K' # 0xD2 -> LATIN CAPITAL LETTER K + 'L' # 0xD3 -> LATIN CAPITAL LETTER L + 'M' # 0xD4 -> LATIN CAPITAL LETTER M + 'N' # 0xD5 -> LATIN CAPITAL LETTER N + 'O' # 0xD6 -> LATIN CAPITAL LETTER O + 'P' # 0xD7 -> LATIN CAPITAL LETTER P + 'Q' # 0xD8 -> LATIN CAPITAL LETTER Q + 'R' # 0xD9 -> LATIN CAPITAL LETTER R + '\xb9' # 0xDA -> SUPERSCRIPT ONE + '\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\\' # 0xDC -> REVERSE SOLIDUS + '\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE + '\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\xfc' # 0xE0 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xf7' # 0xE1 -> DIVISION SIGN + 'S' # 0xE2 -> LATIN CAPITAL LETTER S + 'T' # 0xE3 -> LATIN CAPITAL LETTER T + 'U' # 0xE4 -> LATIN CAPITAL LETTER U + 'V' # 0xE5 -> LATIN CAPITAL LETTER V + 'W' # 0xE6 -> LATIN CAPITAL LETTER W + 'X' # 0xE7 -> LATIN CAPITAL LETTER X + 'Y' # 0xE8 -> LATIN CAPITAL LETTER Y + 'Z' # 0xE9 -> LATIN CAPITAL LETTER Z + '\xb2' # 0xEA -> SUPERSCRIPT TWO + '\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '#' # 0xEC -> NUMBER SIGN + '\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE + '0' # 0xF0 -> DIGIT ZERO + '1' # 0xF1 -> DIGIT ONE + '2' # 0xF2 -> DIGIT TWO + '3' # 0xF3 -> DIGIT THREE + '4' # 0xF4 -> DIGIT FOUR + '5' # 0xF5 -> DIGIT FIVE + '6' # 0xF6 -> DIGIT SIX + '7' # 0xF7 -> DIGIT SEVEN + '8' # 0xF8 -> DIGIT EIGHT + '9' # 0xF9 -> DIGIT NINE + '\xb3' # 0xFA -> SUPERSCRIPT THREE + '\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '"' # 0xFC -> QUOTATION MARK + '\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE + '\x9f' # 0xFF -> CONTROL ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1140.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1140.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1140.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\xa0' # 0x41 -> NO-BREAK SPACE - u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE - u'\xa2' # 0x4A -> CENT SIGN - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'|' # 0x4F -> VERTICAL LINE - u'&' # 0x50 -> AMPERSAND - u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE - u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE - u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'!' # 0x5A -> EXCLAMATION MARK - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'\xac' # 0x5F -> NOT SIGN - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xa6' # 0x6A -> BROKEN BAR - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE - u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) - u'\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR - u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE - u'\xb8' # 0x9D -> CEDILLA - u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE - u'\u20ac' # 0x9F -> EURO SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK - u'\xbf' # 0xAB -> INVERTED QUESTION MARK - u'\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) - u'\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) - u'\xae' # 0xAF -> REGISTERED SIGN - u'^' # 0xB0 -> CIRCUMFLEX ACCENT - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'[' # 0xBA -> LEFT SQUARE BRACKET - u']' # 0xBB -> RIGHT SQUARE BRACKET - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE - u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE - u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE - u'\x9f' # 0xFF -> CONTROL + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x9c' # 0x04 -> CONTROL + '\t' # 0x05 -> HORIZONTAL TABULATION + '\x86' # 0x06 -> CONTROL + '\x7f' # 0x07 -> DELETE + '\x97' # 0x08 -> CONTROL + '\x8d' # 0x09 -> CONTROL + '\x8e' # 0x0A -> CONTROL + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x9d' # 0x14 -> CONTROL + '\x85' # 0x15 -> CONTROL + '\x08' # 0x16 -> BACKSPACE + '\x87' # 0x17 -> CONTROL + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x92' # 0x1A -> CONTROL + '\x8f' # 0x1B -> CONTROL + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + '\x80' # 0x20 -> CONTROL + '\x81' # 0x21 -> CONTROL + '\x82' # 0x22 -> CONTROL + '\x83' # 0x23 -> CONTROL + '\x84' # 0x24 -> CONTROL + '\n' # 0x25 -> LINE FEED + '\x17' # 0x26 -> END OF TRANSMISSION BLOCK + '\x1b' # 0x27 -> ESCAPE + '\x88' # 0x28 -> CONTROL + '\x89' # 0x29 -> CONTROL + '\x8a' # 0x2A -> CONTROL + '\x8b' # 0x2B -> CONTROL + '\x8c' # 0x2C -> CONTROL + '\x05' # 0x2D -> ENQUIRY + '\x06' # 0x2E -> ACKNOWLEDGE + '\x07' # 0x2F -> BELL + '\x90' # 0x30 -> CONTROL + '\x91' # 0x31 -> CONTROL + '\x16' # 0x32 -> SYNCHRONOUS IDLE + '\x93' # 0x33 -> CONTROL + '\x94' # 0x34 -> CONTROL + '\x95' # 0x35 -> CONTROL + '\x96' # 0x36 -> CONTROL + '\x04' # 0x37 -> END OF TRANSMISSION + '\x98' # 0x38 -> CONTROL + '\x99' # 0x39 -> CONTROL + '\x9a' # 0x3A -> CONTROL + '\x9b' # 0x3B -> CONTROL + '\x14' # 0x3C -> DEVICE CONTROL FOUR + '\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE + '\x9e' # 0x3E -> CONTROL + '\x1a' # 0x3F -> SUBSTITUTE + ' ' # 0x40 -> SPACE + '\xa0' # 0x41 -> NO-BREAK SPACE + '\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE + '\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA + '\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE + '\xa2' # 0x4A -> CENT SIGN + '.' # 0x4B -> FULL STOP + '<' # 0x4C -> LESS-THAN SIGN + '(' # 0x4D -> LEFT PARENTHESIS + '+' # 0x4E -> PLUS SIGN + '|' # 0x4F -> VERTICAL LINE + '&' # 0x50 -> AMPERSAND + '\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE + '\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE + '\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) + '!' # 0x5A -> EXCLAMATION MARK + '$' # 0x5B -> DOLLAR SIGN + '*' # 0x5C -> ASTERISK + ')' # 0x5D -> RIGHT PARENTHESIS + ';' # 0x5E -> SEMICOLON + '\xac' # 0x5F -> NOT SIGN + '-' # 0x60 -> HYPHEN-MINUS + '/' # 0x61 -> SOLIDUS + '\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE + '\xa6' # 0x6A -> BROKEN BAR + ',' # 0x6B -> COMMA + '%' # 0x6C -> PERCENT SIGN + '_' # 0x6D -> LOW LINE + '>' # 0x6E -> GREATER-THAN SIGN + '?' # 0x6F -> QUESTION MARK + '\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE + '\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE + '`' # 0x79 -> GRAVE ACCENT + ':' # 0x7A -> COLON + '#' # 0x7B -> NUMBER SIGN + '@' # 0x7C -> COMMERCIAL AT + "'" # 0x7D -> APOSTROPHE + '=' # 0x7E -> EQUALS SIGN + '"' # 0x7F -> QUOTATION MARK + '\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE + 'a' # 0x81 -> LATIN SMALL LETTER A + 'b' # 0x82 -> LATIN SMALL LETTER B + 'c' # 0x83 -> LATIN SMALL LETTER C + 'd' # 0x84 -> LATIN SMALL LETTER D + 'e' # 0x85 -> LATIN SMALL LETTER E + 'f' # 0x86 -> LATIN SMALL LETTER F + 'g' # 0x87 -> LATIN SMALL LETTER G + 'h' # 0x88 -> LATIN SMALL LETTER H + 'i' # 0x89 -> LATIN SMALL LETTER I + '\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) + '\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE + '\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) + '\xb1' # 0x8F -> PLUS-MINUS SIGN + '\xb0' # 0x90 -> DEGREE SIGN + 'j' # 0x91 -> LATIN SMALL LETTER J + 'k' # 0x92 -> LATIN SMALL LETTER K + 'l' # 0x93 -> LATIN SMALL LETTER L + 'm' # 0x94 -> LATIN SMALL LETTER M + 'n' # 0x95 -> LATIN SMALL LETTER N + 'o' # 0x96 -> LATIN SMALL LETTER O + 'p' # 0x97 -> LATIN SMALL LETTER P + 'q' # 0x98 -> LATIN SMALL LETTER Q + 'r' # 0x99 -> LATIN SMALL LETTER R + '\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR + '\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR + '\xe6' # 0x9C -> LATIN SMALL LIGATURE AE + '\xb8' # 0x9D -> CEDILLA + '\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE + '\u20ac' # 0x9F -> EURO SIGN + '\xb5' # 0xA0 -> MICRO SIGN + '~' # 0xA1 -> TILDE + 's' # 0xA2 -> LATIN SMALL LETTER S + 't' # 0xA3 -> LATIN SMALL LETTER T + 'u' # 0xA4 -> LATIN SMALL LETTER U + 'v' # 0xA5 -> LATIN SMALL LETTER V + 'w' # 0xA6 -> LATIN SMALL LETTER W + 'x' # 0xA7 -> LATIN SMALL LETTER X + 'y' # 0xA8 -> LATIN SMALL LETTER Y + 'z' # 0xA9 -> LATIN SMALL LETTER Z + '\xa1' # 0xAA -> INVERTED EXCLAMATION MARK + '\xbf' # 0xAB -> INVERTED QUESTION MARK + '\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) + '\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) + '\xae' # 0xAF -> REGISTERED SIGN + '^' # 0xB0 -> CIRCUMFLEX ACCENT + '\xa3' # 0xB1 -> POUND SIGN + '\xa5' # 0xB2 -> YEN SIGN + '\xb7' # 0xB3 -> MIDDLE DOT + '\xa9' # 0xB4 -> COPYRIGHT SIGN + '\xa7' # 0xB5 -> SECTION SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF + '\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS + '[' # 0xBA -> LEFT SQUARE BRACKET + ']' # 0xBB -> RIGHT SQUARE BRACKET + '\xaf' # 0xBC -> MACRON + '\xa8' # 0xBD -> DIAERESIS + '\xb4' # 0xBE -> ACUTE ACCENT + '\xd7' # 0xBF -> MULTIPLICATION SIGN + '{' # 0xC0 -> LEFT CURLY BRACKET + 'A' # 0xC1 -> LATIN CAPITAL LETTER A + 'B' # 0xC2 -> LATIN CAPITAL LETTER B + 'C' # 0xC3 -> LATIN CAPITAL LETTER C + 'D' # 0xC4 -> LATIN CAPITAL LETTER D + 'E' # 0xC5 -> LATIN CAPITAL LETTER E + 'F' # 0xC6 -> LATIN CAPITAL LETTER F + 'G' # 0xC7 -> LATIN CAPITAL LETTER G + 'H' # 0xC8 -> LATIN CAPITAL LETTER H + 'I' # 0xC9 -> LATIN CAPITAL LETTER I + '\xad' # 0xCA -> SOFT HYPHEN + '\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE + '\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE + '}' # 0xD0 -> RIGHT CURLY BRACKET + 'J' # 0xD1 -> LATIN CAPITAL LETTER J + 'K' # 0xD2 -> LATIN CAPITAL LETTER K + 'L' # 0xD3 -> LATIN CAPITAL LETTER L + 'M' # 0xD4 -> LATIN CAPITAL LETTER M + 'N' # 0xD5 -> LATIN CAPITAL LETTER N + 'O' # 0xD6 -> LATIN CAPITAL LETTER O + 'P' # 0xD7 -> LATIN CAPITAL LETTER P + 'Q' # 0xD8 -> LATIN CAPITAL LETTER Q + 'R' # 0xD9 -> LATIN CAPITAL LETTER R + '\xb9' # 0xDA -> SUPERSCRIPT ONE + '\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE + '\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\\' # 0xE0 -> REVERSE SOLIDUS + '\xf7' # 0xE1 -> DIVISION SIGN + 'S' # 0xE2 -> LATIN CAPITAL LETTER S + 'T' # 0xE3 -> LATIN CAPITAL LETTER T + 'U' # 0xE4 -> LATIN CAPITAL LETTER U + 'V' # 0xE5 -> LATIN CAPITAL LETTER V + 'W' # 0xE6 -> LATIN CAPITAL LETTER W + 'X' # 0xE7 -> LATIN CAPITAL LETTER X + 'Y' # 0xE8 -> LATIN CAPITAL LETTER Y + 'Z' # 0xE9 -> LATIN CAPITAL LETTER Z + '\xb2' # 0xEA -> SUPERSCRIPT TWO + '\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE + '0' # 0xF0 -> DIGIT ZERO + '1' # 0xF1 -> DIGIT ONE + '2' # 0xF2 -> DIGIT TWO + '3' # 0xF3 -> DIGIT THREE + '4' # 0xF4 -> DIGIT FOUR + '5' # 0xF5 -> DIGIT FIVE + '6' # 0xF6 -> DIGIT SIX + '7' # 0xF7 -> DIGIT SEVEN + '8' # 0xF8 -> DIGIT EIGHT + '9' # 0xF9 -> DIGIT NINE + '\xb3' # 0xFA -> SUPERSCRIPT THREE + '\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE + '\x9f' # 0xFF -> CONTROL ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1250.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1250.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1250.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\ufffe' # 0x83 -> UNDEFINED - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\ufffe' # 0x88 -> UNDEFINED - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u015a' # 0x8C -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u0164' # 0x8D -> LATIN CAPITAL LETTER T WITH CARON - u'\u017d' # 0x8E -> LATIN CAPITAL LETTER Z WITH CARON - u'\u0179' # 0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u015b' # 0x9C -> LATIN SMALL LETTER S WITH ACUTE - u'\u0165' # 0x9D -> LATIN SMALL LETTER T WITH CARON - u'\u017e' # 0x9E -> LATIN SMALL LETTER Z WITH CARON - u'\u017a' # 0x9F -> LATIN SMALL LETTER Z WITH ACUTE - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u02c7' # 0xA1 -> CARON - u'\u02d8' # 0xA2 -> BREVE - u'\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u0104' # 0xA5 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u02db' # 0xB2 -> OGONEK - u'\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\u0105' # 0xB9 -> LATIN SMALL LETTER A WITH OGONEK - u'\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u013d' # 0xBC -> LATIN CAPITAL LETTER L WITH CARON - u'\u02dd' # 0xBD -> DOUBLE ACUTE ACCENT - u'\u013e' # 0xBE -> LATIN SMALL LETTER L WITH CARON - u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u0154' # 0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0139' # 0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE - u'\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u011a' # 0xCC -> LATIN CAPITAL LETTER E WITH CARON - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u010e' # 0xCF -> LATIN CAPITAL LETTER D WITH CARON - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0147' # 0xD2 -> LATIN CAPITAL LETTER N WITH CARON - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0158' # 0xD8 -> LATIN CAPITAL LETTER R WITH CARON - u'\u016e' # 0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\u0170' # 0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\u0162' # 0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\u0155' # 0xE0 -> LATIN SMALL LETTER R WITH ACUTE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u013a' # 0xE5 -> LATIN SMALL LETTER L WITH ACUTE - u'\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u011b' # 0xEC -> LATIN SMALL LETTER E WITH CARON - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u010f' # 0xEF -> LATIN SMALL LETTER D WITH CARON - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0148' # 0xF2 -> LATIN SMALL LETTER N WITH CARON - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0159' # 0xF8 -> LATIN SMALL LETTER R WITH CARON - u'\u016f' # 0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\u0171' # 0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\u0163' # 0xFE -> LATIN SMALL LETTER T WITH CEDILLA - u'\u02d9' # 0xFF -> DOT ABOVE + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u20ac' # 0x80 -> EURO SIGN + '\ufffe' # 0x81 -> UNDEFINED + '\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK + '\ufffe' # 0x83 -> UNDEFINED + '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\u2020' # 0x86 -> DAGGER + '\u2021' # 0x87 -> DOUBLE DAGGER + '\ufffe' # 0x88 -> UNDEFINED + '\u2030' # 0x89 -> PER MILLE SIGN + '\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON + '\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u015a' # 0x8C -> LATIN CAPITAL LETTER S WITH ACUTE + '\u0164' # 0x8D -> LATIN CAPITAL LETTER T WITH CARON + '\u017d' # 0x8E -> LATIN CAPITAL LETTER Z WITH CARON + '\u0179' # 0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE + '\ufffe' # 0x90 -> UNDEFINED + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\ufffe' # 0x98 -> UNDEFINED + '\u2122' # 0x99 -> TRADE MARK SIGN + '\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON + '\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\u015b' # 0x9C -> LATIN SMALL LETTER S WITH ACUTE + '\u0165' # 0x9D -> LATIN SMALL LETTER T WITH CARON + '\u017e' # 0x9E -> LATIN SMALL LETTER Z WITH CARON + '\u017a' # 0x9F -> LATIN SMALL LETTER Z WITH ACUTE + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u02c7' # 0xA1 -> CARON + '\u02d8' # 0xA2 -> BREVE + '\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE + '\xa4' # 0xA4 -> CURRENCY SIGN + '\u0104' # 0xA5 -> LATIN CAPITAL LETTER A WITH OGONEK + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u02db' # 0xB2 -> OGONEK + '\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\u0105' # 0xB9 -> LATIN SMALL LETTER A WITH OGONEK + '\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u013d' # 0xBC -> LATIN CAPITAL LETTER L WITH CARON + '\u02dd' # 0xBD -> DOUBLE ACUTE ACCENT + '\u013e' # 0xBE -> LATIN SMALL LETTER L WITH CARON + '\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE + '\u0154' # 0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\u0139' # 0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE + '\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\u011a' # 0xCC -> LATIN CAPITAL LETTER E WITH CARON + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\u010e' # 0xCF -> LATIN CAPITAL LETTER D WITH CARON + '\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE + '\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE + '\u0147' # 0xD2 -> LATIN CAPITAL LETTER N WITH CARON + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\u0158' # 0xD8 -> LATIN CAPITAL LETTER R WITH CARON + '\u016e' # 0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\u0170' # 0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\u0162' # 0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\u0155' # 0xE0 -> LATIN SMALL LETTER R WITH ACUTE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\u013a' # 0xE5 -> LATIN SMALL LETTER L WITH ACUTE + '\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\u011b' # 0xEC -> LATIN SMALL LETTER E WITH CARON + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\u010f' # 0xEF -> LATIN SMALL LETTER D WITH CARON + '\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE + '\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE + '\u0148' # 0xF2 -> LATIN SMALL LETTER N WITH CARON + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\u0159' # 0xF8 -> LATIN SMALL LETTER R WITH CARON + '\u016f' # 0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\u0171' # 0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE + '\u0163' # 0xFE -> LATIN SMALL LETTER T WITH CEDILLA + '\u02d9' # 0xFF -> DOT ABOVE ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1251.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1251.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1251.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u0402' # 0x80 -> CYRILLIC CAPITAL LETTER DJE - u'\u0403' # 0x81 -> CYRILLIC CAPITAL LETTER GJE - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0453' # 0x83 -> CYRILLIC SMALL LETTER GJE - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u20ac' # 0x88 -> EURO SIGN - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0409' # 0x8A -> CYRILLIC CAPITAL LETTER LJE - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u040a' # 0x8C -> CYRILLIC CAPITAL LETTER NJE - u'\u040c' # 0x8D -> CYRILLIC CAPITAL LETTER KJE - u'\u040b' # 0x8E -> CYRILLIC CAPITAL LETTER TSHE - u'\u040f' # 0x8F -> CYRILLIC CAPITAL LETTER DZHE - u'\u0452' # 0x90 -> CYRILLIC SMALL LETTER DJE - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0459' # 0x9A -> CYRILLIC SMALL LETTER LJE - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u045a' # 0x9C -> CYRILLIC SMALL LETTER NJE - u'\u045c' # 0x9D -> CYRILLIC SMALL LETTER KJE - u'\u045b' # 0x9E -> CYRILLIC SMALL LETTER TSHE - u'\u045f' # 0x9F -> CYRILLIC SMALL LETTER DZHE - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u040e' # 0xA1 -> CYRILLIC CAPITAL LETTER SHORT U - u'\u045e' # 0xA2 -> CYRILLIC SMALL LETTER SHORT U - u'\u0408' # 0xA3 -> CYRILLIC CAPITAL LETTER JE - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u0490' # 0xA5 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u0401' # 0xA8 -> CYRILLIC CAPITAL LETTER IO - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u0404' # 0xAA -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\u0407' # 0xAF -> CYRILLIC CAPITAL LETTER YI - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u0406' # 0xB2 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0456' # 0xB3 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0491' # 0xB4 -> CYRILLIC SMALL LETTER GHE WITH UPTURN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u0451' # 0xB8 -> CYRILLIC SMALL LETTER IO - u'\u2116' # 0xB9 -> NUMERO SIGN - u'\u0454' # 0xBA -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u0458' # 0xBC -> CYRILLIC SMALL LETTER JE - u'\u0405' # 0xBD -> CYRILLIC CAPITAL LETTER DZE - u'\u0455' # 0xBE -> CYRILLIC SMALL LETTER DZE - u'\u0457' # 0xBF -> CYRILLIC SMALL LETTER YI - u'\u0410' # 0xC0 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0xC1 -> CYRILLIC CAPITAL LETTER BE - u'\u0412' # 0xC2 -> CYRILLIC CAPITAL LETTER VE - u'\u0413' # 0xC3 -> CYRILLIC CAPITAL LETTER GHE - u'\u0414' # 0xC4 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0xC5 -> CYRILLIC CAPITAL LETTER IE - u'\u0416' # 0xC6 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0417' # 0xC7 -> CYRILLIC CAPITAL LETTER ZE - u'\u0418' # 0xC8 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0xC9 -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0xCA -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0xCB -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0xCC -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0xCD -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0xCE -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0xCF -> CYRILLIC CAPITAL LETTER PE - u'\u0420' # 0xD0 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0xD1 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0xD2 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0xD3 -> CYRILLIC CAPITAL LETTER U - u'\u0424' # 0xD4 -> CYRILLIC CAPITAL LETTER EF - u'\u0425' # 0xD5 -> CYRILLIC CAPITAL LETTER HA - u'\u0426' # 0xD6 -> CYRILLIC CAPITAL LETTER TSE - u'\u0427' # 0xD7 -> CYRILLIC CAPITAL LETTER CHE - u'\u0428' # 0xD8 -> CYRILLIC CAPITAL LETTER SHA - u'\u0429' # 0xD9 -> CYRILLIC CAPITAL LETTER SHCHA - u'\u042a' # 0xDA -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u042b' # 0xDB -> CYRILLIC CAPITAL LETTER YERU - u'\u042c' # 0xDC -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042d' # 0xDD -> CYRILLIC CAPITAL LETTER E - u'\u042e' # 0xDE -> CYRILLIC CAPITAL LETTER YU - u'\u042f' # 0xDF -> CYRILLIC CAPITAL LETTER YA - u'\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE - u'\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE - u'\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE - u'\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE - u'\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE - u'\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE - u'\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xED -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xEE -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE - u'\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U - u'\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF - u'\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA - u'\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE - u'\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE - u'\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA - u'\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA - u'\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN - u'\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU - u'\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044d' # 0xFD -> CYRILLIC SMALL LETTER E - u'\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU - u'\u044f' # 0xFF -> CYRILLIC SMALL LETTER YA + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u0402' # 0x80 -> CYRILLIC CAPITAL LETTER DJE + '\u0403' # 0x81 -> CYRILLIC CAPITAL LETTER GJE + '\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK + '\u0453' # 0x83 -> CYRILLIC SMALL LETTER GJE + '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\u2020' # 0x86 -> DAGGER + '\u2021' # 0x87 -> DOUBLE DAGGER + '\u20ac' # 0x88 -> EURO SIGN + '\u2030' # 0x89 -> PER MILLE SIGN + '\u0409' # 0x8A -> CYRILLIC CAPITAL LETTER LJE + '\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u040a' # 0x8C -> CYRILLIC CAPITAL LETTER NJE + '\u040c' # 0x8D -> CYRILLIC CAPITAL LETTER KJE + '\u040b' # 0x8E -> CYRILLIC CAPITAL LETTER TSHE + '\u040f' # 0x8F -> CYRILLIC CAPITAL LETTER DZHE + '\u0452' # 0x90 -> CYRILLIC SMALL LETTER DJE + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\ufffe' # 0x98 -> UNDEFINED + '\u2122' # 0x99 -> TRADE MARK SIGN + '\u0459' # 0x9A -> CYRILLIC SMALL LETTER LJE + '\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\u045a' # 0x9C -> CYRILLIC SMALL LETTER NJE + '\u045c' # 0x9D -> CYRILLIC SMALL LETTER KJE + '\u045b' # 0x9E -> CYRILLIC SMALL LETTER TSHE + '\u045f' # 0x9F -> CYRILLIC SMALL LETTER DZHE + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u040e' # 0xA1 -> CYRILLIC CAPITAL LETTER SHORT U + '\u045e' # 0xA2 -> CYRILLIC SMALL LETTER SHORT U + '\u0408' # 0xA3 -> CYRILLIC CAPITAL LETTER JE + '\xa4' # 0xA4 -> CURRENCY SIGN + '\u0490' # 0xA5 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\u0401' # 0xA8 -> CYRILLIC CAPITAL LETTER IO + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u0404' # 0xAA -> CYRILLIC CAPITAL LETTER UKRAINIAN IE + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\u0407' # 0xAF -> CYRILLIC CAPITAL LETTER YI + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u0406' # 0xB2 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I + '\u0456' # 0xB3 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I + '\u0491' # 0xB4 -> CYRILLIC SMALL LETTER GHE WITH UPTURN + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\u0451' # 0xB8 -> CYRILLIC SMALL LETTER IO + '\u2116' # 0xB9 -> NUMERO SIGN + '\u0454' # 0xBA -> CYRILLIC SMALL LETTER UKRAINIAN IE + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u0458' # 0xBC -> CYRILLIC SMALL LETTER JE + '\u0405' # 0xBD -> CYRILLIC CAPITAL LETTER DZE + '\u0455' # 0xBE -> CYRILLIC SMALL LETTER DZE + '\u0457' # 0xBF -> CYRILLIC SMALL LETTER YI + '\u0410' # 0xC0 -> CYRILLIC CAPITAL LETTER A + '\u0411' # 0xC1 -> CYRILLIC CAPITAL LETTER BE + '\u0412' # 0xC2 -> CYRILLIC CAPITAL LETTER VE + '\u0413' # 0xC3 -> CYRILLIC CAPITAL LETTER GHE + '\u0414' # 0xC4 -> CYRILLIC CAPITAL LETTER DE + '\u0415' # 0xC5 -> CYRILLIC CAPITAL LETTER IE + '\u0416' # 0xC6 -> CYRILLIC CAPITAL LETTER ZHE + '\u0417' # 0xC7 -> CYRILLIC CAPITAL LETTER ZE + '\u0418' # 0xC8 -> CYRILLIC CAPITAL LETTER I + '\u0419' # 0xC9 -> CYRILLIC CAPITAL LETTER SHORT I + '\u041a' # 0xCA -> CYRILLIC CAPITAL LETTER KA + '\u041b' # 0xCB -> CYRILLIC CAPITAL LETTER EL + '\u041c' # 0xCC -> CYRILLIC CAPITAL LETTER EM + '\u041d' # 0xCD -> CYRILLIC CAPITAL LETTER EN + '\u041e' # 0xCE -> CYRILLIC CAPITAL LETTER O + '\u041f' # 0xCF -> CYRILLIC CAPITAL LETTER PE + '\u0420' # 0xD0 -> CYRILLIC CAPITAL LETTER ER + '\u0421' # 0xD1 -> CYRILLIC CAPITAL LETTER ES + '\u0422' # 0xD2 -> CYRILLIC CAPITAL LETTER TE + '\u0423' # 0xD3 -> CYRILLIC CAPITAL LETTER U + '\u0424' # 0xD4 -> CYRILLIC CAPITAL LETTER EF + '\u0425' # 0xD5 -> CYRILLIC CAPITAL LETTER HA + '\u0426' # 0xD6 -> CYRILLIC CAPITAL LETTER TSE + '\u0427' # 0xD7 -> CYRILLIC CAPITAL LETTER CHE + '\u0428' # 0xD8 -> CYRILLIC CAPITAL LETTER SHA + '\u0429' # 0xD9 -> CYRILLIC CAPITAL LETTER SHCHA + '\u042a' # 0xDA -> CYRILLIC CAPITAL LETTER HARD SIGN + '\u042b' # 0xDB -> CYRILLIC CAPITAL LETTER YERU + '\u042c' # 0xDC -> CYRILLIC CAPITAL LETTER SOFT SIGN + '\u042d' # 0xDD -> CYRILLIC CAPITAL LETTER E + '\u042e' # 0xDE -> CYRILLIC CAPITAL LETTER YU + '\u042f' # 0xDF -> CYRILLIC CAPITAL LETTER YA + '\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A + '\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE + '\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE + '\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE + '\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE + '\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE + '\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE + '\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE + '\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I + '\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I + '\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA + '\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL + '\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM + '\u043d' # 0xED -> CYRILLIC SMALL LETTER EN + '\u043e' # 0xEE -> CYRILLIC SMALL LETTER O + '\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE + '\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER + '\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES + '\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE + '\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U + '\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF + '\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA + '\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE + '\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE + '\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA + '\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA + '\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN + '\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU + '\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN + '\u044d' # 0xFD -> CYRILLIC SMALL LETTER E + '\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU + '\u044f' # 0xFF -> CYRILLIC SMALL LETTER YA ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1252.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1252.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1252.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE - u'\ufffe' # 0x8D -> UNDEFINED - u'\u017d' # 0x8E -> LATIN CAPITAL LETTER Z WITH CARON - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u02dc' # 0x98 -> SMALL TILDE - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE - u'\ufffe' # 0x9D -> UNDEFINED - u'\u017e' # 0x9E -> LATIN SMALL LETTER Z WITH CARON - u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u20ac' # 0x80 -> EURO SIGN + '\ufffe' # 0x81 -> UNDEFINED + '\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK + '\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK + '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\u2020' # 0x86 -> DAGGER + '\u2021' # 0x87 -> DOUBLE DAGGER + '\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u2030' # 0x89 -> PER MILLE SIGN + '\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON + '\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE + '\ufffe' # 0x8D -> UNDEFINED + '\u017d' # 0x8E -> LATIN CAPITAL LETTER Z WITH CARON + '\ufffe' # 0x8F -> UNDEFINED + '\ufffe' # 0x90 -> UNDEFINED + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\u02dc' # 0x98 -> SMALL TILDE + '\u2122' # 0x99 -> TRADE MARK SIGN + '\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON + '\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\u0153' # 0x9C -> LATIN SMALL LIGATURE OE + '\ufffe' # 0x9D -> UNDEFINED + '\u017e' # 0x9E -> LATIN SMALL LETTER Z WITH CARON + '\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\xbf' # 0xBF -> INVERTED QUESTION MARK + '\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH + '\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE + '\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xde' # 0xDE -> LATIN CAPITAL LETTER THORN + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf0' # 0xF0 -> LATIN SMALL LETTER ETH + '\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE + '\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE + '\xfe' # 0xFE -> LATIN SMALL LETTER THORN + '\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1253.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1253.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1253.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\ufffe' # 0x88 -> UNDEFINED - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\ufffe' # 0x8A -> UNDEFINED - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x8C -> UNDEFINED - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\ufffe' # 0x9A -> UNDEFINED - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x9C -> UNDEFINED - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\ufffe' # 0x9F -> UNDEFINED - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0385' # 0xA1 -> GREEK DIALYTIKA TONOS - u'\u0386' # 0xA2 -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\ufffe' # 0xAA -> UNDEFINED - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\u2015' # 0xAF -> HORIZONTAL BAR - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\u0384' # 0xB4 -> GREEK TONOS - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u0388' # 0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0389' # 0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u038c' # 0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\u038e' # 0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u038f' # 0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\u0390' # 0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u0391' # 0xC1 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0xC2 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0xC3 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0xC4 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0xC5 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0xC6 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0xC7 -> GREEK CAPITAL LETTER ETA - u'\u0398' # 0xC8 -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0xC9 -> GREEK CAPITAL LETTER IOTA - u'\u039a' # 0xCA -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0xCB -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0xCC -> GREEK CAPITAL LETTER MU - u'\u039d' # 0xCD -> GREEK CAPITAL LETTER NU - u'\u039e' # 0xCE -> GREEK CAPITAL LETTER XI - u'\u039f' # 0xCF -> GREEK CAPITAL LETTER OMICRON - u'\u03a0' # 0xD0 -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0xD1 -> GREEK CAPITAL LETTER RHO - u'\ufffe' # 0xD2 -> UNDEFINED - u'\u03a3' # 0xD3 -> GREEK CAPITAL LETTER SIGMA - u'\u03a4' # 0xD4 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0xD5 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0xD6 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0xD7 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0xD8 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0xD9 -> GREEK CAPITAL LETTER OMEGA - u'\u03aa' # 0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u03ab' # 0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\u03ac' # 0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u03ad' # 0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0xDE -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03af' # 0xDF -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03b0' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA - u'\u03b3' # 0xE3 -> GREEK SMALL LETTER GAMMA - u'\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON - u'\u03b6' # 0xE6 -> GREEK SMALL LETTER ZETA - u'\u03b7' # 0xE7 -> GREEK SMALL LETTER ETA - u'\u03b8' # 0xE8 -> GREEK SMALL LETTER THETA - u'\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0xEA -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0xEB -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0xEC -> GREEK SMALL LETTER MU - u'\u03bd' # 0xED -> GREEK SMALL LETTER NU - u'\u03be' # 0xEE -> GREEK SMALL LETTER XI - u'\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0xF0 -> GREEK SMALL LETTER PI - u'\u03c1' # 0xF1 -> GREEK SMALL LETTER RHO - u'\u03c2' # 0xF2 -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA - u'\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU - u'\u03c5' # 0xF5 -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0xF6 -> GREEK SMALL LETTER PHI - u'\u03c7' # 0xF7 -> GREEK SMALL LETTER CHI - u'\u03c8' # 0xF8 -> GREEK SMALL LETTER PSI - u'\u03c9' # 0xF9 -> GREEK SMALL LETTER OMEGA - u'\u03ca' # 0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03cb' # 0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03cc' # 0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03ce' # 0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\ufffe' # 0xFF -> UNDEFINED + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u20ac' # 0x80 -> EURO SIGN + '\ufffe' # 0x81 -> UNDEFINED + '\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK + '\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK + '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\u2020' # 0x86 -> DAGGER + '\u2021' # 0x87 -> DOUBLE DAGGER + '\ufffe' # 0x88 -> UNDEFINED + '\u2030' # 0x89 -> PER MILLE SIGN + '\ufffe' # 0x8A -> UNDEFINED + '\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\ufffe' # 0x8C -> UNDEFINED + '\ufffe' # 0x8D -> UNDEFINED + '\ufffe' # 0x8E -> UNDEFINED + '\ufffe' # 0x8F -> UNDEFINED + '\ufffe' # 0x90 -> UNDEFINED + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\ufffe' # 0x98 -> UNDEFINED + '\u2122' # 0x99 -> TRADE MARK SIGN + '\ufffe' # 0x9A -> UNDEFINED + '\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\ufffe' # 0x9C -> UNDEFINED + '\ufffe' # 0x9D -> UNDEFINED + '\ufffe' # 0x9E -> UNDEFINED + '\ufffe' # 0x9F -> UNDEFINED + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u0385' # 0xA1 -> GREEK DIALYTIKA TONOS + '\u0386' # 0xA2 -> GREEK CAPITAL LETTER ALPHA WITH TONOS + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\ufffe' # 0xAA -> UNDEFINED + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\u2015' # 0xAF -> HORIZONTAL BAR + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\u0384' # 0xB4 -> GREEK TONOS + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\u0388' # 0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS + '\u0389' # 0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS + '\u038a' # 0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u038c' # 0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\u038e' # 0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS + '\u038f' # 0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS + '\u0390' # 0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS + '\u0391' # 0xC1 -> GREEK CAPITAL LETTER ALPHA + '\u0392' # 0xC2 -> GREEK CAPITAL LETTER BETA + '\u0393' # 0xC3 -> GREEK CAPITAL LETTER GAMMA + '\u0394' # 0xC4 -> GREEK CAPITAL LETTER DELTA + '\u0395' # 0xC5 -> GREEK CAPITAL LETTER EPSILON + '\u0396' # 0xC6 -> GREEK CAPITAL LETTER ZETA + '\u0397' # 0xC7 -> GREEK CAPITAL LETTER ETA + '\u0398' # 0xC8 -> GREEK CAPITAL LETTER THETA + '\u0399' # 0xC9 -> GREEK CAPITAL LETTER IOTA + '\u039a' # 0xCA -> GREEK CAPITAL LETTER KAPPA + '\u039b' # 0xCB -> GREEK CAPITAL LETTER LAMDA + '\u039c' # 0xCC -> GREEK CAPITAL LETTER MU + '\u039d' # 0xCD -> GREEK CAPITAL LETTER NU + '\u039e' # 0xCE -> GREEK CAPITAL LETTER XI + '\u039f' # 0xCF -> GREEK CAPITAL LETTER OMICRON + '\u03a0' # 0xD0 -> GREEK CAPITAL LETTER PI + '\u03a1' # 0xD1 -> GREEK CAPITAL LETTER RHO + '\ufffe' # 0xD2 -> UNDEFINED + '\u03a3' # 0xD3 -> GREEK CAPITAL LETTER SIGMA + '\u03a4' # 0xD4 -> GREEK CAPITAL LETTER TAU + '\u03a5' # 0xD5 -> GREEK CAPITAL LETTER UPSILON + '\u03a6' # 0xD6 -> GREEK CAPITAL LETTER PHI + '\u03a7' # 0xD7 -> GREEK CAPITAL LETTER CHI + '\u03a8' # 0xD8 -> GREEK CAPITAL LETTER PSI + '\u03a9' # 0xD9 -> GREEK CAPITAL LETTER OMEGA + '\u03aa' # 0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA + '\u03ab' # 0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA + '\u03ac' # 0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS + '\u03ad' # 0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS + '\u03ae' # 0xDE -> GREEK SMALL LETTER ETA WITH TONOS + '\u03af' # 0xDF -> GREEK SMALL LETTER IOTA WITH TONOS + '\u03b0' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS + '\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA + '\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA + '\u03b3' # 0xE3 -> GREEK SMALL LETTER GAMMA + '\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA + '\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON + '\u03b6' # 0xE6 -> GREEK SMALL LETTER ZETA + '\u03b7' # 0xE7 -> GREEK SMALL LETTER ETA + '\u03b8' # 0xE8 -> GREEK SMALL LETTER THETA + '\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA + '\u03ba' # 0xEA -> GREEK SMALL LETTER KAPPA + '\u03bb' # 0xEB -> GREEK SMALL LETTER LAMDA + '\u03bc' # 0xEC -> GREEK SMALL LETTER MU + '\u03bd' # 0xED -> GREEK SMALL LETTER NU + '\u03be' # 0xEE -> GREEK SMALL LETTER XI + '\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON + '\u03c0' # 0xF0 -> GREEK SMALL LETTER PI + '\u03c1' # 0xF1 -> GREEK SMALL LETTER RHO + '\u03c2' # 0xF2 -> GREEK SMALL LETTER FINAL SIGMA + '\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA + '\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU + '\u03c5' # 0xF5 -> GREEK SMALL LETTER UPSILON + '\u03c6' # 0xF6 -> GREEK SMALL LETTER PHI + '\u03c7' # 0xF7 -> GREEK SMALL LETTER CHI + '\u03c8' # 0xF8 -> GREEK SMALL LETTER PSI + '\u03c9' # 0xF9 -> GREEK SMALL LETTER OMEGA + '\u03ca' # 0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA + '\u03cb' # 0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA + '\u03cc' # 0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS + '\u03cd' # 0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS + '\u03ce' # 0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS + '\ufffe' # 0xFF -> UNDEFINED ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1254.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1254.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1254.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u02dc' # 0x98 -> SMALL TILDE - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u011e' # 0xD0 -> LATIN CAPITAL LETTER G WITH BREVE - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0130' # 0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u011f' # 0xF0 -> LATIN SMALL LETTER G WITH BREVE - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u0131' # 0xFD -> LATIN SMALL LETTER DOTLESS I - u'\u015f' # 0xFE -> LATIN SMALL LETTER S WITH CEDILLA - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u20ac' # 0x80 -> EURO SIGN + '\ufffe' # 0x81 -> UNDEFINED + '\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK + '\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK + '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\u2020' # 0x86 -> DAGGER + '\u2021' # 0x87 -> DOUBLE DAGGER + '\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u2030' # 0x89 -> PER MILLE SIGN + '\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON + '\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE + '\ufffe' # 0x8D -> UNDEFINED + '\ufffe' # 0x8E -> UNDEFINED + '\ufffe' # 0x8F -> UNDEFINED + '\ufffe' # 0x90 -> UNDEFINED + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\u02dc' # 0x98 -> SMALL TILDE + '\u2122' # 0x99 -> TRADE MARK SIGN + '\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON + '\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\u0153' # 0x9C -> LATIN SMALL LIGATURE OE + '\ufffe' # 0x9D -> UNDEFINED + '\ufffe' # 0x9E -> UNDEFINED + '\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\xbf' # 0xBF -> INVERTED QUESTION MARK + '\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\u011e' # 0xD0 -> LATIN CAPITAL LETTER G WITH BREVE + '\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE + '\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u0130' # 0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE + '\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\u011f' # 0xF0 -> LATIN SMALL LETTER G WITH BREVE + '\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE + '\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\u0131' # 0xFD -> LATIN SMALL LETTER DOTLESS I + '\u015f' # 0xFE -> LATIN SMALL LETTER S WITH CEDILLA + '\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1255.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1255.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1255.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\ufffe' # 0x8A -> UNDEFINED - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x8C -> UNDEFINED - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u02dc' # 0x98 -> SMALL TILDE - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\ufffe' # 0x9A -> UNDEFINED - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x9C -> UNDEFINED - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\ufffe' # 0x9F -> UNDEFINED - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\u20aa' # 0xA4 -> NEW SHEQEL SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xd7' # 0xAA -> MULTIPLICATION SIGN - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xf7' # 0xBA -> DIVISION SIGN - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\u05b0' # 0xC0 -> HEBREW POINT SHEVA - u'\u05b1' # 0xC1 -> HEBREW POINT HATAF SEGOL - u'\u05b2' # 0xC2 -> HEBREW POINT HATAF PATAH - u'\u05b3' # 0xC3 -> HEBREW POINT HATAF QAMATS - u'\u05b4' # 0xC4 -> HEBREW POINT HIRIQ - u'\u05b5' # 0xC5 -> HEBREW POINT TSERE - u'\u05b6' # 0xC6 -> HEBREW POINT SEGOL - u'\u05b7' # 0xC7 -> HEBREW POINT PATAH - u'\u05b8' # 0xC8 -> HEBREW POINT QAMATS - u'\u05b9' # 0xC9 -> HEBREW POINT HOLAM - u'\ufffe' # 0xCA -> UNDEFINED - u'\u05bb' # 0xCB -> HEBREW POINT QUBUTS - u'\u05bc' # 0xCC -> HEBREW POINT DAGESH OR MAPIQ - u'\u05bd' # 0xCD -> HEBREW POINT METEG - u'\u05be' # 0xCE -> HEBREW PUNCTUATION MAQAF - u'\u05bf' # 0xCF -> HEBREW POINT RAFE - u'\u05c0' # 0xD0 -> HEBREW PUNCTUATION PASEQ - u'\u05c1' # 0xD1 -> HEBREW POINT SHIN DOT - u'\u05c2' # 0xD2 -> HEBREW POINT SIN DOT - u'\u05c3' # 0xD3 -> HEBREW PUNCTUATION SOF PASUQ - u'\u05f0' # 0xD4 -> HEBREW LIGATURE YIDDISH DOUBLE VAV - u'\u05f1' # 0xD5 -> HEBREW LIGATURE YIDDISH VAV YOD - u'\u05f2' # 0xD6 -> HEBREW LIGATURE YIDDISH DOUBLE YOD - u'\u05f3' # 0xD7 -> HEBREW PUNCTUATION GERESH - u'\u05f4' # 0xD8 -> HEBREW PUNCTUATION GERSHAYIM - u'\ufffe' # 0xD9 -> UNDEFINED - u'\ufffe' # 0xDA -> UNDEFINED - u'\ufffe' # 0xDB -> UNDEFINED - u'\ufffe' # 0xDC -> UNDEFINED - u'\ufffe' # 0xDD -> UNDEFINED - u'\ufffe' # 0xDE -> UNDEFINED - u'\ufffe' # 0xDF -> UNDEFINED - u'\u05d0' # 0xE0 -> HEBREW LETTER ALEF - u'\u05d1' # 0xE1 -> HEBREW LETTER BET - u'\u05d2' # 0xE2 -> HEBREW LETTER GIMEL - u'\u05d3' # 0xE3 -> HEBREW LETTER DALET - u'\u05d4' # 0xE4 -> HEBREW LETTER HE - u'\u05d5' # 0xE5 -> HEBREW LETTER VAV - u'\u05d6' # 0xE6 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0xE7 -> HEBREW LETTER HET - u'\u05d8' # 0xE8 -> HEBREW LETTER TET - u'\u05d9' # 0xE9 -> HEBREW LETTER YOD - u'\u05da' # 0xEA -> HEBREW LETTER FINAL KAF - u'\u05db' # 0xEB -> HEBREW LETTER KAF - u'\u05dc' # 0xEC -> HEBREW LETTER LAMED - u'\u05dd' # 0xED -> HEBREW LETTER FINAL MEM - u'\u05de' # 0xEE -> HEBREW LETTER MEM - u'\u05df' # 0xEF -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0xF0 -> HEBREW LETTER NUN - u'\u05e1' # 0xF1 -> HEBREW LETTER SAMEKH - u'\u05e2' # 0xF2 -> HEBREW LETTER AYIN - u'\u05e3' # 0xF3 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0xF4 -> HEBREW LETTER PE - u'\u05e5' # 0xF5 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0xF6 -> HEBREW LETTER TSADI - u'\u05e7' # 0xF7 -> HEBREW LETTER QOF - u'\u05e8' # 0xF8 -> HEBREW LETTER RESH - u'\u05e9' # 0xF9 -> HEBREW LETTER SHIN - u'\u05ea' # 0xFA -> HEBREW LETTER TAV - u'\ufffe' # 0xFB -> UNDEFINED - u'\ufffe' # 0xFC -> UNDEFINED - u'\u200e' # 0xFD -> LEFT-TO-RIGHT MARK - u'\u200f' # 0xFE -> RIGHT-TO-LEFT MARK - u'\ufffe' # 0xFF -> UNDEFINED + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u20ac' # 0x80 -> EURO SIGN + '\ufffe' # 0x81 -> UNDEFINED + '\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK + '\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK + '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\u2020' # 0x86 -> DAGGER + '\u2021' # 0x87 -> DOUBLE DAGGER + '\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u2030' # 0x89 -> PER MILLE SIGN + '\ufffe' # 0x8A -> UNDEFINED + '\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\ufffe' # 0x8C -> UNDEFINED + '\ufffe' # 0x8D -> UNDEFINED + '\ufffe' # 0x8E -> UNDEFINED + '\ufffe' # 0x8F -> UNDEFINED + '\ufffe' # 0x90 -> UNDEFINED + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\u02dc' # 0x98 -> SMALL TILDE + '\u2122' # 0x99 -> TRADE MARK SIGN + '\ufffe' # 0x9A -> UNDEFINED + '\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\ufffe' # 0x9C -> UNDEFINED + '\ufffe' # 0x9D -> UNDEFINED + '\ufffe' # 0x9E -> UNDEFINED + '\ufffe' # 0x9F -> UNDEFINED + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\u20aa' # 0xA4 -> NEW SHEQEL SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\xd7' # 0xAA -> MULTIPLICATION SIGN + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\xf7' # 0xBA -> DIVISION SIGN + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\xbf' # 0xBF -> INVERTED QUESTION MARK + '\u05b0' # 0xC0 -> HEBREW POINT SHEVA + '\u05b1' # 0xC1 -> HEBREW POINT HATAF SEGOL + '\u05b2' # 0xC2 -> HEBREW POINT HATAF PATAH + '\u05b3' # 0xC3 -> HEBREW POINT HATAF QAMATS + '\u05b4' # 0xC4 -> HEBREW POINT HIRIQ + '\u05b5' # 0xC5 -> HEBREW POINT TSERE + '\u05b6' # 0xC6 -> HEBREW POINT SEGOL + '\u05b7' # 0xC7 -> HEBREW POINT PATAH + '\u05b8' # 0xC8 -> HEBREW POINT QAMATS + '\u05b9' # 0xC9 -> HEBREW POINT HOLAM + '\ufffe' # 0xCA -> UNDEFINED + '\u05bb' # 0xCB -> HEBREW POINT QUBUTS + '\u05bc' # 0xCC -> HEBREW POINT DAGESH OR MAPIQ + '\u05bd' # 0xCD -> HEBREW POINT METEG + '\u05be' # 0xCE -> HEBREW PUNCTUATION MAQAF + '\u05bf' # 0xCF -> HEBREW POINT RAFE + '\u05c0' # 0xD0 -> HEBREW PUNCTUATION PASEQ + '\u05c1' # 0xD1 -> HEBREW POINT SHIN DOT + '\u05c2' # 0xD2 -> HEBREW POINT SIN DOT + '\u05c3' # 0xD3 -> HEBREW PUNCTUATION SOF PASUQ + '\u05f0' # 0xD4 -> HEBREW LIGATURE YIDDISH DOUBLE VAV + '\u05f1' # 0xD5 -> HEBREW LIGATURE YIDDISH VAV YOD + '\u05f2' # 0xD6 -> HEBREW LIGATURE YIDDISH DOUBLE YOD + '\u05f3' # 0xD7 -> HEBREW PUNCTUATION GERESH + '\u05f4' # 0xD8 -> HEBREW PUNCTUATION GERSHAYIM + '\ufffe' # 0xD9 -> UNDEFINED + '\ufffe' # 0xDA -> UNDEFINED + '\ufffe' # 0xDB -> UNDEFINED + '\ufffe' # 0xDC -> UNDEFINED + '\ufffe' # 0xDD -> UNDEFINED + '\ufffe' # 0xDE -> UNDEFINED + '\ufffe' # 0xDF -> UNDEFINED + '\u05d0' # 0xE0 -> HEBREW LETTER ALEF + '\u05d1' # 0xE1 -> HEBREW LETTER BET + '\u05d2' # 0xE2 -> HEBREW LETTER GIMEL + '\u05d3' # 0xE3 -> HEBREW LETTER DALET + '\u05d4' # 0xE4 -> HEBREW LETTER HE + '\u05d5' # 0xE5 -> HEBREW LETTER VAV + '\u05d6' # 0xE6 -> HEBREW LETTER ZAYIN + '\u05d7' # 0xE7 -> HEBREW LETTER HET + '\u05d8' # 0xE8 -> HEBREW LETTER TET + '\u05d9' # 0xE9 -> HEBREW LETTER YOD + '\u05da' # 0xEA -> HEBREW LETTER FINAL KAF + '\u05db' # 0xEB -> HEBREW LETTER KAF + '\u05dc' # 0xEC -> HEBREW LETTER LAMED + '\u05dd' # 0xED -> HEBREW LETTER FINAL MEM + '\u05de' # 0xEE -> HEBREW LETTER MEM + '\u05df' # 0xEF -> HEBREW LETTER FINAL NUN + '\u05e0' # 0xF0 -> HEBREW LETTER NUN + '\u05e1' # 0xF1 -> HEBREW LETTER SAMEKH + '\u05e2' # 0xF2 -> HEBREW LETTER AYIN + '\u05e3' # 0xF3 -> HEBREW LETTER FINAL PE + '\u05e4' # 0xF4 -> HEBREW LETTER PE + '\u05e5' # 0xF5 -> HEBREW LETTER FINAL TSADI + '\u05e6' # 0xF6 -> HEBREW LETTER TSADI + '\u05e7' # 0xF7 -> HEBREW LETTER QOF + '\u05e8' # 0xF8 -> HEBREW LETTER RESH + '\u05e9' # 0xF9 -> HEBREW LETTER SHIN + '\u05ea' # 0xFA -> HEBREW LETTER TAV + '\ufffe' # 0xFB -> UNDEFINED + '\ufffe' # 0xFC -> UNDEFINED + '\u200e' # 0xFD -> LEFT-TO-RIGHT MARK + '\u200f' # 0xFE -> RIGHT-TO-LEFT MARK + '\ufffe' # 0xFF -> UNDEFINED ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1256.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1256.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1256.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\u067e' # 0x81 -> ARABIC LETTER PEH - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0679' # 0x8A -> ARABIC LETTER TTEH - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE - u'\u0686' # 0x8D -> ARABIC LETTER TCHEH - u'\u0698' # 0x8E -> ARABIC LETTER JEH - u'\u0688' # 0x8F -> ARABIC LETTER DDAL - u'\u06af' # 0x90 -> ARABIC LETTER GAF - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u06a9' # 0x98 -> ARABIC LETTER KEHEH - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0691' # 0x9A -> ARABIC LETTER RREH - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE - u'\u200c' # 0x9D -> ZERO WIDTH NON-JOINER - u'\u200d' # 0x9E -> ZERO WIDTH JOINER - u'\u06ba' # 0x9F -> ARABIC LETTER NOON GHUNNA - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u060c' # 0xA1 -> ARABIC COMMA - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u06be' # 0xAA -> ARABIC LETTER HEH DOACHASHMEE - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\u061b' # 0xBA -> ARABIC SEMICOLON - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\u061f' # 0xBF -> ARABIC QUESTION MARK - u'\u06c1' # 0xC0 -> ARABIC LETTER HEH GOAL - u'\u0621' # 0xC1 -> ARABIC LETTER HAMZA - u'\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE - u'\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE - u'\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE - u'\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW - u'\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE - u'\u0627' # 0xC7 -> ARABIC LETTER ALEF - u'\u0628' # 0xC8 -> ARABIC LETTER BEH - u'\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA - u'\u062a' # 0xCA -> ARABIC LETTER TEH - u'\u062b' # 0xCB -> ARABIC LETTER THEH - u'\u062c' # 0xCC -> ARABIC LETTER JEEM - u'\u062d' # 0xCD -> ARABIC LETTER HAH - u'\u062e' # 0xCE -> ARABIC LETTER KHAH - u'\u062f' # 0xCF -> ARABIC LETTER DAL - u'\u0630' # 0xD0 -> ARABIC LETTER THAL - u'\u0631' # 0xD1 -> ARABIC LETTER REH - u'\u0632' # 0xD2 -> ARABIC LETTER ZAIN - u'\u0633' # 0xD3 -> ARABIC LETTER SEEN - u'\u0634' # 0xD4 -> ARABIC LETTER SHEEN - u'\u0635' # 0xD5 -> ARABIC LETTER SAD - u'\u0636' # 0xD6 -> ARABIC LETTER DAD - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0637' # 0xD8 -> ARABIC LETTER TAH - u'\u0638' # 0xD9 -> ARABIC LETTER ZAH - u'\u0639' # 0xDA -> ARABIC LETTER AIN - u'\u063a' # 0xDB -> ARABIC LETTER GHAIN - u'\u0640' # 0xDC -> ARABIC TATWEEL - u'\u0641' # 0xDD -> ARABIC LETTER FEH - u'\u0642' # 0xDE -> ARABIC LETTER QAF - u'\u0643' # 0xDF -> ARABIC LETTER KAF - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\u0644' # 0xE1 -> ARABIC LETTER LAM - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0645' # 0xE3 -> ARABIC LETTER MEEM - u'\u0646' # 0xE4 -> ARABIC LETTER NOON - u'\u0647' # 0xE5 -> ARABIC LETTER HEH - u'\u0648' # 0xE6 -> ARABIC LETTER WAW - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0649' # 0xEC -> ARABIC LETTER ALEF MAKSURA - u'\u064a' # 0xED -> ARABIC LETTER YEH - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u064b' # 0xF0 -> ARABIC FATHATAN - u'\u064c' # 0xF1 -> ARABIC DAMMATAN - u'\u064d' # 0xF2 -> ARABIC KASRATAN - u'\u064e' # 0xF3 -> ARABIC FATHA - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u064f' # 0xF5 -> ARABIC DAMMA - u'\u0650' # 0xF6 -> ARABIC KASRA - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0651' # 0xF8 -> ARABIC SHADDA - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\u0652' # 0xFA -> ARABIC SUKUN - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u200e' # 0xFD -> LEFT-TO-RIGHT MARK - u'\u200f' # 0xFE -> RIGHT-TO-LEFT MARK - u'\u06d2' # 0xFF -> ARABIC LETTER YEH BARREE + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u20ac' # 0x80 -> EURO SIGN + '\u067e' # 0x81 -> ARABIC LETTER PEH + '\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK + '\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK + '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\u2020' # 0x86 -> DAGGER + '\u2021' # 0x87 -> DOUBLE DAGGER + '\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u2030' # 0x89 -> PER MILLE SIGN + '\u0679' # 0x8A -> ARABIC LETTER TTEH + '\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE + '\u0686' # 0x8D -> ARABIC LETTER TCHEH + '\u0698' # 0x8E -> ARABIC LETTER JEH + '\u0688' # 0x8F -> ARABIC LETTER DDAL + '\u06af' # 0x90 -> ARABIC LETTER GAF + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\u06a9' # 0x98 -> ARABIC LETTER KEHEH + '\u2122' # 0x99 -> TRADE MARK SIGN + '\u0691' # 0x9A -> ARABIC LETTER RREH + '\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\u0153' # 0x9C -> LATIN SMALL LIGATURE OE + '\u200c' # 0x9D -> ZERO WIDTH NON-JOINER + '\u200d' # 0x9E -> ZERO WIDTH JOINER + '\u06ba' # 0x9F -> ARABIC LETTER NOON GHUNNA + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u060c' # 0xA1 -> ARABIC COMMA + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u06be' # 0xAA -> ARABIC LETTER HEH DOACHASHMEE + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\u061b' # 0xBA -> ARABIC SEMICOLON + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\u061f' # 0xBF -> ARABIC QUESTION MARK + '\u06c1' # 0xC0 -> ARABIC LETTER HEH GOAL + '\u0621' # 0xC1 -> ARABIC LETTER HAMZA + '\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE + '\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE + '\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE + '\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW + '\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE + '\u0627' # 0xC7 -> ARABIC LETTER ALEF + '\u0628' # 0xC8 -> ARABIC LETTER BEH + '\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA + '\u062a' # 0xCA -> ARABIC LETTER TEH + '\u062b' # 0xCB -> ARABIC LETTER THEH + '\u062c' # 0xCC -> ARABIC LETTER JEEM + '\u062d' # 0xCD -> ARABIC LETTER HAH + '\u062e' # 0xCE -> ARABIC LETTER KHAH + '\u062f' # 0xCF -> ARABIC LETTER DAL + '\u0630' # 0xD0 -> ARABIC LETTER THAL + '\u0631' # 0xD1 -> ARABIC LETTER REH + '\u0632' # 0xD2 -> ARABIC LETTER ZAIN + '\u0633' # 0xD3 -> ARABIC LETTER SEEN + '\u0634' # 0xD4 -> ARABIC LETTER SHEEN + '\u0635' # 0xD5 -> ARABIC LETTER SAD + '\u0636' # 0xD6 -> ARABIC LETTER DAD + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\u0637' # 0xD8 -> ARABIC LETTER TAH + '\u0638' # 0xD9 -> ARABIC LETTER ZAH + '\u0639' # 0xDA -> ARABIC LETTER AIN + '\u063a' # 0xDB -> ARABIC LETTER GHAIN + '\u0640' # 0xDC -> ARABIC TATWEEL + '\u0641' # 0xDD -> ARABIC LETTER FEH + '\u0642' # 0xDE -> ARABIC LETTER QAF + '\u0643' # 0xDF -> ARABIC LETTER KAF + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\u0644' # 0xE1 -> ARABIC LETTER LAM + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\u0645' # 0xE3 -> ARABIC LETTER MEEM + '\u0646' # 0xE4 -> ARABIC LETTER NOON + '\u0647' # 0xE5 -> ARABIC LETTER HEH + '\u0648' # 0xE6 -> ARABIC LETTER WAW + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\u0649' # 0xEC -> ARABIC LETTER ALEF MAKSURA + '\u064a' # 0xED -> ARABIC LETTER YEH + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\u064b' # 0xF0 -> ARABIC FATHATAN + '\u064c' # 0xF1 -> ARABIC DAMMATAN + '\u064d' # 0xF2 -> ARABIC KASRATAN + '\u064e' # 0xF3 -> ARABIC FATHA + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\u064f' # 0xF5 -> ARABIC DAMMA + '\u0650' # 0xF6 -> ARABIC KASRA + '\xf7' # 0xF7 -> DIVISION SIGN + '\u0651' # 0xF8 -> ARABIC SHADDA + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\u0652' # 0xFA -> ARABIC SUKUN + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\u200e' # 0xFD -> LEFT-TO-RIGHT MARK + '\u200f' # 0xFE -> RIGHT-TO-LEFT MARK + '\u06d2' # 0xFF -> ARABIC LETTER YEH BARREE ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1257.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1257.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1257.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\ufffe' # 0x83 -> UNDEFINED - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\ufffe' # 0x88 -> UNDEFINED - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\ufffe' # 0x8A -> UNDEFINED - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x8C -> UNDEFINED - u'\xa8' # 0x8D -> DIAERESIS - u'\u02c7' # 0x8E -> CARON - u'\xb8' # 0x8F -> CEDILLA - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\ufffe' # 0x9A -> UNDEFINED - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x9C -> UNDEFINED - u'\xaf' # 0x9D -> MACRON - u'\u02db' # 0x9E -> OGONEK - u'\ufffe' # 0x9F -> UNDEFINED - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\ufffe' # 0xA1 -> UNDEFINED - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\ufffe' # 0xA5 -> UNDEFINED - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xd8' # 0xA8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u0156' # 0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xc6' # 0xAF -> LATIN CAPITAL LETTER AE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xf8' # 0xB8 -> LATIN SMALL LETTER O WITH STROKE - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\u0157' # 0xBA -> LATIN SMALL LETTER R WITH CEDILLA - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xe6' # 0xBF -> LATIN SMALL LETTER AE - u'\u0104' # 0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u012e' # 0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u0100' # 0xC2 -> LATIN CAPITAL LETTER A WITH MACRON - u'\u0106' # 0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\u0118' # 0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u0112' # 0xC7 -> LATIN CAPITAL LETTER E WITH MACRON - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0179' # 0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\u0116' # 0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\u0122' # 0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u0136' # 0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\u012a' # 0xCE -> LATIN CAPITAL LETTER I WITH MACRON - u'\u013b' # 0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u0160' # 0xD0 -> LATIN CAPITAL LETTER S WITH CARON - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0145' # 0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\u014c' # 0xD4 -> LATIN CAPITAL LETTER O WITH MACRON - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0172' # 0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\u0141' # 0xD9 -> LATIN CAPITAL LETTER L WITH STROKE - u'\u015a' # 0xDA -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u016a' # 0xDB -> LATIN CAPITAL LETTER U WITH MACRON - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u017b' # 0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u017d' # 0xDE -> LATIN CAPITAL LETTER Z WITH CARON - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\u0105' # 0xE0 -> LATIN SMALL LETTER A WITH OGONEK - u'\u012f' # 0xE1 -> LATIN SMALL LETTER I WITH OGONEK - u'\u0101' # 0xE2 -> LATIN SMALL LETTER A WITH MACRON - u'\u0107' # 0xE3 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\u0119' # 0xE6 -> LATIN SMALL LETTER E WITH OGONEK - u'\u0113' # 0xE7 -> LATIN SMALL LETTER E WITH MACRON - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u017a' # 0xEA -> LATIN SMALL LETTER Z WITH ACUTE - u'\u0117' # 0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\u0123' # 0xEC -> LATIN SMALL LETTER G WITH CEDILLA - u'\u0137' # 0xED -> LATIN SMALL LETTER K WITH CEDILLA - u'\u012b' # 0xEE -> LATIN SMALL LETTER I WITH MACRON - u'\u013c' # 0xEF -> LATIN SMALL LETTER L WITH CEDILLA - u'\u0161' # 0xF0 -> LATIN SMALL LETTER S WITH CARON - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0146' # 0xF2 -> LATIN SMALL LETTER N WITH CEDILLA - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\u014d' # 0xF4 -> LATIN SMALL LETTER O WITH MACRON - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0173' # 0xF8 -> LATIN SMALL LETTER U WITH OGONEK - u'\u0142' # 0xF9 -> LATIN SMALL LETTER L WITH STROKE - u'\u015b' # 0xFA -> LATIN SMALL LETTER S WITH ACUTE - u'\u016b' # 0xFB -> LATIN SMALL LETTER U WITH MACRON - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u017e' # 0xFE -> LATIN SMALL LETTER Z WITH CARON - u'\u02d9' # 0xFF -> DOT ABOVE + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u20ac' # 0x80 -> EURO SIGN + '\ufffe' # 0x81 -> UNDEFINED + '\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK + '\ufffe' # 0x83 -> UNDEFINED + '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\u2020' # 0x86 -> DAGGER + '\u2021' # 0x87 -> DOUBLE DAGGER + '\ufffe' # 0x88 -> UNDEFINED + '\u2030' # 0x89 -> PER MILLE SIGN + '\ufffe' # 0x8A -> UNDEFINED + '\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\ufffe' # 0x8C -> UNDEFINED + '\xa8' # 0x8D -> DIAERESIS + '\u02c7' # 0x8E -> CARON + '\xb8' # 0x8F -> CEDILLA + '\ufffe' # 0x90 -> UNDEFINED + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\ufffe' # 0x98 -> UNDEFINED + '\u2122' # 0x99 -> TRADE MARK SIGN + '\ufffe' # 0x9A -> UNDEFINED + '\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\ufffe' # 0x9C -> UNDEFINED + '\xaf' # 0x9D -> MACRON + '\u02db' # 0x9E -> OGONEK + '\ufffe' # 0x9F -> UNDEFINED + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\ufffe' # 0xA1 -> UNDEFINED + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\ufffe' # 0xA5 -> UNDEFINED + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xd8' # 0xA8 -> LATIN CAPITAL LETTER O WITH STROKE + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u0156' # 0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xc6' # 0xAF -> LATIN CAPITAL LETTER AE + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xf8' # 0xB8 -> LATIN SMALL LETTER O WITH STROKE + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\u0157' # 0xBA -> LATIN SMALL LETTER R WITH CEDILLA + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\xe6' # 0xBF -> LATIN SMALL LETTER AE + '\u0104' # 0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK + '\u012e' # 0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK + '\u0100' # 0xC2 -> LATIN CAPITAL LETTER A WITH MACRON + '\u0106' # 0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\u0118' # 0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK + '\u0112' # 0xC7 -> LATIN CAPITAL LETTER E WITH MACRON + '\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\u0179' # 0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE + '\u0116' # 0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE + '\u0122' # 0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA + '\u0136' # 0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA + '\u012a' # 0xCE -> LATIN CAPITAL LETTER I WITH MACRON + '\u013b' # 0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA + '\u0160' # 0xD0 -> LATIN CAPITAL LETTER S WITH CARON + '\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE + '\u0145' # 0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\u014c' # 0xD4 -> LATIN CAPITAL LETTER O WITH MACRON + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\u0172' # 0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK + '\u0141' # 0xD9 -> LATIN CAPITAL LETTER L WITH STROKE + '\u015a' # 0xDA -> LATIN CAPITAL LETTER S WITH ACUTE + '\u016a' # 0xDB -> LATIN CAPITAL LETTER U WITH MACRON + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u017b' # 0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE + '\u017d' # 0xDE -> LATIN CAPITAL LETTER Z WITH CARON + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\u0105' # 0xE0 -> LATIN SMALL LETTER A WITH OGONEK + '\u012f' # 0xE1 -> LATIN SMALL LETTER I WITH OGONEK + '\u0101' # 0xE2 -> LATIN SMALL LETTER A WITH MACRON + '\u0107' # 0xE3 -> LATIN SMALL LETTER C WITH ACUTE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\u0119' # 0xE6 -> LATIN SMALL LETTER E WITH OGONEK + '\u0113' # 0xE7 -> LATIN SMALL LETTER E WITH MACRON + '\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\u017a' # 0xEA -> LATIN SMALL LETTER Z WITH ACUTE + '\u0117' # 0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE + '\u0123' # 0xEC -> LATIN SMALL LETTER G WITH CEDILLA + '\u0137' # 0xED -> LATIN SMALL LETTER K WITH CEDILLA + '\u012b' # 0xEE -> LATIN SMALL LETTER I WITH MACRON + '\u013c' # 0xEF -> LATIN SMALL LETTER L WITH CEDILLA + '\u0161' # 0xF0 -> LATIN SMALL LETTER S WITH CARON + '\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE + '\u0146' # 0xF2 -> LATIN SMALL LETTER N WITH CEDILLA + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\u014d' # 0xF4 -> LATIN SMALL LETTER O WITH MACRON + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\u0173' # 0xF8 -> LATIN SMALL LETTER U WITH OGONEK + '\u0142' # 0xF9 -> LATIN SMALL LETTER L WITH STROKE + '\u015b' # 0xFA -> LATIN SMALL LETTER S WITH ACUTE + '\u016b' # 0xFB -> LATIN SMALL LETTER U WITH MACRON + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE + '\u017e' # 0xFE -> LATIN SMALL LETTER Z WITH CARON + '\u02d9' # 0xFF -> DOT ABOVE ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp1258.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp1258.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp1258.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\ufffe' # 0x8A -> UNDEFINED - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u02dc' # 0x98 -> SMALL TILDE - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\ufffe' # 0x9A -> UNDEFINED - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u0300' # 0xCC -> COMBINING GRAVE ACCENT - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\u0309' # 0xD2 -> COMBINING HOOK ABOVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u01a0' # 0xD5 -> LATIN CAPITAL LETTER O WITH HORN - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u01af' # 0xDD -> LATIN CAPITAL LETTER U WITH HORN - u'\u0303' # 0xDE -> COMBINING TILDE - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0301' # 0xEC -> COMBINING ACUTE ACCENT - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\u0323' # 0xF2 -> COMBINING DOT BELOW - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u01a1' # 0xF5 -> LATIN SMALL LETTER O WITH HORN - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u01b0' # 0xFD -> LATIN SMALL LETTER U WITH HORN - u'\u20ab' # 0xFE -> DONG SIGN - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u20ac' # 0x80 -> EURO SIGN + '\ufffe' # 0x81 -> UNDEFINED + '\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK + '\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK + '\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\u2020' # 0x86 -> DAGGER + '\u2021' # 0x87 -> DOUBLE DAGGER + '\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u2030' # 0x89 -> PER MILLE SIGN + '\ufffe' # 0x8A -> UNDEFINED + '\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE + '\ufffe' # 0x8D -> UNDEFINED + '\ufffe' # 0x8E -> UNDEFINED + '\ufffe' # 0x8F -> UNDEFINED + '\ufffe' # 0x90 -> UNDEFINED + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\u02dc' # 0x98 -> SMALL TILDE + '\u2122' # 0x99 -> TRADE MARK SIGN + '\ufffe' # 0x9A -> UNDEFINED + '\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\u0153' # 0x9C -> LATIN SMALL LIGATURE OE + '\ufffe' # 0x9D -> UNDEFINED + '\ufffe' # 0x9E -> UNDEFINED + '\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\xbf' # 0xBF -> INVERTED QUESTION MARK + '\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\u0300' # 0xCC -> COMBINING GRAVE ACCENT + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE + '\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE + '\u0309' # 0xD2 -> COMBINING HOOK ABOVE + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\u01a0' # 0xD5 -> LATIN CAPITAL LETTER O WITH HORN + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE + '\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u01af' # 0xDD -> LATIN CAPITAL LETTER U WITH HORN + '\u0303' # 0xDE -> COMBINING TILDE + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\u0301' # 0xEC -> COMBINING ACUTE ACCENT + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE + '\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE + '\u0323' # 0xF2 -> COMBINING DOT BELOW + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\u01a1' # 0xF5 -> LATIN SMALL LETTER O WITH HORN + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\u01b0' # 0xFD -> LATIN SMALL LETTER U WITH HORN + '\u20ab' # 0xFE -> DONG SIGN + '\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp424.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp424.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp424.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> SELECT - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> REQUIRED NEW LINE - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> GRAPHIC ESCAPE - u'\x8d' # 0x09 -> SUPERSCRIPT - u'\x8e' # 0x0A -> REPEAT - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> RESTORE/ENABLE PRESENTATION - u'\x85' # 0x15 -> NEW LINE - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> PROGRAM OPERATOR COMMUNICATION - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> UNIT BACK SPACE - u'\x8f' # 0x1B -> CUSTOMER USE ONE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> DIGIT SELECT - u'\x81' # 0x21 -> START OF SIGNIFICANCE - u'\x82' # 0x22 -> FIELD SEPARATOR - u'\x83' # 0x23 -> WORD UNDERSCORE - u'\x84' # 0x24 -> BYPASS OR INHIBIT PRESENTATION - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> SET ATTRIBUTE - u'\x89' # 0x29 -> START FIELD EXTENDED - u'\x8a' # 0x2A -> SET MODE OR SWITCH - u'\x8b' # 0x2B -> CONTROL SEQUENCE PREFIX - u'\x8c' # 0x2C -> MODIFY FIELD ATTRIBUTE - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> - u'\x91' # 0x31 -> - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> INDEX RETURN - u'\x94' # 0x34 -> PRESENTATION POSITION - u'\x95' # 0x35 -> TRANSPARENT - u'\x96' # 0x36 -> NUMERIC BACKSPACE - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> SUBSCRIPT - u'\x99' # 0x39 -> INDENT TABULATION - u'\x9a' # 0x3A -> REVERSE FORM FEED - u'\x9b' # 0x3B -> CUSTOMER USE THREE - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\u05d0' # 0x41 -> HEBREW LETTER ALEF - u'\u05d1' # 0x42 -> HEBREW LETTER BET - u'\u05d2' # 0x43 -> HEBREW LETTER GIMEL - u'\u05d3' # 0x44 -> HEBREW LETTER DALET - u'\u05d4' # 0x45 -> HEBREW LETTER HE - u'\u05d5' # 0x46 -> HEBREW LETTER VAV - u'\u05d6' # 0x47 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0x48 -> HEBREW LETTER HET - u'\u05d8' # 0x49 -> HEBREW LETTER TET - u'\xa2' # 0x4A -> CENT SIGN - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'|' # 0x4F -> VERTICAL LINE - u'&' # 0x50 -> AMPERSAND - u'\u05d9' # 0x51 -> HEBREW LETTER YOD - u'\u05da' # 0x52 -> HEBREW LETTER FINAL KAF - u'\u05db' # 0x53 -> HEBREW LETTER KAF - u'\u05dc' # 0x54 -> HEBREW LETTER LAMED - u'\u05dd' # 0x55 -> HEBREW LETTER FINAL MEM - u'\u05de' # 0x56 -> HEBREW LETTER MEM - u'\u05df' # 0x57 -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0x58 -> HEBREW LETTER NUN - u'\u05e1' # 0x59 -> HEBREW LETTER SAMEKH - u'!' # 0x5A -> EXCLAMATION MARK - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'\xac' # 0x5F -> NOT SIGN - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\u05e2' # 0x62 -> HEBREW LETTER AYIN - u'\u05e3' # 0x63 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0x64 -> HEBREW LETTER PE - u'\u05e5' # 0x65 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0x66 -> HEBREW LETTER TSADI - u'\u05e7' # 0x67 -> HEBREW LETTER QOF - u'\u05e8' # 0x68 -> HEBREW LETTER RESH - u'\u05e9' # 0x69 -> HEBREW LETTER SHIN - u'\xa6' # 0x6A -> BROKEN BAR - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\ufffe' # 0x70 -> UNDEFINED - u'\u05ea' # 0x71 -> HEBREW LETTER TAV - u'\ufffe' # 0x72 -> UNDEFINED - u'\ufffe' # 0x73 -> UNDEFINED - u'\xa0' # 0x74 -> NO-BREAK SPACE - u'\ufffe' # 0x75 -> UNDEFINED - u'\ufffe' # 0x76 -> UNDEFINED - u'\ufffe' # 0x77 -> UNDEFINED - u'\u2017' # 0x78 -> DOUBLE LOW LINE - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\ufffe' # 0x80 -> UNDEFINED - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\ufffe' # 0x8C -> UNDEFINED - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\ufffe' # 0x9A -> UNDEFINED - u'\ufffe' # 0x9B -> UNDEFINED - u'\ufffe' # 0x9C -> UNDEFINED - u'\xb8' # 0x9D -> CEDILLA - u'\ufffe' # 0x9E -> UNDEFINED - u'\xa4' # 0x9F -> CURRENCY SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\ufffe' # 0xAA -> UNDEFINED - u'\ufffe' # 0xAB -> UNDEFINED - u'\ufffe' # 0xAC -> UNDEFINED - u'\ufffe' # 0xAD -> UNDEFINED - u'\ufffe' # 0xAE -> UNDEFINED - u'\xae' # 0xAF -> REGISTERED SIGN - u'^' # 0xB0 -> CIRCUMFLEX ACCENT - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'[' # 0xBA -> LEFT SQUARE BRACKET - u']' # 0xBB -> RIGHT SQUARE BRACKET - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\ufffe' # 0xCB -> UNDEFINED - u'\ufffe' # 0xCC -> UNDEFINED - u'\ufffe' # 0xCD -> UNDEFINED - u'\ufffe' # 0xCE -> UNDEFINED - u'\ufffe' # 0xCF -> UNDEFINED - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\ufffe' # 0xDB -> UNDEFINED - u'\ufffe' # 0xDC -> UNDEFINED - u'\ufffe' # 0xDD -> UNDEFINED - u'\ufffe' # 0xDE -> UNDEFINED - u'\ufffe' # 0xDF -> UNDEFINED - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\ufffe' # 0xEB -> UNDEFINED - u'\ufffe' # 0xEC -> UNDEFINED - u'\ufffe' # 0xED -> UNDEFINED - u'\ufffe' # 0xEE -> UNDEFINED - u'\ufffe' # 0xEF -> UNDEFINED - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\ufffe' # 0xFB -> UNDEFINED - u'\ufffe' # 0xFC -> UNDEFINED - u'\ufffe' # 0xFD -> UNDEFINED - u'\ufffe' # 0xFE -> UNDEFINED - u'\x9f' # 0xFF -> EIGHT ONES + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x9c' # 0x04 -> SELECT + '\t' # 0x05 -> HORIZONTAL TABULATION + '\x86' # 0x06 -> REQUIRED NEW LINE + '\x7f' # 0x07 -> DELETE + '\x97' # 0x08 -> GRAPHIC ESCAPE + '\x8d' # 0x09 -> SUPERSCRIPT + '\x8e' # 0x0A -> REPEAT + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x9d' # 0x14 -> RESTORE/ENABLE PRESENTATION + '\x85' # 0x15 -> NEW LINE + '\x08' # 0x16 -> BACKSPACE + '\x87' # 0x17 -> PROGRAM OPERATOR COMMUNICATION + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x92' # 0x1A -> UNIT BACK SPACE + '\x8f' # 0x1B -> CUSTOMER USE ONE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + '\x80' # 0x20 -> DIGIT SELECT + '\x81' # 0x21 -> START OF SIGNIFICANCE + '\x82' # 0x22 -> FIELD SEPARATOR + '\x83' # 0x23 -> WORD UNDERSCORE + '\x84' # 0x24 -> BYPASS OR INHIBIT PRESENTATION + '\n' # 0x25 -> LINE FEED + '\x17' # 0x26 -> END OF TRANSMISSION BLOCK + '\x1b' # 0x27 -> ESCAPE + '\x88' # 0x28 -> SET ATTRIBUTE + '\x89' # 0x29 -> START FIELD EXTENDED + '\x8a' # 0x2A -> SET MODE OR SWITCH + '\x8b' # 0x2B -> CONTROL SEQUENCE PREFIX + '\x8c' # 0x2C -> MODIFY FIELD ATTRIBUTE + '\x05' # 0x2D -> ENQUIRY + '\x06' # 0x2E -> ACKNOWLEDGE + '\x07' # 0x2F -> BELL + '\x90' # 0x30 -> + '\x91' # 0x31 -> + '\x16' # 0x32 -> SYNCHRONOUS IDLE + '\x93' # 0x33 -> INDEX RETURN + '\x94' # 0x34 -> PRESENTATION POSITION + '\x95' # 0x35 -> TRANSPARENT + '\x96' # 0x36 -> NUMERIC BACKSPACE + '\x04' # 0x37 -> END OF TRANSMISSION + '\x98' # 0x38 -> SUBSCRIPT + '\x99' # 0x39 -> INDENT TABULATION + '\x9a' # 0x3A -> REVERSE FORM FEED + '\x9b' # 0x3B -> CUSTOMER USE THREE + '\x14' # 0x3C -> DEVICE CONTROL FOUR + '\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE + '\x9e' # 0x3E -> + '\x1a' # 0x3F -> SUBSTITUTE + ' ' # 0x40 -> SPACE + '\u05d0' # 0x41 -> HEBREW LETTER ALEF + '\u05d1' # 0x42 -> HEBREW LETTER BET + '\u05d2' # 0x43 -> HEBREW LETTER GIMEL + '\u05d3' # 0x44 -> HEBREW LETTER DALET + '\u05d4' # 0x45 -> HEBREW LETTER HE + '\u05d5' # 0x46 -> HEBREW LETTER VAV + '\u05d6' # 0x47 -> HEBREW LETTER ZAYIN + '\u05d7' # 0x48 -> HEBREW LETTER HET + '\u05d8' # 0x49 -> HEBREW LETTER TET + '\xa2' # 0x4A -> CENT SIGN + '.' # 0x4B -> FULL STOP + '<' # 0x4C -> LESS-THAN SIGN + '(' # 0x4D -> LEFT PARENTHESIS + '+' # 0x4E -> PLUS SIGN + '|' # 0x4F -> VERTICAL LINE + '&' # 0x50 -> AMPERSAND + '\u05d9' # 0x51 -> HEBREW LETTER YOD + '\u05da' # 0x52 -> HEBREW LETTER FINAL KAF + '\u05db' # 0x53 -> HEBREW LETTER KAF + '\u05dc' # 0x54 -> HEBREW LETTER LAMED + '\u05dd' # 0x55 -> HEBREW LETTER FINAL MEM + '\u05de' # 0x56 -> HEBREW LETTER MEM + '\u05df' # 0x57 -> HEBREW LETTER FINAL NUN + '\u05e0' # 0x58 -> HEBREW LETTER NUN + '\u05e1' # 0x59 -> HEBREW LETTER SAMEKH + '!' # 0x5A -> EXCLAMATION MARK + '$' # 0x5B -> DOLLAR SIGN + '*' # 0x5C -> ASTERISK + ')' # 0x5D -> RIGHT PARENTHESIS + ';' # 0x5E -> SEMICOLON + '\xac' # 0x5F -> NOT SIGN + '-' # 0x60 -> HYPHEN-MINUS + '/' # 0x61 -> SOLIDUS + '\u05e2' # 0x62 -> HEBREW LETTER AYIN + '\u05e3' # 0x63 -> HEBREW LETTER FINAL PE + '\u05e4' # 0x64 -> HEBREW LETTER PE + '\u05e5' # 0x65 -> HEBREW LETTER FINAL TSADI + '\u05e6' # 0x66 -> HEBREW LETTER TSADI + '\u05e7' # 0x67 -> HEBREW LETTER QOF + '\u05e8' # 0x68 -> HEBREW LETTER RESH + '\u05e9' # 0x69 -> HEBREW LETTER SHIN + '\xa6' # 0x6A -> BROKEN BAR + ',' # 0x6B -> COMMA + '%' # 0x6C -> PERCENT SIGN + '_' # 0x6D -> LOW LINE + '>' # 0x6E -> GREATER-THAN SIGN + '?' # 0x6F -> QUESTION MARK + '\ufffe' # 0x70 -> UNDEFINED + '\u05ea' # 0x71 -> HEBREW LETTER TAV + '\ufffe' # 0x72 -> UNDEFINED + '\ufffe' # 0x73 -> UNDEFINED + '\xa0' # 0x74 -> NO-BREAK SPACE + '\ufffe' # 0x75 -> UNDEFINED + '\ufffe' # 0x76 -> UNDEFINED + '\ufffe' # 0x77 -> UNDEFINED + '\u2017' # 0x78 -> DOUBLE LOW LINE + '`' # 0x79 -> GRAVE ACCENT + ':' # 0x7A -> COLON + '#' # 0x7B -> NUMBER SIGN + '@' # 0x7C -> COMMERCIAL AT + "'" # 0x7D -> APOSTROPHE + '=' # 0x7E -> EQUALS SIGN + '"' # 0x7F -> QUOTATION MARK + '\ufffe' # 0x80 -> UNDEFINED + 'a' # 0x81 -> LATIN SMALL LETTER A + 'b' # 0x82 -> LATIN SMALL LETTER B + 'c' # 0x83 -> LATIN SMALL LETTER C + 'd' # 0x84 -> LATIN SMALL LETTER D + 'e' # 0x85 -> LATIN SMALL LETTER E + 'f' # 0x86 -> LATIN SMALL LETTER F + 'g' # 0x87 -> LATIN SMALL LETTER G + 'h' # 0x88 -> LATIN SMALL LETTER H + 'i' # 0x89 -> LATIN SMALL LETTER I + '\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\ufffe' # 0x8C -> UNDEFINED + '\ufffe' # 0x8D -> UNDEFINED + '\ufffe' # 0x8E -> UNDEFINED + '\xb1' # 0x8F -> PLUS-MINUS SIGN + '\xb0' # 0x90 -> DEGREE SIGN + 'j' # 0x91 -> LATIN SMALL LETTER J + 'k' # 0x92 -> LATIN SMALL LETTER K + 'l' # 0x93 -> LATIN SMALL LETTER L + 'm' # 0x94 -> LATIN SMALL LETTER M + 'n' # 0x95 -> LATIN SMALL LETTER N + 'o' # 0x96 -> LATIN SMALL LETTER O + 'p' # 0x97 -> LATIN SMALL LETTER P + 'q' # 0x98 -> LATIN SMALL LETTER Q + 'r' # 0x99 -> LATIN SMALL LETTER R + '\ufffe' # 0x9A -> UNDEFINED + '\ufffe' # 0x9B -> UNDEFINED + '\ufffe' # 0x9C -> UNDEFINED + '\xb8' # 0x9D -> CEDILLA + '\ufffe' # 0x9E -> UNDEFINED + '\xa4' # 0x9F -> CURRENCY SIGN + '\xb5' # 0xA0 -> MICRO SIGN + '~' # 0xA1 -> TILDE + 's' # 0xA2 -> LATIN SMALL LETTER S + 't' # 0xA3 -> LATIN SMALL LETTER T + 'u' # 0xA4 -> LATIN SMALL LETTER U + 'v' # 0xA5 -> LATIN SMALL LETTER V + 'w' # 0xA6 -> LATIN SMALL LETTER W + 'x' # 0xA7 -> LATIN SMALL LETTER X + 'y' # 0xA8 -> LATIN SMALL LETTER Y + 'z' # 0xA9 -> LATIN SMALL LETTER Z + '\ufffe' # 0xAA -> UNDEFINED + '\ufffe' # 0xAB -> UNDEFINED + '\ufffe' # 0xAC -> UNDEFINED + '\ufffe' # 0xAD -> UNDEFINED + '\ufffe' # 0xAE -> UNDEFINED + '\xae' # 0xAF -> REGISTERED SIGN + '^' # 0xB0 -> CIRCUMFLEX ACCENT + '\xa3' # 0xB1 -> POUND SIGN + '\xa5' # 0xB2 -> YEN SIGN + '\xb7' # 0xB3 -> MIDDLE DOT + '\xa9' # 0xB4 -> COPYRIGHT SIGN + '\xa7' # 0xB5 -> SECTION SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF + '\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS + '[' # 0xBA -> LEFT SQUARE BRACKET + ']' # 0xBB -> RIGHT SQUARE BRACKET + '\xaf' # 0xBC -> MACRON + '\xa8' # 0xBD -> DIAERESIS + '\xb4' # 0xBE -> ACUTE ACCENT + '\xd7' # 0xBF -> MULTIPLICATION SIGN + '{' # 0xC0 -> LEFT CURLY BRACKET + 'A' # 0xC1 -> LATIN CAPITAL LETTER A + 'B' # 0xC2 -> LATIN CAPITAL LETTER B + 'C' # 0xC3 -> LATIN CAPITAL LETTER C + 'D' # 0xC4 -> LATIN CAPITAL LETTER D + 'E' # 0xC5 -> LATIN CAPITAL LETTER E + 'F' # 0xC6 -> LATIN CAPITAL LETTER F + 'G' # 0xC7 -> LATIN CAPITAL LETTER G + 'H' # 0xC8 -> LATIN CAPITAL LETTER H + 'I' # 0xC9 -> LATIN CAPITAL LETTER I + '\xad' # 0xCA -> SOFT HYPHEN + '\ufffe' # 0xCB -> UNDEFINED + '\ufffe' # 0xCC -> UNDEFINED + '\ufffe' # 0xCD -> UNDEFINED + '\ufffe' # 0xCE -> UNDEFINED + '\ufffe' # 0xCF -> UNDEFINED + '}' # 0xD0 -> RIGHT CURLY BRACKET + 'J' # 0xD1 -> LATIN CAPITAL LETTER J + 'K' # 0xD2 -> LATIN CAPITAL LETTER K + 'L' # 0xD3 -> LATIN CAPITAL LETTER L + 'M' # 0xD4 -> LATIN CAPITAL LETTER M + 'N' # 0xD5 -> LATIN CAPITAL LETTER N + 'O' # 0xD6 -> LATIN CAPITAL LETTER O + 'P' # 0xD7 -> LATIN CAPITAL LETTER P + 'Q' # 0xD8 -> LATIN CAPITAL LETTER Q + 'R' # 0xD9 -> LATIN CAPITAL LETTER R + '\xb9' # 0xDA -> SUPERSCRIPT ONE + '\ufffe' # 0xDB -> UNDEFINED + '\ufffe' # 0xDC -> UNDEFINED + '\ufffe' # 0xDD -> UNDEFINED + '\ufffe' # 0xDE -> UNDEFINED + '\ufffe' # 0xDF -> UNDEFINED + '\\' # 0xE0 -> REVERSE SOLIDUS + '\xf7' # 0xE1 -> DIVISION SIGN + 'S' # 0xE2 -> LATIN CAPITAL LETTER S + 'T' # 0xE3 -> LATIN CAPITAL LETTER T + 'U' # 0xE4 -> LATIN CAPITAL LETTER U + 'V' # 0xE5 -> LATIN CAPITAL LETTER V + 'W' # 0xE6 -> LATIN CAPITAL LETTER W + 'X' # 0xE7 -> LATIN CAPITAL LETTER X + 'Y' # 0xE8 -> LATIN CAPITAL LETTER Y + 'Z' # 0xE9 -> LATIN CAPITAL LETTER Z + '\xb2' # 0xEA -> SUPERSCRIPT TWO + '\ufffe' # 0xEB -> UNDEFINED + '\ufffe' # 0xEC -> UNDEFINED + '\ufffe' # 0xED -> UNDEFINED + '\ufffe' # 0xEE -> UNDEFINED + '\ufffe' # 0xEF -> UNDEFINED + '0' # 0xF0 -> DIGIT ZERO + '1' # 0xF1 -> DIGIT ONE + '2' # 0xF2 -> DIGIT TWO + '3' # 0xF3 -> DIGIT THREE + '4' # 0xF4 -> DIGIT FOUR + '5' # 0xF5 -> DIGIT FIVE + '6' # 0xF6 -> DIGIT SIX + '7' # 0xF7 -> DIGIT SEVEN + '8' # 0xF8 -> DIGIT EIGHT + '9' # 0xF9 -> DIGIT NINE + '\xb3' # 0xFA -> SUPERSCRIPT THREE + '\ufffe' # 0xFB -> UNDEFINED + '\ufffe' # 0xFC -> UNDEFINED + '\ufffe' # 0xFD -> UNDEFINED + '\ufffe' # 0xFE -> UNDEFINED + '\x9f' # 0xFF -> EIGHT ONES ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp437.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp437.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp437.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xa2' # 0x009b -> CENT SIGN - u'\xa3' # 0x009c -> POUND SIGN - u'\xa5' # 0x009d -> YEN SIGN - u'\u20a7' # 0x009e -> PESETA SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE + '\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE + '\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA + '\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE + '\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS + '\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE + '\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE + '\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE + '\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE + '\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE + '\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS + '\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xa2' # 0x009b -> CENT SIGN + '\xa3' # 0x009c -> POUND SIGN + '\xa5' # 0x009d -> YEN SIGN + '\u20a7' # 0x009e -> PESETA SIGN + '\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK + '\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE + '\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE + '\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE + '\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE + '\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR + '\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR + '\xbf' # 0x00a8 -> INVERTED QUESTION MARK + '\u2310' # 0x00a9 -> REVERSED NOT SIGN + '\xac' # 0x00aa -> NOT SIGN + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER + '\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + '\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + '\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + '\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + '\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + '\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + '\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + '\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u258c' # 0x00dd -> LEFT HALF BLOCK + '\u2590' # 0x00de -> RIGHT HALF BLOCK + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S + '\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA + '\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI + '\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA + '\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA + '\xb5' # 0x00e6 -> MICRO SIGN + '\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU + '\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI + '\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA + '\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA + '\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA + '\u221e' # 0x00ec -> INFINITY + '\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI + '\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON + '\u2229' # 0x00ef -> INTERSECTION + '\u2261' # 0x00f0 -> IDENTICAL TO + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO + '\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO + '\u2320' # 0x00f4 -> TOP HALF INTEGRAL + '\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL + '\xf7' # 0x00f6 -> DIVISION SIGN + '\u2248' # 0x00f7 -> ALMOST EQUAL TO + '\xb0' # 0x00f8 -> DEGREE SIGN + '\u2219' # 0x00f9 -> BULLET OPERATOR + '\xb7' # 0x00fa -> MIDDLE DOT + '\u221a' # 0x00fb -> SQUARE ROOT + '\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp500.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp500.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp500.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\xa0' # 0x41 -> NO-BREAK SPACE - u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE - u'[' # 0x4A -> LEFT SQUARE BRACKET - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'!' # 0x4F -> EXCLAMATION MARK - u'&' # 0x50 -> AMPERSAND - u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE - u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE - u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) - u']' # 0x5A -> RIGHT SQUARE BRACKET - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'^' # 0x5F -> CIRCUMFLEX ACCENT - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xa6' # 0x6A -> BROKEN BAR - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE - u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) - u'\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR - u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE - u'\xb8' # 0x9D -> CEDILLA - u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE - u'\xa4' # 0x9F -> CURRENCY SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK - u'\xbf' # 0xAB -> INVERTED QUESTION MARK - u'\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) - u'\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) - u'\xae' # 0xAF -> REGISTERED SIGN - u'\xa2' # 0xB0 -> CENT SIGN - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'\xac' # 0xBA -> NOT SIGN - u'|' # 0xBB -> VERTICAL LINE - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE - u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE - u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE - u'\x9f' # 0xFF -> CONTROL + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x9c' # 0x04 -> CONTROL + '\t' # 0x05 -> HORIZONTAL TABULATION + '\x86' # 0x06 -> CONTROL + '\x7f' # 0x07 -> DELETE + '\x97' # 0x08 -> CONTROL + '\x8d' # 0x09 -> CONTROL + '\x8e' # 0x0A -> CONTROL + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x9d' # 0x14 -> CONTROL + '\x85' # 0x15 -> CONTROL + '\x08' # 0x16 -> BACKSPACE + '\x87' # 0x17 -> CONTROL + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x92' # 0x1A -> CONTROL + '\x8f' # 0x1B -> CONTROL + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + '\x80' # 0x20 -> CONTROL + '\x81' # 0x21 -> CONTROL + '\x82' # 0x22 -> CONTROL + '\x83' # 0x23 -> CONTROL + '\x84' # 0x24 -> CONTROL + '\n' # 0x25 -> LINE FEED + '\x17' # 0x26 -> END OF TRANSMISSION BLOCK + '\x1b' # 0x27 -> ESCAPE + '\x88' # 0x28 -> CONTROL + '\x89' # 0x29 -> CONTROL + '\x8a' # 0x2A -> CONTROL + '\x8b' # 0x2B -> CONTROL + '\x8c' # 0x2C -> CONTROL + '\x05' # 0x2D -> ENQUIRY + '\x06' # 0x2E -> ACKNOWLEDGE + '\x07' # 0x2F -> BELL + '\x90' # 0x30 -> CONTROL + '\x91' # 0x31 -> CONTROL + '\x16' # 0x32 -> SYNCHRONOUS IDLE + '\x93' # 0x33 -> CONTROL + '\x94' # 0x34 -> CONTROL + '\x95' # 0x35 -> CONTROL + '\x96' # 0x36 -> CONTROL + '\x04' # 0x37 -> END OF TRANSMISSION + '\x98' # 0x38 -> CONTROL + '\x99' # 0x39 -> CONTROL + '\x9a' # 0x3A -> CONTROL + '\x9b' # 0x3B -> CONTROL + '\x14' # 0x3C -> DEVICE CONTROL FOUR + '\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE + '\x9e' # 0x3E -> CONTROL + '\x1a' # 0x3F -> SUBSTITUTE + ' ' # 0x40 -> SPACE + '\xa0' # 0x41 -> NO-BREAK SPACE + '\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE + '\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA + '\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE + '[' # 0x4A -> LEFT SQUARE BRACKET + '.' # 0x4B -> FULL STOP + '<' # 0x4C -> LESS-THAN SIGN + '(' # 0x4D -> LEFT PARENTHESIS + '+' # 0x4E -> PLUS SIGN + '!' # 0x4F -> EXCLAMATION MARK + '&' # 0x50 -> AMPERSAND + '\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE + '\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE + '\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) + ']' # 0x5A -> RIGHT SQUARE BRACKET + '$' # 0x5B -> DOLLAR SIGN + '*' # 0x5C -> ASTERISK + ')' # 0x5D -> RIGHT PARENTHESIS + ';' # 0x5E -> SEMICOLON + '^' # 0x5F -> CIRCUMFLEX ACCENT + '-' # 0x60 -> HYPHEN-MINUS + '/' # 0x61 -> SOLIDUS + '\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE + '\xa6' # 0x6A -> BROKEN BAR + ',' # 0x6B -> COMMA + '%' # 0x6C -> PERCENT SIGN + '_' # 0x6D -> LOW LINE + '>' # 0x6E -> GREATER-THAN SIGN + '?' # 0x6F -> QUESTION MARK + '\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE + '\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE + '`' # 0x79 -> GRAVE ACCENT + ':' # 0x7A -> COLON + '#' # 0x7B -> NUMBER SIGN + '@' # 0x7C -> COMMERCIAL AT + "'" # 0x7D -> APOSTROPHE + '=' # 0x7E -> EQUALS SIGN + '"' # 0x7F -> QUOTATION MARK + '\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE + 'a' # 0x81 -> LATIN SMALL LETTER A + 'b' # 0x82 -> LATIN SMALL LETTER B + 'c' # 0x83 -> LATIN SMALL LETTER C + 'd' # 0x84 -> LATIN SMALL LETTER D + 'e' # 0x85 -> LATIN SMALL LETTER E + 'f' # 0x86 -> LATIN SMALL LETTER F + 'g' # 0x87 -> LATIN SMALL LETTER G + 'h' # 0x88 -> LATIN SMALL LETTER H + 'i' # 0x89 -> LATIN SMALL LETTER I + '\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) + '\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE + '\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) + '\xb1' # 0x8F -> PLUS-MINUS SIGN + '\xb0' # 0x90 -> DEGREE SIGN + 'j' # 0x91 -> LATIN SMALL LETTER J + 'k' # 0x92 -> LATIN SMALL LETTER K + 'l' # 0x93 -> LATIN SMALL LETTER L + 'm' # 0x94 -> LATIN SMALL LETTER M + 'n' # 0x95 -> LATIN SMALL LETTER N + 'o' # 0x96 -> LATIN SMALL LETTER O + 'p' # 0x97 -> LATIN SMALL LETTER P + 'q' # 0x98 -> LATIN SMALL LETTER Q + 'r' # 0x99 -> LATIN SMALL LETTER R + '\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR + '\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR + '\xe6' # 0x9C -> LATIN SMALL LIGATURE AE + '\xb8' # 0x9D -> CEDILLA + '\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE + '\xa4' # 0x9F -> CURRENCY SIGN + '\xb5' # 0xA0 -> MICRO SIGN + '~' # 0xA1 -> TILDE + 's' # 0xA2 -> LATIN SMALL LETTER S + 't' # 0xA3 -> LATIN SMALL LETTER T + 'u' # 0xA4 -> LATIN SMALL LETTER U + 'v' # 0xA5 -> LATIN SMALL LETTER V + 'w' # 0xA6 -> LATIN SMALL LETTER W + 'x' # 0xA7 -> LATIN SMALL LETTER X + 'y' # 0xA8 -> LATIN SMALL LETTER Y + 'z' # 0xA9 -> LATIN SMALL LETTER Z + '\xa1' # 0xAA -> INVERTED EXCLAMATION MARK + '\xbf' # 0xAB -> INVERTED QUESTION MARK + '\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) + '\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) + '\xae' # 0xAF -> REGISTERED SIGN + '\xa2' # 0xB0 -> CENT SIGN + '\xa3' # 0xB1 -> POUND SIGN + '\xa5' # 0xB2 -> YEN SIGN + '\xb7' # 0xB3 -> MIDDLE DOT + '\xa9' # 0xB4 -> COPYRIGHT SIGN + '\xa7' # 0xB5 -> SECTION SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF + '\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS + '\xac' # 0xBA -> NOT SIGN + '|' # 0xBB -> VERTICAL LINE + '\xaf' # 0xBC -> MACRON + '\xa8' # 0xBD -> DIAERESIS + '\xb4' # 0xBE -> ACUTE ACCENT + '\xd7' # 0xBF -> MULTIPLICATION SIGN + '{' # 0xC0 -> LEFT CURLY BRACKET + 'A' # 0xC1 -> LATIN CAPITAL LETTER A + 'B' # 0xC2 -> LATIN CAPITAL LETTER B + 'C' # 0xC3 -> LATIN CAPITAL LETTER C + 'D' # 0xC4 -> LATIN CAPITAL LETTER D + 'E' # 0xC5 -> LATIN CAPITAL LETTER E + 'F' # 0xC6 -> LATIN CAPITAL LETTER F + 'G' # 0xC7 -> LATIN CAPITAL LETTER G + 'H' # 0xC8 -> LATIN CAPITAL LETTER H + 'I' # 0xC9 -> LATIN CAPITAL LETTER I + '\xad' # 0xCA -> SOFT HYPHEN + '\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE + '\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE + '}' # 0xD0 -> RIGHT CURLY BRACKET + 'J' # 0xD1 -> LATIN CAPITAL LETTER J + 'K' # 0xD2 -> LATIN CAPITAL LETTER K + 'L' # 0xD3 -> LATIN CAPITAL LETTER L + 'M' # 0xD4 -> LATIN CAPITAL LETTER M + 'N' # 0xD5 -> LATIN CAPITAL LETTER N + 'O' # 0xD6 -> LATIN CAPITAL LETTER O + 'P' # 0xD7 -> LATIN CAPITAL LETTER P + 'Q' # 0xD8 -> LATIN CAPITAL LETTER Q + 'R' # 0xD9 -> LATIN CAPITAL LETTER R + '\xb9' # 0xDA -> SUPERSCRIPT ONE + '\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE + '\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\\' # 0xE0 -> REVERSE SOLIDUS + '\xf7' # 0xE1 -> DIVISION SIGN + 'S' # 0xE2 -> LATIN CAPITAL LETTER S + 'T' # 0xE3 -> LATIN CAPITAL LETTER T + 'U' # 0xE4 -> LATIN CAPITAL LETTER U + 'V' # 0xE5 -> LATIN CAPITAL LETTER V + 'W' # 0xE6 -> LATIN CAPITAL LETTER W + 'X' # 0xE7 -> LATIN CAPITAL LETTER X + 'Y' # 0xE8 -> LATIN CAPITAL LETTER Y + 'Z' # 0xE9 -> LATIN CAPITAL LETTER Z + '\xb2' # 0xEA -> SUPERSCRIPT TWO + '\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE + '0' # 0xF0 -> DIGIT ZERO + '1' # 0xF1 -> DIGIT ONE + '2' # 0xF2 -> DIGIT TWO + '3' # 0xF3 -> DIGIT THREE + '4' # 0xF4 -> DIGIT FOUR + '5' # 0xF5 -> DIGIT FIVE + '6' # 0xF6 -> DIGIT SIX + '7' # 0xF7 -> DIGIT SEVEN + '8' # 0xF8 -> DIGIT EIGHT + '9' # 0xF9 -> DIGIT NINE + '\xb3' # 0xFA -> SUPERSCRIPT THREE + '\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE + '\x9f' # 0xFF -> CONTROL ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp737.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp737.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp737.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u0391' # 0x0080 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0x0081 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0x0082 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0x0083 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0x0084 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0x0085 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0x0086 -> GREEK CAPITAL LETTER ETA - u'\u0398' # 0x0087 -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0x0088 -> GREEK CAPITAL LETTER IOTA - u'\u039a' # 0x0089 -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0x008a -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0x008b -> GREEK CAPITAL LETTER MU - u'\u039d' # 0x008c -> GREEK CAPITAL LETTER NU - u'\u039e' # 0x008d -> GREEK CAPITAL LETTER XI - u'\u039f' # 0x008e -> GREEK CAPITAL LETTER OMICRON - u'\u03a0' # 0x008f -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0x0090 -> GREEK CAPITAL LETTER RHO - u'\u03a3' # 0x0091 -> GREEK CAPITAL LETTER SIGMA - u'\u03a4' # 0x0092 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0x0093 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0x0094 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0x0095 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0x0096 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0x0097 -> GREEK CAPITAL LETTER OMEGA - u'\u03b1' # 0x0098 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0x0099 -> GREEK SMALL LETTER BETA - u'\u03b3' # 0x009a -> GREEK SMALL LETTER GAMMA - u'\u03b4' # 0x009b -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0x009c -> GREEK SMALL LETTER EPSILON - u'\u03b6' # 0x009d -> GREEK SMALL LETTER ZETA - u'\u03b7' # 0x009e -> GREEK SMALL LETTER ETA - u'\u03b8' # 0x009f -> GREEK SMALL LETTER THETA - u'\u03b9' # 0x00a0 -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0x00a1 -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0x00a2 -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0x00a3 -> GREEK SMALL LETTER MU - u'\u03bd' # 0x00a4 -> GREEK SMALL LETTER NU - u'\u03be' # 0x00a5 -> GREEK SMALL LETTER XI - u'\u03bf' # 0x00a6 -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0x00a7 -> GREEK SMALL LETTER PI - u'\u03c1' # 0x00a8 -> GREEK SMALL LETTER RHO - u'\u03c3' # 0x00a9 -> GREEK SMALL LETTER SIGMA - u'\u03c2' # 0x00aa -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c4' # 0x00ab -> GREEK SMALL LETTER TAU - u'\u03c5' # 0x00ac -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0x00ad -> GREEK SMALL LETTER PHI - u'\u03c7' # 0x00ae -> GREEK SMALL LETTER CHI - u'\u03c8' # 0x00af -> GREEK SMALL LETTER PSI - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03c9' # 0x00e0 -> GREEK SMALL LETTER OMEGA - u'\u03ac' # 0x00e1 -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u03ad' # 0x00e2 -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0x00e3 -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03ca' # 0x00e4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03af' # 0x00e5 -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03cc' # 0x00e6 -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0x00e7 -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03cb' # 0x00e8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03ce' # 0x00e9 -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\u0386' # 0x00ea -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\u0388' # 0x00eb -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0389' # 0x00ec -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0x00ed -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\u038c' # 0x00ee -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\u038e' # 0x00ef -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u038f' # 0x00f0 -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u03aa' # 0x00f4 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u03ab' # 0x00f5 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\u0391' # 0x0080 -> GREEK CAPITAL LETTER ALPHA + '\u0392' # 0x0081 -> GREEK CAPITAL LETTER BETA + '\u0393' # 0x0082 -> GREEK CAPITAL LETTER GAMMA + '\u0394' # 0x0083 -> GREEK CAPITAL LETTER DELTA + '\u0395' # 0x0084 -> GREEK CAPITAL LETTER EPSILON + '\u0396' # 0x0085 -> GREEK CAPITAL LETTER ZETA + '\u0397' # 0x0086 -> GREEK CAPITAL LETTER ETA + '\u0398' # 0x0087 -> GREEK CAPITAL LETTER THETA + '\u0399' # 0x0088 -> GREEK CAPITAL LETTER IOTA + '\u039a' # 0x0089 -> GREEK CAPITAL LETTER KAPPA + '\u039b' # 0x008a -> GREEK CAPITAL LETTER LAMDA + '\u039c' # 0x008b -> GREEK CAPITAL LETTER MU + '\u039d' # 0x008c -> GREEK CAPITAL LETTER NU + '\u039e' # 0x008d -> GREEK CAPITAL LETTER XI + '\u039f' # 0x008e -> GREEK CAPITAL LETTER OMICRON + '\u03a0' # 0x008f -> GREEK CAPITAL LETTER PI + '\u03a1' # 0x0090 -> GREEK CAPITAL LETTER RHO + '\u03a3' # 0x0091 -> GREEK CAPITAL LETTER SIGMA + '\u03a4' # 0x0092 -> GREEK CAPITAL LETTER TAU + '\u03a5' # 0x0093 -> GREEK CAPITAL LETTER UPSILON + '\u03a6' # 0x0094 -> GREEK CAPITAL LETTER PHI + '\u03a7' # 0x0095 -> GREEK CAPITAL LETTER CHI + '\u03a8' # 0x0096 -> GREEK CAPITAL LETTER PSI + '\u03a9' # 0x0097 -> GREEK CAPITAL LETTER OMEGA + '\u03b1' # 0x0098 -> GREEK SMALL LETTER ALPHA + '\u03b2' # 0x0099 -> GREEK SMALL LETTER BETA + '\u03b3' # 0x009a -> GREEK SMALL LETTER GAMMA + '\u03b4' # 0x009b -> GREEK SMALL LETTER DELTA + '\u03b5' # 0x009c -> GREEK SMALL LETTER EPSILON + '\u03b6' # 0x009d -> GREEK SMALL LETTER ZETA + '\u03b7' # 0x009e -> GREEK SMALL LETTER ETA + '\u03b8' # 0x009f -> GREEK SMALL LETTER THETA + '\u03b9' # 0x00a0 -> GREEK SMALL LETTER IOTA + '\u03ba' # 0x00a1 -> GREEK SMALL LETTER KAPPA + '\u03bb' # 0x00a2 -> GREEK SMALL LETTER LAMDA + '\u03bc' # 0x00a3 -> GREEK SMALL LETTER MU + '\u03bd' # 0x00a4 -> GREEK SMALL LETTER NU + '\u03be' # 0x00a5 -> GREEK SMALL LETTER XI + '\u03bf' # 0x00a6 -> GREEK SMALL LETTER OMICRON + '\u03c0' # 0x00a7 -> GREEK SMALL LETTER PI + '\u03c1' # 0x00a8 -> GREEK SMALL LETTER RHO + '\u03c3' # 0x00a9 -> GREEK SMALL LETTER SIGMA + '\u03c2' # 0x00aa -> GREEK SMALL LETTER FINAL SIGMA + '\u03c4' # 0x00ab -> GREEK SMALL LETTER TAU + '\u03c5' # 0x00ac -> GREEK SMALL LETTER UPSILON + '\u03c6' # 0x00ad -> GREEK SMALL LETTER PHI + '\u03c7' # 0x00ae -> GREEK SMALL LETTER CHI + '\u03c8' # 0x00af -> GREEK SMALL LETTER PSI + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + '\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + '\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + '\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + '\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + '\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + '\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + '\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u258c' # 0x00dd -> LEFT HALF BLOCK + '\u2590' # 0x00de -> RIGHT HALF BLOCK + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u03c9' # 0x00e0 -> GREEK SMALL LETTER OMEGA + '\u03ac' # 0x00e1 -> GREEK SMALL LETTER ALPHA WITH TONOS + '\u03ad' # 0x00e2 -> GREEK SMALL LETTER EPSILON WITH TONOS + '\u03ae' # 0x00e3 -> GREEK SMALL LETTER ETA WITH TONOS + '\u03ca' # 0x00e4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA + '\u03af' # 0x00e5 -> GREEK SMALL LETTER IOTA WITH TONOS + '\u03cc' # 0x00e6 -> GREEK SMALL LETTER OMICRON WITH TONOS + '\u03cd' # 0x00e7 -> GREEK SMALL LETTER UPSILON WITH TONOS + '\u03cb' # 0x00e8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA + '\u03ce' # 0x00e9 -> GREEK SMALL LETTER OMEGA WITH TONOS + '\u0386' # 0x00ea -> GREEK CAPITAL LETTER ALPHA WITH TONOS + '\u0388' # 0x00eb -> GREEK CAPITAL LETTER EPSILON WITH TONOS + '\u0389' # 0x00ec -> GREEK CAPITAL LETTER ETA WITH TONOS + '\u038a' # 0x00ed -> GREEK CAPITAL LETTER IOTA WITH TONOS + '\u038c' # 0x00ee -> GREEK CAPITAL LETTER OMICRON WITH TONOS + '\u038e' # 0x00ef -> GREEK CAPITAL LETTER UPSILON WITH TONOS + '\u038f' # 0x00f0 -> GREEK CAPITAL LETTER OMEGA WITH TONOS + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO + '\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO + '\u03aa' # 0x00f4 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA + '\u03ab' # 0x00f5 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA + '\xf7' # 0x00f6 -> DIVISION SIGN + '\u2248' # 0x00f7 -> ALMOST EQUAL TO + '\xb0' # 0x00f8 -> DEGREE SIGN + '\u2219' # 0x00f9 -> BULLET OPERATOR + '\xb7' # 0x00fa -> MIDDLE DOT + '\u221a' # 0x00fb -> SQUARE ROOT + '\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp775.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp775.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp775.py Wed May 2 21:09:54 2007 @@ -177,262 +177,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u0106' # 0x0080 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0101' # 0x0083 -> LATIN SMALL LETTER A WITH MACRON - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u0123' # 0x0085 -> LATIN SMALL LETTER G WITH CEDILLA - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\u0107' # 0x0087 -> LATIN SMALL LETTER C WITH ACUTE - u'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE - u'\u0113' # 0x0089 -> LATIN SMALL LETTER E WITH MACRON - u'\u0156' # 0x008a -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\u0157' # 0x008b -> LATIN SMALL LETTER R WITH CEDILLA - u'\u012b' # 0x008c -> LATIN SMALL LETTER I WITH MACRON - u'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\u014d' # 0x0093 -> LATIN SMALL LETTER O WITH MACRON - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u0122' # 0x0095 -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\xa2' # 0x0096 -> CENT SIGN - u'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd7' # 0x009e -> MULTIPLICATION SIGN - u'\xa4' # 0x009f -> CURRENCY SIGN - u'\u0100' # 0x00a0 -> LATIN CAPITAL LETTER A WITH MACRON - u'\u012a' # 0x00a1 -> LATIN CAPITAL LETTER I WITH MACRON - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\u017b' # 0x00a3 -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u017c' # 0x00a4 -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u017a' # 0x00a5 -> LATIN SMALL LETTER Z WITH ACUTE - u'\u201d' # 0x00a6 -> RIGHT DOUBLE QUOTATION MARK - u'\xa6' # 0x00a7 -> BROKEN BAR - u'\xa9' # 0x00a8 -> COPYRIGHT SIGN - u'\xae' # 0x00a9 -> REGISTERED SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\u0141' # 0x00ad -> LATIN CAPITAL LETTER L WITH STROKE - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u0104' # 0x00b5 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u010c' # 0x00b6 -> LATIN CAPITAL LETTER C WITH CARON - u'\u0118' # 0x00b7 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u0116' # 0x00b8 -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u012e' # 0x00bd -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u0160' # 0x00be -> LATIN CAPITAL LETTER S WITH CARON - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u0172' # 0x00c6 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\u016a' # 0x00c7 -> LATIN CAPITAL LETTER U WITH MACRON - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u017d' # 0x00cf -> LATIN CAPITAL LETTER Z WITH CARON - u'\u0105' # 0x00d0 -> LATIN SMALL LETTER A WITH OGONEK - u'\u010d' # 0x00d1 -> LATIN SMALL LETTER C WITH CARON - u'\u0119' # 0x00d2 -> LATIN SMALL LETTER E WITH OGONEK - u'\u0117' # 0x00d3 -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\u012f' # 0x00d4 -> LATIN SMALL LETTER I WITH OGONEK - u'\u0161' # 0x00d5 -> LATIN SMALL LETTER S WITH CARON - u'\u0173' # 0x00d6 -> LATIN SMALL LETTER U WITH OGONEK - u'\u016b' # 0x00d7 -> LATIN SMALL LETTER U WITH MACRON - u'\u017e' # 0x00d8 -> LATIN SMALL LETTER Z WITH CARON - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'\u014c' # 0x00e2 -> LATIN CAPITAL LETTER O WITH MACRON - u'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE - u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u0144' # 0x00e7 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0136' # 0x00e8 -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\u0137' # 0x00e9 -> LATIN SMALL LETTER K WITH CEDILLA - u'\u013b' # 0x00ea -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u013c' # 0x00eb -> LATIN SMALL LETTER L WITH CEDILLA - u'\u0146' # 0x00ec -> LATIN SMALL LETTER N WITH CEDILLA - u'\u0112' # 0x00ed -> LATIN CAPITAL LETTER E WITH MACRON - u'\u0145' # 0x00ee -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\u2019' # 0x00ef -> RIGHT SINGLE QUOTATION MARK - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u201c' # 0x00f2 -> LEFT DOUBLE QUOTATION MARK - u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS - u'\xb6' # 0x00f4 -> PILCROW SIGN - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u201e' # 0x00f7 -> DOUBLE LOW-9 QUOTATION MARK - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\xb9' # 0x00fb -> SUPERSCRIPT ONE - u'\xb3' # 0x00fc -> SUPERSCRIPT THREE - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\u0106' # 0x0080 -> LATIN CAPITAL LETTER C WITH ACUTE + '\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE + '\u0101' # 0x0083 -> LATIN SMALL LETTER A WITH MACRON + '\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS + '\u0123' # 0x0085 -> LATIN SMALL LETTER G WITH CEDILLA + '\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE + '\u0107' # 0x0087 -> LATIN SMALL LETTER C WITH ACUTE + '\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE + '\u0113' # 0x0089 -> LATIN SMALL LETTER E WITH MACRON + '\u0156' # 0x008a -> LATIN CAPITAL LETTER R WITH CEDILLA + '\u0157' # 0x008b -> LATIN SMALL LETTER R WITH CEDILLA + '\u012b' # 0x008c -> LATIN SMALL LETTER I WITH MACRON + '\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE + '\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE + '\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE + '\u014d' # 0x0093 -> LATIN SMALL LETTER O WITH MACRON + '\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS + '\u0122' # 0x0095 -> LATIN CAPITAL LETTER G WITH CEDILLA + '\xa2' # 0x0096 -> CENT SIGN + '\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE + '\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE + '\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE + '\xa3' # 0x009c -> POUND SIGN + '\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE + '\xd7' # 0x009e -> MULTIPLICATION SIGN + '\xa4' # 0x009f -> CURRENCY SIGN + '\u0100' # 0x00a0 -> LATIN CAPITAL LETTER A WITH MACRON + '\u012a' # 0x00a1 -> LATIN CAPITAL LETTER I WITH MACRON + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\u017b' # 0x00a3 -> LATIN CAPITAL LETTER Z WITH DOT ABOVE + '\u017c' # 0x00a4 -> LATIN SMALL LETTER Z WITH DOT ABOVE + '\u017a' # 0x00a5 -> LATIN SMALL LETTER Z WITH ACUTE + '\u201d' # 0x00a6 -> RIGHT DOUBLE QUOTATION MARK + '\xa6' # 0x00a7 -> BROKEN BAR + '\xa9' # 0x00a8 -> COPYRIGHT SIGN + '\xae' # 0x00a9 -> REGISTERED SIGN + '\xac' # 0x00aa -> NOT SIGN + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER + '\u0141' # 0x00ad -> LATIN CAPITAL LETTER L WITH STROKE + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u0104' # 0x00b5 -> LATIN CAPITAL LETTER A WITH OGONEK + '\u010c' # 0x00b6 -> LATIN CAPITAL LETTER C WITH CARON + '\u0118' # 0x00b7 -> LATIN CAPITAL LETTER E WITH OGONEK + '\u0116' # 0x00b8 -> LATIN CAPITAL LETTER E WITH DOT ABOVE + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u012e' # 0x00bd -> LATIN CAPITAL LETTER I WITH OGONEK + '\u0160' # 0x00be -> LATIN CAPITAL LETTER S WITH CARON + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u0172' # 0x00c6 -> LATIN CAPITAL LETTER U WITH OGONEK + '\u016a' # 0x00c7 -> LATIN CAPITAL LETTER U WITH MACRON + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u017d' # 0x00cf -> LATIN CAPITAL LETTER Z WITH CARON + '\u0105' # 0x00d0 -> LATIN SMALL LETTER A WITH OGONEK + '\u010d' # 0x00d1 -> LATIN SMALL LETTER C WITH CARON + '\u0119' # 0x00d2 -> LATIN SMALL LETTER E WITH OGONEK + '\u0117' # 0x00d3 -> LATIN SMALL LETTER E WITH DOT ABOVE + '\u012f' # 0x00d4 -> LATIN SMALL LETTER I WITH OGONEK + '\u0161' # 0x00d5 -> LATIN SMALL LETTER S WITH CARON + '\u0173' # 0x00d6 -> LATIN SMALL LETTER U WITH OGONEK + '\u016b' # 0x00d7 -> LATIN SMALL LETTER U WITH MACRON + '\u017e' # 0x00d8 -> LATIN SMALL LETTER Z WITH CARON + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u258c' # 0x00dd -> LEFT HALF BLOCK + '\u2590' # 0x00de -> RIGHT HALF BLOCK + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN) + '\u014c' # 0x00e2 -> LATIN CAPITAL LETTER O WITH MACRON + '\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE + '\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE + '\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xb5' # 0x00e6 -> MICRO SIGN + '\u0144' # 0x00e7 -> LATIN SMALL LETTER N WITH ACUTE + '\u0136' # 0x00e8 -> LATIN CAPITAL LETTER K WITH CEDILLA + '\u0137' # 0x00e9 -> LATIN SMALL LETTER K WITH CEDILLA + '\u013b' # 0x00ea -> LATIN CAPITAL LETTER L WITH CEDILLA + '\u013c' # 0x00eb -> LATIN SMALL LETTER L WITH CEDILLA + '\u0146' # 0x00ec -> LATIN SMALL LETTER N WITH CEDILLA + '\u0112' # 0x00ed -> LATIN CAPITAL LETTER E WITH MACRON + '\u0145' # 0x00ee -> LATIN CAPITAL LETTER N WITH CEDILLA + '\u2019' # 0x00ef -> RIGHT SINGLE QUOTATION MARK + '\xad' # 0x00f0 -> SOFT HYPHEN + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u201c' # 0x00f2 -> LEFT DOUBLE QUOTATION MARK + '\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS + '\xb6' # 0x00f4 -> PILCROW SIGN + '\xa7' # 0x00f5 -> SECTION SIGN + '\xf7' # 0x00f6 -> DIVISION SIGN + '\u201e' # 0x00f7 -> DOUBLE LOW-9 QUOTATION MARK + '\xb0' # 0x00f8 -> DEGREE SIGN + '\u2219' # 0x00f9 -> BULLET OPERATOR + '\xb7' # 0x00fa -> MIDDLE DOT + '\xb9' # 0x00fb -> SUPERSCRIPT ONE + '\xb3' # 0x00fc -> SUPERSCRIPT THREE + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp850.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp850.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp850.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd7' # 0x009e -> MULTIPLICATION SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\xae' # 0x00a9 -> REGISTERED SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xa9' # 0x00b8 -> COPYRIGHT SIGN - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\xa2' # 0x00bd -> CENT SIGN - u'\xa5' # 0x00be -> YEN SIGN - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE - u'\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0x00cf -> CURRENCY SIGN - u'\xf0' # 0x00d0 -> LATIN SMALL LETTER ETH - u'\xd0' # 0x00d1 -> LATIN CAPITAL LETTER ETH - u'\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\u0131' # 0x00d5 -> LATIN SMALL LETTER DOTLESS I - u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\xa6' # 0x00dd -> BROKEN BAR - u'\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE - u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\xfe' # 0x00e7 -> LATIN SMALL LETTER THORN - u'\xde' # 0x00e8 -> LATIN CAPITAL LETTER THORN - u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE - u'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xaf' # 0x00ee -> MACRON - u'\xb4' # 0x00ef -> ACUTE ACCENT - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2017' # 0x00f2 -> DOUBLE LOW LINE - u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS - u'\xb6' # 0x00f4 -> PILCROW SIGN - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\xb8' # 0x00f7 -> CEDILLA - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\xa8' # 0x00f9 -> DIAERESIS - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\xb9' # 0x00fb -> SUPERSCRIPT ONE - u'\xb3' # 0x00fc -> SUPERSCRIPT THREE - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE + '\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE + '\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA + '\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE + '\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS + '\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE + '\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE + '\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE + '\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE + '\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE + '\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS + '\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE + '\xa3' # 0x009c -> POUND SIGN + '\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE + '\xd7' # 0x009e -> MULTIPLICATION SIGN + '\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK + '\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE + '\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE + '\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE + '\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE + '\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR + '\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR + '\xbf' # 0x00a8 -> INVERTED QUESTION MARK + '\xae' # 0x00a9 -> REGISTERED SIGN + '\xac' # 0x00aa -> NOT SIGN + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER + '\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xa9' # 0x00b8 -> COPYRIGHT SIGN + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\xa2' # 0x00bd -> CENT SIGN + '\xa5' # 0x00be -> YEN SIGN + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE + '\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\xa4' # 0x00cf -> CURRENCY SIGN + '\xf0' # 0x00d0 -> LATIN SMALL LETTER ETH + '\xd0' # 0x00d1 -> LATIN CAPITAL LETTER ETH + '\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE + '\u0131' # 0x00d5 -> LATIN SMALL LETTER DOTLESS I + '\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\xa6' # 0x00dd -> BROKEN BAR + '\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S + '\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE + '\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xb5' # 0x00e6 -> MICRO SIGN + '\xfe' # 0x00e7 -> LATIN SMALL LETTER THORN + '\xde' # 0x00e8 -> LATIN CAPITAL LETTER THORN + '\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE + '\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE + '\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xaf' # 0x00ee -> MACRON + '\xb4' # 0x00ef -> ACUTE ACCENT + '\xad' # 0x00f0 -> SOFT HYPHEN + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u2017' # 0x00f2 -> DOUBLE LOW LINE + '\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS + '\xb6' # 0x00f4 -> PILCROW SIGN + '\xa7' # 0x00f5 -> SECTION SIGN + '\xf7' # 0x00f6 -> DIVISION SIGN + '\xb8' # 0x00f7 -> CEDILLA + '\xb0' # 0x00f8 -> DEGREE SIGN + '\xa8' # 0x00f9 -> DIAERESIS + '\xb7' # 0x00fa -> MIDDLE DOT + '\xb9' # 0x00fb -> SUPERSCRIPT ONE + '\xb3' # 0x00fc -> SUPERSCRIPT THREE + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp852.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp852.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp852.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u016f' # 0x0085 -> LATIN SMALL LETTER U WITH RING ABOVE - u'\u0107' # 0x0086 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0150' # 0x008a -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\u0151' # 0x008b -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0106' # 0x008f -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0139' # 0x0091 -> LATIN CAPITAL LETTER L WITH ACUTE - u'\u013a' # 0x0092 -> LATIN SMALL LETTER L WITH ACUTE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u013d' # 0x0095 -> LATIN CAPITAL LETTER L WITH CARON - u'\u013e' # 0x0096 -> LATIN SMALL LETTER L WITH CARON - u'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0164' # 0x009b -> LATIN CAPITAL LETTER T WITH CARON - u'\u0165' # 0x009c -> LATIN SMALL LETTER T WITH CARON - u'\u0141' # 0x009d -> LATIN CAPITAL LETTER L WITH STROKE - u'\xd7' # 0x009e -> MULTIPLICATION SIGN - u'\u010d' # 0x009f -> LATIN SMALL LETTER C WITH CARON - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\u0104' # 0x00a4 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u0105' # 0x00a5 -> LATIN SMALL LETTER A WITH OGONEK - u'\u017d' # 0x00a6 -> LATIN CAPITAL LETTER Z WITH CARON - u'\u017e' # 0x00a7 -> LATIN SMALL LETTER Z WITH CARON - u'\u0118' # 0x00a8 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u0119' # 0x00a9 -> LATIN SMALL LETTER E WITH OGONEK - u'\xac' # 0x00aa -> NOT SIGN - u'\u017a' # 0x00ab -> LATIN SMALL LETTER Z WITH ACUTE - u'\u010c' # 0x00ac -> LATIN CAPITAL LETTER C WITH CARON - u'\u015f' # 0x00ad -> LATIN SMALL LETTER S WITH CEDILLA - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u011a' # 0x00b7 -> LATIN CAPITAL LETTER E WITH CARON - u'\u015e' # 0x00b8 -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u017b' # 0x00bd -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u017c' # 0x00be -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u0102' # 0x00c6 -> LATIN CAPITAL LETTER A WITH BREVE - u'\u0103' # 0x00c7 -> LATIN SMALL LETTER A WITH BREVE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0x00cf -> CURRENCY SIGN - u'\u0111' # 0x00d0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0110' # 0x00d1 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u010e' # 0x00d2 -> LATIN CAPITAL LETTER D WITH CARON - u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u010f' # 0x00d4 -> LATIN SMALL LETTER D WITH CARON - u'\u0147' # 0x00d5 -> LATIN CAPITAL LETTER N WITH CARON - u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u011b' # 0x00d8 -> LATIN SMALL LETTER E WITH CARON - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u0162' # 0x00dd -> LATIN CAPITAL LETTER T WITH CEDILLA - u'\u016e' # 0x00de -> LATIN CAPITAL LETTER U WITH RING ABOVE - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0144' # 0x00e4 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0148' # 0x00e5 -> LATIN SMALL LETTER N WITH CARON - u'\u0160' # 0x00e6 -> LATIN CAPITAL LETTER S WITH CARON - u'\u0161' # 0x00e7 -> LATIN SMALL LETTER S WITH CARON - u'\u0154' # 0x00e8 -> LATIN CAPITAL LETTER R WITH ACUTE - u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\u0155' # 0x00ea -> LATIN SMALL LETTER R WITH ACUTE - u'\u0170' # 0x00eb -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE - u'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\u0163' # 0x00ee -> LATIN SMALL LETTER T WITH CEDILLA - u'\xb4' # 0x00ef -> ACUTE ACCENT - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\u02dd' # 0x00f1 -> DOUBLE ACUTE ACCENT - u'\u02db' # 0x00f2 -> OGONEK - u'\u02c7' # 0x00f3 -> CARON - u'\u02d8' # 0x00f4 -> BREVE - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\xb8' # 0x00f7 -> CEDILLA - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\xa8' # 0x00f9 -> DIAERESIS - u'\u02d9' # 0x00fa -> DOT ABOVE - u'\u0171' # 0x00fb -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\u0158' # 0x00fc -> LATIN CAPITAL LETTER R WITH CARON - u'\u0159' # 0x00fd -> LATIN SMALL LETTER R WITH CARON - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE + '\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS + '\u016f' # 0x0085 -> LATIN SMALL LETTER U WITH RING ABOVE + '\u0107' # 0x0086 -> LATIN SMALL LETTER C WITH ACUTE + '\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA + '\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE + '\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS + '\u0150' # 0x008a -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE + '\u0151' # 0x008b -> LATIN SMALL LETTER O WITH DOUBLE ACUTE + '\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE + '\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\u0106' # 0x008f -> LATIN CAPITAL LETTER C WITH ACUTE + '\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE + '\u0139' # 0x0091 -> LATIN CAPITAL LETTER L WITH ACUTE + '\u013a' # 0x0092 -> LATIN SMALL LETTER L WITH ACUTE + '\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS + '\u013d' # 0x0095 -> LATIN CAPITAL LETTER L WITH CARON + '\u013e' # 0x0096 -> LATIN SMALL LETTER L WITH CARON + '\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE + '\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE + '\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u0164' # 0x009b -> LATIN CAPITAL LETTER T WITH CARON + '\u0165' # 0x009c -> LATIN SMALL LETTER T WITH CARON + '\u0141' # 0x009d -> LATIN CAPITAL LETTER L WITH STROKE + '\xd7' # 0x009e -> MULTIPLICATION SIGN + '\u010d' # 0x009f -> LATIN SMALL LETTER C WITH CARON + '\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE + '\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE + '\u0104' # 0x00a4 -> LATIN CAPITAL LETTER A WITH OGONEK + '\u0105' # 0x00a5 -> LATIN SMALL LETTER A WITH OGONEK + '\u017d' # 0x00a6 -> LATIN CAPITAL LETTER Z WITH CARON + '\u017e' # 0x00a7 -> LATIN SMALL LETTER Z WITH CARON + '\u0118' # 0x00a8 -> LATIN CAPITAL LETTER E WITH OGONEK + '\u0119' # 0x00a9 -> LATIN SMALL LETTER E WITH OGONEK + '\xac' # 0x00aa -> NOT SIGN + '\u017a' # 0x00ab -> LATIN SMALL LETTER Z WITH ACUTE + '\u010c' # 0x00ac -> LATIN CAPITAL LETTER C WITH CARON + '\u015f' # 0x00ad -> LATIN SMALL LETTER S WITH CEDILLA + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\u011a' # 0x00b7 -> LATIN CAPITAL LETTER E WITH CARON + '\u015e' # 0x00b8 -> LATIN CAPITAL LETTER S WITH CEDILLA + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u017b' # 0x00bd -> LATIN CAPITAL LETTER Z WITH DOT ABOVE + '\u017c' # 0x00be -> LATIN SMALL LETTER Z WITH DOT ABOVE + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u0102' # 0x00c6 -> LATIN CAPITAL LETTER A WITH BREVE + '\u0103' # 0x00c7 -> LATIN SMALL LETTER A WITH BREVE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\xa4' # 0x00cf -> CURRENCY SIGN + '\u0111' # 0x00d0 -> LATIN SMALL LETTER D WITH STROKE + '\u0110' # 0x00d1 -> LATIN CAPITAL LETTER D WITH STROKE + '\u010e' # 0x00d2 -> LATIN CAPITAL LETTER D WITH CARON + '\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\u010f' # 0x00d4 -> LATIN SMALL LETTER D WITH CARON + '\u0147' # 0x00d5 -> LATIN CAPITAL LETTER N WITH CARON + '\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\u011b' # 0x00d8 -> LATIN SMALL LETTER E WITH CARON + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u0162' # 0x00dd -> LATIN CAPITAL LETTER T WITH CEDILLA + '\u016e' # 0x00de -> LATIN CAPITAL LETTER U WITH RING ABOVE + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S + '\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE + '\u0144' # 0x00e4 -> LATIN SMALL LETTER N WITH ACUTE + '\u0148' # 0x00e5 -> LATIN SMALL LETTER N WITH CARON + '\u0160' # 0x00e6 -> LATIN CAPITAL LETTER S WITH CARON + '\u0161' # 0x00e7 -> LATIN SMALL LETTER S WITH CARON + '\u0154' # 0x00e8 -> LATIN CAPITAL LETTER R WITH ACUTE + '\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE + '\u0155' # 0x00ea -> LATIN SMALL LETTER R WITH ACUTE + '\u0170' # 0x00eb -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE + '\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE + '\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE + '\u0163' # 0x00ee -> LATIN SMALL LETTER T WITH CEDILLA + '\xb4' # 0x00ef -> ACUTE ACCENT + '\xad' # 0x00f0 -> SOFT HYPHEN + '\u02dd' # 0x00f1 -> DOUBLE ACUTE ACCENT + '\u02db' # 0x00f2 -> OGONEK + '\u02c7' # 0x00f3 -> CARON + '\u02d8' # 0x00f4 -> BREVE + '\xa7' # 0x00f5 -> SECTION SIGN + '\xf7' # 0x00f6 -> DIVISION SIGN + '\xb8' # 0x00f7 -> CEDILLA + '\xb0' # 0x00f8 -> DEGREE SIGN + '\xa8' # 0x00f9 -> DIAERESIS + '\u02d9' # 0x00fa -> DOT ABOVE + '\u0171' # 0x00fb -> LATIN SMALL LETTER U WITH DOUBLE ACUTE + '\u0158' # 0x00fc -> LATIN CAPITAL LETTER R WITH CARON + '\u0159' # 0x00fd -> LATIN SMALL LETTER R WITH CARON + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp855.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp855.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp855.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u0452' # 0x0080 -> CYRILLIC SMALL LETTER DJE - u'\u0402' # 0x0081 -> CYRILLIC CAPITAL LETTER DJE - u'\u0453' # 0x0082 -> CYRILLIC SMALL LETTER GJE - u'\u0403' # 0x0083 -> CYRILLIC CAPITAL LETTER GJE - u'\u0451' # 0x0084 -> CYRILLIC SMALL LETTER IO - u'\u0401' # 0x0085 -> CYRILLIC CAPITAL LETTER IO - u'\u0454' # 0x0086 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u0404' # 0x0087 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u0455' # 0x0088 -> CYRILLIC SMALL LETTER DZE - u'\u0405' # 0x0089 -> CYRILLIC CAPITAL LETTER DZE - u'\u0456' # 0x008a -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0406' # 0x008b -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0457' # 0x008c -> CYRILLIC SMALL LETTER YI - u'\u0407' # 0x008d -> CYRILLIC CAPITAL LETTER YI - u'\u0458' # 0x008e -> CYRILLIC SMALL LETTER JE - u'\u0408' # 0x008f -> CYRILLIC CAPITAL LETTER JE - u'\u0459' # 0x0090 -> CYRILLIC SMALL LETTER LJE - u'\u0409' # 0x0091 -> CYRILLIC CAPITAL LETTER LJE - u'\u045a' # 0x0092 -> CYRILLIC SMALL LETTER NJE - u'\u040a' # 0x0093 -> CYRILLIC CAPITAL LETTER NJE - u'\u045b' # 0x0094 -> CYRILLIC SMALL LETTER TSHE - u'\u040b' # 0x0095 -> CYRILLIC CAPITAL LETTER TSHE - u'\u045c' # 0x0096 -> CYRILLIC SMALL LETTER KJE - u'\u040c' # 0x0097 -> CYRILLIC CAPITAL LETTER KJE - u'\u045e' # 0x0098 -> CYRILLIC SMALL LETTER SHORT U - u'\u040e' # 0x0099 -> CYRILLIC CAPITAL LETTER SHORT U - u'\u045f' # 0x009a -> CYRILLIC SMALL LETTER DZHE - u'\u040f' # 0x009b -> CYRILLIC CAPITAL LETTER DZHE - u'\u044e' # 0x009c -> CYRILLIC SMALL LETTER YU - u'\u042e' # 0x009d -> CYRILLIC CAPITAL LETTER YU - u'\u044a' # 0x009e -> CYRILLIC SMALL LETTER HARD SIGN - u'\u042a' # 0x009f -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u0430' # 0x00a0 -> CYRILLIC SMALL LETTER A - u'\u0410' # 0x00a1 -> CYRILLIC CAPITAL LETTER A - u'\u0431' # 0x00a2 -> CYRILLIC SMALL LETTER BE - u'\u0411' # 0x00a3 -> CYRILLIC CAPITAL LETTER BE - u'\u0446' # 0x00a4 -> CYRILLIC SMALL LETTER TSE - u'\u0426' # 0x00a5 -> CYRILLIC CAPITAL LETTER TSE - u'\u0434' # 0x00a6 -> CYRILLIC SMALL LETTER DE - u'\u0414' # 0x00a7 -> CYRILLIC CAPITAL LETTER DE - u'\u0435' # 0x00a8 -> CYRILLIC SMALL LETTER IE - u'\u0415' # 0x00a9 -> CYRILLIC CAPITAL LETTER IE - u'\u0444' # 0x00aa -> CYRILLIC SMALL LETTER EF - u'\u0424' # 0x00ab -> CYRILLIC CAPITAL LETTER EF - u'\u0433' # 0x00ac -> CYRILLIC SMALL LETTER GHE - u'\u0413' # 0x00ad -> CYRILLIC CAPITAL LETTER GHE - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u0445' # 0x00b5 -> CYRILLIC SMALL LETTER HA - u'\u0425' # 0x00b6 -> CYRILLIC CAPITAL LETTER HA - u'\u0438' # 0x00b7 -> CYRILLIC SMALL LETTER I - u'\u0418' # 0x00b8 -> CYRILLIC CAPITAL LETTER I - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u0439' # 0x00bd -> CYRILLIC SMALL LETTER SHORT I - u'\u0419' # 0x00be -> CYRILLIC CAPITAL LETTER SHORT I - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u043a' # 0x00c6 -> CYRILLIC SMALL LETTER KA - u'\u041a' # 0x00c7 -> CYRILLIC CAPITAL LETTER KA - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0x00cf -> CURRENCY SIGN - u'\u043b' # 0x00d0 -> CYRILLIC SMALL LETTER EL - u'\u041b' # 0x00d1 -> CYRILLIC CAPITAL LETTER EL - u'\u043c' # 0x00d2 -> CYRILLIC SMALL LETTER EM - u'\u041c' # 0x00d3 -> CYRILLIC CAPITAL LETTER EM - u'\u043d' # 0x00d4 -> CYRILLIC SMALL LETTER EN - u'\u041d' # 0x00d5 -> CYRILLIC CAPITAL LETTER EN - u'\u043e' # 0x00d6 -> CYRILLIC SMALL LETTER O - u'\u041e' # 0x00d7 -> CYRILLIC CAPITAL LETTER O - u'\u043f' # 0x00d8 -> CYRILLIC SMALL LETTER PE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u041f' # 0x00dd -> CYRILLIC CAPITAL LETTER PE - u'\u044f' # 0x00de -> CYRILLIC SMALL LETTER YA - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u042f' # 0x00e0 -> CYRILLIC CAPITAL LETTER YA - u'\u0440' # 0x00e1 -> CYRILLIC SMALL LETTER ER - u'\u0420' # 0x00e2 -> CYRILLIC CAPITAL LETTER ER - u'\u0441' # 0x00e3 -> CYRILLIC SMALL LETTER ES - u'\u0421' # 0x00e4 -> CYRILLIC CAPITAL LETTER ES - u'\u0442' # 0x00e5 -> CYRILLIC SMALL LETTER TE - u'\u0422' # 0x00e6 -> CYRILLIC CAPITAL LETTER TE - u'\u0443' # 0x00e7 -> CYRILLIC SMALL LETTER U - u'\u0423' # 0x00e8 -> CYRILLIC CAPITAL LETTER U - u'\u0436' # 0x00e9 -> CYRILLIC SMALL LETTER ZHE - u'\u0416' # 0x00ea -> CYRILLIC CAPITAL LETTER ZHE - u'\u0432' # 0x00eb -> CYRILLIC SMALL LETTER VE - u'\u0412' # 0x00ec -> CYRILLIC CAPITAL LETTER VE - u'\u044c' # 0x00ed -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u042c' # 0x00ee -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u2116' # 0x00ef -> NUMERO SIGN - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\u044b' # 0x00f1 -> CYRILLIC SMALL LETTER YERU - u'\u042b' # 0x00f2 -> CYRILLIC CAPITAL LETTER YERU - u'\u0437' # 0x00f3 -> CYRILLIC SMALL LETTER ZE - u'\u0417' # 0x00f4 -> CYRILLIC CAPITAL LETTER ZE - u'\u0448' # 0x00f5 -> CYRILLIC SMALL LETTER SHA - u'\u0428' # 0x00f6 -> CYRILLIC CAPITAL LETTER SHA - u'\u044d' # 0x00f7 -> CYRILLIC SMALL LETTER E - u'\u042d' # 0x00f8 -> CYRILLIC CAPITAL LETTER E - u'\u0449' # 0x00f9 -> CYRILLIC SMALL LETTER SHCHA - u'\u0429' # 0x00fa -> CYRILLIC CAPITAL LETTER SHCHA - u'\u0447' # 0x00fb -> CYRILLIC SMALL LETTER CHE - u'\u0427' # 0x00fc -> CYRILLIC CAPITAL LETTER CHE - u'\xa7' # 0x00fd -> SECTION SIGN - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\u0452' # 0x0080 -> CYRILLIC SMALL LETTER DJE + '\u0402' # 0x0081 -> CYRILLIC CAPITAL LETTER DJE + '\u0453' # 0x0082 -> CYRILLIC SMALL LETTER GJE + '\u0403' # 0x0083 -> CYRILLIC CAPITAL LETTER GJE + '\u0451' # 0x0084 -> CYRILLIC SMALL LETTER IO + '\u0401' # 0x0085 -> CYRILLIC CAPITAL LETTER IO + '\u0454' # 0x0086 -> CYRILLIC SMALL LETTER UKRAINIAN IE + '\u0404' # 0x0087 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE + '\u0455' # 0x0088 -> CYRILLIC SMALL LETTER DZE + '\u0405' # 0x0089 -> CYRILLIC CAPITAL LETTER DZE + '\u0456' # 0x008a -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I + '\u0406' # 0x008b -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I + '\u0457' # 0x008c -> CYRILLIC SMALL LETTER YI + '\u0407' # 0x008d -> CYRILLIC CAPITAL LETTER YI + '\u0458' # 0x008e -> CYRILLIC SMALL LETTER JE + '\u0408' # 0x008f -> CYRILLIC CAPITAL LETTER JE + '\u0459' # 0x0090 -> CYRILLIC SMALL LETTER LJE + '\u0409' # 0x0091 -> CYRILLIC CAPITAL LETTER LJE + '\u045a' # 0x0092 -> CYRILLIC SMALL LETTER NJE + '\u040a' # 0x0093 -> CYRILLIC CAPITAL LETTER NJE + '\u045b' # 0x0094 -> CYRILLIC SMALL LETTER TSHE + '\u040b' # 0x0095 -> CYRILLIC CAPITAL LETTER TSHE + '\u045c' # 0x0096 -> CYRILLIC SMALL LETTER KJE + '\u040c' # 0x0097 -> CYRILLIC CAPITAL LETTER KJE + '\u045e' # 0x0098 -> CYRILLIC SMALL LETTER SHORT U + '\u040e' # 0x0099 -> CYRILLIC CAPITAL LETTER SHORT U + '\u045f' # 0x009a -> CYRILLIC SMALL LETTER DZHE + '\u040f' # 0x009b -> CYRILLIC CAPITAL LETTER DZHE + '\u044e' # 0x009c -> CYRILLIC SMALL LETTER YU + '\u042e' # 0x009d -> CYRILLIC CAPITAL LETTER YU + '\u044a' # 0x009e -> CYRILLIC SMALL LETTER HARD SIGN + '\u042a' # 0x009f -> CYRILLIC CAPITAL LETTER HARD SIGN + '\u0430' # 0x00a0 -> CYRILLIC SMALL LETTER A + '\u0410' # 0x00a1 -> CYRILLIC CAPITAL LETTER A + '\u0431' # 0x00a2 -> CYRILLIC SMALL LETTER BE + '\u0411' # 0x00a3 -> CYRILLIC CAPITAL LETTER BE + '\u0446' # 0x00a4 -> CYRILLIC SMALL LETTER TSE + '\u0426' # 0x00a5 -> CYRILLIC CAPITAL LETTER TSE + '\u0434' # 0x00a6 -> CYRILLIC SMALL LETTER DE + '\u0414' # 0x00a7 -> CYRILLIC CAPITAL LETTER DE + '\u0435' # 0x00a8 -> CYRILLIC SMALL LETTER IE + '\u0415' # 0x00a9 -> CYRILLIC CAPITAL LETTER IE + '\u0444' # 0x00aa -> CYRILLIC SMALL LETTER EF + '\u0424' # 0x00ab -> CYRILLIC CAPITAL LETTER EF + '\u0433' # 0x00ac -> CYRILLIC SMALL LETTER GHE + '\u0413' # 0x00ad -> CYRILLIC CAPITAL LETTER GHE + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u0445' # 0x00b5 -> CYRILLIC SMALL LETTER HA + '\u0425' # 0x00b6 -> CYRILLIC CAPITAL LETTER HA + '\u0438' # 0x00b7 -> CYRILLIC SMALL LETTER I + '\u0418' # 0x00b8 -> CYRILLIC CAPITAL LETTER I + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u0439' # 0x00bd -> CYRILLIC SMALL LETTER SHORT I + '\u0419' # 0x00be -> CYRILLIC CAPITAL LETTER SHORT I + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u043a' # 0x00c6 -> CYRILLIC SMALL LETTER KA + '\u041a' # 0x00c7 -> CYRILLIC CAPITAL LETTER KA + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\xa4' # 0x00cf -> CURRENCY SIGN + '\u043b' # 0x00d0 -> CYRILLIC SMALL LETTER EL + '\u041b' # 0x00d1 -> CYRILLIC CAPITAL LETTER EL + '\u043c' # 0x00d2 -> CYRILLIC SMALL LETTER EM + '\u041c' # 0x00d3 -> CYRILLIC CAPITAL LETTER EM + '\u043d' # 0x00d4 -> CYRILLIC SMALL LETTER EN + '\u041d' # 0x00d5 -> CYRILLIC CAPITAL LETTER EN + '\u043e' # 0x00d6 -> CYRILLIC SMALL LETTER O + '\u041e' # 0x00d7 -> CYRILLIC CAPITAL LETTER O + '\u043f' # 0x00d8 -> CYRILLIC SMALL LETTER PE + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u041f' # 0x00dd -> CYRILLIC CAPITAL LETTER PE + '\u044f' # 0x00de -> CYRILLIC SMALL LETTER YA + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u042f' # 0x00e0 -> CYRILLIC CAPITAL LETTER YA + '\u0440' # 0x00e1 -> CYRILLIC SMALL LETTER ER + '\u0420' # 0x00e2 -> CYRILLIC CAPITAL LETTER ER + '\u0441' # 0x00e3 -> CYRILLIC SMALL LETTER ES + '\u0421' # 0x00e4 -> CYRILLIC CAPITAL LETTER ES + '\u0442' # 0x00e5 -> CYRILLIC SMALL LETTER TE + '\u0422' # 0x00e6 -> CYRILLIC CAPITAL LETTER TE + '\u0443' # 0x00e7 -> CYRILLIC SMALL LETTER U + '\u0423' # 0x00e8 -> CYRILLIC CAPITAL LETTER U + '\u0436' # 0x00e9 -> CYRILLIC SMALL LETTER ZHE + '\u0416' # 0x00ea -> CYRILLIC CAPITAL LETTER ZHE + '\u0432' # 0x00eb -> CYRILLIC SMALL LETTER VE + '\u0412' # 0x00ec -> CYRILLIC CAPITAL LETTER VE + '\u044c' # 0x00ed -> CYRILLIC SMALL LETTER SOFT SIGN + '\u042c' # 0x00ee -> CYRILLIC CAPITAL LETTER SOFT SIGN + '\u2116' # 0x00ef -> NUMERO SIGN + '\xad' # 0x00f0 -> SOFT HYPHEN + '\u044b' # 0x00f1 -> CYRILLIC SMALL LETTER YERU + '\u042b' # 0x00f2 -> CYRILLIC CAPITAL LETTER YERU + '\u0437' # 0x00f3 -> CYRILLIC SMALL LETTER ZE + '\u0417' # 0x00f4 -> CYRILLIC CAPITAL LETTER ZE + '\u0448' # 0x00f5 -> CYRILLIC SMALL LETTER SHA + '\u0428' # 0x00f6 -> CYRILLIC CAPITAL LETTER SHA + '\u044d' # 0x00f7 -> CYRILLIC SMALL LETTER E + '\u042d' # 0x00f8 -> CYRILLIC CAPITAL LETTER E + '\u0449' # 0x00f9 -> CYRILLIC SMALL LETTER SHCHA + '\u0429' # 0x00fa -> CYRILLIC CAPITAL LETTER SHCHA + '\u0447' # 0x00fb -> CYRILLIC SMALL LETTER CHE + '\u0427' # 0x00fc -> CYRILLIC CAPITAL LETTER CHE + '\xa7' # 0x00fd -> SECTION SIGN + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp856.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp856.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp856.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u05d0' # 0x80 -> HEBREW LETTER ALEF - u'\u05d1' # 0x81 -> HEBREW LETTER BET - u'\u05d2' # 0x82 -> HEBREW LETTER GIMEL - u'\u05d3' # 0x83 -> HEBREW LETTER DALET - u'\u05d4' # 0x84 -> HEBREW LETTER HE - u'\u05d5' # 0x85 -> HEBREW LETTER VAV - u'\u05d6' # 0x86 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0x87 -> HEBREW LETTER HET - u'\u05d8' # 0x88 -> HEBREW LETTER TET - u'\u05d9' # 0x89 -> HEBREW LETTER YOD - u'\u05da' # 0x8A -> HEBREW LETTER FINAL KAF - u'\u05db' # 0x8B -> HEBREW LETTER KAF - u'\u05dc' # 0x8C -> HEBREW LETTER LAMED - u'\u05dd' # 0x8D -> HEBREW LETTER FINAL MEM - u'\u05de' # 0x8E -> HEBREW LETTER MEM - u'\u05df' # 0x8F -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0x90 -> HEBREW LETTER NUN - u'\u05e1' # 0x91 -> HEBREW LETTER SAMEKH - u'\u05e2' # 0x92 -> HEBREW LETTER AYIN - u'\u05e3' # 0x93 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0x94 -> HEBREW LETTER PE - u'\u05e5' # 0x95 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0x96 -> HEBREW LETTER TSADI - u'\u05e7' # 0x97 -> HEBREW LETTER QOF - u'\u05e8' # 0x98 -> HEBREW LETTER RESH - u'\u05e9' # 0x99 -> HEBREW LETTER SHIN - u'\u05ea' # 0x9A -> HEBREW LETTER TAV - u'\ufffe' # 0x9B -> UNDEFINED - u'\xa3' # 0x9C -> POUND SIGN - u'\ufffe' # 0x9D -> UNDEFINED - u'\xd7' # 0x9E -> MULTIPLICATION SIGN - u'\ufffe' # 0x9F -> UNDEFINED - u'\ufffe' # 0xA0 -> UNDEFINED - u'\ufffe' # 0xA1 -> UNDEFINED - u'\ufffe' # 0xA2 -> UNDEFINED - u'\ufffe' # 0xA3 -> UNDEFINED - u'\ufffe' # 0xA4 -> UNDEFINED - u'\ufffe' # 0xA5 -> UNDEFINED - u'\ufffe' # 0xA6 -> UNDEFINED - u'\ufffe' # 0xA7 -> UNDEFINED - u'\ufffe' # 0xA8 -> UNDEFINED - u'\xae' # 0xA9 -> REGISTERED SIGN - u'\xac' # 0xAA -> NOT SIGN - u'\xbd' # 0xAB -> VULGAR FRACTION ONE HALF - u'\xbc' # 0xAC -> VULGAR FRACTION ONE QUARTER - u'\ufffe' # 0xAD -> UNDEFINED - u'\xab' # 0xAE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xAF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0xB0 -> LIGHT SHADE - u'\u2592' # 0xB1 -> MEDIUM SHADE - u'\u2593' # 0xB2 -> DARK SHADE - u'\u2502' # 0xB3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0xB4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\ufffe' # 0xB5 -> UNDEFINED - u'\ufffe' # 0xB6 -> UNDEFINED - u'\ufffe' # 0xB7 -> UNDEFINED - u'\xa9' # 0xB8 -> COPYRIGHT SIGN - u'\u2563' # 0xB9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0xBA -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0xBB -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0xBC -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\xa2' # 0xBD -> CENT SIGN - u'\xa5' # 0xBE -> YEN SIGN - u'\u2510' # 0xBF -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0xC0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0xC1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0xC2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0xC3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0xC4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0xC5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\ufffe' # 0xC6 -> UNDEFINED - u'\ufffe' # 0xC7 -> UNDEFINED - u'\u255a' # 0xC8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0xC9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0xCA -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0xCB -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0xCC -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0xCD -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0xCE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0xCF -> CURRENCY SIGN - u'\ufffe' # 0xD0 -> UNDEFINED - u'\ufffe' # 0xD1 -> UNDEFINED - u'\ufffe' # 0xD2 -> UNDEFINED - u'\ufffe' # 0xD3 -> UNDEFINEDS - u'\ufffe' # 0xD4 -> UNDEFINED - u'\ufffe' # 0xD5 -> UNDEFINED - u'\ufffe' # 0xD6 -> UNDEFINEDE - u'\ufffe' # 0xD7 -> UNDEFINED - u'\ufffe' # 0xD8 -> UNDEFINED - u'\u2518' # 0xD9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0xDA -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0xDB -> FULL BLOCK - u'\u2584' # 0xDC -> LOWER HALF BLOCK - u'\xa6' # 0xDD -> BROKEN BAR - u'\ufffe' # 0xDE -> UNDEFINED - u'\u2580' # 0xDF -> UPPER HALF BLOCK - u'\ufffe' # 0xE0 -> UNDEFINED - u'\ufffe' # 0xE1 -> UNDEFINED - u'\ufffe' # 0xE2 -> UNDEFINED - u'\ufffe' # 0xE3 -> UNDEFINED - u'\ufffe' # 0xE4 -> UNDEFINED - u'\ufffe' # 0xE5 -> UNDEFINED - u'\xb5' # 0xE6 -> MICRO SIGN - u'\ufffe' # 0xE7 -> UNDEFINED - u'\ufffe' # 0xE8 -> UNDEFINED - u'\ufffe' # 0xE9 -> UNDEFINED - u'\ufffe' # 0xEA -> UNDEFINED - u'\ufffe' # 0xEB -> UNDEFINED - u'\ufffe' # 0xEC -> UNDEFINED - u'\ufffe' # 0xED -> UNDEFINED - u'\xaf' # 0xEE -> MACRON - u'\xb4' # 0xEF -> ACUTE ACCENT - u'\xad' # 0xF0 -> SOFT HYPHEN - u'\xb1' # 0xF1 -> PLUS-MINUS SIGN - u'\u2017' # 0xF2 -> DOUBLE LOW LINE - u'\xbe' # 0xF3 -> VULGAR FRACTION THREE QUARTERS - u'\xb6' # 0xF4 -> PILCROW SIGN - u'\xa7' # 0xF5 -> SECTION SIGN - u'\xf7' # 0xF6 -> DIVISION SIGN - u'\xb8' # 0xF7 -> CEDILLA - u'\xb0' # 0xF8 -> DEGREE SIGN - u'\xa8' # 0xF9 -> DIAERESIS - u'\xb7' # 0xFA -> MIDDLE DOT - u'\xb9' # 0xFB -> SUPERSCRIPT ONE - u'\xb3' # 0xFC -> SUPERSCRIPT THREE - u'\xb2' # 0xFD -> SUPERSCRIPT TWO - u'\u25a0' # 0xFE -> BLACK SQUARE - u'\xa0' # 0xFF -> NO-BREAK SPACE + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u05d0' # 0x80 -> HEBREW LETTER ALEF + '\u05d1' # 0x81 -> HEBREW LETTER BET + '\u05d2' # 0x82 -> HEBREW LETTER GIMEL + '\u05d3' # 0x83 -> HEBREW LETTER DALET + '\u05d4' # 0x84 -> HEBREW LETTER HE + '\u05d5' # 0x85 -> HEBREW LETTER VAV + '\u05d6' # 0x86 -> HEBREW LETTER ZAYIN + '\u05d7' # 0x87 -> HEBREW LETTER HET + '\u05d8' # 0x88 -> HEBREW LETTER TET + '\u05d9' # 0x89 -> HEBREW LETTER YOD + '\u05da' # 0x8A -> HEBREW LETTER FINAL KAF + '\u05db' # 0x8B -> HEBREW LETTER KAF + '\u05dc' # 0x8C -> HEBREW LETTER LAMED + '\u05dd' # 0x8D -> HEBREW LETTER FINAL MEM + '\u05de' # 0x8E -> HEBREW LETTER MEM + '\u05df' # 0x8F -> HEBREW LETTER FINAL NUN + '\u05e0' # 0x90 -> HEBREW LETTER NUN + '\u05e1' # 0x91 -> HEBREW LETTER SAMEKH + '\u05e2' # 0x92 -> HEBREW LETTER AYIN + '\u05e3' # 0x93 -> HEBREW LETTER FINAL PE + '\u05e4' # 0x94 -> HEBREW LETTER PE + '\u05e5' # 0x95 -> HEBREW LETTER FINAL TSADI + '\u05e6' # 0x96 -> HEBREW LETTER TSADI + '\u05e7' # 0x97 -> HEBREW LETTER QOF + '\u05e8' # 0x98 -> HEBREW LETTER RESH + '\u05e9' # 0x99 -> HEBREW LETTER SHIN + '\u05ea' # 0x9A -> HEBREW LETTER TAV + '\ufffe' # 0x9B -> UNDEFINED + '\xa3' # 0x9C -> POUND SIGN + '\ufffe' # 0x9D -> UNDEFINED + '\xd7' # 0x9E -> MULTIPLICATION SIGN + '\ufffe' # 0x9F -> UNDEFINED + '\ufffe' # 0xA0 -> UNDEFINED + '\ufffe' # 0xA1 -> UNDEFINED + '\ufffe' # 0xA2 -> UNDEFINED + '\ufffe' # 0xA3 -> UNDEFINED + '\ufffe' # 0xA4 -> UNDEFINED + '\ufffe' # 0xA5 -> UNDEFINED + '\ufffe' # 0xA6 -> UNDEFINED + '\ufffe' # 0xA7 -> UNDEFINED + '\ufffe' # 0xA8 -> UNDEFINED + '\xae' # 0xA9 -> REGISTERED SIGN + '\xac' # 0xAA -> NOT SIGN + '\xbd' # 0xAB -> VULGAR FRACTION ONE HALF + '\xbc' # 0xAC -> VULGAR FRACTION ONE QUARTER + '\ufffe' # 0xAD -> UNDEFINED + '\xab' # 0xAE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0xAF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0xB0 -> LIGHT SHADE + '\u2592' # 0xB1 -> MEDIUM SHADE + '\u2593' # 0xB2 -> DARK SHADE + '\u2502' # 0xB3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0xB4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\ufffe' # 0xB5 -> UNDEFINED + '\ufffe' # 0xB6 -> UNDEFINED + '\ufffe' # 0xB7 -> UNDEFINED + '\xa9' # 0xB8 -> COPYRIGHT SIGN + '\u2563' # 0xB9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0xBA -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0xBB -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0xBC -> BOX DRAWINGS DOUBLE UP AND LEFT + '\xa2' # 0xBD -> CENT SIGN + '\xa5' # 0xBE -> YEN SIGN + '\u2510' # 0xBF -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0xC0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0xC1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0xC2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0xC3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0xC4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0xC5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\ufffe' # 0xC6 -> UNDEFINED + '\ufffe' # 0xC7 -> UNDEFINED + '\u255a' # 0xC8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0xC9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0xCA -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0xCB -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0xCC -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0xCD -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0xCE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\xa4' # 0xCF -> CURRENCY SIGN + '\ufffe' # 0xD0 -> UNDEFINED + '\ufffe' # 0xD1 -> UNDEFINED + '\ufffe' # 0xD2 -> UNDEFINED + '\ufffe' # 0xD3 -> UNDEFINEDS + '\ufffe' # 0xD4 -> UNDEFINED + '\ufffe' # 0xD5 -> UNDEFINED + '\ufffe' # 0xD6 -> UNDEFINEDE + '\ufffe' # 0xD7 -> UNDEFINED + '\ufffe' # 0xD8 -> UNDEFINED + '\u2518' # 0xD9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0xDA -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0xDB -> FULL BLOCK + '\u2584' # 0xDC -> LOWER HALF BLOCK + '\xa6' # 0xDD -> BROKEN BAR + '\ufffe' # 0xDE -> UNDEFINED + '\u2580' # 0xDF -> UPPER HALF BLOCK + '\ufffe' # 0xE0 -> UNDEFINED + '\ufffe' # 0xE1 -> UNDEFINED + '\ufffe' # 0xE2 -> UNDEFINED + '\ufffe' # 0xE3 -> UNDEFINED + '\ufffe' # 0xE4 -> UNDEFINED + '\ufffe' # 0xE5 -> UNDEFINED + '\xb5' # 0xE6 -> MICRO SIGN + '\ufffe' # 0xE7 -> UNDEFINED + '\ufffe' # 0xE8 -> UNDEFINED + '\ufffe' # 0xE9 -> UNDEFINED + '\ufffe' # 0xEA -> UNDEFINED + '\ufffe' # 0xEB -> UNDEFINED + '\ufffe' # 0xEC -> UNDEFINED + '\ufffe' # 0xED -> UNDEFINED + '\xaf' # 0xEE -> MACRON + '\xb4' # 0xEF -> ACUTE ACCENT + '\xad' # 0xF0 -> SOFT HYPHEN + '\xb1' # 0xF1 -> PLUS-MINUS SIGN + '\u2017' # 0xF2 -> DOUBLE LOW LINE + '\xbe' # 0xF3 -> VULGAR FRACTION THREE QUARTERS + '\xb6' # 0xF4 -> PILCROW SIGN + '\xa7' # 0xF5 -> SECTION SIGN + '\xf7' # 0xF6 -> DIVISION SIGN + '\xb8' # 0xF7 -> CEDILLA + '\xb0' # 0xF8 -> DEGREE SIGN + '\xa8' # 0xF9 -> DIAERESIS + '\xb7' # 0xFA -> MIDDLE DOT + '\xb9' # 0xFB -> SUPERSCRIPT ONE + '\xb3' # 0xFC -> SUPERSCRIPT THREE + '\xb2' # 0xFD -> SUPERSCRIPT TWO + '\u25a0' # 0xFE -> BLACK SQUARE + '\xa0' # 0xFF -> NO-BREAK SPACE ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp857.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp857.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp857.py Wed May 2 21:09:54 2007 @@ -177,262 +177,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u0131' # 0x008d -> LATIN SMALL LETTER DOTLESS I - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\u0130' # 0x0098 -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\u015e' # 0x009e -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u015f' # 0x009f -> LATIN SMALL LETTER S WITH CEDILLA - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\u011e' # 0x00a6 -> LATIN CAPITAL LETTER G WITH BREVE - u'\u011f' # 0x00a7 -> LATIN SMALL LETTER G WITH BREVE - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\xae' # 0x00a9 -> REGISTERED SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xa9' # 0x00b8 -> COPYRIGHT SIGN - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\xa2' # 0x00bd -> CENT SIGN - u'\xa5' # 0x00be -> YEN SIGN - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE - u'\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0x00cf -> CURRENCY SIGN - u'\xba' # 0x00d0 -> MASCULINE ORDINAL INDICATOR - u'\xaa' # 0x00d1 -> FEMININE ORDINAL INDICATOR - u'\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\ufffe' # 0x00d5 -> UNDEFINED - u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\xa6' # 0x00dd -> BROKEN BAR - u'\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE - u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\ufffe' # 0x00e7 -> UNDEFINED - u'\xd7' # 0x00e8 -> MULTIPLICATION SIGN - u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xec' # 0x00ec -> LATIN SMALL LETTER I WITH GRAVE - u'\xff' # 0x00ed -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xaf' # 0x00ee -> MACRON - u'\xb4' # 0x00ef -> ACUTE ACCENT - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\ufffe' # 0x00f2 -> UNDEFINED - u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS - u'\xb6' # 0x00f4 -> PILCROW SIGN - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\xb8' # 0x00f7 -> CEDILLA - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\xa8' # 0x00f9 -> DIAERESIS - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\xb9' # 0x00fb -> SUPERSCRIPT ONE - u'\xb3' # 0x00fc -> SUPERSCRIPT THREE - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE + '\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE + '\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA + '\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE + '\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS + '\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\u0131' # 0x008d -> LATIN SMALL LETTER DOTLESS I + '\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE + '\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE + '\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE + '\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE + '\u0130' # 0x0098 -> LATIN CAPITAL LETTER I WITH DOT ABOVE + '\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE + '\xa3' # 0x009c -> POUND SIGN + '\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE + '\u015e' # 0x009e -> LATIN CAPITAL LETTER S WITH CEDILLA + '\u015f' # 0x009f -> LATIN SMALL LETTER S WITH CEDILLA + '\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE + '\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE + '\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE + '\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE + '\u011e' # 0x00a6 -> LATIN CAPITAL LETTER G WITH BREVE + '\u011f' # 0x00a7 -> LATIN SMALL LETTER G WITH BREVE + '\xbf' # 0x00a8 -> INVERTED QUESTION MARK + '\xae' # 0x00a9 -> REGISTERED SIGN + '\xac' # 0x00aa -> NOT SIGN + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER + '\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xa9' # 0x00b8 -> COPYRIGHT SIGN + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\xa2' # 0x00bd -> CENT SIGN + '\xa5' # 0x00be -> YEN SIGN + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE + '\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\xa4' # 0x00cf -> CURRENCY SIGN + '\xba' # 0x00d0 -> MASCULINE ORDINAL INDICATOR + '\xaa' # 0x00d1 -> FEMININE ORDINAL INDICATOR + '\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE + '\ufffe' # 0x00d5 -> UNDEFINED + '\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\xa6' # 0x00dd -> BROKEN BAR + '\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S + '\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE + '\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xb5' # 0x00e6 -> MICRO SIGN + '\ufffe' # 0x00e7 -> UNDEFINED + '\xd7' # 0x00e8 -> MULTIPLICATION SIGN + '\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE + '\xec' # 0x00ec -> LATIN SMALL LETTER I WITH GRAVE + '\xff' # 0x00ed -> LATIN SMALL LETTER Y WITH DIAERESIS + '\xaf' # 0x00ee -> MACRON + '\xb4' # 0x00ef -> ACUTE ACCENT + '\xad' # 0x00f0 -> SOFT HYPHEN + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\ufffe' # 0x00f2 -> UNDEFINED + '\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS + '\xb6' # 0x00f4 -> PILCROW SIGN + '\xa7' # 0x00f5 -> SECTION SIGN + '\xf7' # 0x00f6 -> DIVISION SIGN + '\xb8' # 0x00f7 -> CEDILLA + '\xb0' # 0x00f8 -> DEGREE SIGN + '\xa8' # 0x00f9 -> DIAERESIS + '\xb7' # 0x00fa -> MIDDLE DOT + '\xb9' # 0x00fb -> SUPERSCRIPT ONE + '\xb3' # 0x00fc -> SUPERSCRIPT THREE + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp860.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp860.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp860.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0x0084 -> LATIN SMALL LETTER A WITH TILDE - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xc1' # 0x0086 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xca' # 0x0089 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xcd' # 0x008b -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xd4' # 0x008c -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE - u'\xc3' # 0x008e -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc2' # 0x008f -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xc0' # 0x0091 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc8' # 0x0092 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0x0094 -> LATIN SMALL LETTER O WITH TILDE - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xda' # 0x0096 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xcc' # 0x0098 -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd5' # 0x0099 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xa2' # 0x009b -> CENT SIGN - u'\xa3' # 0x009c -> POUND SIGN - u'\xd9' # 0x009d -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u20a7' # 0x009e -> PESETA SIGN - u'\xd3' # 0x009f -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\xd2' # 0x00a9 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE + '\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe3' # 0x0084 -> LATIN SMALL LETTER A WITH TILDE + '\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE + '\xc1' # 0x0086 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA + '\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xca' # 0x0089 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE + '\xcd' # 0x008b -> LATIN CAPITAL LETTER I WITH ACUTE + '\xd4' # 0x008c -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE + '\xc3' # 0x008e -> LATIN CAPITAL LETTER A WITH TILDE + '\xc2' # 0x008f -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xc0' # 0x0091 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc8' # 0x0092 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf5' # 0x0094 -> LATIN SMALL LETTER O WITH TILDE + '\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE + '\xda' # 0x0096 -> LATIN CAPITAL LETTER U WITH ACUTE + '\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE + '\xcc' # 0x0098 -> LATIN CAPITAL LETTER I WITH GRAVE + '\xd5' # 0x0099 -> LATIN CAPITAL LETTER O WITH TILDE + '\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xa2' # 0x009b -> CENT SIGN + '\xa3' # 0x009c -> POUND SIGN + '\xd9' # 0x009d -> LATIN CAPITAL LETTER U WITH GRAVE + '\u20a7' # 0x009e -> PESETA SIGN + '\xd3' # 0x009f -> LATIN CAPITAL LETTER O WITH ACUTE + '\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE + '\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE + '\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE + '\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE + '\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR + '\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR + '\xbf' # 0x00a8 -> INVERTED QUESTION MARK + '\xd2' # 0x00a9 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xac' # 0x00aa -> NOT SIGN + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER + '\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + '\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + '\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + '\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + '\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + '\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + '\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + '\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u258c' # 0x00dd -> LEFT HALF BLOCK + '\u2590' # 0x00de -> RIGHT HALF BLOCK + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S + '\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA + '\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI + '\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA + '\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA + '\xb5' # 0x00e6 -> MICRO SIGN + '\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU + '\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI + '\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA + '\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA + '\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA + '\u221e' # 0x00ec -> INFINITY + '\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI + '\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON + '\u2229' # 0x00ef -> INTERSECTION + '\u2261' # 0x00f0 -> IDENTICAL TO + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO + '\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO + '\u2320' # 0x00f4 -> TOP HALF INTEGRAL + '\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL + '\xf7' # 0x00f6 -> DIVISION SIGN + '\u2248' # 0x00f7 -> ALMOST EQUAL TO + '\xb0' # 0x00f8 -> DEGREE SIGN + '\u2219' # 0x00f9 -> BULLET OPERATOR + '\xb7' # 0x00fa -> MIDDLE DOT + '\u221a' # 0x00fb -> SQUARE ROOT + '\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp861.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp861.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp861.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xd0' # 0x008b -> LATIN CAPITAL LETTER ETH - u'\xf0' # 0x008c -> LATIN SMALL LETTER ETH - u'\xde' # 0x008d -> LATIN CAPITAL LETTER THORN - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xfe' # 0x0095 -> LATIN SMALL LETTER THORN - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xdd' # 0x0097 -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xfd' # 0x0098 -> LATIN SMALL LETTER Y WITH ACUTE - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\u20a7' # 0x009e -> PESETA SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xc1' # 0x00a4 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcd' # 0x00a5 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xd3' # 0x00a6 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xda' # 0x00a7 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE + '\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE + '\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA + '\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE + '\xd0' # 0x008b -> LATIN CAPITAL LETTER ETH + '\xf0' # 0x008c -> LATIN SMALL LETTER ETH + '\xde' # 0x008d -> LATIN CAPITAL LETTER THORN + '\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE + '\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE + '\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xfe' # 0x0095 -> LATIN SMALL LETTER THORN + '\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xdd' # 0x0097 -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xfd' # 0x0098 -> LATIN SMALL LETTER Y WITH ACUTE + '\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE + '\xa3' # 0x009c -> POUND SIGN + '\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE + '\u20a7' # 0x009e -> PESETA SIGN + '\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK + '\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE + '\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE + '\xc1' # 0x00a4 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xcd' # 0x00a5 -> LATIN CAPITAL LETTER I WITH ACUTE + '\xd3' # 0x00a6 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xda' # 0x00a7 -> LATIN CAPITAL LETTER U WITH ACUTE + '\xbf' # 0x00a8 -> INVERTED QUESTION MARK + '\u2310' # 0x00a9 -> REVERSED NOT SIGN + '\xac' # 0x00aa -> NOT SIGN + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER + '\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + '\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + '\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + '\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + '\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + '\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + '\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + '\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u258c' # 0x00dd -> LEFT HALF BLOCK + '\u2590' # 0x00de -> RIGHT HALF BLOCK + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S + '\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA + '\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI + '\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA + '\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA + '\xb5' # 0x00e6 -> MICRO SIGN + '\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU + '\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI + '\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA + '\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA + '\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA + '\u221e' # 0x00ec -> INFINITY + '\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI + '\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON + '\u2229' # 0x00ef -> INTERSECTION + '\u2261' # 0x00f0 -> IDENTICAL TO + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO + '\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO + '\u2320' # 0x00f4 -> TOP HALF INTEGRAL + '\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL + '\xf7' # 0x00f6 -> DIVISION SIGN + '\u2248' # 0x00f7 -> ALMOST EQUAL TO + '\xb0' # 0x00f8 -> DEGREE SIGN + '\u2219' # 0x00f9 -> BULLET OPERATOR + '\xb7' # 0x00fa -> MIDDLE DOT + '\u221a' # 0x00fb -> SQUARE ROOT + '\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp862.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp862.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp862.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u05d0' # 0x0080 -> HEBREW LETTER ALEF - u'\u05d1' # 0x0081 -> HEBREW LETTER BET - u'\u05d2' # 0x0082 -> HEBREW LETTER GIMEL - u'\u05d3' # 0x0083 -> HEBREW LETTER DALET - u'\u05d4' # 0x0084 -> HEBREW LETTER HE - u'\u05d5' # 0x0085 -> HEBREW LETTER VAV - u'\u05d6' # 0x0086 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0x0087 -> HEBREW LETTER HET - u'\u05d8' # 0x0088 -> HEBREW LETTER TET - u'\u05d9' # 0x0089 -> HEBREW LETTER YOD - u'\u05da' # 0x008a -> HEBREW LETTER FINAL KAF - u'\u05db' # 0x008b -> HEBREW LETTER KAF - u'\u05dc' # 0x008c -> HEBREW LETTER LAMED - u'\u05dd' # 0x008d -> HEBREW LETTER FINAL MEM - u'\u05de' # 0x008e -> HEBREW LETTER MEM - u'\u05df' # 0x008f -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0x0090 -> HEBREW LETTER NUN - u'\u05e1' # 0x0091 -> HEBREW LETTER SAMEKH - u'\u05e2' # 0x0092 -> HEBREW LETTER AYIN - u'\u05e3' # 0x0093 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0x0094 -> HEBREW LETTER PE - u'\u05e5' # 0x0095 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0x0096 -> HEBREW LETTER TSADI - u'\u05e7' # 0x0097 -> HEBREW LETTER QOF - u'\u05e8' # 0x0098 -> HEBREW LETTER RESH - u'\u05e9' # 0x0099 -> HEBREW LETTER SHIN - u'\u05ea' # 0x009a -> HEBREW LETTER TAV - u'\xa2' # 0x009b -> CENT SIGN - u'\xa3' # 0x009c -> POUND SIGN - u'\xa5' # 0x009d -> YEN SIGN - u'\u20a7' # 0x009e -> PESETA SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\u05d0' # 0x0080 -> HEBREW LETTER ALEF + '\u05d1' # 0x0081 -> HEBREW LETTER BET + '\u05d2' # 0x0082 -> HEBREW LETTER GIMEL + '\u05d3' # 0x0083 -> HEBREW LETTER DALET + '\u05d4' # 0x0084 -> HEBREW LETTER HE + '\u05d5' # 0x0085 -> HEBREW LETTER VAV + '\u05d6' # 0x0086 -> HEBREW LETTER ZAYIN + '\u05d7' # 0x0087 -> HEBREW LETTER HET + '\u05d8' # 0x0088 -> HEBREW LETTER TET + '\u05d9' # 0x0089 -> HEBREW LETTER YOD + '\u05da' # 0x008a -> HEBREW LETTER FINAL KAF + '\u05db' # 0x008b -> HEBREW LETTER KAF + '\u05dc' # 0x008c -> HEBREW LETTER LAMED + '\u05dd' # 0x008d -> HEBREW LETTER FINAL MEM + '\u05de' # 0x008e -> HEBREW LETTER MEM + '\u05df' # 0x008f -> HEBREW LETTER FINAL NUN + '\u05e0' # 0x0090 -> HEBREW LETTER NUN + '\u05e1' # 0x0091 -> HEBREW LETTER SAMEKH + '\u05e2' # 0x0092 -> HEBREW LETTER AYIN + '\u05e3' # 0x0093 -> HEBREW LETTER FINAL PE + '\u05e4' # 0x0094 -> HEBREW LETTER PE + '\u05e5' # 0x0095 -> HEBREW LETTER FINAL TSADI + '\u05e6' # 0x0096 -> HEBREW LETTER TSADI + '\u05e7' # 0x0097 -> HEBREW LETTER QOF + '\u05e8' # 0x0098 -> HEBREW LETTER RESH + '\u05e9' # 0x0099 -> HEBREW LETTER SHIN + '\u05ea' # 0x009a -> HEBREW LETTER TAV + '\xa2' # 0x009b -> CENT SIGN + '\xa3' # 0x009c -> POUND SIGN + '\xa5' # 0x009d -> YEN SIGN + '\u20a7' # 0x009e -> PESETA SIGN + '\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK + '\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE + '\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE + '\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE + '\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE + '\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR + '\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR + '\xbf' # 0x00a8 -> INVERTED QUESTION MARK + '\u2310' # 0x00a9 -> REVERSED NOT SIGN + '\xac' # 0x00aa -> NOT SIGN + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER + '\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + '\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + '\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + '\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + '\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + '\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + '\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + '\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u258c' # 0x00dd -> LEFT HALF BLOCK + '\u2590' # 0x00de -> RIGHT HALF BLOCK + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN) + '\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA + '\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI + '\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA + '\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA + '\xb5' # 0x00e6 -> MICRO SIGN + '\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU + '\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI + '\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA + '\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA + '\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA + '\u221e' # 0x00ec -> INFINITY + '\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI + '\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON + '\u2229' # 0x00ef -> INTERSECTION + '\u2261' # 0x00f0 -> IDENTICAL TO + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO + '\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO + '\u2320' # 0x00f4 -> TOP HALF INTEGRAL + '\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL + '\xf7' # 0x00f6 -> DIVISION SIGN + '\u2248' # 0x00f7 -> ALMOST EQUAL TO + '\xb0' # 0x00f8 -> DEGREE SIGN + '\u2219' # 0x00f9 -> BULLET OPERATOR + '\xb7' # 0x00fa -> MIDDLE DOT + '\u221a' # 0x00fb -> SQUARE ROOT + '\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp863.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp863.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp863.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xc2' # 0x0084 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xb6' # 0x0086 -> PILCROW SIGN - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u2017' # 0x008d -> DOUBLE LOW LINE - u'\xc0' # 0x008e -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xa7' # 0x008f -> SECTION SIGN - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xc8' # 0x0091 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xca' # 0x0092 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xcb' # 0x0094 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcf' # 0x0095 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xa4' # 0x0098 -> CURRENCY SIGN - u'\xd4' # 0x0099 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xa2' # 0x009b -> CENT SIGN - u'\xa3' # 0x009c -> POUND SIGN - u'\xd9' # 0x009d -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xdb' # 0x009e -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xa6' # 0x00a0 -> BROKEN BAR - u'\xb4' # 0x00a1 -> ACUTE ACCENT - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xa8' # 0x00a4 -> DIAERESIS - u'\xb8' # 0x00a5 -> CEDILLA - u'\xb3' # 0x00a6 -> SUPERSCRIPT THREE - u'\xaf' # 0x00a7 -> MACRON - u'\xce' # 0x00a8 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xbe' # 0x00ad -> VULGAR FRACTION THREE QUARTERS - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE + '\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xc2' # 0x0084 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE + '\xb6' # 0x0086 -> PILCROW SIGN + '\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA + '\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE + '\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS + '\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\u2017' # 0x008d -> DOUBLE LOW LINE + '\xc0' # 0x008e -> LATIN CAPITAL LETTER A WITH GRAVE + '\xa7' # 0x008f -> SECTION SIGN + '\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xc8' # 0x0091 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xca' # 0x0092 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xcb' # 0x0094 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xcf' # 0x0095 -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE + '\xa4' # 0x0098 -> CURRENCY SIGN + '\xd4' # 0x0099 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xa2' # 0x009b -> CENT SIGN + '\xa3' # 0x009c -> POUND SIGN + '\xd9' # 0x009d -> LATIN CAPITAL LETTER U WITH GRAVE + '\xdb' # 0x009e -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK + '\xa6' # 0x00a0 -> BROKEN BAR + '\xb4' # 0x00a1 -> ACUTE ACCENT + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE + '\xa8' # 0x00a4 -> DIAERESIS + '\xb8' # 0x00a5 -> CEDILLA + '\xb3' # 0x00a6 -> SUPERSCRIPT THREE + '\xaf' # 0x00a7 -> MACRON + '\xce' # 0x00a8 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\u2310' # 0x00a9 -> REVERSED NOT SIGN + '\xac' # 0x00aa -> NOT SIGN + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER + '\xbe' # 0x00ad -> VULGAR FRACTION THREE QUARTERS + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + '\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + '\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + '\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + '\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + '\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + '\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + '\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u258c' # 0x00dd -> LEFT HALF BLOCK + '\u2590' # 0x00de -> RIGHT HALF BLOCK + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S + '\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA + '\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI + '\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA + '\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA + '\xb5' # 0x00e6 -> MICRO SIGN + '\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU + '\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI + '\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA + '\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA + '\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA + '\u221e' # 0x00ec -> INFINITY + '\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI + '\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON + '\u2229' # 0x00ef -> INTERSECTION + '\u2261' # 0x00f0 -> IDENTICAL TO + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO + '\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO + '\u2320' # 0x00f4 -> TOP HALF INTEGRAL + '\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL + '\xf7' # 0x00f6 -> DIVISION SIGN + '\u2248' # 0x00f7 -> ALMOST EQUAL TO + '\xb0' # 0x00f8 -> DEGREE SIGN + '\u2219' # 0x00f9 -> BULLET OPERATOR + '\xb7' # 0x00fa -> MIDDLE DOT + '\u221a' # 0x00fb -> SQUARE ROOT + '\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp864.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp864.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp864.py Wed May 2 21:09:54 2007 @@ -176,262 +176,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'\u066a' # 0x0025 -> ARABIC PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xb0' # 0x0080 -> DEGREE SIGN - u'\xb7' # 0x0081 -> MIDDLE DOT - u'\u2219' # 0x0082 -> BULLET OPERATOR - u'\u221a' # 0x0083 -> SQUARE ROOT - u'\u2592' # 0x0084 -> MEDIUM SHADE - u'\u2500' # 0x0085 -> FORMS LIGHT HORIZONTAL - u'\u2502' # 0x0086 -> FORMS LIGHT VERTICAL - u'\u253c' # 0x0087 -> FORMS LIGHT VERTICAL AND HORIZONTAL - u'\u2524' # 0x0088 -> FORMS LIGHT VERTICAL AND LEFT - u'\u252c' # 0x0089 -> FORMS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x008a -> FORMS LIGHT VERTICAL AND RIGHT - u'\u2534' # 0x008b -> FORMS LIGHT UP AND HORIZONTAL - u'\u2510' # 0x008c -> FORMS LIGHT DOWN AND LEFT - u'\u250c' # 0x008d -> FORMS LIGHT DOWN AND RIGHT - u'\u2514' # 0x008e -> FORMS LIGHT UP AND RIGHT - u'\u2518' # 0x008f -> FORMS LIGHT UP AND LEFT - u'\u03b2' # 0x0090 -> GREEK SMALL BETA - u'\u221e' # 0x0091 -> INFINITY - u'\u03c6' # 0x0092 -> GREEK SMALL PHI - u'\xb1' # 0x0093 -> PLUS-OR-MINUS SIGN - u'\xbd' # 0x0094 -> FRACTION 1/2 - u'\xbc' # 0x0095 -> FRACTION 1/4 - u'\u2248' # 0x0096 -> ALMOST EQUAL TO - u'\xab' # 0x0097 -> LEFT POINTING GUILLEMET - u'\xbb' # 0x0098 -> RIGHT POINTING GUILLEMET - u'\ufef7' # 0x0099 -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM - u'\ufef8' # 0x009a -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM - u'\ufffe' # 0x009b -> UNDEFINED - u'\ufffe' # 0x009c -> UNDEFINED - u'\ufefb' # 0x009d -> ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM - u'\ufefc' # 0x009e -> ARABIC LIGATURE LAM WITH ALEF FINAL FORM - u'\ufffe' # 0x009f -> UNDEFINED - u'\xa0' # 0x00a0 -> NON-BREAKING SPACE - u'\xad' # 0x00a1 -> SOFT HYPHEN - u'\ufe82' # 0x00a2 -> ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM - u'\xa3' # 0x00a3 -> POUND SIGN - u'\xa4' # 0x00a4 -> CURRENCY SIGN - u'\ufe84' # 0x00a5 -> ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM - u'\ufffe' # 0x00a6 -> UNDEFINED - u'\ufffe' # 0x00a7 -> UNDEFINED - u'\ufe8e' # 0x00a8 -> ARABIC LETTER ALEF FINAL FORM - u'\ufe8f' # 0x00a9 -> ARABIC LETTER BEH ISOLATED FORM - u'\ufe95' # 0x00aa -> ARABIC LETTER TEH ISOLATED FORM - u'\ufe99' # 0x00ab -> ARABIC LETTER THEH ISOLATED FORM - u'\u060c' # 0x00ac -> ARABIC COMMA - u'\ufe9d' # 0x00ad -> ARABIC LETTER JEEM ISOLATED FORM - u'\ufea1' # 0x00ae -> ARABIC LETTER HAH ISOLATED FORM - u'\ufea5' # 0x00af -> ARABIC LETTER KHAH ISOLATED FORM - u'\u0660' # 0x00b0 -> ARABIC-INDIC DIGIT ZERO - u'\u0661' # 0x00b1 -> ARABIC-INDIC DIGIT ONE - u'\u0662' # 0x00b2 -> ARABIC-INDIC DIGIT TWO - u'\u0663' # 0x00b3 -> ARABIC-INDIC DIGIT THREE - u'\u0664' # 0x00b4 -> ARABIC-INDIC DIGIT FOUR - u'\u0665' # 0x00b5 -> ARABIC-INDIC DIGIT FIVE - u'\u0666' # 0x00b6 -> ARABIC-INDIC DIGIT SIX - u'\u0667' # 0x00b7 -> ARABIC-INDIC DIGIT SEVEN - u'\u0668' # 0x00b8 -> ARABIC-INDIC DIGIT EIGHT - u'\u0669' # 0x00b9 -> ARABIC-INDIC DIGIT NINE - u'\ufed1' # 0x00ba -> ARABIC LETTER FEH ISOLATED FORM - u'\u061b' # 0x00bb -> ARABIC SEMICOLON - u'\ufeb1' # 0x00bc -> ARABIC LETTER SEEN ISOLATED FORM - u'\ufeb5' # 0x00bd -> ARABIC LETTER SHEEN ISOLATED FORM - u'\ufeb9' # 0x00be -> ARABIC LETTER SAD ISOLATED FORM - u'\u061f' # 0x00bf -> ARABIC QUESTION MARK - u'\xa2' # 0x00c0 -> CENT SIGN - u'\ufe80' # 0x00c1 -> ARABIC LETTER HAMZA ISOLATED FORM - u'\ufe81' # 0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM - u'\ufe83' # 0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM - u'\ufe85' # 0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM - u'\ufeca' # 0x00c5 -> ARABIC LETTER AIN FINAL FORM - u'\ufe8b' # 0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM - u'\ufe8d' # 0x00c7 -> ARABIC LETTER ALEF ISOLATED FORM - u'\ufe91' # 0x00c8 -> ARABIC LETTER BEH INITIAL FORM - u'\ufe93' # 0x00c9 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM - u'\ufe97' # 0x00ca -> ARABIC LETTER TEH INITIAL FORM - u'\ufe9b' # 0x00cb -> ARABIC LETTER THEH INITIAL FORM - u'\ufe9f' # 0x00cc -> ARABIC LETTER JEEM INITIAL FORM - u'\ufea3' # 0x00cd -> ARABIC LETTER HAH INITIAL FORM - u'\ufea7' # 0x00ce -> ARABIC LETTER KHAH INITIAL FORM - u'\ufea9' # 0x00cf -> ARABIC LETTER DAL ISOLATED FORM - u'\ufeab' # 0x00d0 -> ARABIC LETTER THAL ISOLATED FORM - u'\ufead' # 0x00d1 -> ARABIC LETTER REH ISOLATED FORM - u'\ufeaf' # 0x00d2 -> ARABIC LETTER ZAIN ISOLATED FORM - u'\ufeb3' # 0x00d3 -> ARABIC LETTER SEEN INITIAL FORM - u'\ufeb7' # 0x00d4 -> ARABIC LETTER SHEEN INITIAL FORM - u'\ufebb' # 0x00d5 -> ARABIC LETTER SAD INITIAL FORM - u'\ufebf' # 0x00d6 -> ARABIC LETTER DAD INITIAL FORM - u'\ufec1' # 0x00d7 -> ARABIC LETTER TAH ISOLATED FORM - u'\ufec5' # 0x00d8 -> ARABIC LETTER ZAH ISOLATED FORM - u'\ufecb' # 0x00d9 -> ARABIC LETTER AIN INITIAL FORM - u'\ufecf' # 0x00da -> ARABIC LETTER GHAIN INITIAL FORM - u'\xa6' # 0x00db -> BROKEN VERTICAL BAR - u'\xac' # 0x00dc -> NOT SIGN - u'\xf7' # 0x00dd -> DIVISION SIGN - u'\xd7' # 0x00de -> MULTIPLICATION SIGN - u'\ufec9' # 0x00df -> ARABIC LETTER AIN ISOLATED FORM - u'\u0640' # 0x00e0 -> ARABIC TATWEEL - u'\ufed3' # 0x00e1 -> ARABIC LETTER FEH INITIAL FORM - u'\ufed7' # 0x00e2 -> ARABIC LETTER QAF INITIAL FORM - u'\ufedb' # 0x00e3 -> ARABIC LETTER KAF INITIAL FORM - u'\ufedf' # 0x00e4 -> ARABIC LETTER LAM INITIAL FORM - u'\ufee3' # 0x00e5 -> ARABIC LETTER MEEM INITIAL FORM - u'\ufee7' # 0x00e6 -> ARABIC LETTER NOON INITIAL FORM - u'\ufeeb' # 0x00e7 -> ARABIC LETTER HEH INITIAL FORM - u'\ufeed' # 0x00e8 -> ARABIC LETTER WAW ISOLATED FORM - u'\ufeef' # 0x00e9 -> ARABIC LETTER ALEF MAKSURA ISOLATED FORM - u'\ufef3' # 0x00ea -> ARABIC LETTER YEH INITIAL FORM - u'\ufebd' # 0x00eb -> ARABIC LETTER DAD ISOLATED FORM - u'\ufecc' # 0x00ec -> ARABIC LETTER AIN MEDIAL FORM - u'\ufece' # 0x00ed -> ARABIC LETTER GHAIN FINAL FORM - u'\ufecd' # 0x00ee -> ARABIC LETTER GHAIN ISOLATED FORM - u'\ufee1' # 0x00ef -> ARABIC LETTER MEEM ISOLATED FORM - u'\ufe7d' # 0x00f0 -> ARABIC SHADDA MEDIAL FORM - u'\u0651' # 0x00f1 -> ARABIC SHADDAH - u'\ufee5' # 0x00f2 -> ARABIC LETTER NOON ISOLATED FORM - u'\ufee9' # 0x00f3 -> ARABIC LETTER HEH ISOLATED FORM - u'\ufeec' # 0x00f4 -> ARABIC LETTER HEH MEDIAL FORM - u'\ufef0' # 0x00f5 -> ARABIC LETTER ALEF MAKSURA FINAL FORM - u'\ufef2' # 0x00f6 -> ARABIC LETTER YEH FINAL FORM - u'\ufed0' # 0x00f7 -> ARABIC LETTER GHAIN MEDIAL FORM - u'\ufed5' # 0x00f8 -> ARABIC LETTER QAF ISOLATED FORM - u'\ufef5' # 0x00f9 -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM - u'\ufef6' # 0x00fa -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM - u'\ufedd' # 0x00fb -> ARABIC LETTER LAM ISOLATED FORM - u'\ufed9' # 0x00fc -> ARABIC LETTER KAF ISOLATED FORM - u'\ufef1' # 0x00fd -> ARABIC LETTER YEH ISOLATED FORM - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\ufffe' # 0x00ff -> UNDEFINED + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '\u066a' # 0x0025 -> ARABIC PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\xb0' # 0x0080 -> DEGREE SIGN + '\xb7' # 0x0081 -> MIDDLE DOT + '\u2219' # 0x0082 -> BULLET OPERATOR + '\u221a' # 0x0083 -> SQUARE ROOT + '\u2592' # 0x0084 -> MEDIUM SHADE + '\u2500' # 0x0085 -> FORMS LIGHT HORIZONTAL + '\u2502' # 0x0086 -> FORMS LIGHT VERTICAL + '\u253c' # 0x0087 -> FORMS LIGHT VERTICAL AND HORIZONTAL + '\u2524' # 0x0088 -> FORMS LIGHT VERTICAL AND LEFT + '\u252c' # 0x0089 -> FORMS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x008a -> FORMS LIGHT VERTICAL AND RIGHT + '\u2534' # 0x008b -> FORMS LIGHT UP AND HORIZONTAL + '\u2510' # 0x008c -> FORMS LIGHT DOWN AND LEFT + '\u250c' # 0x008d -> FORMS LIGHT DOWN AND RIGHT + '\u2514' # 0x008e -> FORMS LIGHT UP AND RIGHT + '\u2518' # 0x008f -> FORMS LIGHT UP AND LEFT + '\u03b2' # 0x0090 -> GREEK SMALL BETA + '\u221e' # 0x0091 -> INFINITY + '\u03c6' # 0x0092 -> GREEK SMALL PHI + '\xb1' # 0x0093 -> PLUS-OR-MINUS SIGN + '\xbd' # 0x0094 -> FRACTION 1/2 + '\xbc' # 0x0095 -> FRACTION 1/4 + '\u2248' # 0x0096 -> ALMOST EQUAL TO + '\xab' # 0x0097 -> LEFT POINTING GUILLEMET + '\xbb' # 0x0098 -> RIGHT POINTING GUILLEMET + '\ufef7' # 0x0099 -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM + '\ufef8' # 0x009a -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM + '\ufffe' # 0x009b -> UNDEFINED + '\ufffe' # 0x009c -> UNDEFINED + '\ufefb' # 0x009d -> ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM + '\ufefc' # 0x009e -> ARABIC LIGATURE LAM WITH ALEF FINAL FORM + '\ufffe' # 0x009f -> UNDEFINED + '\xa0' # 0x00a0 -> NON-BREAKING SPACE + '\xad' # 0x00a1 -> SOFT HYPHEN + '\ufe82' # 0x00a2 -> ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM + '\xa3' # 0x00a3 -> POUND SIGN + '\xa4' # 0x00a4 -> CURRENCY SIGN + '\ufe84' # 0x00a5 -> ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM + '\ufffe' # 0x00a6 -> UNDEFINED + '\ufffe' # 0x00a7 -> UNDEFINED + '\ufe8e' # 0x00a8 -> ARABIC LETTER ALEF FINAL FORM + '\ufe8f' # 0x00a9 -> ARABIC LETTER BEH ISOLATED FORM + '\ufe95' # 0x00aa -> ARABIC LETTER TEH ISOLATED FORM + '\ufe99' # 0x00ab -> ARABIC LETTER THEH ISOLATED FORM + '\u060c' # 0x00ac -> ARABIC COMMA + '\ufe9d' # 0x00ad -> ARABIC LETTER JEEM ISOLATED FORM + '\ufea1' # 0x00ae -> ARABIC LETTER HAH ISOLATED FORM + '\ufea5' # 0x00af -> ARABIC LETTER KHAH ISOLATED FORM + '\u0660' # 0x00b0 -> ARABIC-INDIC DIGIT ZERO + '\u0661' # 0x00b1 -> ARABIC-INDIC DIGIT ONE + '\u0662' # 0x00b2 -> ARABIC-INDIC DIGIT TWO + '\u0663' # 0x00b3 -> ARABIC-INDIC DIGIT THREE + '\u0664' # 0x00b4 -> ARABIC-INDIC DIGIT FOUR + '\u0665' # 0x00b5 -> ARABIC-INDIC DIGIT FIVE + '\u0666' # 0x00b6 -> ARABIC-INDIC DIGIT SIX + '\u0667' # 0x00b7 -> ARABIC-INDIC DIGIT SEVEN + '\u0668' # 0x00b8 -> ARABIC-INDIC DIGIT EIGHT + '\u0669' # 0x00b9 -> ARABIC-INDIC DIGIT NINE + '\ufed1' # 0x00ba -> ARABIC LETTER FEH ISOLATED FORM + '\u061b' # 0x00bb -> ARABIC SEMICOLON + '\ufeb1' # 0x00bc -> ARABIC LETTER SEEN ISOLATED FORM + '\ufeb5' # 0x00bd -> ARABIC LETTER SHEEN ISOLATED FORM + '\ufeb9' # 0x00be -> ARABIC LETTER SAD ISOLATED FORM + '\u061f' # 0x00bf -> ARABIC QUESTION MARK + '\xa2' # 0x00c0 -> CENT SIGN + '\ufe80' # 0x00c1 -> ARABIC LETTER HAMZA ISOLATED FORM + '\ufe81' # 0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM + '\ufe83' # 0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM + '\ufe85' # 0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM + '\ufeca' # 0x00c5 -> ARABIC LETTER AIN FINAL FORM + '\ufe8b' # 0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM + '\ufe8d' # 0x00c7 -> ARABIC LETTER ALEF ISOLATED FORM + '\ufe91' # 0x00c8 -> ARABIC LETTER BEH INITIAL FORM + '\ufe93' # 0x00c9 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM + '\ufe97' # 0x00ca -> ARABIC LETTER TEH INITIAL FORM + '\ufe9b' # 0x00cb -> ARABIC LETTER THEH INITIAL FORM + '\ufe9f' # 0x00cc -> ARABIC LETTER JEEM INITIAL FORM + '\ufea3' # 0x00cd -> ARABIC LETTER HAH INITIAL FORM + '\ufea7' # 0x00ce -> ARABIC LETTER KHAH INITIAL FORM + '\ufea9' # 0x00cf -> ARABIC LETTER DAL ISOLATED FORM + '\ufeab' # 0x00d0 -> ARABIC LETTER THAL ISOLATED FORM + '\ufead' # 0x00d1 -> ARABIC LETTER REH ISOLATED FORM + '\ufeaf' # 0x00d2 -> ARABIC LETTER ZAIN ISOLATED FORM + '\ufeb3' # 0x00d3 -> ARABIC LETTER SEEN INITIAL FORM + '\ufeb7' # 0x00d4 -> ARABIC LETTER SHEEN INITIAL FORM + '\ufebb' # 0x00d5 -> ARABIC LETTER SAD INITIAL FORM + '\ufebf' # 0x00d6 -> ARABIC LETTER DAD INITIAL FORM + '\ufec1' # 0x00d7 -> ARABIC LETTER TAH ISOLATED FORM + '\ufec5' # 0x00d8 -> ARABIC LETTER ZAH ISOLATED FORM + '\ufecb' # 0x00d9 -> ARABIC LETTER AIN INITIAL FORM + '\ufecf' # 0x00da -> ARABIC LETTER GHAIN INITIAL FORM + '\xa6' # 0x00db -> BROKEN VERTICAL BAR + '\xac' # 0x00dc -> NOT SIGN + '\xf7' # 0x00dd -> DIVISION SIGN + '\xd7' # 0x00de -> MULTIPLICATION SIGN + '\ufec9' # 0x00df -> ARABIC LETTER AIN ISOLATED FORM + '\u0640' # 0x00e0 -> ARABIC TATWEEL + '\ufed3' # 0x00e1 -> ARABIC LETTER FEH INITIAL FORM + '\ufed7' # 0x00e2 -> ARABIC LETTER QAF INITIAL FORM + '\ufedb' # 0x00e3 -> ARABIC LETTER KAF INITIAL FORM + '\ufedf' # 0x00e4 -> ARABIC LETTER LAM INITIAL FORM + '\ufee3' # 0x00e5 -> ARABIC LETTER MEEM INITIAL FORM + '\ufee7' # 0x00e6 -> ARABIC LETTER NOON INITIAL FORM + '\ufeeb' # 0x00e7 -> ARABIC LETTER HEH INITIAL FORM + '\ufeed' # 0x00e8 -> ARABIC LETTER WAW ISOLATED FORM + '\ufeef' # 0x00e9 -> ARABIC LETTER ALEF MAKSURA ISOLATED FORM + '\ufef3' # 0x00ea -> ARABIC LETTER YEH INITIAL FORM + '\ufebd' # 0x00eb -> ARABIC LETTER DAD ISOLATED FORM + '\ufecc' # 0x00ec -> ARABIC LETTER AIN MEDIAL FORM + '\ufece' # 0x00ed -> ARABIC LETTER GHAIN FINAL FORM + '\ufecd' # 0x00ee -> ARABIC LETTER GHAIN ISOLATED FORM + '\ufee1' # 0x00ef -> ARABIC LETTER MEEM ISOLATED FORM + '\ufe7d' # 0x00f0 -> ARABIC SHADDA MEDIAL FORM + '\u0651' # 0x00f1 -> ARABIC SHADDAH + '\ufee5' # 0x00f2 -> ARABIC LETTER NOON ISOLATED FORM + '\ufee9' # 0x00f3 -> ARABIC LETTER HEH ISOLATED FORM + '\ufeec' # 0x00f4 -> ARABIC LETTER HEH MEDIAL FORM + '\ufef0' # 0x00f5 -> ARABIC LETTER ALEF MAKSURA FINAL FORM + '\ufef2' # 0x00f6 -> ARABIC LETTER YEH FINAL FORM + '\ufed0' # 0x00f7 -> ARABIC LETTER GHAIN MEDIAL FORM + '\ufed5' # 0x00f8 -> ARABIC LETTER QAF ISOLATED FORM + '\ufef5' # 0x00f9 -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM + '\ufef6' # 0x00fa -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM + '\ufedd' # 0x00fb -> ARABIC LETTER LAM ISOLATED FORM + '\ufed9' # 0x00fc -> ARABIC LETTER KAF ISOLATED FORM + '\ufef1' # 0x00fd -> ARABIC LETTER YEH ISOLATED FORM + '\u25a0' # 0x00fe -> BLACK SQUARE + '\ufffe' # 0x00ff -> UNDEFINED ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp865.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp865.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp865.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\u20a7' # 0x009e -> PESETA SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xa4' # 0x00af -> CURRENCY SIGN - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS + '\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE + '\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE + '\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA + '\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE + '\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS + '\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE + '\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE + '\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE + '\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE + '\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE + '\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS + '\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE + '\xa3' # 0x009c -> POUND SIGN + '\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE + '\u20a7' # 0x009e -> PESETA SIGN + '\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK + '\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE + '\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE + '\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE + '\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE + '\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE + '\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE + '\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR + '\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR + '\xbf' # 0x00a8 -> INVERTED QUESTION MARK + '\u2310' # 0x00a9 -> REVERSED NOT SIGN + '\xac' # 0x00aa -> NOT SIGN + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER + '\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xa4' # 0x00af -> CURRENCY SIGN + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + '\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + '\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + '\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + '\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + '\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + '\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + '\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u258c' # 0x00dd -> LEFT HALF BLOCK + '\u2590' # 0x00de -> RIGHT HALF BLOCK + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA + '\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S + '\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA + '\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI + '\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA + '\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA + '\xb5' # 0x00e6 -> MICRO SIGN + '\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU + '\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI + '\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA + '\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA + '\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA + '\u221e' # 0x00ec -> INFINITY + '\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI + '\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON + '\u2229' # 0x00ef -> INTERSECTION + '\u2261' # 0x00f0 -> IDENTICAL TO + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO + '\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO + '\u2320' # 0x00f4 -> TOP HALF INTEGRAL + '\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL + '\xf7' # 0x00f6 -> DIVISION SIGN + '\u2248' # 0x00f7 -> ALMOST EQUAL TO + '\xb0' # 0x00f8 -> DEGREE SIGN + '\u2219' # 0x00f9 -> BULLET OPERATOR + '\xb7' # 0x00fa -> MIDDLE DOT + '\u221a' # 0x00fb -> SQUARE ROOT + '\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N + '\xb2' # 0x00fd -> SUPERSCRIPT TWO + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp866.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp866.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp866.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u0410' # 0x0080 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0x0081 -> CYRILLIC CAPITAL LETTER BE - u'\u0412' # 0x0082 -> CYRILLIC CAPITAL LETTER VE - u'\u0413' # 0x0083 -> CYRILLIC CAPITAL LETTER GHE - u'\u0414' # 0x0084 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0x0085 -> CYRILLIC CAPITAL LETTER IE - u'\u0416' # 0x0086 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0417' # 0x0087 -> CYRILLIC CAPITAL LETTER ZE - u'\u0418' # 0x0088 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0x0089 -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0x008a -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0x008b -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0x008c -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0x008d -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0x008e -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0x008f -> CYRILLIC CAPITAL LETTER PE - u'\u0420' # 0x0090 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0x0091 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0x0092 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0x0093 -> CYRILLIC CAPITAL LETTER U - u'\u0424' # 0x0094 -> CYRILLIC CAPITAL LETTER EF - u'\u0425' # 0x0095 -> CYRILLIC CAPITAL LETTER HA - u'\u0426' # 0x0096 -> CYRILLIC CAPITAL LETTER TSE - u'\u0427' # 0x0097 -> CYRILLIC CAPITAL LETTER CHE - u'\u0428' # 0x0098 -> CYRILLIC CAPITAL LETTER SHA - u'\u0429' # 0x0099 -> CYRILLIC CAPITAL LETTER SHCHA - u'\u042a' # 0x009a -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u042b' # 0x009b -> CYRILLIC CAPITAL LETTER YERU - u'\u042c' # 0x009c -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042d' # 0x009d -> CYRILLIC CAPITAL LETTER E - u'\u042e' # 0x009e -> CYRILLIC CAPITAL LETTER YU - u'\u042f' # 0x009f -> CYRILLIC CAPITAL LETTER YA - u'\u0430' # 0x00a0 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0x00a1 -> CYRILLIC SMALL LETTER BE - u'\u0432' # 0x00a2 -> CYRILLIC SMALL LETTER VE - u'\u0433' # 0x00a3 -> CYRILLIC SMALL LETTER GHE - u'\u0434' # 0x00a4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0x00a5 -> CYRILLIC SMALL LETTER IE - u'\u0436' # 0x00a6 -> CYRILLIC SMALL LETTER ZHE - u'\u0437' # 0x00a7 -> CYRILLIC SMALL LETTER ZE - u'\u0438' # 0x00a8 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0x00a9 -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0x00aa -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0x00ab -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0x00ac -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0x00ad -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0x00ae -> CYRILLIC SMALL LETTER O - u'\u043f' # 0x00af -> CYRILLIC SMALL LETTER PE - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u0440' # 0x00e0 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0x00e1 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0x00e2 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0x00e3 -> CYRILLIC SMALL LETTER U - u'\u0444' # 0x00e4 -> CYRILLIC SMALL LETTER EF - u'\u0445' # 0x00e5 -> CYRILLIC SMALL LETTER HA - u'\u0446' # 0x00e6 -> CYRILLIC SMALL LETTER TSE - u'\u0447' # 0x00e7 -> CYRILLIC SMALL LETTER CHE - u'\u0448' # 0x00e8 -> CYRILLIC SMALL LETTER SHA - u'\u0449' # 0x00e9 -> CYRILLIC SMALL LETTER SHCHA - u'\u044a' # 0x00ea -> CYRILLIC SMALL LETTER HARD SIGN - u'\u044b' # 0x00eb -> CYRILLIC SMALL LETTER YERU - u'\u044c' # 0x00ec -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044d' # 0x00ed -> CYRILLIC SMALL LETTER E - u'\u044e' # 0x00ee -> CYRILLIC SMALL LETTER YU - u'\u044f' # 0x00ef -> CYRILLIC SMALL LETTER YA - u'\u0401' # 0x00f0 -> CYRILLIC CAPITAL LETTER IO - u'\u0451' # 0x00f1 -> CYRILLIC SMALL LETTER IO - u'\u0404' # 0x00f2 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u0454' # 0x00f3 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u0407' # 0x00f4 -> CYRILLIC CAPITAL LETTER YI - u'\u0457' # 0x00f5 -> CYRILLIC SMALL LETTER YI - u'\u040e' # 0x00f6 -> CYRILLIC CAPITAL LETTER SHORT U - u'\u045e' # 0x00f7 -> CYRILLIC SMALL LETTER SHORT U - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u2116' # 0x00fc -> NUMERO SIGN - u'\xa4' # 0x00fd -> CURRENCY SIGN - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\u0410' # 0x0080 -> CYRILLIC CAPITAL LETTER A + '\u0411' # 0x0081 -> CYRILLIC CAPITAL LETTER BE + '\u0412' # 0x0082 -> CYRILLIC CAPITAL LETTER VE + '\u0413' # 0x0083 -> CYRILLIC CAPITAL LETTER GHE + '\u0414' # 0x0084 -> CYRILLIC CAPITAL LETTER DE + '\u0415' # 0x0085 -> CYRILLIC CAPITAL LETTER IE + '\u0416' # 0x0086 -> CYRILLIC CAPITAL LETTER ZHE + '\u0417' # 0x0087 -> CYRILLIC CAPITAL LETTER ZE + '\u0418' # 0x0088 -> CYRILLIC CAPITAL LETTER I + '\u0419' # 0x0089 -> CYRILLIC CAPITAL LETTER SHORT I + '\u041a' # 0x008a -> CYRILLIC CAPITAL LETTER KA + '\u041b' # 0x008b -> CYRILLIC CAPITAL LETTER EL + '\u041c' # 0x008c -> CYRILLIC CAPITAL LETTER EM + '\u041d' # 0x008d -> CYRILLIC CAPITAL LETTER EN + '\u041e' # 0x008e -> CYRILLIC CAPITAL LETTER O + '\u041f' # 0x008f -> CYRILLIC CAPITAL LETTER PE + '\u0420' # 0x0090 -> CYRILLIC CAPITAL LETTER ER + '\u0421' # 0x0091 -> CYRILLIC CAPITAL LETTER ES + '\u0422' # 0x0092 -> CYRILLIC CAPITAL LETTER TE + '\u0423' # 0x0093 -> CYRILLIC CAPITAL LETTER U + '\u0424' # 0x0094 -> CYRILLIC CAPITAL LETTER EF + '\u0425' # 0x0095 -> CYRILLIC CAPITAL LETTER HA + '\u0426' # 0x0096 -> CYRILLIC CAPITAL LETTER TSE + '\u0427' # 0x0097 -> CYRILLIC CAPITAL LETTER CHE + '\u0428' # 0x0098 -> CYRILLIC CAPITAL LETTER SHA + '\u0429' # 0x0099 -> CYRILLIC CAPITAL LETTER SHCHA + '\u042a' # 0x009a -> CYRILLIC CAPITAL LETTER HARD SIGN + '\u042b' # 0x009b -> CYRILLIC CAPITAL LETTER YERU + '\u042c' # 0x009c -> CYRILLIC CAPITAL LETTER SOFT SIGN + '\u042d' # 0x009d -> CYRILLIC CAPITAL LETTER E + '\u042e' # 0x009e -> CYRILLIC CAPITAL LETTER YU + '\u042f' # 0x009f -> CYRILLIC CAPITAL LETTER YA + '\u0430' # 0x00a0 -> CYRILLIC SMALL LETTER A + '\u0431' # 0x00a1 -> CYRILLIC SMALL LETTER BE + '\u0432' # 0x00a2 -> CYRILLIC SMALL LETTER VE + '\u0433' # 0x00a3 -> CYRILLIC SMALL LETTER GHE + '\u0434' # 0x00a4 -> CYRILLIC SMALL LETTER DE + '\u0435' # 0x00a5 -> CYRILLIC SMALL LETTER IE + '\u0436' # 0x00a6 -> CYRILLIC SMALL LETTER ZHE + '\u0437' # 0x00a7 -> CYRILLIC SMALL LETTER ZE + '\u0438' # 0x00a8 -> CYRILLIC SMALL LETTER I + '\u0439' # 0x00a9 -> CYRILLIC SMALL LETTER SHORT I + '\u043a' # 0x00aa -> CYRILLIC SMALL LETTER KA + '\u043b' # 0x00ab -> CYRILLIC SMALL LETTER EL + '\u043c' # 0x00ac -> CYRILLIC SMALL LETTER EM + '\u043d' # 0x00ad -> CYRILLIC SMALL LETTER EN + '\u043e' # 0x00ae -> CYRILLIC SMALL LETTER O + '\u043f' # 0x00af -> CYRILLIC SMALL LETTER PE + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + '\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + '\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + '\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + '\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + '\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + '\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + '\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u258c' # 0x00dd -> LEFT HALF BLOCK + '\u2590' # 0x00de -> RIGHT HALF BLOCK + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u0440' # 0x00e0 -> CYRILLIC SMALL LETTER ER + '\u0441' # 0x00e1 -> CYRILLIC SMALL LETTER ES + '\u0442' # 0x00e2 -> CYRILLIC SMALL LETTER TE + '\u0443' # 0x00e3 -> CYRILLIC SMALL LETTER U + '\u0444' # 0x00e4 -> CYRILLIC SMALL LETTER EF + '\u0445' # 0x00e5 -> CYRILLIC SMALL LETTER HA + '\u0446' # 0x00e6 -> CYRILLIC SMALL LETTER TSE + '\u0447' # 0x00e7 -> CYRILLIC SMALL LETTER CHE + '\u0448' # 0x00e8 -> CYRILLIC SMALL LETTER SHA + '\u0449' # 0x00e9 -> CYRILLIC SMALL LETTER SHCHA + '\u044a' # 0x00ea -> CYRILLIC SMALL LETTER HARD SIGN + '\u044b' # 0x00eb -> CYRILLIC SMALL LETTER YERU + '\u044c' # 0x00ec -> CYRILLIC SMALL LETTER SOFT SIGN + '\u044d' # 0x00ed -> CYRILLIC SMALL LETTER E + '\u044e' # 0x00ee -> CYRILLIC SMALL LETTER YU + '\u044f' # 0x00ef -> CYRILLIC SMALL LETTER YA + '\u0401' # 0x00f0 -> CYRILLIC CAPITAL LETTER IO + '\u0451' # 0x00f1 -> CYRILLIC SMALL LETTER IO + '\u0404' # 0x00f2 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE + '\u0454' # 0x00f3 -> CYRILLIC SMALL LETTER UKRAINIAN IE + '\u0407' # 0x00f4 -> CYRILLIC CAPITAL LETTER YI + '\u0457' # 0x00f5 -> CYRILLIC SMALL LETTER YI + '\u040e' # 0x00f6 -> CYRILLIC CAPITAL LETTER SHORT U + '\u045e' # 0x00f7 -> CYRILLIC SMALL LETTER SHORT U + '\xb0' # 0x00f8 -> DEGREE SIGN + '\u2219' # 0x00f9 -> BULLET OPERATOR + '\xb7' # 0x00fa -> MIDDLE DOT + '\u221a' # 0x00fb -> SQUARE ROOT + '\u2116' # 0x00fc -> NUMERO SIGN + '\xa4' # 0x00fd -> CURRENCY SIGN + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp869.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp869.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp869.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\ufffe' # 0x0080 -> UNDEFINED - u'\ufffe' # 0x0081 -> UNDEFINED - u'\ufffe' # 0x0082 -> UNDEFINED - u'\ufffe' # 0x0083 -> UNDEFINED - u'\ufffe' # 0x0084 -> UNDEFINED - u'\ufffe' # 0x0085 -> UNDEFINED - u'\u0386' # 0x0086 -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\ufffe' # 0x0087 -> UNDEFINED - u'\xb7' # 0x0088 -> MIDDLE DOT - u'\xac' # 0x0089 -> NOT SIGN - u'\xa6' # 0x008a -> BROKEN BAR - u'\u2018' # 0x008b -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x008c -> RIGHT SINGLE QUOTATION MARK - u'\u0388' # 0x008d -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u2015' # 0x008e -> HORIZONTAL BAR - u'\u0389' # 0x008f -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0x0090 -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\u03aa' # 0x0091 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u038c' # 0x0092 -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\ufffe' # 0x0093 -> UNDEFINED - u'\ufffe' # 0x0094 -> UNDEFINED - u'\u038e' # 0x0095 -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u03ab' # 0x0096 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\xa9' # 0x0097 -> COPYRIGHT SIGN - u'\u038f' # 0x0098 -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\xb2' # 0x0099 -> SUPERSCRIPT TWO - u'\xb3' # 0x009a -> SUPERSCRIPT THREE - u'\u03ac' # 0x009b -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\xa3' # 0x009c -> POUND SIGN - u'\u03ad' # 0x009d -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0x009e -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03af' # 0x009f -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03ca' # 0x00a0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u0390' # 0x00a1 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u03cc' # 0x00a2 -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0x00a3 -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u0391' # 0x00a4 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0x00a5 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0x00a6 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0x00a7 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0x00a8 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0x00a9 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0x00aa -> GREEK CAPITAL LETTER ETA - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\u0398' # 0x00ac -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0x00ad -> GREEK CAPITAL LETTER IOTA - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u039a' # 0x00b5 -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0x00b6 -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0x00b7 -> GREEK CAPITAL LETTER MU - u'\u039d' # 0x00b8 -> GREEK CAPITAL LETTER NU - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u039e' # 0x00bd -> GREEK CAPITAL LETTER XI - u'\u039f' # 0x00be -> GREEK CAPITAL LETTER OMICRON - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u03a0' # 0x00c6 -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0x00c7 -> GREEK CAPITAL LETTER RHO - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u03a3' # 0x00cf -> GREEK CAPITAL LETTER SIGMA - u'\u03a4' # 0x00d0 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0x00d1 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0x00d2 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0x00d3 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0x00d4 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0x00d5 -> GREEK CAPITAL LETTER OMEGA - u'\u03b1' # 0x00d6 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0x00d7 -> GREEK SMALL LETTER BETA - u'\u03b3' # 0x00d8 -> GREEK SMALL LETTER GAMMA - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u03b4' # 0x00dd -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0x00de -> GREEK SMALL LETTER EPSILON - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b6' # 0x00e0 -> GREEK SMALL LETTER ZETA - u'\u03b7' # 0x00e1 -> GREEK SMALL LETTER ETA - u'\u03b8' # 0x00e2 -> GREEK SMALL LETTER THETA - u'\u03b9' # 0x00e3 -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0x00e4 -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0x00e5 -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0x00e6 -> GREEK SMALL LETTER MU - u'\u03bd' # 0x00e7 -> GREEK SMALL LETTER NU - u'\u03be' # 0x00e8 -> GREEK SMALL LETTER XI - u'\u03bf' # 0x00e9 -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0x00ea -> GREEK SMALL LETTER PI - u'\u03c1' # 0x00eb -> GREEK SMALL LETTER RHO - u'\u03c3' # 0x00ec -> GREEK SMALL LETTER SIGMA - u'\u03c2' # 0x00ed -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c4' # 0x00ee -> GREEK SMALL LETTER TAU - u'\u0384' # 0x00ef -> GREEK TONOS - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u03c5' # 0x00f2 -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0x00f3 -> GREEK SMALL LETTER PHI - u'\u03c7' # 0x00f4 -> GREEK SMALL LETTER CHI - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\u03c8' # 0x00f6 -> GREEK SMALL LETTER PSI - u'\u0385' # 0x00f7 -> GREEK DIALYTIKA TONOS - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\xa8' # 0x00f9 -> DIAERESIS - u'\u03c9' # 0x00fa -> GREEK SMALL LETTER OMEGA - u'\u03cb' # 0x00fb -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03b0' # 0x00fc -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\u03ce' # 0x00fd -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE + '\x00' # 0x0000 -> NULL + '\x01' # 0x0001 -> START OF HEADING + '\x02' # 0x0002 -> START OF TEXT + '\x03' # 0x0003 -> END OF TEXT + '\x04' # 0x0004 -> END OF TRANSMISSION + '\x05' # 0x0005 -> ENQUIRY + '\x06' # 0x0006 -> ACKNOWLEDGE + '\x07' # 0x0007 -> BELL + '\x08' # 0x0008 -> BACKSPACE + '\t' # 0x0009 -> HORIZONTAL TABULATION + '\n' # 0x000a -> LINE FEED + '\x0b' # 0x000b -> VERTICAL TABULATION + '\x0c' # 0x000c -> FORM FEED + '\r' # 0x000d -> CARRIAGE RETURN + '\x0e' # 0x000e -> SHIFT OUT + '\x0f' # 0x000f -> SHIFT IN + '\x10' # 0x0010 -> DATA LINK ESCAPE + '\x11' # 0x0011 -> DEVICE CONTROL ONE + '\x12' # 0x0012 -> DEVICE CONTROL TWO + '\x13' # 0x0013 -> DEVICE CONTROL THREE + '\x14' # 0x0014 -> DEVICE CONTROL FOUR + '\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x0016 -> SYNCHRONOUS IDLE + '\x17' # 0x0017 -> END OF TRANSMISSION BLOCK + '\x18' # 0x0018 -> CANCEL + '\x19' # 0x0019 -> END OF MEDIUM + '\x1a' # 0x001a -> SUBSTITUTE + '\x1b' # 0x001b -> ESCAPE + '\x1c' # 0x001c -> FILE SEPARATOR + '\x1d' # 0x001d -> GROUP SEPARATOR + '\x1e' # 0x001e -> RECORD SEPARATOR + '\x1f' # 0x001f -> UNIT SEPARATOR + ' ' # 0x0020 -> SPACE + '!' # 0x0021 -> EXCLAMATION MARK + '"' # 0x0022 -> QUOTATION MARK + '#' # 0x0023 -> NUMBER SIGN + '$' # 0x0024 -> DOLLAR SIGN + '%' # 0x0025 -> PERCENT SIGN + '&' # 0x0026 -> AMPERSAND + "'" # 0x0027 -> APOSTROPHE + '(' # 0x0028 -> LEFT PARENTHESIS + ')' # 0x0029 -> RIGHT PARENTHESIS + '*' # 0x002a -> ASTERISK + '+' # 0x002b -> PLUS SIGN + ',' # 0x002c -> COMMA + '-' # 0x002d -> HYPHEN-MINUS + '.' # 0x002e -> FULL STOP + '/' # 0x002f -> SOLIDUS + '0' # 0x0030 -> DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE + '2' # 0x0032 -> DIGIT TWO + '3' # 0x0033 -> DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE + ':' # 0x003a -> COLON + ';' # 0x003b -> SEMICOLON + '<' # 0x003c -> LESS-THAN SIGN + '=' # 0x003d -> EQUALS SIGN + '>' # 0x003e -> GREATER-THAN SIGN + '?' # 0x003f -> QUESTION MARK + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET + '\\' # 0x005c -> REVERSE SOLIDUS + ']' # 0x005d -> RIGHT SQUARE BRACKET + '^' # 0x005e -> CIRCUMFLEX ACCENT + '_' # 0x005f -> LOW LINE + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET + '|' # 0x007c -> VERTICAL LINE + '}' # 0x007d -> RIGHT CURLY BRACKET + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> DELETE + '\ufffe' # 0x0080 -> UNDEFINED + '\ufffe' # 0x0081 -> UNDEFINED + '\ufffe' # 0x0082 -> UNDEFINED + '\ufffe' # 0x0083 -> UNDEFINED + '\ufffe' # 0x0084 -> UNDEFINED + '\ufffe' # 0x0085 -> UNDEFINED + '\u0386' # 0x0086 -> GREEK CAPITAL LETTER ALPHA WITH TONOS + '\ufffe' # 0x0087 -> UNDEFINED + '\xb7' # 0x0088 -> MIDDLE DOT + '\xac' # 0x0089 -> NOT SIGN + '\xa6' # 0x008a -> BROKEN BAR + '\u2018' # 0x008b -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x008c -> RIGHT SINGLE QUOTATION MARK + '\u0388' # 0x008d -> GREEK CAPITAL LETTER EPSILON WITH TONOS + '\u2015' # 0x008e -> HORIZONTAL BAR + '\u0389' # 0x008f -> GREEK CAPITAL LETTER ETA WITH TONOS + '\u038a' # 0x0090 -> GREEK CAPITAL LETTER IOTA WITH TONOS + '\u03aa' # 0x0091 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA + '\u038c' # 0x0092 -> GREEK CAPITAL LETTER OMICRON WITH TONOS + '\ufffe' # 0x0093 -> UNDEFINED + '\ufffe' # 0x0094 -> UNDEFINED + '\u038e' # 0x0095 -> GREEK CAPITAL LETTER UPSILON WITH TONOS + '\u03ab' # 0x0096 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA + '\xa9' # 0x0097 -> COPYRIGHT SIGN + '\u038f' # 0x0098 -> GREEK CAPITAL LETTER OMEGA WITH TONOS + '\xb2' # 0x0099 -> SUPERSCRIPT TWO + '\xb3' # 0x009a -> SUPERSCRIPT THREE + '\u03ac' # 0x009b -> GREEK SMALL LETTER ALPHA WITH TONOS + '\xa3' # 0x009c -> POUND SIGN + '\u03ad' # 0x009d -> GREEK SMALL LETTER EPSILON WITH TONOS + '\u03ae' # 0x009e -> GREEK SMALL LETTER ETA WITH TONOS + '\u03af' # 0x009f -> GREEK SMALL LETTER IOTA WITH TONOS + '\u03ca' # 0x00a0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA + '\u0390' # 0x00a1 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS + '\u03cc' # 0x00a2 -> GREEK SMALL LETTER OMICRON WITH TONOS + '\u03cd' # 0x00a3 -> GREEK SMALL LETTER UPSILON WITH TONOS + '\u0391' # 0x00a4 -> GREEK CAPITAL LETTER ALPHA + '\u0392' # 0x00a5 -> GREEK CAPITAL LETTER BETA + '\u0393' # 0x00a6 -> GREEK CAPITAL LETTER GAMMA + '\u0394' # 0x00a7 -> GREEK CAPITAL LETTER DELTA + '\u0395' # 0x00a8 -> GREEK CAPITAL LETTER EPSILON + '\u0396' # 0x00a9 -> GREEK CAPITAL LETTER ZETA + '\u0397' # 0x00aa -> GREEK CAPITAL LETTER ETA + '\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF + '\u0398' # 0x00ac -> GREEK CAPITAL LETTER THETA + '\u0399' # 0x00ad -> GREEK CAPITAL LETTER IOTA + '\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2591' # 0x00b0 -> LIGHT SHADE + '\u2592' # 0x00b1 -> MEDIUM SHADE + '\u2593' # 0x00b2 -> DARK SHADE + '\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL + '\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u039a' # 0x00b5 -> GREEK CAPITAL LETTER KAPPA + '\u039b' # 0x00b6 -> GREEK CAPITAL LETTER LAMDA + '\u039c' # 0x00b7 -> GREEK CAPITAL LETTER MU + '\u039d' # 0x00b8 -> GREEK CAPITAL LETTER NU + '\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL + '\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u039e' # 0x00bd -> GREEK CAPITAL LETTER XI + '\u039f' # 0x00be -> GREEK CAPITAL LETTER OMICRON + '\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u03a0' # 0x00c6 -> GREEK CAPITAL LETTER PI + '\u03a1' # 0x00c7 -> GREEK CAPITAL LETTER RHO + '\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\u03a3' # 0x00cf -> GREEK CAPITAL LETTER SIGMA + '\u03a4' # 0x00d0 -> GREEK CAPITAL LETTER TAU + '\u03a5' # 0x00d1 -> GREEK CAPITAL LETTER UPSILON + '\u03a6' # 0x00d2 -> GREEK CAPITAL LETTER PHI + '\u03a7' # 0x00d3 -> GREEK CAPITAL LETTER CHI + '\u03a8' # 0x00d4 -> GREEK CAPITAL LETTER PSI + '\u03a9' # 0x00d5 -> GREEK CAPITAL LETTER OMEGA + '\u03b1' # 0x00d6 -> GREEK SMALL LETTER ALPHA + '\u03b2' # 0x00d7 -> GREEK SMALL LETTER BETA + '\u03b3' # 0x00d8 -> GREEK SMALL LETTER GAMMA + '\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2588' # 0x00db -> FULL BLOCK + '\u2584' # 0x00dc -> LOWER HALF BLOCK + '\u03b4' # 0x00dd -> GREEK SMALL LETTER DELTA + '\u03b5' # 0x00de -> GREEK SMALL LETTER EPSILON + '\u2580' # 0x00df -> UPPER HALF BLOCK + '\u03b6' # 0x00e0 -> GREEK SMALL LETTER ZETA + '\u03b7' # 0x00e1 -> GREEK SMALL LETTER ETA + '\u03b8' # 0x00e2 -> GREEK SMALL LETTER THETA + '\u03b9' # 0x00e3 -> GREEK SMALL LETTER IOTA + '\u03ba' # 0x00e4 -> GREEK SMALL LETTER KAPPA + '\u03bb' # 0x00e5 -> GREEK SMALL LETTER LAMDA + '\u03bc' # 0x00e6 -> GREEK SMALL LETTER MU + '\u03bd' # 0x00e7 -> GREEK SMALL LETTER NU + '\u03be' # 0x00e8 -> GREEK SMALL LETTER XI + '\u03bf' # 0x00e9 -> GREEK SMALL LETTER OMICRON + '\u03c0' # 0x00ea -> GREEK SMALL LETTER PI + '\u03c1' # 0x00eb -> GREEK SMALL LETTER RHO + '\u03c3' # 0x00ec -> GREEK SMALL LETTER SIGMA + '\u03c2' # 0x00ed -> GREEK SMALL LETTER FINAL SIGMA + '\u03c4' # 0x00ee -> GREEK SMALL LETTER TAU + '\u0384' # 0x00ef -> GREEK TONOS + '\xad' # 0x00f0 -> SOFT HYPHEN + '\xb1' # 0x00f1 -> PLUS-MINUS SIGN + '\u03c5' # 0x00f2 -> GREEK SMALL LETTER UPSILON + '\u03c6' # 0x00f3 -> GREEK SMALL LETTER PHI + '\u03c7' # 0x00f4 -> GREEK SMALL LETTER CHI + '\xa7' # 0x00f5 -> SECTION SIGN + '\u03c8' # 0x00f6 -> GREEK SMALL LETTER PSI + '\u0385' # 0x00f7 -> GREEK DIALYTIKA TONOS + '\xb0' # 0x00f8 -> DEGREE SIGN + '\xa8' # 0x00f9 -> DIAERESIS + '\u03c9' # 0x00fa -> GREEK SMALL LETTER OMEGA + '\u03cb' # 0x00fb -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA + '\u03b0' # 0x00fc -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS + '\u03ce' # 0x00fd -> GREEK SMALL LETTER OMEGA WITH TONOS + '\u25a0' # 0x00fe -> BLACK SQUARE + '\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/cp874.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp874.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp874.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\ufffe' # 0x82 -> UNDEFINED - u'\ufffe' # 0x83 -> UNDEFINED - u'\ufffe' # 0x84 -> UNDEFINED - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\ufffe' # 0x86 -> UNDEFINED - u'\ufffe' # 0x87 -> UNDEFINED - u'\ufffe' # 0x88 -> UNDEFINED - u'\ufffe' # 0x89 -> UNDEFINED - u'\ufffe' # 0x8A -> UNDEFINED - u'\ufffe' # 0x8B -> UNDEFINED - u'\ufffe' # 0x8C -> UNDEFINED - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\ufffe' # 0x99 -> UNDEFINED - u'\ufffe' # 0x9A -> UNDEFINED - u'\ufffe' # 0x9B -> UNDEFINED - u'\ufffe' # 0x9C -> UNDEFINED - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\ufffe' # 0x9F -> UNDEFINED - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0e01' # 0xA1 -> THAI CHARACTER KO KAI - u'\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI - u'\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT - u'\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI - u'\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON - u'\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG - u'\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU - u'\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN - u'\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING - u'\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG - u'\u0e0b' # 0xAB -> THAI CHARACTER SO SO - u'\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE - u'\u0e0d' # 0xAD -> THAI CHARACTER YO YING - u'\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA - u'\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK - u'\u0e10' # 0xB0 -> THAI CHARACTER THO THAN - u'\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO - u'\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO - u'\u0e13' # 0xB3 -> THAI CHARACTER NO NEN - u'\u0e14' # 0xB4 -> THAI CHARACTER DO DEK - u'\u0e15' # 0xB5 -> THAI CHARACTER TO TAO - u'\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG - u'\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN - u'\u0e18' # 0xB8 -> THAI CHARACTER THO THONG - u'\u0e19' # 0xB9 -> THAI CHARACTER NO NU - u'\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI - u'\u0e1b' # 0xBB -> THAI CHARACTER PO PLA - u'\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG - u'\u0e1d' # 0xBD -> THAI CHARACTER FO FA - u'\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN - u'\u0e1f' # 0xBF -> THAI CHARACTER FO FAN - u'\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO - u'\u0e21' # 0xC1 -> THAI CHARACTER MO MA - u'\u0e22' # 0xC2 -> THAI CHARACTER YO YAK - u'\u0e23' # 0xC3 -> THAI CHARACTER RO RUA - u'\u0e24' # 0xC4 -> THAI CHARACTER RU - u'\u0e25' # 0xC5 -> THAI CHARACTER LO LING - u'\u0e26' # 0xC6 -> THAI CHARACTER LU - u'\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN - u'\u0e28' # 0xC8 -> THAI CHARACTER SO SALA - u'\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI - u'\u0e2a' # 0xCA -> THAI CHARACTER SO SUA - u'\u0e2b' # 0xCB -> THAI CHARACTER HO HIP - u'\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA - u'\u0e2d' # 0xCD -> THAI CHARACTER O ANG - u'\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK - u'\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI - u'\u0e30' # 0xD0 -> THAI CHARACTER SARA A - u'\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT - u'\u0e32' # 0xD2 -> THAI CHARACTER SARA AA - u'\u0e33' # 0xD3 -> THAI CHARACTER SARA AM - u'\u0e34' # 0xD4 -> THAI CHARACTER SARA I - u'\u0e35' # 0xD5 -> THAI CHARACTER SARA II - u'\u0e36' # 0xD6 -> THAI CHARACTER SARA UE - u'\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE - u'\u0e38' # 0xD8 -> THAI CHARACTER SARA U - u'\u0e39' # 0xD9 -> THAI CHARACTER SARA UU - u'\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU - u'\ufffe' # 0xDB -> UNDEFINED - u'\ufffe' # 0xDC -> UNDEFINED - u'\ufffe' # 0xDD -> UNDEFINED - u'\ufffe' # 0xDE -> UNDEFINED - u'\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT - u'\u0e40' # 0xE0 -> THAI CHARACTER SARA E - u'\u0e41' # 0xE1 -> THAI CHARACTER SARA AE - u'\u0e42' # 0xE2 -> THAI CHARACTER SARA O - u'\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN - u'\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI - u'\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO - u'\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK - u'\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU - u'\u0e48' # 0xE8 -> THAI CHARACTER MAI EK - u'\u0e49' # 0xE9 -> THAI CHARACTER MAI THO - u'\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI - u'\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA - u'\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT - u'\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT - u'\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN - u'\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN - u'\u0e50' # 0xF0 -> THAI DIGIT ZERO - u'\u0e51' # 0xF1 -> THAI DIGIT ONE - u'\u0e52' # 0xF2 -> THAI DIGIT TWO - u'\u0e53' # 0xF3 -> THAI DIGIT THREE - u'\u0e54' # 0xF4 -> THAI DIGIT FOUR - u'\u0e55' # 0xF5 -> THAI DIGIT FIVE - u'\u0e56' # 0xF6 -> THAI DIGIT SIX - u'\u0e57' # 0xF7 -> THAI DIGIT SEVEN - u'\u0e58' # 0xF8 -> THAI DIGIT EIGHT - u'\u0e59' # 0xF9 -> THAI DIGIT NINE - u'\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU - u'\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT - u'\ufffe' # 0xFC -> UNDEFINED - u'\ufffe' # 0xFD -> UNDEFINED - u'\ufffe' # 0xFE -> UNDEFINED - u'\ufffe' # 0xFF -> UNDEFINED + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u20ac' # 0x80 -> EURO SIGN + '\ufffe' # 0x81 -> UNDEFINED + '\ufffe' # 0x82 -> UNDEFINED + '\ufffe' # 0x83 -> UNDEFINED + '\ufffe' # 0x84 -> UNDEFINED + '\u2026' # 0x85 -> HORIZONTAL ELLIPSIS + '\ufffe' # 0x86 -> UNDEFINED + '\ufffe' # 0x87 -> UNDEFINED + '\ufffe' # 0x88 -> UNDEFINED + '\ufffe' # 0x89 -> UNDEFINED + '\ufffe' # 0x8A -> UNDEFINED + '\ufffe' # 0x8B -> UNDEFINED + '\ufffe' # 0x8C -> UNDEFINED + '\ufffe' # 0x8D -> UNDEFINED + '\ufffe' # 0x8E -> UNDEFINED + '\ufffe' # 0x8F -> UNDEFINED + '\ufffe' # 0x90 -> UNDEFINED + '\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK + '\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK + '\u2022' # 0x95 -> BULLET + '\u2013' # 0x96 -> EN DASH + '\u2014' # 0x97 -> EM DASH + '\ufffe' # 0x98 -> UNDEFINED + '\ufffe' # 0x99 -> UNDEFINED + '\ufffe' # 0x9A -> UNDEFINED + '\ufffe' # 0x9B -> UNDEFINED + '\ufffe' # 0x9C -> UNDEFINED + '\ufffe' # 0x9D -> UNDEFINED + '\ufffe' # 0x9E -> UNDEFINED + '\ufffe' # 0x9F -> UNDEFINED + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u0e01' # 0xA1 -> THAI CHARACTER KO KAI + '\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI + '\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT + '\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI + '\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON + '\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG + '\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU + '\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN + '\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING + '\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG + '\u0e0b' # 0xAB -> THAI CHARACTER SO SO + '\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE + '\u0e0d' # 0xAD -> THAI CHARACTER YO YING + '\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA + '\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK + '\u0e10' # 0xB0 -> THAI CHARACTER THO THAN + '\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO + '\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO + '\u0e13' # 0xB3 -> THAI CHARACTER NO NEN + '\u0e14' # 0xB4 -> THAI CHARACTER DO DEK + '\u0e15' # 0xB5 -> THAI CHARACTER TO TAO + '\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG + '\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN + '\u0e18' # 0xB8 -> THAI CHARACTER THO THONG + '\u0e19' # 0xB9 -> THAI CHARACTER NO NU + '\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI + '\u0e1b' # 0xBB -> THAI CHARACTER PO PLA + '\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG + '\u0e1d' # 0xBD -> THAI CHARACTER FO FA + '\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN + '\u0e1f' # 0xBF -> THAI CHARACTER FO FAN + '\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO + '\u0e21' # 0xC1 -> THAI CHARACTER MO MA + '\u0e22' # 0xC2 -> THAI CHARACTER YO YAK + '\u0e23' # 0xC3 -> THAI CHARACTER RO RUA + '\u0e24' # 0xC4 -> THAI CHARACTER RU + '\u0e25' # 0xC5 -> THAI CHARACTER LO LING + '\u0e26' # 0xC6 -> THAI CHARACTER LU + '\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN + '\u0e28' # 0xC8 -> THAI CHARACTER SO SALA + '\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI + '\u0e2a' # 0xCA -> THAI CHARACTER SO SUA + '\u0e2b' # 0xCB -> THAI CHARACTER HO HIP + '\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA + '\u0e2d' # 0xCD -> THAI CHARACTER O ANG + '\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK + '\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI + '\u0e30' # 0xD0 -> THAI CHARACTER SARA A + '\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT + '\u0e32' # 0xD2 -> THAI CHARACTER SARA AA + '\u0e33' # 0xD3 -> THAI CHARACTER SARA AM + '\u0e34' # 0xD4 -> THAI CHARACTER SARA I + '\u0e35' # 0xD5 -> THAI CHARACTER SARA II + '\u0e36' # 0xD6 -> THAI CHARACTER SARA UE + '\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE + '\u0e38' # 0xD8 -> THAI CHARACTER SARA U + '\u0e39' # 0xD9 -> THAI CHARACTER SARA UU + '\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU + '\ufffe' # 0xDB -> UNDEFINED + '\ufffe' # 0xDC -> UNDEFINED + '\ufffe' # 0xDD -> UNDEFINED + '\ufffe' # 0xDE -> UNDEFINED + '\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT + '\u0e40' # 0xE0 -> THAI CHARACTER SARA E + '\u0e41' # 0xE1 -> THAI CHARACTER SARA AE + '\u0e42' # 0xE2 -> THAI CHARACTER SARA O + '\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN + '\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI + '\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO + '\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK + '\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU + '\u0e48' # 0xE8 -> THAI CHARACTER MAI EK + '\u0e49' # 0xE9 -> THAI CHARACTER MAI THO + '\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI + '\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA + '\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT + '\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT + '\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN + '\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN + '\u0e50' # 0xF0 -> THAI DIGIT ZERO + '\u0e51' # 0xF1 -> THAI DIGIT ONE + '\u0e52' # 0xF2 -> THAI DIGIT TWO + '\u0e53' # 0xF3 -> THAI DIGIT THREE + '\u0e54' # 0xF4 -> THAI DIGIT FOUR + '\u0e55' # 0xF5 -> THAI DIGIT FIVE + '\u0e56' # 0xF6 -> THAI DIGIT SIX + '\u0e57' # 0xF7 -> THAI DIGIT SEVEN + '\u0e58' # 0xF8 -> THAI DIGIT EIGHT + '\u0e59' # 0xF9 -> THAI DIGIT NINE + '\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU + '\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT + '\ufffe' # 0xFC -> UNDEFINED + '\ufffe' # 0xFD -> UNDEFINED + '\ufffe' # 0xFE -> UNDEFINED + '\ufffe' # 0xFF -> UNDEFINED ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/cp875.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/cp875.py (original) +++ python/branches/py3k-struni/Lib/encodings/cp875.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\u0391' # 0x41 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0x42 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0x43 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0x44 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0x45 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0x46 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0x47 -> GREEK CAPITAL LETTER ETA - u'\u0398' # 0x48 -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0x49 -> GREEK CAPITAL LETTER IOTA - u'[' # 0x4A -> LEFT SQUARE BRACKET - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'!' # 0x4F -> EXCLAMATION MARK - u'&' # 0x50 -> AMPERSAND - u'\u039a' # 0x51 -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0x52 -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0x53 -> GREEK CAPITAL LETTER MU - u'\u039d' # 0x54 -> GREEK CAPITAL LETTER NU - u'\u039e' # 0x55 -> GREEK CAPITAL LETTER XI - u'\u039f' # 0x56 -> GREEK CAPITAL LETTER OMICRON - u'\u03a0' # 0x57 -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0x58 -> GREEK CAPITAL LETTER RHO - u'\u03a3' # 0x59 -> GREEK CAPITAL LETTER SIGMA - u']' # 0x5A -> RIGHT SQUARE BRACKET - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'^' # 0x5F -> CIRCUMFLEX ACCENT - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\u03a4' # 0x62 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0x63 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0x64 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0x65 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0x66 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0x67 -> GREEK CAPITAL LETTER OMEGA - u'\u03aa' # 0x68 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u03ab' # 0x69 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'|' # 0x6A -> VERTICAL LINE - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xa8' # 0x70 -> DIAERESIS - u'\u0386' # 0x71 -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\u0388' # 0x72 -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0389' # 0x73 -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\xa0' # 0x74 -> NO-BREAK SPACE - u'\u038a' # 0x75 -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\u038c' # 0x76 -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\u038e' # 0x77 -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u038f' # 0x78 -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\u0385' # 0x80 -> GREEK DIALYTIKA TONOS - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\u03b1' # 0x8A -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0x8B -> GREEK SMALL LETTER BETA - u'\u03b3' # 0x8C -> GREEK SMALL LETTER GAMMA - u'\u03b4' # 0x8D -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0x8E -> GREEK SMALL LETTER EPSILON - u'\u03b6' # 0x8F -> GREEK SMALL LETTER ZETA - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\u03b7' # 0x9A -> GREEK SMALL LETTER ETA - u'\u03b8' # 0x9B -> GREEK SMALL LETTER THETA - u'\u03b9' # 0x9C -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0x9D -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0x9E -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0x9F -> GREEK SMALL LETTER MU - u'\xb4' # 0xA0 -> ACUTE ACCENT - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\u03bd' # 0xAA -> GREEK SMALL LETTER NU - u'\u03be' # 0xAB -> GREEK SMALL LETTER XI - u'\u03bf' # 0xAC -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0xAD -> GREEK SMALL LETTER PI - u'\u03c1' # 0xAE -> GREEK SMALL LETTER RHO - u'\u03c3' # 0xAF -> GREEK SMALL LETTER SIGMA - u'\xa3' # 0xB0 -> POUND SIGN - u'\u03ac' # 0xB1 -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u03ad' # 0xB2 -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0xB3 -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03ca' # 0xB4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03af' # 0xB5 -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03cc' # 0xB6 -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0xB7 -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03cb' # 0xB8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03ce' # 0xB9 -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\u03c2' # 0xBA -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c4' # 0xBB -> GREEK SMALL LETTER TAU - u'\u03c5' # 0xBC -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0xBD -> GREEK SMALL LETTER PHI - u'\u03c7' # 0xBE -> GREEK SMALL LETTER CHI - u'\u03c8' # 0xBF -> GREEK SMALL LETTER PSI - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\u03c9' # 0xCB -> GREEK SMALL LETTER OMEGA - u'\u0390' # 0xCC -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u03b0' # 0xCD -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\u2018' # 0xCE -> LEFT SINGLE QUOTATION MARK - u'\u2015' # 0xCF -> HORIZONTAL BAR - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb1' # 0xDA -> PLUS-MINUS SIGN - u'\xbd' # 0xDB -> VULGAR FRACTION ONE HALF - u'\x1a' # 0xDC -> SUBSTITUTE - u'\u0387' # 0xDD -> GREEK ANO TELEIA - u'\u2019' # 0xDE -> RIGHT SINGLE QUOTATION MARK - u'\xa6' # 0xDF -> BROKEN BAR - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\x1a' # 0xE1 -> SUBSTITUTE - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xa7' # 0xEB -> SECTION SIGN - u'\x1a' # 0xEC -> SUBSTITUTE - u'\x1a' # 0xED -> SUBSTITUTE - u'\xab' # 0xEE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xEF -> NOT SIGN - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xa9' # 0xFB -> COPYRIGHT SIGN - u'\x1a' # 0xFC -> SUBSTITUTE - u'\x1a' # 0xFD -> SUBSTITUTE - u'\xbb' # 0xFE -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\x9f' # 0xFF -> CONTROL + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x9c' # 0x04 -> CONTROL + '\t' # 0x05 -> HORIZONTAL TABULATION + '\x86' # 0x06 -> CONTROL + '\x7f' # 0x07 -> DELETE + '\x97' # 0x08 -> CONTROL + '\x8d' # 0x09 -> CONTROL + '\x8e' # 0x0A -> CONTROL + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x9d' # 0x14 -> CONTROL + '\x85' # 0x15 -> CONTROL + '\x08' # 0x16 -> BACKSPACE + '\x87' # 0x17 -> CONTROL + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x92' # 0x1A -> CONTROL + '\x8f' # 0x1B -> CONTROL + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + '\x80' # 0x20 -> CONTROL + '\x81' # 0x21 -> CONTROL + '\x82' # 0x22 -> CONTROL + '\x83' # 0x23 -> CONTROL + '\x84' # 0x24 -> CONTROL + '\n' # 0x25 -> LINE FEED + '\x17' # 0x26 -> END OF TRANSMISSION BLOCK + '\x1b' # 0x27 -> ESCAPE + '\x88' # 0x28 -> CONTROL + '\x89' # 0x29 -> CONTROL + '\x8a' # 0x2A -> CONTROL + '\x8b' # 0x2B -> CONTROL + '\x8c' # 0x2C -> CONTROL + '\x05' # 0x2D -> ENQUIRY + '\x06' # 0x2E -> ACKNOWLEDGE + '\x07' # 0x2F -> BELL + '\x90' # 0x30 -> CONTROL + '\x91' # 0x31 -> CONTROL + '\x16' # 0x32 -> SYNCHRONOUS IDLE + '\x93' # 0x33 -> CONTROL + '\x94' # 0x34 -> CONTROL + '\x95' # 0x35 -> CONTROL + '\x96' # 0x36 -> CONTROL + '\x04' # 0x37 -> END OF TRANSMISSION + '\x98' # 0x38 -> CONTROL + '\x99' # 0x39 -> CONTROL + '\x9a' # 0x3A -> CONTROL + '\x9b' # 0x3B -> CONTROL + '\x14' # 0x3C -> DEVICE CONTROL FOUR + '\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE + '\x9e' # 0x3E -> CONTROL + '\x1a' # 0x3F -> SUBSTITUTE + ' ' # 0x40 -> SPACE + '\u0391' # 0x41 -> GREEK CAPITAL LETTER ALPHA + '\u0392' # 0x42 -> GREEK CAPITAL LETTER BETA + '\u0393' # 0x43 -> GREEK CAPITAL LETTER GAMMA + '\u0394' # 0x44 -> GREEK CAPITAL LETTER DELTA + '\u0395' # 0x45 -> GREEK CAPITAL LETTER EPSILON + '\u0396' # 0x46 -> GREEK CAPITAL LETTER ZETA + '\u0397' # 0x47 -> GREEK CAPITAL LETTER ETA + '\u0398' # 0x48 -> GREEK CAPITAL LETTER THETA + '\u0399' # 0x49 -> GREEK CAPITAL LETTER IOTA + '[' # 0x4A -> LEFT SQUARE BRACKET + '.' # 0x4B -> FULL STOP + '<' # 0x4C -> LESS-THAN SIGN + '(' # 0x4D -> LEFT PARENTHESIS + '+' # 0x4E -> PLUS SIGN + '!' # 0x4F -> EXCLAMATION MARK + '&' # 0x50 -> AMPERSAND + '\u039a' # 0x51 -> GREEK CAPITAL LETTER KAPPA + '\u039b' # 0x52 -> GREEK CAPITAL LETTER LAMDA + '\u039c' # 0x53 -> GREEK CAPITAL LETTER MU + '\u039d' # 0x54 -> GREEK CAPITAL LETTER NU + '\u039e' # 0x55 -> GREEK CAPITAL LETTER XI + '\u039f' # 0x56 -> GREEK CAPITAL LETTER OMICRON + '\u03a0' # 0x57 -> GREEK CAPITAL LETTER PI + '\u03a1' # 0x58 -> GREEK CAPITAL LETTER RHO + '\u03a3' # 0x59 -> GREEK CAPITAL LETTER SIGMA + ']' # 0x5A -> RIGHT SQUARE BRACKET + '$' # 0x5B -> DOLLAR SIGN + '*' # 0x5C -> ASTERISK + ')' # 0x5D -> RIGHT PARENTHESIS + ';' # 0x5E -> SEMICOLON + '^' # 0x5F -> CIRCUMFLEX ACCENT + '-' # 0x60 -> HYPHEN-MINUS + '/' # 0x61 -> SOLIDUS + '\u03a4' # 0x62 -> GREEK CAPITAL LETTER TAU + '\u03a5' # 0x63 -> GREEK CAPITAL LETTER UPSILON + '\u03a6' # 0x64 -> GREEK CAPITAL LETTER PHI + '\u03a7' # 0x65 -> GREEK CAPITAL LETTER CHI + '\u03a8' # 0x66 -> GREEK CAPITAL LETTER PSI + '\u03a9' # 0x67 -> GREEK CAPITAL LETTER OMEGA + '\u03aa' # 0x68 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA + '\u03ab' # 0x69 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA + '|' # 0x6A -> VERTICAL LINE + ',' # 0x6B -> COMMA + '%' # 0x6C -> PERCENT SIGN + '_' # 0x6D -> LOW LINE + '>' # 0x6E -> GREATER-THAN SIGN + '?' # 0x6F -> QUESTION MARK + '\xa8' # 0x70 -> DIAERESIS + '\u0386' # 0x71 -> GREEK CAPITAL LETTER ALPHA WITH TONOS + '\u0388' # 0x72 -> GREEK CAPITAL LETTER EPSILON WITH TONOS + '\u0389' # 0x73 -> GREEK CAPITAL LETTER ETA WITH TONOS + '\xa0' # 0x74 -> NO-BREAK SPACE + '\u038a' # 0x75 -> GREEK CAPITAL LETTER IOTA WITH TONOS + '\u038c' # 0x76 -> GREEK CAPITAL LETTER OMICRON WITH TONOS + '\u038e' # 0x77 -> GREEK CAPITAL LETTER UPSILON WITH TONOS + '\u038f' # 0x78 -> GREEK CAPITAL LETTER OMEGA WITH TONOS + '`' # 0x79 -> GRAVE ACCENT + ':' # 0x7A -> COLON + '#' # 0x7B -> NUMBER SIGN + '@' # 0x7C -> COMMERCIAL AT + "'" # 0x7D -> APOSTROPHE + '=' # 0x7E -> EQUALS SIGN + '"' # 0x7F -> QUOTATION MARK + '\u0385' # 0x80 -> GREEK DIALYTIKA TONOS + 'a' # 0x81 -> LATIN SMALL LETTER A + 'b' # 0x82 -> LATIN SMALL LETTER B + 'c' # 0x83 -> LATIN SMALL LETTER C + 'd' # 0x84 -> LATIN SMALL LETTER D + 'e' # 0x85 -> LATIN SMALL LETTER E + 'f' # 0x86 -> LATIN SMALL LETTER F + 'g' # 0x87 -> LATIN SMALL LETTER G + 'h' # 0x88 -> LATIN SMALL LETTER H + 'i' # 0x89 -> LATIN SMALL LETTER I + '\u03b1' # 0x8A -> GREEK SMALL LETTER ALPHA + '\u03b2' # 0x8B -> GREEK SMALL LETTER BETA + '\u03b3' # 0x8C -> GREEK SMALL LETTER GAMMA + '\u03b4' # 0x8D -> GREEK SMALL LETTER DELTA + '\u03b5' # 0x8E -> GREEK SMALL LETTER EPSILON + '\u03b6' # 0x8F -> GREEK SMALL LETTER ZETA + '\xb0' # 0x90 -> DEGREE SIGN + 'j' # 0x91 -> LATIN SMALL LETTER J + 'k' # 0x92 -> LATIN SMALL LETTER K + 'l' # 0x93 -> LATIN SMALL LETTER L + 'm' # 0x94 -> LATIN SMALL LETTER M + 'n' # 0x95 -> LATIN SMALL LETTER N + 'o' # 0x96 -> LATIN SMALL LETTER O + 'p' # 0x97 -> LATIN SMALL LETTER P + 'q' # 0x98 -> LATIN SMALL LETTER Q + 'r' # 0x99 -> LATIN SMALL LETTER R + '\u03b7' # 0x9A -> GREEK SMALL LETTER ETA + '\u03b8' # 0x9B -> GREEK SMALL LETTER THETA + '\u03b9' # 0x9C -> GREEK SMALL LETTER IOTA + '\u03ba' # 0x9D -> GREEK SMALL LETTER KAPPA + '\u03bb' # 0x9E -> GREEK SMALL LETTER LAMDA + '\u03bc' # 0x9F -> GREEK SMALL LETTER MU + '\xb4' # 0xA0 -> ACUTE ACCENT + '~' # 0xA1 -> TILDE + 's' # 0xA2 -> LATIN SMALL LETTER S + 't' # 0xA3 -> LATIN SMALL LETTER T + 'u' # 0xA4 -> LATIN SMALL LETTER U + 'v' # 0xA5 -> LATIN SMALL LETTER V + 'w' # 0xA6 -> LATIN SMALL LETTER W + 'x' # 0xA7 -> LATIN SMALL LETTER X + 'y' # 0xA8 -> LATIN SMALL LETTER Y + 'z' # 0xA9 -> LATIN SMALL LETTER Z + '\u03bd' # 0xAA -> GREEK SMALL LETTER NU + '\u03be' # 0xAB -> GREEK SMALL LETTER XI + '\u03bf' # 0xAC -> GREEK SMALL LETTER OMICRON + '\u03c0' # 0xAD -> GREEK SMALL LETTER PI + '\u03c1' # 0xAE -> GREEK SMALL LETTER RHO + '\u03c3' # 0xAF -> GREEK SMALL LETTER SIGMA + '\xa3' # 0xB0 -> POUND SIGN + '\u03ac' # 0xB1 -> GREEK SMALL LETTER ALPHA WITH TONOS + '\u03ad' # 0xB2 -> GREEK SMALL LETTER EPSILON WITH TONOS + '\u03ae' # 0xB3 -> GREEK SMALL LETTER ETA WITH TONOS + '\u03ca' # 0xB4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA + '\u03af' # 0xB5 -> GREEK SMALL LETTER IOTA WITH TONOS + '\u03cc' # 0xB6 -> GREEK SMALL LETTER OMICRON WITH TONOS + '\u03cd' # 0xB7 -> GREEK SMALL LETTER UPSILON WITH TONOS + '\u03cb' # 0xB8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA + '\u03ce' # 0xB9 -> GREEK SMALL LETTER OMEGA WITH TONOS + '\u03c2' # 0xBA -> GREEK SMALL LETTER FINAL SIGMA + '\u03c4' # 0xBB -> GREEK SMALL LETTER TAU + '\u03c5' # 0xBC -> GREEK SMALL LETTER UPSILON + '\u03c6' # 0xBD -> GREEK SMALL LETTER PHI + '\u03c7' # 0xBE -> GREEK SMALL LETTER CHI + '\u03c8' # 0xBF -> GREEK SMALL LETTER PSI + '{' # 0xC0 -> LEFT CURLY BRACKET + 'A' # 0xC1 -> LATIN CAPITAL LETTER A + 'B' # 0xC2 -> LATIN CAPITAL LETTER B + 'C' # 0xC3 -> LATIN CAPITAL LETTER C + 'D' # 0xC4 -> LATIN CAPITAL LETTER D + 'E' # 0xC5 -> LATIN CAPITAL LETTER E + 'F' # 0xC6 -> LATIN CAPITAL LETTER F + 'G' # 0xC7 -> LATIN CAPITAL LETTER G + 'H' # 0xC8 -> LATIN CAPITAL LETTER H + 'I' # 0xC9 -> LATIN CAPITAL LETTER I + '\xad' # 0xCA -> SOFT HYPHEN + '\u03c9' # 0xCB -> GREEK SMALL LETTER OMEGA + '\u0390' # 0xCC -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS + '\u03b0' # 0xCD -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS + '\u2018' # 0xCE -> LEFT SINGLE QUOTATION MARK + '\u2015' # 0xCF -> HORIZONTAL BAR + '}' # 0xD0 -> RIGHT CURLY BRACKET + 'J' # 0xD1 -> LATIN CAPITAL LETTER J + 'K' # 0xD2 -> LATIN CAPITAL LETTER K + 'L' # 0xD3 -> LATIN CAPITAL LETTER L + 'M' # 0xD4 -> LATIN CAPITAL LETTER M + 'N' # 0xD5 -> LATIN CAPITAL LETTER N + 'O' # 0xD6 -> LATIN CAPITAL LETTER O + 'P' # 0xD7 -> LATIN CAPITAL LETTER P + 'Q' # 0xD8 -> LATIN CAPITAL LETTER Q + 'R' # 0xD9 -> LATIN CAPITAL LETTER R + '\xb1' # 0xDA -> PLUS-MINUS SIGN + '\xbd' # 0xDB -> VULGAR FRACTION ONE HALF + '\x1a' # 0xDC -> SUBSTITUTE + '\u0387' # 0xDD -> GREEK ANO TELEIA + '\u2019' # 0xDE -> RIGHT SINGLE QUOTATION MARK + '\xa6' # 0xDF -> BROKEN BAR + '\\' # 0xE0 -> REVERSE SOLIDUS + '\x1a' # 0xE1 -> SUBSTITUTE + 'S' # 0xE2 -> LATIN CAPITAL LETTER S + 'T' # 0xE3 -> LATIN CAPITAL LETTER T + 'U' # 0xE4 -> LATIN CAPITAL LETTER U + 'V' # 0xE5 -> LATIN CAPITAL LETTER V + 'W' # 0xE6 -> LATIN CAPITAL LETTER W + 'X' # 0xE7 -> LATIN CAPITAL LETTER X + 'Y' # 0xE8 -> LATIN CAPITAL LETTER Y + 'Z' # 0xE9 -> LATIN CAPITAL LETTER Z + '\xb2' # 0xEA -> SUPERSCRIPT TWO + '\xa7' # 0xEB -> SECTION SIGN + '\x1a' # 0xEC -> SUBSTITUTE + '\x1a' # 0xED -> SUBSTITUTE + '\xab' # 0xEE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xEF -> NOT SIGN + '0' # 0xF0 -> DIGIT ZERO + '1' # 0xF1 -> DIGIT ONE + '2' # 0xF2 -> DIGIT TWO + '3' # 0xF3 -> DIGIT THREE + '4' # 0xF4 -> DIGIT FOUR + '5' # 0xF5 -> DIGIT FIVE + '6' # 0xF6 -> DIGIT SIX + '7' # 0xF7 -> DIGIT SEVEN + '8' # 0xF8 -> DIGIT EIGHT + '9' # 0xF9 -> DIGIT NINE + '\xb3' # 0xFA -> SUPERSCRIPT THREE + '\xa9' # 0xFB -> COPYRIGHT SIGN + '\x1a' # 0xFC -> SUBSTITUTE + '\x1a' # 0xFD -> SUBSTITUTE + '\xbb' # 0xFE -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\x9f' # 0xFF -> CONTROL ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/idna.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/idna.py (original) +++ python/branches/py3k-struni/Lib/encodings/idna.py Wed May 2 21:09:54 2007 @@ -4,11 +4,11 @@ from unicodedata import ucd_3_2_0 as unicodedata # IDNA section 3.1 -dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]") +dots = re.compile("[\u002E\u3002\uFF0E\uFF61]") # IDNA section 5 ace_prefix = "xn--" -uace_prefix = unicode(ace_prefix, "ascii") +uace_prefix = str(ace_prefix, "ascii") # This assumes query strings, so AllowUnassigned is true def nameprep(label): @@ -19,7 +19,7 @@ # Map to nothing continue newlabel.append(stringprep.map_table_b2(c)) - label = u"".join(newlabel) + label = "".join(newlabel) # Normalize label = unicodedata.normalize("NFKC", label) @@ -122,7 +122,7 @@ raise UnicodeError("Invalid character in IDN label") # Step 3: Check for ACE prefix if not label.startswith(ace_prefix): - return unicode(label, "ascii") + return str(label, "ascii") # Step 4: Remove ACE prefix label1 = label[len(ace_prefix):] @@ -171,28 +171,28 @@ raise UnicodeError("Unsupported error handling "+errors) if not input: - return u"", 0 + return "", 0 # IDNA allows decoding to operate on Unicode strings, too. - if isinstance(input, unicode): + if isinstance(input, str): labels = dots.split(input) else: # Must be ASCII string input = str(input) - unicode(input, "ascii") + str(input, "ascii") labels = input.split(".") if labels and len(labels[-1]) == 0: - trailing_dot = u'.' + trailing_dot = '.' del labels[-1] else: - trailing_dot = u'' + trailing_dot = '' result = [] for label in labels: result.append(ToUnicode(label)) - return u".".join(result)+trailing_dot, len(input) + return ".".join(result)+trailing_dot, len(input) class IncrementalEncoder(codecs.BufferedIncrementalEncoder): def _buffer_encode(self, input, errors, final): @@ -204,7 +204,7 @@ return ("", 0) labels = dots.split(input) - trailing_dot = u'' + trailing_dot = '' if labels: if not labels[-1]: trailing_dot = '.' @@ -234,27 +234,27 @@ raise UnicodeError("Unsupported error handling "+errors) if not input: - return (u"", 0) + return ("", 0) # IDNA allows decoding to operate on Unicode strings, too. - if isinstance(input, unicode): + if isinstance(input, str): labels = dots.split(input) else: # Must be ASCII string input = str(input) - unicode(input, "ascii") + str(input, "ascii") labels = input.split(".") - trailing_dot = u'' + trailing_dot = '' if labels: if not labels[-1]: - trailing_dot = u'.' + trailing_dot = '.' del labels[-1] elif not final: # Keep potentially unfinished label until the next call del labels[-1] if labels: - trailing_dot = u'.' + trailing_dot = '.' result = [] size = 0 @@ -264,7 +264,7 @@ size += 1 size += len(label) - result = u".".join(result) + trailing_dot + result = ".".join(result) + trailing_dot size += len(trailing_dot) return (result, size) Modified: python/branches/py3k-struni/Lib/encodings/iso8859_1.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_1.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_1.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic) - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN (Icelandic) - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German) - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH (Icelandic) - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN (Icelandic) - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\xbf' # 0xBF -> INVERTED QUESTION MARK + '\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic) + '\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE + '\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xde' # 0xDE -> LATIN CAPITAL LETTER THORN (Icelandic) + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German) + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf0' # 0xF0 -> LATIN SMALL LETTER ETH (Icelandic) + '\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE + '\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE + '\xfe' # 0xFE -> LATIN SMALL LETTER THORN (Icelandic) + '\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_10.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_10.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_10.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u0112' # 0xA2 -> LATIN CAPITAL LETTER E WITH MACRON - u'\u0122' # 0xA3 -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u012a' # 0xA4 -> LATIN CAPITAL LETTER I WITH MACRON - u'\u0128' # 0xA5 -> LATIN CAPITAL LETTER I WITH TILDE - u'\u0136' # 0xA6 -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u013b' # 0xA8 -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u0110' # 0xA9 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0160' # 0xAA -> LATIN CAPITAL LETTER S WITH CARON - u'\u0166' # 0xAB -> LATIN CAPITAL LETTER T WITH STROKE - u'\u017d' # 0xAC -> LATIN CAPITAL LETTER Z WITH CARON - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u016a' # 0xAE -> LATIN CAPITAL LETTER U WITH MACRON - u'\u014a' # 0xAF -> LATIN CAPITAL LETTER ENG - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK - u'\u0113' # 0xB2 -> LATIN SMALL LETTER E WITH MACRON - u'\u0123' # 0xB3 -> LATIN SMALL LETTER G WITH CEDILLA - u'\u012b' # 0xB4 -> LATIN SMALL LETTER I WITH MACRON - u'\u0129' # 0xB5 -> LATIN SMALL LETTER I WITH TILDE - u'\u0137' # 0xB6 -> LATIN SMALL LETTER K WITH CEDILLA - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u013c' # 0xB8 -> LATIN SMALL LETTER L WITH CEDILLA - u'\u0111' # 0xB9 -> LATIN SMALL LETTER D WITH STROKE - u'\u0161' # 0xBA -> LATIN SMALL LETTER S WITH CARON - u'\u0167' # 0xBB -> LATIN SMALL LETTER T WITH STROKE - u'\u017e' # 0xBC -> LATIN SMALL LETTER Z WITH CARON - u'\u2015' # 0xBD -> HORIZONTAL BAR - u'\u016b' # 0xBE -> LATIN SMALL LETTER U WITH MACRON - u'\u014b' # 0xBF -> LATIN SMALL LETTER ENG - u'\u0100' # 0xC0 -> LATIN CAPITAL LETTER A WITH MACRON - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\u012e' # 0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u0116' # 0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic) - u'\u0145' # 0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\u014c' # 0xD2 -> LATIN CAPITAL LETTER O WITH MACRON - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\u0168' # 0xD7 -> LATIN CAPITAL LETTER U WITH TILDE - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\u0172' # 0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN (Icelandic) - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German) - u'\u0101' # 0xE0 -> LATIN SMALL LETTER A WITH MACRON - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\u012f' # 0xE7 -> LATIN SMALL LETTER I WITH OGONEK - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0117' # 0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH (Icelandic) - u'\u0146' # 0xF1 -> LATIN SMALL LETTER N WITH CEDILLA - u'\u014d' # 0xF2 -> LATIN SMALL LETTER O WITH MACRON - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u0169' # 0xF7 -> LATIN SMALL LETTER U WITH TILDE - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\u0173' # 0xF9 -> LATIN SMALL LETTER U WITH OGONEK - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN (Icelandic) - u'\u0138' # 0xFF -> LATIN SMALL LETTER KRA + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK + '\u0112' # 0xA2 -> LATIN CAPITAL LETTER E WITH MACRON + '\u0122' # 0xA3 -> LATIN CAPITAL LETTER G WITH CEDILLA + '\u012a' # 0xA4 -> LATIN CAPITAL LETTER I WITH MACRON + '\u0128' # 0xA5 -> LATIN CAPITAL LETTER I WITH TILDE + '\u0136' # 0xA6 -> LATIN CAPITAL LETTER K WITH CEDILLA + '\xa7' # 0xA7 -> SECTION SIGN + '\u013b' # 0xA8 -> LATIN CAPITAL LETTER L WITH CEDILLA + '\u0110' # 0xA9 -> LATIN CAPITAL LETTER D WITH STROKE + '\u0160' # 0xAA -> LATIN CAPITAL LETTER S WITH CARON + '\u0166' # 0xAB -> LATIN CAPITAL LETTER T WITH STROKE + '\u017d' # 0xAC -> LATIN CAPITAL LETTER Z WITH CARON + '\xad' # 0xAD -> SOFT HYPHEN + '\u016a' # 0xAE -> LATIN CAPITAL LETTER U WITH MACRON + '\u014a' # 0xAF -> LATIN CAPITAL LETTER ENG + '\xb0' # 0xB0 -> DEGREE SIGN + '\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK + '\u0113' # 0xB2 -> LATIN SMALL LETTER E WITH MACRON + '\u0123' # 0xB3 -> LATIN SMALL LETTER G WITH CEDILLA + '\u012b' # 0xB4 -> LATIN SMALL LETTER I WITH MACRON + '\u0129' # 0xB5 -> LATIN SMALL LETTER I WITH TILDE + '\u0137' # 0xB6 -> LATIN SMALL LETTER K WITH CEDILLA + '\xb7' # 0xB7 -> MIDDLE DOT + '\u013c' # 0xB8 -> LATIN SMALL LETTER L WITH CEDILLA + '\u0111' # 0xB9 -> LATIN SMALL LETTER D WITH STROKE + '\u0161' # 0xBA -> LATIN SMALL LETTER S WITH CARON + '\u0167' # 0xBB -> LATIN SMALL LETTER T WITH STROKE + '\u017e' # 0xBC -> LATIN SMALL LETTER Z WITH CARON + '\u2015' # 0xBD -> HORIZONTAL BAR + '\u016b' # 0xBE -> LATIN SMALL LETTER U WITH MACRON + '\u014b' # 0xBF -> LATIN SMALL LETTER ENG + '\u0100' # 0xC0 -> LATIN CAPITAL LETTER A WITH MACRON + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\u012e' # 0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK + '\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\u0116' # 0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic) + '\u0145' # 0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA + '\u014c' # 0xD2 -> LATIN CAPITAL LETTER O WITH MACRON + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\u0168' # 0xD7 -> LATIN CAPITAL LETTER U WITH TILDE + '\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE + '\u0172' # 0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xde' # 0xDE -> LATIN CAPITAL LETTER THORN (Icelandic) + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German) + '\u0101' # 0xE0 -> LATIN SMALL LETTER A WITH MACRON + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\u012f' # 0xE7 -> LATIN SMALL LETTER I WITH OGONEK + '\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\u0117' # 0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf0' # 0xF0 -> LATIN SMALL LETTER ETH (Icelandic) + '\u0146' # 0xF1 -> LATIN SMALL LETTER N WITH CEDILLA + '\u014d' # 0xF2 -> LATIN SMALL LETTER O WITH MACRON + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\u0169' # 0xF7 -> LATIN SMALL LETTER U WITH TILDE + '\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + '\u0173' # 0xF9 -> LATIN SMALL LETTER U WITH OGONEK + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE + '\xfe' # 0xFE -> LATIN SMALL LETTER THORN (Icelandic) + '\u0138' # 0xFF -> LATIN SMALL LETTER KRA ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_11.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_11.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_11.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0e01' # 0xA1 -> THAI CHARACTER KO KAI - u'\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI - u'\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT - u'\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI - u'\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON - u'\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG - u'\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU - u'\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN - u'\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING - u'\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG - u'\u0e0b' # 0xAB -> THAI CHARACTER SO SO - u'\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE - u'\u0e0d' # 0xAD -> THAI CHARACTER YO YING - u'\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA - u'\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK - u'\u0e10' # 0xB0 -> THAI CHARACTER THO THAN - u'\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO - u'\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO - u'\u0e13' # 0xB3 -> THAI CHARACTER NO NEN - u'\u0e14' # 0xB4 -> THAI CHARACTER DO DEK - u'\u0e15' # 0xB5 -> THAI CHARACTER TO TAO - u'\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG - u'\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN - u'\u0e18' # 0xB8 -> THAI CHARACTER THO THONG - u'\u0e19' # 0xB9 -> THAI CHARACTER NO NU - u'\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI - u'\u0e1b' # 0xBB -> THAI CHARACTER PO PLA - u'\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG - u'\u0e1d' # 0xBD -> THAI CHARACTER FO FA - u'\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN - u'\u0e1f' # 0xBF -> THAI CHARACTER FO FAN - u'\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO - u'\u0e21' # 0xC1 -> THAI CHARACTER MO MA - u'\u0e22' # 0xC2 -> THAI CHARACTER YO YAK - u'\u0e23' # 0xC3 -> THAI CHARACTER RO RUA - u'\u0e24' # 0xC4 -> THAI CHARACTER RU - u'\u0e25' # 0xC5 -> THAI CHARACTER LO LING - u'\u0e26' # 0xC6 -> THAI CHARACTER LU - u'\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN - u'\u0e28' # 0xC8 -> THAI CHARACTER SO SALA - u'\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI - u'\u0e2a' # 0xCA -> THAI CHARACTER SO SUA - u'\u0e2b' # 0xCB -> THAI CHARACTER HO HIP - u'\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA - u'\u0e2d' # 0xCD -> THAI CHARACTER O ANG - u'\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK - u'\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI - u'\u0e30' # 0xD0 -> THAI CHARACTER SARA A - u'\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT - u'\u0e32' # 0xD2 -> THAI CHARACTER SARA AA - u'\u0e33' # 0xD3 -> THAI CHARACTER SARA AM - u'\u0e34' # 0xD4 -> THAI CHARACTER SARA I - u'\u0e35' # 0xD5 -> THAI CHARACTER SARA II - u'\u0e36' # 0xD6 -> THAI CHARACTER SARA UE - u'\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE - u'\u0e38' # 0xD8 -> THAI CHARACTER SARA U - u'\u0e39' # 0xD9 -> THAI CHARACTER SARA UU - u'\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT - u'\u0e40' # 0xE0 -> THAI CHARACTER SARA E - u'\u0e41' # 0xE1 -> THAI CHARACTER SARA AE - u'\u0e42' # 0xE2 -> THAI CHARACTER SARA O - u'\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN - u'\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI - u'\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO - u'\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK - u'\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU - u'\u0e48' # 0xE8 -> THAI CHARACTER MAI EK - u'\u0e49' # 0xE9 -> THAI CHARACTER MAI THO - u'\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI - u'\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA - u'\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT - u'\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT - u'\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN - u'\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN - u'\u0e50' # 0xF0 -> THAI DIGIT ZERO - u'\u0e51' # 0xF1 -> THAI DIGIT ONE - u'\u0e52' # 0xF2 -> THAI DIGIT TWO - u'\u0e53' # 0xF3 -> THAI DIGIT THREE - u'\u0e54' # 0xF4 -> THAI DIGIT FOUR - u'\u0e55' # 0xF5 -> THAI DIGIT FIVE - u'\u0e56' # 0xF6 -> THAI DIGIT SIX - u'\u0e57' # 0xF7 -> THAI DIGIT SEVEN - u'\u0e58' # 0xF8 -> THAI DIGIT EIGHT - u'\u0e59' # 0xF9 -> THAI DIGIT NINE - u'\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU - u'\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u0e01' # 0xA1 -> THAI CHARACTER KO KAI + '\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI + '\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT + '\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI + '\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON + '\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG + '\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU + '\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN + '\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING + '\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG + '\u0e0b' # 0xAB -> THAI CHARACTER SO SO + '\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE + '\u0e0d' # 0xAD -> THAI CHARACTER YO YING + '\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA + '\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK + '\u0e10' # 0xB0 -> THAI CHARACTER THO THAN + '\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO + '\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO + '\u0e13' # 0xB3 -> THAI CHARACTER NO NEN + '\u0e14' # 0xB4 -> THAI CHARACTER DO DEK + '\u0e15' # 0xB5 -> THAI CHARACTER TO TAO + '\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG + '\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN + '\u0e18' # 0xB8 -> THAI CHARACTER THO THONG + '\u0e19' # 0xB9 -> THAI CHARACTER NO NU + '\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI + '\u0e1b' # 0xBB -> THAI CHARACTER PO PLA + '\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG + '\u0e1d' # 0xBD -> THAI CHARACTER FO FA + '\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN + '\u0e1f' # 0xBF -> THAI CHARACTER FO FAN + '\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO + '\u0e21' # 0xC1 -> THAI CHARACTER MO MA + '\u0e22' # 0xC2 -> THAI CHARACTER YO YAK + '\u0e23' # 0xC3 -> THAI CHARACTER RO RUA + '\u0e24' # 0xC4 -> THAI CHARACTER RU + '\u0e25' # 0xC5 -> THAI CHARACTER LO LING + '\u0e26' # 0xC6 -> THAI CHARACTER LU + '\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN + '\u0e28' # 0xC8 -> THAI CHARACTER SO SALA + '\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI + '\u0e2a' # 0xCA -> THAI CHARACTER SO SUA + '\u0e2b' # 0xCB -> THAI CHARACTER HO HIP + '\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA + '\u0e2d' # 0xCD -> THAI CHARACTER O ANG + '\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK + '\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI + '\u0e30' # 0xD0 -> THAI CHARACTER SARA A + '\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT + '\u0e32' # 0xD2 -> THAI CHARACTER SARA AA + '\u0e33' # 0xD3 -> THAI CHARACTER SARA AM + '\u0e34' # 0xD4 -> THAI CHARACTER SARA I + '\u0e35' # 0xD5 -> THAI CHARACTER SARA II + '\u0e36' # 0xD6 -> THAI CHARACTER SARA UE + '\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE + '\u0e38' # 0xD8 -> THAI CHARACTER SARA U + '\u0e39' # 0xD9 -> THAI CHARACTER SARA UU + '\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT + '\u0e40' # 0xE0 -> THAI CHARACTER SARA E + '\u0e41' # 0xE1 -> THAI CHARACTER SARA AE + '\u0e42' # 0xE2 -> THAI CHARACTER SARA O + '\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN + '\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI + '\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO + '\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK + '\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU + '\u0e48' # 0xE8 -> THAI CHARACTER MAI EK + '\u0e49' # 0xE9 -> THAI CHARACTER MAI THO + '\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI + '\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA + '\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT + '\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT + '\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN + '\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN + '\u0e50' # 0xF0 -> THAI DIGIT ZERO + '\u0e51' # 0xF1 -> THAI DIGIT ONE + '\u0e52' # 0xF2 -> THAI DIGIT TWO + '\u0e53' # 0xF3 -> THAI DIGIT THREE + '\u0e54' # 0xF4 -> THAI DIGIT FOUR + '\u0e55' # 0xF5 -> THAI DIGIT FIVE + '\u0e56' # 0xF6 -> THAI DIGIT SIX + '\u0e57' # 0xF7 -> THAI DIGIT SEVEN + '\u0e58' # 0xF8 -> THAI DIGIT EIGHT + '\u0e59' # 0xF9 -> THAI DIGIT NINE + '\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU + '\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_13.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_13.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_13.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u201d' # 0xA1 -> RIGHT DOUBLE QUOTATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u201e' # 0xA5 -> DOUBLE LOW-9 QUOTATION MARK - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xd8' # 0xA8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u0156' # 0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xc6' # 0xAF -> LATIN CAPITAL LETTER AE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\u201c' # 0xB4 -> LEFT DOUBLE QUOTATION MARK - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xf8' # 0xB8 -> LATIN SMALL LETTER O WITH STROKE - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\u0157' # 0xBA -> LATIN SMALL LETTER R WITH CEDILLA - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xe6' # 0xBF -> LATIN SMALL LETTER AE - u'\u0104' # 0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u012e' # 0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u0100' # 0xC2 -> LATIN CAPITAL LETTER A WITH MACRON - u'\u0106' # 0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\u0118' # 0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u0112' # 0xC7 -> LATIN CAPITAL LETTER E WITH MACRON - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0179' # 0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\u0116' # 0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\u0122' # 0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u0136' # 0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\u012a' # 0xCE -> LATIN CAPITAL LETTER I WITH MACRON - u'\u013b' # 0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u0160' # 0xD0 -> LATIN CAPITAL LETTER S WITH CARON - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0145' # 0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\u014c' # 0xD4 -> LATIN CAPITAL LETTER O WITH MACRON - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0172' # 0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\u0141' # 0xD9 -> LATIN CAPITAL LETTER L WITH STROKE - u'\u015a' # 0xDA -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u016a' # 0xDB -> LATIN CAPITAL LETTER U WITH MACRON - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u017b' # 0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u017d' # 0xDE -> LATIN CAPITAL LETTER Z WITH CARON - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German) - u'\u0105' # 0xE0 -> LATIN SMALL LETTER A WITH OGONEK - u'\u012f' # 0xE1 -> LATIN SMALL LETTER I WITH OGONEK - u'\u0101' # 0xE2 -> LATIN SMALL LETTER A WITH MACRON - u'\u0107' # 0xE3 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\u0119' # 0xE6 -> LATIN SMALL LETTER E WITH OGONEK - u'\u0113' # 0xE7 -> LATIN SMALL LETTER E WITH MACRON - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u017a' # 0xEA -> LATIN SMALL LETTER Z WITH ACUTE - u'\u0117' # 0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\u0123' # 0xEC -> LATIN SMALL LETTER G WITH CEDILLA - u'\u0137' # 0xED -> LATIN SMALL LETTER K WITH CEDILLA - u'\u012b' # 0xEE -> LATIN SMALL LETTER I WITH MACRON - u'\u013c' # 0xEF -> LATIN SMALL LETTER L WITH CEDILLA - u'\u0161' # 0xF0 -> LATIN SMALL LETTER S WITH CARON - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0146' # 0xF2 -> LATIN SMALL LETTER N WITH CEDILLA - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\u014d' # 0xF4 -> LATIN SMALL LETTER O WITH MACRON - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0173' # 0xF8 -> LATIN SMALL LETTER U WITH OGONEK - u'\u0142' # 0xF9 -> LATIN SMALL LETTER L WITH STROKE - u'\u015b' # 0xFA -> LATIN SMALL LETTER S WITH ACUTE - u'\u016b' # 0xFB -> LATIN SMALL LETTER U WITH MACRON - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u017e' # 0xFE -> LATIN SMALL LETTER Z WITH CARON - u'\u2019' # 0xFF -> RIGHT SINGLE QUOTATION MARK + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u201d' # 0xA1 -> RIGHT DOUBLE QUOTATION MARK + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\u201e' # 0xA5 -> DOUBLE LOW-9 QUOTATION MARK + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xd8' # 0xA8 -> LATIN CAPITAL LETTER O WITH STROKE + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u0156' # 0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xc6' # 0xAF -> LATIN CAPITAL LETTER AE + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\u201c' # 0xB4 -> LEFT DOUBLE QUOTATION MARK + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xf8' # 0xB8 -> LATIN SMALL LETTER O WITH STROKE + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\u0157' # 0xBA -> LATIN SMALL LETTER R WITH CEDILLA + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\xe6' # 0xBF -> LATIN SMALL LETTER AE + '\u0104' # 0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK + '\u012e' # 0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK + '\u0100' # 0xC2 -> LATIN CAPITAL LETTER A WITH MACRON + '\u0106' # 0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\u0118' # 0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK + '\u0112' # 0xC7 -> LATIN CAPITAL LETTER E WITH MACRON + '\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\u0179' # 0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE + '\u0116' # 0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE + '\u0122' # 0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA + '\u0136' # 0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA + '\u012a' # 0xCE -> LATIN CAPITAL LETTER I WITH MACRON + '\u013b' # 0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA + '\u0160' # 0xD0 -> LATIN CAPITAL LETTER S WITH CARON + '\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE + '\u0145' # 0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\u014c' # 0xD4 -> LATIN CAPITAL LETTER O WITH MACRON + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\u0172' # 0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK + '\u0141' # 0xD9 -> LATIN CAPITAL LETTER L WITH STROKE + '\u015a' # 0xDA -> LATIN CAPITAL LETTER S WITH ACUTE + '\u016a' # 0xDB -> LATIN CAPITAL LETTER U WITH MACRON + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u017b' # 0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE + '\u017d' # 0xDE -> LATIN CAPITAL LETTER Z WITH CARON + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German) + '\u0105' # 0xE0 -> LATIN SMALL LETTER A WITH OGONEK + '\u012f' # 0xE1 -> LATIN SMALL LETTER I WITH OGONEK + '\u0101' # 0xE2 -> LATIN SMALL LETTER A WITH MACRON + '\u0107' # 0xE3 -> LATIN SMALL LETTER C WITH ACUTE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\u0119' # 0xE6 -> LATIN SMALL LETTER E WITH OGONEK + '\u0113' # 0xE7 -> LATIN SMALL LETTER E WITH MACRON + '\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\u017a' # 0xEA -> LATIN SMALL LETTER Z WITH ACUTE + '\u0117' # 0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE + '\u0123' # 0xEC -> LATIN SMALL LETTER G WITH CEDILLA + '\u0137' # 0xED -> LATIN SMALL LETTER K WITH CEDILLA + '\u012b' # 0xEE -> LATIN SMALL LETTER I WITH MACRON + '\u013c' # 0xEF -> LATIN SMALL LETTER L WITH CEDILLA + '\u0161' # 0xF0 -> LATIN SMALL LETTER S WITH CARON + '\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE + '\u0146' # 0xF2 -> LATIN SMALL LETTER N WITH CEDILLA + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\u014d' # 0xF4 -> LATIN SMALL LETTER O WITH MACRON + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\u0173' # 0xF8 -> LATIN SMALL LETTER U WITH OGONEK + '\u0142' # 0xF9 -> LATIN SMALL LETTER L WITH STROKE + '\u015b' # 0xFA -> LATIN SMALL LETTER S WITH ACUTE + '\u016b' # 0xFB -> LATIN SMALL LETTER U WITH MACRON + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE + '\u017e' # 0xFE -> LATIN SMALL LETTER Z WITH CARON + '\u2019' # 0xFF -> RIGHT SINGLE QUOTATION MARK ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_14.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_14.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_14.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u1e02' # 0xA1 -> LATIN CAPITAL LETTER B WITH DOT ABOVE - u'\u1e03' # 0xA2 -> LATIN SMALL LETTER B WITH DOT ABOVE - u'\xa3' # 0xA3 -> POUND SIGN - u'\u010a' # 0xA4 -> LATIN CAPITAL LETTER C WITH DOT ABOVE - u'\u010b' # 0xA5 -> LATIN SMALL LETTER C WITH DOT ABOVE - u'\u1e0a' # 0xA6 -> LATIN CAPITAL LETTER D WITH DOT ABOVE - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u1e80' # 0xA8 -> LATIN CAPITAL LETTER W WITH GRAVE - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u1e82' # 0xAA -> LATIN CAPITAL LETTER W WITH ACUTE - u'\u1e0b' # 0xAB -> LATIN SMALL LETTER D WITH DOT ABOVE - u'\u1ef2' # 0xAC -> LATIN CAPITAL LETTER Y WITH GRAVE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\u0178' # 0xAF -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u1e1e' # 0xB0 -> LATIN CAPITAL LETTER F WITH DOT ABOVE - u'\u1e1f' # 0xB1 -> LATIN SMALL LETTER F WITH DOT ABOVE - u'\u0120' # 0xB2 -> LATIN CAPITAL LETTER G WITH DOT ABOVE - u'\u0121' # 0xB3 -> LATIN SMALL LETTER G WITH DOT ABOVE - u'\u1e40' # 0xB4 -> LATIN CAPITAL LETTER M WITH DOT ABOVE - u'\u1e41' # 0xB5 -> LATIN SMALL LETTER M WITH DOT ABOVE - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\u1e56' # 0xB7 -> LATIN CAPITAL LETTER P WITH DOT ABOVE - u'\u1e81' # 0xB8 -> LATIN SMALL LETTER W WITH GRAVE - u'\u1e57' # 0xB9 -> LATIN SMALL LETTER P WITH DOT ABOVE - u'\u1e83' # 0xBA -> LATIN SMALL LETTER W WITH ACUTE - u'\u1e60' # 0xBB -> LATIN CAPITAL LETTER S WITH DOT ABOVE - u'\u1ef3' # 0xBC -> LATIN SMALL LETTER Y WITH GRAVE - u'\u1e84' # 0xBD -> LATIN CAPITAL LETTER W WITH DIAERESIS - u'\u1e85' # 0xBE -> LATIN SMALL LETTER W WITH DIAERESIS - u'\u1e61' # 0xBF -> LATIN SMALL LETTER S WITH DOT ABOVE - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u0174' # 0xD0 -> LATIN CAPITAL LETTER W WITH CIRCUMFLEX - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\u1e6a' # 0xD7 -> LATIN CAPITAL LETTER T WITH DOT ABOVE - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\u0176' # 0xDE -> LATIN CAPITAL LETTER Y WITH CIRCUMFLEX - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u0175' # 0xF0 -> LATIN SMALL LETTER W WITH CIRCUMFLEX - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u1e6b' # 0xF7 -> LATIN SMALL LETTER T WITH DOT ABOVE - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\u0177' # 0xFE -> LATIN SMALL LETTER Y WITH CIRCUMFLEX - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u1e02' # 0xA1 -> LATIN CAPITAL LETTER B WITH DOT ABOVE + '\u1e03' # 0xA2 -> LATIN SMALL LETTER B WITH DOT ABOVE + '\xa3' # 0xA3 -> POUND SIGN + '\u010a' # 0xA4 -> LATIN CAPITAL LETTER C WITH DOT ABOVE + '\u010b' # 0xA5 -> LATIN SMALL LETTER C WITH DOT ABOVE + '\u1e0a' # 0xA6 -> LATIN CAPITAL LETTER D WITH DOT ABOVE + '\xa7' # 0xA7 -> SECTION SIGN + '\u1e80' # 0xA8 -> LATIN CAPITAL LETTER W WITH GRAVE + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u1e82' # 0xAA -> LATIN CAPITAL LETTER W WITH ACUTE + '\u1e0b' # 0xAB -> LATIN SMALL LETTER D WITH DOT ABOVE + '\u1ef2' # 0xAC -> LATIN CAPITAL LETTER Y WITH GRAVE + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\u0178' # 0xAF -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\u1e1e' # 0xB0 -> LATIN CAPITAL LETTER F WITH DOT ABOVE + '\u1e1f' # 0xB1 -> LATIN SMALL LETTER F WITH DOT ABOVE + '\u0120' # 0xB2 -> LATIN CAPITAL LETTER G WITH DOT ABOVE + '\u0121' # 0xB3 -> LATIN SMALL LETTER G WITH DOT ABOVE + '\u1e40' # 0xB4 -> LATIN CAPITAL LETTER M WITH DOT ABOVE + '\u1e41' # 0xB5 -> LATIN SMALL LETTER M WITH DOT ABOVE + '\xb6' # 0xB6 -> PILCROW SIGN + '\u1e56' # 0xB7 -> LATIN CAPITAL LETTER P WITH DOT ABOVE + '\u1e81' # 0xB8 -> LATIN SMALL LETTER W WITH GRAVE + '\u1e57' # 0xB9 -> LATIN SMALL LETTER P WITH DOT ABOVE + '\u1e83' # 0xBA -> LATIN SMALL LETTER W WITH ACUTE + '\u1e60' # 0xBB -> LATIN CAPITAL LETTER S WITH DOT ABOVE + '\u1ef3' # 0xBC -> LATIN SMALL LETTER Y WITH GRAVE + '\u1e84' # 0xBD -> LATIN CAPITAL LETTER W WITH DIAERESIS + '\u1e85' # 0xBE -> LATIN SMALL LETTER W WITH DIAERESIS + '\u1e61' # 0xBF -> LATIN SMALL LETTER S WITH DOT ABOVE + '\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\u0174' # 0xD0 -> LATIN CAPITAL LETTER W WITH CIRCUMFLEX + '\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\u1e6a' # 0xD7 -> LATIN CAPITAL LETTER T WITH DOT ABOVE + '\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE + '\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\u0176' # 0xDE -> LATIN CAPITAL LETTER Y WITH CIRCUMFLEX + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\u0175' # 0xF0 -> LATIN SMALL LETTER W WITH CIRCUMFLEX + '\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE + '\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\u1e6b' # 0xF7 -> LATIN SMALL LETTER T WITH DOT ABOVE + '\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE + '\u0177' # 0xFE -> LATIN SMALL LETTER Y WITH CIRCUMFLEX + '\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_15.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_15.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_15.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\u20ac' # 0xA4 -> EURO SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\u0160' # 0xA6 -> LATIN CAPITAL LETTER S WITH CARON - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u0161' # 0xA8 -> LATIN SMALL LETTER S WITH CARON - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\u017d' # 0xB4 -> LATIN CAPITAL LETTER Z WITH CARON - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u017e' # 0xB8 -> LATIN SMALL LETTER Z WITH CARON - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u0152' # 0xBC -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xBD -> LATIN SMALL LIGATURE OE - u'\u0178' # 0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\u20ac' # 0xA4 -> EURO SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\u0160' # 0xA6 -> LATIN CAPITAL LETTER S WITH CARON + '\xa7' # 0xA7 -> SECTION SIGN + '\u0161' # 0xA8 -> LATIN SMALL LETTER S WITH CARON + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\u017d' # 0xB4 -> LATIN CAPITAL LETTER Z WITH CARON + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\u017e' # 0xB8 -> LATIN SMALL LETTER Z WITH CARON + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u0152' # 0xBC -> LATIN CAPITAL LIGATURE OE + '\u0153' # 0xBD -> LATIN SMALL LIGATURE OE + '\u0178' # 0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\xbf' # 0xBF -> INVERTED QUESTION MARK + '\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH + '\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE + '\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xde' # 0xDE -> LATIN CAPITAL LETTER THORN + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf0' # 0xF0 -> LATIN SMALL LETTER ETH + '\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE + '\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE + '\xfe' # 0xFE -> LATIN SMALL LETTER THORN + '\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_16.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_16.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_16.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u0105' # 0xA2 -> LATIN SMALL LETTER A WITH OGONEK - u'\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE - u'\u20ac' # 0xA4 -> EURO SIGN - u'\u201e' # 0xA5 -> DOUBLE LOW-9 QUOTATION MARK - u'\u0160' # 0xA6 -> LATIN CAPITAL LETTER S WITH CARON - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u0161' # 0xA8 -> LATIN SMALL LETTER S WITH CARON - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u0218' # 0xAA -> LATIN CAPITAL LETTER S WITH COMMA BELOW - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u0179' # 0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u017a' # 0xAE -> LATIN SMALL LETTER Z WITH ACUTE - u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u010c' # 0xB2 -> LATIN CAPITAL LETTER C WITH CARON - u'\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE - u'\u017d' # 0xB4 -> LATIN CAPITAL LETTER Z WITH CARON - u'\u201d' # 0xB5 -> RIGHT DOUBLE QUOTATION MARK - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u017e' # 0xB8 -> LATIN SMALL LETTER Z WITH CARON - u'\u010d' # 0xB9 -> LATIN SMALL LETTER C WITH CARON - u'\u0219' # 0xBA -> LATIN SMALL LETTER S WITH COMMA BELOW - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u0152' # 0xBC -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xBD -> LATIN SMALL LIGATURE OE - u'\u0178' # 0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0106' # 0xC5 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\u015a' # 0xD7 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u0170' # 0xD8 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0118' # 0xDD -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u021a' # 0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u0107' # 0xE5 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u015b' # 0xF7 -> LATIN SMALL LETTER S WITH ACUTE - u'\u0171' # 0xF8 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u0119' # 0xFD -> LATIN SMALL LETTER E WITH OGONEK - u'\u021b' # 0xFE -> LATIN SMALL LETTER T WITH COMMA BELOW - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK + '\u0105' # 0xA2 -> LATIN SMALL LETTER A WITH OGONEK + '\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE + '\u20ac' # 0xA4 -> EURO SIGN + '\u201e' # 0xA5 -> DOUBLE LOW-9 QUOTATION MARK + '\u0160' # 0xA6 -> LATIN CAPITAL LETTER S WITH CARON + '\xa7' # 0xA7 -> SECTION SIGN + '\u0161' # 0xA8 -> LATIN SMALL LETTER S WITH CARON + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u0218' # 0xAA -> LATIN CAPITAL LETTER S WITH COMMA BELOW + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u0179' # 0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE + '\xad' # 0xAD -> SOFT HYPHEN + '\u017a' # 0xAE -> LATIN SMALL LETTER Z WITH ACUTE + '\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u010c' # 0xB2 -> LATIN CAPITAL LETTER C WITH CARON + '\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE + '\u017d' # 0xB4 -> LATIN CAPITAL LETTER Z WITH CARON + '\u201d' # 0xB5 -> RIGHT DOUBLE QUOTATION MARK + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\u017e' # 0xB8 -> LATIN SMALL LETTER Z WITH CARON + '\u010d' # 0xB9 -> LATIN SMALL LETTER C WITH CARON + '\u0219' # 0xBA -> LATIN SMALL LETTER S WITH COMMA BELOW + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u0152' # 0xBC -> LATIN CAPITAL LIGATURE OE + '\u0153' # 0xBD -> LATIN SMALL LIGATURE OE + '\u0178' # 0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE + '\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\u0106' # 0xC5 -> LATIN CAPITAL LETTER C WITH ACUTE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE + '\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE + '\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\u015a' # 0xD7 -> LATIN CAPITAL LETTER S WITH ACUTE + '\u0170' # 0xD8 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE + '\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u0118' # 0xDD -> LATIN CAPITAL LETTER E WITH OGONEK + '\u021a' # 0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\u0107' # 0xE5 -> LATIN SMALL LETTER C WITH ACUTE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE + '\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE + '\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\u015b' # 0xF7 -> LATIN SMALL LETTER S WITH ACUTE + '\u0171' # 0xF8 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\u0119' # 0xFD -> LATIN SMALL LETTER E WITH OGONEK + '\u021b' # 0xFE -> LATIN SMALL LETTER T WITH COMMA BELOW + '\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_2.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_2.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_2.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u02d8' # 0xA2 -> BREVE - u'\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u013d' # 0xA5 -> LATIN CAPITAL LETTER L WITH CARON - u'\u015a' # 0xA6 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON - u'\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u0164' # 0xAB -> LATIN CAPITAL LETTER T WITH CARON - u'\u0179' # 0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON - u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK - u'\u02db' # 0xB2 -> OGONEK - u'\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\u013e' # 0xB5 -> LATIN SMALL LETTER L WITH CARON - u'\u015b' # 0xB6 -> LATIN SMALL LETTER S WITH ACUTE - u'\u02c7' # 0xB7 -> CARON - u'\xb8' # 0xB8 -> CEDILLA - u'\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON - u'\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA - u'\u0165' # 0xBB -> LATIN SMALL LETTER T WITH CARON - u'\u017a' # 0xBC -> LATIN SMALL LETTER Z WITH ACUTE - u'\u02dd' # 0xBD -> DOUBLE ACUTE ACCENT - u'\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON - u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u0154' # 0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0139' # 0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE - u'\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u011a' # 0xCC -> LATIN CAPITAL LETTER E WITH CARON - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u010e' # 0xCF -> LATIN CAPITAL LETTER D WITH CARON - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0147' # 0xD2 -> LATIN CAPITAL LETTER N WITH CARON - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0158' # 0xD8 -> LATIN CAPITAL LETTER R WITH CARON - u'\u016e' # 0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\u0170' # 0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\u0162' # 0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\u0155' # 0xE0 -> LATIN SMALL LETTER R WITH ACUTE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u013a' # 0xE5 -> LATIN SMALL LETTER L WITH ACUTE - u'\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u011b' # 0xEC -> LATIN SMALL LETTER E WITH CARON - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u010f' # 0xEF -> LATIN SMALL LETTER D WITH CARON - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0148' # 0xF2 -> LATIN SMALL LETTER N WITH CARON - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0159' # 0xF8 -> LATIN SMALL LETTER R WITH CARON - u'\u016f' # 0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\u0171' # 0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\u0163' # 0xFE -> LATIN SMALL LETTER T WITH CEDILLA - u'\u02d9' # 0xFF -> DOT ABOVE + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK + '\u02d8' # 0xA2 -> BREVE + '\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE + '\xa4' # 0xA4 -> CURRENCY SIGN + '\u013d' # 0xA5 -> LATIN CAPITAL LETTER L WITH CARON + '\u015a' # 0xA6 -> LATIN CAPITAL LETTER S WITH ACUTE + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON + '\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA + '\u0164' # 0xAB -> LATIN CAPITAL LETTER T WITH CARON + '\u0179' # 0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE + '\xad' # 0xAD -> SOFT HYPHEN + '\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON + '\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE + '\xb0' # 0xB0 -> DEGREE SIGN + '\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK + '\u02db' # 0xB2 -> OGONEK + '\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\u013e' # 0xB5 -> LATIN SMALL LETTER L WITH CARON + '\u015b' # 0xB6 -> LATIN SMALL LETTER S WITH ACUTE + '\u02c7' # 0xB7 -> CARON + '\xb8' # 0xB8 -> CEDILLA + '\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON + '\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA + '\u0165' # 0xBB -> LATIN SMALL LETTER T WITH CARON + '\u017a' # 0xBC -> LATIN SMALL LETTER Z WITH ACUTE + '\u02dd' # 0xBD -> DOUBLE ACUTE ACCENT + '\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON + '\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE + '\u0154' # 0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\u0139' # 0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE + '\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\u011a' # 0xCC -> LATIN CAPITAL LETTER E WITH CARON + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\u010e' # 0xCF -> LATIN CAPITAL LETTER D WITH CARON + '\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE + '\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE + '\u0147' # 0xD2 -> LATIN CAPITAL LETTER N WITH CARON + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\u0158' # 0xD8 -> LATIN CAPITAL LETTER R WITH CARON + '\u016e' # 0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\u0170' # 0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\u0162' # 0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\u0155' # 0xE0 -> LATIN SMALL LETTER R WITH ACUTE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\u013a' # 0xE5 -> LATIN SMALL LETTER L WITH ACUTE + '\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\u011b' # 0xEC -> LATIN SMALL LETTER E WITH CARON + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\u010f' # 0xEF -> LATIN SMALL LETTER D WITH CARON + '\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE + '\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE + '\u0148' # 0xF2 -> LATIN SMALL LETTER N WITH CARON + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\u0159' # 0xF8 -> LATIN SMALL LETTER R WITH CARON + '\u016f' # 0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\u0171' # 0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE + '\u0163' # 0xFE -> LATIN SMALL LETTER T WITH CEDILLA + '\u02d9' # 0xFF -> DOT ABOVE ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_3.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_3.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_3.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0126' # 0xA1 -> LATIN CAPITAL LETTER H WITH STROKE - u'\u02d8' # 0xA2 -> BREVE - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\ufffe' - u'\u0124' # 0xA6 -> LATIN CAPITAL LETTER H WITH CIRCUMFLEX - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\u0130' # 0xA9 -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u011e' # 0xAB -> LATIN CAPITAL LETTER G WITH BREVE - u'\u0134' # 0xAC -> LATIN CAPITAL LETTER J WITH CIRCUMFLEX - u'\xad' # 0xAD -> SOFT HYPHEN - u'\ufffe' - u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\u0127' # 0xB1 -> LATIN SMALL LETTER H WITH STROKE - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u0125' # 0xB6 -> LATIN SMALL LETTER H WITH CIRCUMFLEX - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\u0131' # 0xB9 -> LATIN SMALL LETTER DOTLESS I - u'\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA - u'\u011f' # 0xBB -> LATIN SMALL LETTER G WITH BREVE - u'\u0135' # 0xBC -> LATIN SMALL LETTER J WITH CIRCUMFLEX - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\ufffe' - u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\ufffe' - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u010a' # 0xC5 -> LATIN CAPITAL LETTER C WITH DOT ABOVE - u'\u0108' # 0xC6 -> LATIN CAPITAL LETTER C WITH CIRCUMFLEX - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\ufffe' - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0120' # 0xD5 -> LATIN CAPITAL LETTER G WITH DOT ABOVE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u011c' # 0xD8 -> LATIN CAPITAL LETTER G WITH CIRCUMFLEX - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u016c' # 0xDD -> LATIN CAPITAL LETTER U WITH BREVE - u'\u015c' # 0xDE -> LATIN CAPITAL LETTER S WITH CIRCUMFLEX - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\ufffe' - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u010b' # 0xE5 -> LATIN SMALL LETTER C WITH DOT ABOVE - u'\u0109' # 0xE6 -> LATIN SMALL LETTER C WITH CIRCUMFLEX - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\ufffe' - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u0121' # 0xF5 -> LATIN SMALL LETTER G WITH DOT ABOVE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u011d' # 0xF8 -> LATIN SMALL LETTER G WITH CIRCUMFLEX - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u016d' # 0xFD -> LATIN SMALL LETTER U WITH BREVE - u'\u015d' # 0xFE -> LATIN SMALL LETTER S WITH CIRCUMFLEX - u'\u02d9' # 0xFF -> DOT ABOVE + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u0126' # 0xA1 -> LATIN CAPITAL LETTER H WITH STROKE + '\u02d8' # 0xA2 -> BREVE + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\ufffe' + '\u0124' # 0xA6 -> LATIN CAPITAL LETTER H WITH CIRCUMFLEX + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\u0130' # 0xA9 -> LATIN CAPITAL LETTER I WITH DOT ABOVE + '\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA + '\u011e' # 0xAB -> LATIN CAPITAL LETTER G WITH BREVE + '\u0134' # 0xAC -> LATIN CAPITAL LETTER J WITH CIRCUMFLEX + '\xad' # 0xAD -> SOFT HYPHEN + '\ufffe' + '\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE + '\xb0' # 0xB0 -> DEGREE SIGN + '\u0127' # 0xB1 -> LATIN SMALL LETTER H WITH STROKE + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\u0125' # 0xB6 -> LATIN SMALL LETTER H WITH CIRCUMFLEX + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\u0131' # 0xB9 -> LATIN SMALL LETTER DOTLESS I + '\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA + '\u011f' # 0xBB -> LATIN SMALL LETTER G WITH BREVE + '\u0135' # 0xBC -> LATIN SMALL LETTER J WITH CIRCUMFLEX + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\ufffe' + '\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE + '\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\ufffe' + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\u010a' # 0xC5 -> LATIN CAPITAL LETTER C WITH DOT ABOVE + '\u0108' # 0xC6 -> LATIN CAPITAL LETTER C WITH CIRCUMFLEX + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\ufffe' + '\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\u0120' # 0xD5 -> LATIN CAPITAL LETTER G WITH DOT ABOVE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\u011c' # 0xD8 -> LATIN CAPITAL LETTER G WITH CIRCUMFLEX + '\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u016c' # 0xDD -> LATIN CAPITAL LETTER U WITH BREVE + '\u015c' # 0xDE -> LATIN CAPITAL LETTER S WITH CIRCUMFLEX + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\ufffe' + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\u010b' # 0xE5 -> LATIN SMALL LETTER C WITH DOT ABOVE + '\u0109' # 0xE6 -> LATIN SMALL LETTER C WITH CIRCUMFLEX + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\ufffe' + '\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE + '\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\u0121' # 0xF5 -> LATIN SMALL LETTER G WITH DOT ABOVE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\u011d' # 0xF8 -> LATIN SMALL LETTER G WITH CIRCUMFLEX + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\u016d' # 0xFD -> LATIN SMALL LETTER U WITH BREVE + '\u015d' # 0xFE -> LATIN SMALL LETTER S WITH CIRCUMFLEX + '\u02d9' # 0xFF -> DOT ABOVE ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_4.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_4.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_4.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u0138' # 0xA2 -> LATIN SMALL LETTER KRA - u'\u0156' # 0xA3 -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u0128' # 0xA5 -> LATIN CAPITAL LETTER I WITH TILDE - u'\u013b' # 0xA6 -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON - u'\u0112' # 0xAA -> LATIN CAPITAL LETTER E WITH MACRON - u'\u0122' # 0xAB -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u0166' # 0xAC -> LATIN CAPITAL LETTER T WITH STROKE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK - u'\u02db' # 0xB2 -> OGONEK - u'\u0157' # 0xB3 -> LATIN SMALL LETTER R WITH CEDILLA - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\u0129' # 0xB5 -> LATIN SMALL LETTER I WITH TILDE - u'\u013c' # 0xB6 -> LATIN SMALL LETTER L WITH CEDILLA - u'\u02c7' # 0xB7 -> CARON - u'\xb8' # 0xB8 -> CEDILLA - u'\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON - u'\u0113' # 0xBA -> LATIN SMALL LETTER E WITH MACRON - u'\u0123' # 0xBB -> LATIN SMALL LETTER G WITH CEDILLA - u'\u0167' # 0xBC -> LATIN SMALL LETTER T WITH STROKE - u'\u014a' # 0xBD -> LATIN CAPITAL LETTER ENG - u'\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON - u'\u014b' # 0xBF -> LATIN SMALL LETTER ENG - u'\u0100' # 0xC0 -> LATIN CAPITAL LETTER A WITH MACRON - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\u012e' # 0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u0116' # 0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u012a' # 0xCF -> LATIN CAPITAL LETTER I WITH MACRON - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0145' # 0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\u014c' # 0xD2 -> LATIN CAPITAL LETTER O WITH MACRON - u'\u0136' # 0xD3 -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\u0172' # 0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0168' # 0xDD -> LATIN CAPITAL LETTER U WITH TILDE - u'\u016a' # 0xDE -> LATIN CAPITAL LETTER U WITH MACRON - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\u0101' # 0xE0 -> LATIN SMALL LETTER A WITH MACRON - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\u012f' # 0xE7 -> LATIN SMALL LETTER I WITH OGONEK - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0117' # 0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u012b' # 0xEF -> LATIN SMALL LETTER I WITH MACRON - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0146' # 0xF1 -> LATIN SMALL LETTER N WITH CEDILLA - u'\u014d' # 0xF2 -> LATIN SMALL LETTER O WITH MACRON - u'\u0137' # 0xF3 -> LATIN SMALL LETTER K WITH CEDILLA - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\u0173' # 0xF9 -> LATIN SMALL LETTER U WITH OGONEK - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u0169' # 0xFD -> LATIN SMALL LETTER U WITH TILDE - u'\u016b' # 0xFE -> LATIN SMALL LETTER U WITH MACRON - u'\u02d9' # 0xFF -> DOT ABOVE + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK + '\u0138' # 0xA2 -> LATIN SMALL LETTER KRA + '\u0156' # 0xA3 -> LATIN CAPITAL LETTER R WITH CEDILLA + '\xa4' # 0xA4 -> CURRENCY SIGN + '\u0128' # 0xA5 -> LATIN CAPITAL LETTER I WITH TILDE + '\u013b' # 0xA6 -> LATIN CAPITAL LETTER L WITH CEDILLA + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON + '\u0112' # 0xAA -> LATIN CAPITAL LETTER E WITH MACRON + '\u0122' # 0xAB -> LATIN CAPITAL LETTER G WITH CEDILLA + '\u0166' # 0xAC -> LATIN CAPITAL LETTER T WITH STROKE + '\xad' # 0xAD -> SOFT HYPHEN + '\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK + '\u02db' # 0xB2 -> OGONEK + '\u0157' # 0xB3 -> LATIN SMALL LETTER R WITH CEDILLA + '\xb4' # 0xB4 -> ACUTE ACCENT + '\u0129' # 0xB5 -> LATIN SMALL LETTER I WITH TILDE + '\u013c' # 0xB6 -> LATIN SMALL LETTER L WITH CEDILLA + '\u02c7' # 0xB7 -> CARON + '\xb8' # 0xB8 -> CEDILLA + '\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON + '\u0113' # 0xBA -> LATIN SMALL LETTER E WITH MACRON + '\u0123' # 0xBB -> LATIN SMALL LETTER G WITH CEDILLA + '\u0167' # 0xBC -> LATIN SMALL LETTER T WITH STROKE + '\u014a' # 0xBD -> LATIN CAPITAL LETTER ENG + '\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON + '\u014b' # 0xBF -> LATIN SMALL LETTER ENG + '\u0100' # 0xC0 -> LATIN CAPITAL LETTER A WITH MACRON + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\u012e' # 0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK + '\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\u0116' # 0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\u012a' # 0xCF -> LATIN CAPITAL LETTER I WITH MACRON + '\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE + '\u0145' # 0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA + '\u014c' # 0xD2 -> LATIN CAPITAL LETTER O WITH MACRON + '\u0136' # 0xD3 -> LATIN CAPITAL LETTER K WITH CEDILLA + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE + '\u0172' # 0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u0168' # 0xDD -> LATIN CAPITAL LETTER U WITH TILDE + '\u016a' # 0xDE -> LATIN CAPITAL LETTER U WITH MACRON + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\u0101' # 0xE0 -> LATIN SMALL LETTER A WITH MACRON + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\u012f' # 0xE7 -> LATIN SMALL LETTER I WITH OGONEK + '\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\u0117' # 0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\u012b' # 0xEF -> LATIN SMALL LETTER I WITH MACRON + '\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE + '\u0146' # 0xF1 -> LATIN SMALL LETTER N WITH CEDILLA + '\u014d' # 0xF2 -> LATIN SMALL LETTER O WITH MACRON + '\u0137' # 0xF3 -> LATIN SMALL LETTER K WITH CEDILLA + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + '\u0173' # 0xF9 -> LATIN SMALL LETTER U WITH OGONEK + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\u0169' # 0xFD -> LATIN SMALL LETTER U WITH TILDE + '\u016b' # 0xFE -> LATIN SMALL LETTER U WITH MACRON + '\u02d9' # 0xFF -> DOT ABOVE ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_5.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_5.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_5.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0401' # 0xA1 -> CYRILLIC CAPITAL LETTER IO - u'\u0402' # 0xA2 -> CYRILLIC CAPITAL LETTER DJE - u'\u0403' # 0xA3 -> CYRILLIC CAPITAL LETTER GJE - u'\u0404' # 0xA4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u0405' # 0xA5 -> CYRILLIC CAPITAL LETTER DZE - u'\u0406' # 0xA6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0407' # 0xA7 -> CYRILLIC CAPITAL LETTER YI - u'\u0408' # 0xA8 -> CYRILLIC CAPITAL LETTER JE - u'\u0409' # 0xA9 -> CYRILLIC CAPITAL LETTER LJE - u'\u040a' # 0xAA -> CYRILLIC CAPITAL LETTER NJE - u'\u040b' # 0xAB -> CYRILLIC CAPITAL LETTER TSHE - u'\u040c' # 0xAC -> CYRILLIC CAPITAL LETTER KJE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u040e' # 0xAE -> CYRILLIC CAPITAL LETTER SHORT U - u'\u040f' # 0xAF -> CYRILLIC CAPITAL LETTER DZHE - u'\u0410' # 0xB0 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0xB1 -> CYRILLIC CAPITAL LETTER BE - u'\u0412' # 0xB2 -> CYRILLIC CAPITAL LETTER VE - u'\u0413' # 0xB3 -> CYRILLIC CAPITAL LETTER GHE - u'\u0414' # 0xB4 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0xB5 -> CYRILLIC CAPITAL LETTER IE - u'\u0416' # 0xB6 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0417' # 0xB7 -> CYRILLIC CAPITAL LETTER ZE - u'\u0418' # 0xB8 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0xB9 -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0xBA -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0xBB -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0xBC -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0xBD -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0xBE -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0xBF -> CYRILLIC CAPITAL LETTER PE - u'\u0420' # 0xC0 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0xC1 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0xC2 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0xC3 -> CYRILLIC CAPITAL LETTER U - u'\u0424' # 0xC4 -> CYRILLIC CAPITAL LETTER EF - u'\u0425' # 0xC5 -> CYRILLIC CAPITAL LETTER HA - u'\u0426' # 0xC6 -> CYRILLIC CAPITAL LETTER TSE - u'\u0427' # 0xC7 -> CYRILLIC CAPITAL LETTER CHE - u'\u0428' # 0xC8 -> CYRILLIC CAPITAL LETTER SHA - u'\u0429' # 0xC9 -> CYRILLIC CAPITAL LETTER SHCHA - u'\u042a' # 0xCA -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u042b' # 0xCB -> CYRILLIC CAPITAL LETTER YERU - u'\u042c' # 0xCC -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042d' # 0xCD -> CYRILLIC CAPITAL LETTER E - u'\u042e' # 0xCE -> CYRILLIC CAPITAL LETTER YU - u'\u042f' # 0xCF -> CYRILLIC CAPITAL LETTER YA - u'\u0430' # 0xD0 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xD1 -> CYRILLIC SMALL LETTER BE - u'\u0432' # 0xD2 -> CYRILLIC SMALL LETTER VE - u'\u0433' # 0xD3 -> CYRILLIC SMALL LETTER GHE - u'\u0434' # 0xD4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xD5 -> CYRILLIC SMALL LETTER IE - u'\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE - u'\u0437' # 0xD7 -> CYRILLIC SMALL LETTER ZE - u'\u0438' # 0xD8 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xD9 -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xDA -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xDB -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xDC -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xDD -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xDE -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xDF -> CYRILLIC SMALL LETTER PE - u'\u0440' # 0xE0 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xE1 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xE2 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xE3 -> CYRILLIC SMALL LETTER U - u'\u0444' # 0xE4 -> CYRILLIC SMALL LETTER EF - u'\u0445' # 0xE5 -> CYRILLIC SMALL LETTER HA - u'\u0446' # 0xE6 -> CYRILLIC SMALL LETTER TSE - u'\u0447' # 0xE7 -> CYRILLIC SMALL LETTER CHE - u'\u0448' # 0xE8 -> CYRILLIC SMALL LETTER SHA - u'\u0449' # 0xE9 -> CYRILLIC SMALL LETTER SHCHA - u'\u044a' # 0xEA -> CYRILLIC SMALL LETTER HARD SIGN - u'\u044b' # 0xEB -> CYRILLIC SMALL LETTER YERU - u'\u044c' # 0xEC -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044d' # 0xED -> CYRILLIC SMALL LETTER E - u'\u044e' # 0xEE -> CYRILLIC SMALL LETTER YU - u'\u044f' # 0xEF -> CYRILLIC SMALL LETTER YA - u'\u2116' # 0xF0 -> NUMERO SIGN - u'\u0451' # 0xF1 -> CYRILLIC SMALL LETTER IO - u'\u0452' # 0xF2 -> CYRILLIC SMALL LETTER DJE - u'\u0453' # 0xF3 -> CYRILLIC SMALL LETTER GJE - u'\u0454' # 0xF4 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u0455' # 0xF5 -> CYRILLIC SMALL LETTER DZE - u'\u0456' # 0xF6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0457' # 0xF7 -> CYRILLIC SMALL LETTER YI - u'\u0458' # 0xF8 -> CYRILLIC SMALL LETTER JE - u'\u0459' # 0xF9 -> CYRILLIC SMALL LETTER LJE - u'\u045a' # 0xFA -> CYRILLIC SMALL LETTER NJE - u'\u045b' # 0xFB -> CYRILLIC SMALL LETTER TSHE - u'\u045c' # 0xFC -> CYRILLIC SMALL LETTER KJE - u'\xa7' # 0xFD -> SECTION SIGN - u'\u045e' # 0xFE -> CYRILLIC SMALL LETTER SHORT U - u'\u045f' # 0xFF -> CYRILLIC SMALL LETTER DZHE + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u0401' # 0xA1 -> CYRILLIC CAPITAL LETTER IO + '\u0402' # 0xA2 -> CYRILLIC CAPITAL LETTER DJE + '\u0403' # 0xA3 -> CYRILLIC CAPITAL LETTER GJE + '\u0404' # 0xA4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE + '\u0405' # 0xA5 -> CYRILLIC CAPITAL LETTER DZE + '\u0406' # 0xA6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I + '\u0407' # 0xA7 -> CYRILLIC CAPITAL LETTER YI + '\u0408' # 0xA8 -> CYRILLIC CAPITAL LETTER JE + '\u0409' # 0xA9 -> CYRILLIC CAPITAL LETTER LJE + '\u040a' # 0xAA -> CYRILLIC CAPITAL LETTER NJE + '\u040b' # 0xAB -> CYRILLIC CAPITAL LETTER TSHE + '\u040c' # 0xAC -> CYRILLIC CAPITAL LETTER KJE + '\xad' # 0xAD -> SOFT HYPHEN + '\u040e' # 0xAE -> CYRILLIC CAPITAL LETTER SHORT U + '\u040f' # 0xAF -> CYRILLIC CAPITAL LETTER DZHE + '\u0410' # 0xB0 -> CYRILLIC CAPITAL LETTER A + '\u0411' # 0xB1 -> CYRILLIC CAPITAL LETTER BE + '\u0412' # 0xB2 -> CYRILLIC CAPITAL LETTER VE + '\u0413' # 0xB3 -> CYRILLIC CAPITAL LETTER GHE + '\u0414' # 0xB4 -> CYRILLIC CAPITAL LETTER DE + '\u0415' # 0xB5 -> CYRILLIC CAPITAL LETTER IE + '\u0416' # 0xB6 -> CYRILLIC CAPITAL LETTER ZHE + '\u0417' # 0xB7 -> CYRILLIC CAPITAL LETTER ZE + '\u0418' # 0xB8 -> CYRILLIC CAPITAL LETTER I + '\u0419' # 0xB9 -> CYRILLIC CAPITAL LETTER SHORT I + '\u041a' # 0xBA -> CYRILLIC CAPITAL LETTER KA + '\u041b' # 0xBB -> CYRILLIC CAPITAL LETTER EL + '\u041c' # 0xBC -> CYRILLIC CAPITAL LETTER EM + '\u041d' # 0xBD -> CYRILLIC CAPITAL LETTER EN + '\u041e' # 0xBE -> CYRILLIC CAPITAL LETTER O + '\u041f' # 0xBF -> CYRILLIC CAPITAL LETTER PE + '\u0420' # 0xC0 -> CYRILLIC CAPITAL LETTER ER + '\u0421' # 0xC1 -> CYRILLIC CAPITAL LETTER ES + '\u0422' # 0xC2 -> CYRILLIC CAPITAL LETTER TE + '\u0423' # 0xC3 -> CYRILLIC CAPITAL LETTER U + '\u0424' # 0xC4 -> CYRILLIC CAPITAL LETTER EF + '\u0425' # 0xC5 -> CYRILLIC CAPITAL LETTER HA + '\u0426' # 0xC6 -> CYRILLIC CAPITAL LETTER TSE + '\u0427' # 0xC7 -> CYRILLIC CAPITAL LETTER CHE + '\u0428' # 0xC8 -> CYRILLIC CAPITAL LETTER SHA + '\u0429' # 0xC9 -> CYRILLIC CAPITAL LETTER SHCHA + '\u042a' # 0xCA -> CYRILLIC CAPITAL LETTER HARD SIGN + '\u042b' # 0xCB -> CYRILLIC CAPITAL LETTER YERU + '\u042c' # 0xCC -> CYRILLIC CAPITAL LETTER SOFT SIGN + '\u042d' # 0xCD -> CYRILLIC CAPITAL LETTER E + '\u042e' # 0xCE -> CYRILLIC CAPITAL LETTER YU + '\u042f' # 0xCF -> CYRILLIC CAPITAL LETTER YA + '\u0430' # 0xD0 -> CYRILLIC SMALL LETTER A + '\u0431' # 0xD1 -> CYRILLIC SMALL LETTER BE + '\u0432' # 0xD2 -> CYRILLIC SMALL LETTER VE + '\u0433' # 0xD3 -> CYRILLIC SMALL LETTER GHE + '\u0434' # 0xD4 -> CYRILLIC SMALL LETTER DE + '\u0435' # 0xD5 -> CYRILLIC SMALL LETTER IE + '\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE + '\u0437' # 0xD7 -> CYRILLIC SMALL LETTER ZE + '\u0438' # 0xD8 -> CYRILLIC SMALL LETTER I + '\u0439' # 0xD9 -> CYRILLIC SMALL LETTER SHORT I + '\u043a' # 0xDA -> CYRILLIC SMALL LETTER KA + '\u043b' # 0xDB -> CYRILLIC SMALL LETTER EL + '\u043c' # 0xDC -> CYRILLIC SMALL LETTER EM + '\u043d' # 0xDD -> CYRILLIC SMALL LETTER EN + '\u043e' # 0xDE -> CYRILLIC SMALL LETTER O + '\u043f' # 0xDF -> CYRILLIC SMALL LETTER PE + '\u0440' # 0xE0 -> CYRILLIC SMALL LETTER ER + '\u0441' # 0xE1 -> CYRILLIC SMALL LETTER ES + '\u0442' # 0xE2 -> CYRILLIC SMALL LETTER TE + '\u0443' # 0xE3 -> CYRILLIC SMALL LETTER U + '\u0444' # 0xE4 -> CYRILLIC SMALL LETTER EF + '\u0445' # 0xE5 -> CYRILLIC SMALL LETTER HA + '\u0446' # 0xE6 -> CYRILLIC SMALL LETTER TSE + '\u0447' # 0xE7 -> CYRILLIC SMALL LETTER CHE + '\u0448' # 0xE8 -> CYRILLIC SMALL LETTER SHA + '\u0449' # 0xE9 -> CYRILLIC SMALL LETTER SHCHA + '\u044a' # 0xEA -> CYRILLIC SMALL LETTER HARD SIGN + '\u044b' # 0xEB -> CYRILLIC SMALL LETTER YERU + '\u044c' # 0xEC -> CYRILLIC SMALL LETTER SOFT SIGN + '\u044d' # 0xED -> CYRILLIC SMALL LETTER E + '\u044e' # 0xEE -> CYRILLIC SMALL LETTER YU + '\u044f' # 0xEF -> CYRILLIC SMALL LETTER YA + '\u2116' # 0xF0 -> NUMERO SIGN + '\u0451' # 0xF1 -> CYRILLIC SMALL LETTER IO + '\u0452' # 0xF2 -> CYRILLIC SMALL LETTER DJE + '\u0453' # 0xF3 -> CYRILLIC SMALL LETTER GJE + '\u0454' # 0xF4 -> CYRILLIC SMALL LETTER UKRAINIAN IE + '\u0455' # 0xF5 -> CYRILLIC SMALL LETTER DZE + '\u0456' # 0xF6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I + '\u0457' # 0xF7 -> CYRILLIC SMALL LETTER YI + '\u0458' # 0xF8 -> CYRILLIC SMALL LETTER JE + '\u0459' # 0xF9 -> CYRILLIC SMALL LETTER LJE + '\u045a' # 0xFA -> CYRILLIC SMALL LETTER NJE + '\u045b' # 0xFB -> CYRILLIC SMALL LETTER TSHE + '\u045c' # 0xFC -> CYRILLIC SMALL LETTER KJE + '\xa7' # 0xFD -> SECTION SIGN + '\u045e' # 0xFE -> CYRILLIC SMALL LETTER SHORT U + '\u045f' # 0xFF -> CYRILLIC SMALL LETTER DZHE ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_6.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_6.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_6.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u060c' # 0xAC -> ARABIC COMMA - u'\xad' # 0xAD -> SOFT HYPHEN - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u061b' # 0xBB -> ARABIC SEMICOLON - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u061f' # 0xBF -> ARABIC QUESTION MARK - u'\ufffe' - u'\u0621' # 0xC1 -> ARABIC LETTER HAMZA - u'\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE - u'\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE - u'\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE - u'\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW - u'\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE - u'\u0627' # 0xC7 -> ARABIC LETTER ALEF - u'\u0628' # 0xC8 -> ARABIC LETTER BEH - u'\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA - u'\u062a' # 0xCA -> ARABIC LETTER TEH - u'\u062b' # 0xCB -> ARABIC LETTER THEH - u'\u062c' # 0xCC -> ARABIC LETTER JEEM - u'\u062d' # 0xCD -> ARABIC LETTER HAH - u'\u062e' # 0xCE -> ARABIC LETTER KHAH - u'\u062f' # 0xCF -> ARABIC LETTER DAL - u'\u0630' # 0xD0 -> ARABIC LETTER THAL - u'\u0631' # 0xD1 -> ARABIC LETTER REH - u'\u0632' # 0xD2 -> ARABIC LETTER ZAIN - u'\u0633' # 0xD3 -> ARABIC LETTER SEEN - u'\u0634' # 0xD4 -> ARABIC LETTER SHEEN - u'\u0635' # 0xD5 -> ARABIC LETTER SAD - u'\u0636' # 0xD6 -> ARABIC LETTER DAD - u'\u0637' # 0xD7 -> ARABIC LETTER TAH - u'\u0638' # 0xD8 -> ARABIC LETTER ZAH - u'\u0639' # 0xD9 -> ARABIC LETTER AIN - u'\u063a' # 0xDA -> ARABIC LETTER GHAIN - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u0640' # 0xE0 -> ARABIC TATWEEL - u'\u0641' # 0xE1 -> ARABIC LETTER FEH - u'\u0642' # 0xE2 -> ARABIC LETTER QAF - u'\u0643' # 0xE3 -> ARABIC LETTER KAF - u'\u0644' # 0xE4 -> ARABIC LETTER LAM - u'\u0645' # 0xE5 -> ARABIC LETTER MEEM - u'\u0646' # 0xE6 -> ARABIC LETTER NOON - u'\u0647' # 0xE7 -> ARABIC LETTER HEH - u'\u0648' # 0xE8 -> ARABIC LETTER WAW - u'\u0649' # 0xE9 -> ARABIC LETTER ALEF MAKSURA - u'\u064a' # 0xEA -> ARABIC LETTER YEH - u'\u064b' # 0xEB -> ARABIC FATHATAN - u'\u064c' # 0xEC -> ARABIC DAMMATAN - u'\u064d' # 0xED -> ARABIC KASRATAN - u'\u064e' # 0xEE -> ARABIC FATHA - u'\u064f' # 0xEF -> ARABIC DAMMA - u'\u0650' # 0xF0 -> ARABIC KASRA - u'\u0651' # 0xF1 -> ARABIC SHADDA - u'\u0652' # 0xF2 -> ARABIC SUKUN - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\ufffe' + '\ufffe' + '\ufffe' + '\xa4' # 0xA4 -> CURRENCY SIGN + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\u060c' # 0xAC -> ARABIC COMMA + '\xad' # 0xAD -> SOFT HYPHEN + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\u061b' # 0xBB -> ARABIC SEMICOLON + '\ufffe' + '\ufffe' + '\ufffe' + '\u061f' # 0xBF -> ARABIC QUESTION MARK + '\ufffe' + '\u0621' # 0xC1 -> ARABIC LETTER HAMZA + '\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE + '\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE + '\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE + '\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW + '\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE + '\u0627' # 0xC7 -> ARABIC LETTER ALEF + '\u0628' # 0xC8 -> ARABIC LETTER BEH + '\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA + '\u062a' # 0xCA -> ARABIC LETTER TEH + '\u062b' # 0xCB -> ARABIC LETTER THEH + '\u062c' # 0xCC -> ARABIC LETTER JEEM + '\u062d' # 0xCD -> ARABIC LETTER HAH + '\u062e' # 0xCE -> ARABIC LETTER KHAH + '\u062f' # 0xCF -> ARABIC LETTER DAL + '\u0630' # 0xD0 -> ARABIC LETTER THAL + '\u0631' # 0xD1 -> ARABIC LETTER REH + '\u0632' # 0xD2 -> ARABIC LETTER ZAIN + '\u0633' # 0xD3 -> ARABIC LETTER SEEN + '\u0634' # 0xD4 -> ARABIC LETTER SHEEN + '\u0635' # 0xD5 -> ARABIC LETTER SAD + '\u0636' # 0xD6 -> ARABIC LETTER DAD + '\u0637' # 0xD7 -> ARABIC LETTER TAH + '\u0638' # 0xD8 -> ARABIC LETTER ZAH + '\u0639' # 0xD9 -> ARABIC LETTER AIN + '\u063a' # 0xDA -> ARABIC LETTER GHAIN + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\u0640' # 0xE0 -> ARABIC TATWEEL + '\u0641' # 0xE1 -> ARABIC LETTER FEH + '\u0642' # 0xE2 -> ARABIC LETTER QAF + '\u0643' # 0xE3 -> ARABIC LETTER KAF + '\u0644' # 0xE4 -> ARABIC LETTER LAM + '\u0645' # 0xE5 -> ARABIC LETTER MEEM + '\u0646' # 0xE6 -> ARABIC LETTER NOON + '\u0647' # 0xE7 -> ARABIC LETTER HEH + '\u0648' # 0xE8 -> ARABIC LETTER WAW + '\u0649' # 0xE9 -> ARABIC LETTER ALEF MAKSURA + '\u064a' # 0xEA -> ARABIC LETTER YEH + '\u064b' # 0xEB -> ARABIC FATHATAN + '\u064c' # 0xEC -> ARABIC DAMMATAN + '\u064d' # 0xED -> ARABIC KASRATAN + '\u064e' # 0xEE -> ARABIC FATHA + '\u064f' # 0xEF -> ARABIC DAMMA + '\u0650' # 0xF0 -> ARABIC KASRA + '\u0651' # 0xF1 -> ARABIC SHADDA + '\u0652' # 0xF2 -> ARABIC SUKUN + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_7.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_7.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_7.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u2018' # 0xA1 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xA2 -> RIGHT SINGLE QUOTATION MARK - u'\xa3' # 0xA3 -> POUND SIGN - u'\u20ac' # 0xA4 -> EURO SIGN - u'\u20af' # 0xA5 -> DRACHMA SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u037a' # 0xAA -> GREEK YPOGEGRAMMENI - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\ufffe' - u'\u2015' # 0xAF -> HORIZONTAL BAR - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\u0384' # 0xB4 -> GREEK TONOS - u'\u0385' # 0xB5 -> GREEK DIALYTIKA TONOS - u'\u0386' # 0xB6 -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u0388' # 0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0389' # 0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u038c' # 0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\u038e' # 0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u038f' # 0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\u0390' # 0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u0391' # 0xC1 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0xC2 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0xC3 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0xC4 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0xC5 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0xC6 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0xC7 -> GREEK CAPITAL LETTER ETA - u'\u0398' # 0xC8 -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0xC9 -> GREEK CAPITAL LETTER IOTA - u'\u039a' # 0xCA -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0xCB -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0xCC -> GREEK CAPITAL LETTER MU - u'\u039d' # 0xCD -> GREEK CAPITAL LETTER NU - u'\u039e' # 0xCE -> GREEK CAPITAL LETTER XI - u'\u039f' # 0xCF -> GREEK CAPITAL LETTER OMICRON - u'\u03a0' # 0xD0 -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0xD1 -> GREEK CAPITAL LETTER RHO - u'\ufffe' - u'\u03a3' # 0xD3 -> GREEK CAPITAL LETTER SIGMA - u'\u03a4' # 0xD4 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0xD5 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0xD6 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0xD7 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0xD8 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0xD9 -> GREEK CAPITAL LETTER OMEGA - u'\u03aa' # 0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u03ab' # 0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\u03ac' # 0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u03ad' # 0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0xDE -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03af' # 0xDF -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03b0' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA - u'\u03b3' # 0xE3 -> GREEK SMALL LETTER GAMMA - u'\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON - u'\u03b6' # 0xE6 -> GREEK SMALL LETTER ZETA - u'\u03b7' # 0xE7 -> GREEK SMALL LETTER ETA - u'\u03b8' # 0xE8 -> GREEK SMALL LETTER THETA - u'\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0xEA -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0xEB -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0xEC -> GREEK SMALL LETTER MU - u'\u03bd' # 0xED -> GREEK SMALL LETTER NU - u'\u03be' # 0xEE -> GREEK SMALL LETTER XI - u'\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0xF0 -> GREEK SMALL LETTER PI - u'\u03c1' # 0xF1 -> GREEK SMALL LETTER RHO - u'\u03c2' # 0xF2 -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA - u'\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU - u'\u03c5' # 0xF5 -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0xF6 -> GREEK SMALL LETTER PHI - u'\u03c7' # 0xF7 -> GREEK SMALL LETTER CHI - u'\u03c8' # 0xF8 -> GREEK SMALL LETTER PSI - u'\u03c9' # 0xF9 -> GREEK SMALL LETTER OMEGA - u'\u03ca' # 0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03cb' # 0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03cc' # 0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03ce' # 0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\ufffe' + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\u2018' # 0xA1 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0xA2 -> RIGHT SINGLE QUOTATION MARK + '\xa3' # 0xA3 -> POUND SIGN + '\u20ac' # 0xA4 -> EURO SIGN + '\u20af' # 0xA5 -> DRACHMA SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u037a' # 0xAA -> GREEK YPOGEGRAMMENI + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\ufffe' + '\u2015' # 0xAF -> HORIZONTAL BAR + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\u0384' # 0xB4 -> GREEK TONOS + '\u0385' # 0xB5 -> GREEK DIALYTIKA TONOS + '\u0386' # 0xB6 -> GREEK CAPITAL LETTER ALPHA WITH TONOS + '\xb7' # 0xB7 -> MIDDLE DOT + '\u0388' # 0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS + '\u0389' # 0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS + '\u038a' # 0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u038c' # 0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\u038e' # 0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS + '\u038f' # 0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS + '\u0390' # 0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS + '\u0391' # 0xC1 -> GREEK CAPITAL LETTER ALPHA + '\u0392' # 0xC2 -> GREEK CAPITAL LETTER BETA + '\u0393' # 0xC3 -> GREEK CAPITAL LETTER GAMMA + '\u0394' # 0xC4 -> GREEK CAPITAL LETTER DELTA + '\u0395' # 0xC5 -> GREEK CAPITAL LETTER EPSILON + '\u0396' # 0xC6 -> GREEK CAPITAL LETTER ZETA + '\u0397' # 0xC7 -> GREEK CAPITAL LETTER ETA + '\u0398' # 0xC8 -> GREEK CAPITAL LETTER THETA + '\u0399' # 0xC9 -> GREEK CAPITAL LETTER IOTA + '\u039a' # 0xCA -> GREEK CAPITAL LETTER KAPPA + '\u039b' # 0xCB -> GREEK CAPITAL LETTER LAMDA + '\u039c' # 0xCC -> GREEK CAPITAL LETTER MU + '\u039d' # 0xCD -> GREEK CAPITAL LETTER NU + '\u039e' # 0xCE -> GREEK CAPITAL LETTER XI + '\u039f' # 0xCF -> GREEK CAPITAL LETTER OMICRON + '\u03a0' # 0xD0 -> GREEK CAPITAL LETTER PI + '\u03a1' # 0xD1 -> GREEK CAPITAL LETTER RHO + '\ufffe' + '\u03a3' # 0xD3 -> GREEK CAPITAL LETTER SIGMA + '\u03a4' # 0xD4 -> GREEK CAPITAL LETTER TAU + '\u03a5' # 0xD5 -> GREEK CAPITAL LETTER UPSILON + '\u03a6' # 0xD6 -> GREEK CAPITAL LETTER PHI + '\u03a7' # 0xD7 -> GREEK CAPITAL LETTER CHI + '\u03a8' # 0xD8 -> GREEK CAPITAL LETTER PSI + '\u03a9' # 0xD9 -> GREEK CAPITAL LETTER OMEGA + '\u03aa' # 0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA + '\u03ab' # 0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA + '\u03ac' # 0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS + '\u03ad' # 0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS + '\u03ae' # 0xDE -> GREEK SMALL LETTER ETA WITH TONOS + '\u03af' # 0xDF -> GREEK SMALL LETTER IOTA WITH TONOS + '\u03b0' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS + '\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA + '\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA + '\u03b3' # 0xE3 -> GREEK SMALL LETTER GAMMA + '\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA + '\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON + '\u03b6' # 0xE6 -> GREEK SMALL LETTER ZETA + '\u03b7' # 0xE7 -> GREEK SMALL LETTER ETA + '\u03b8' # 0xE8 -> GREEK SMALL LETTER THETA + '\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA + '\u03ba' # 0xEA -> GREEK SMALL LETTER KAPPA + '\u03bb' # 0xEB -> GREEK SMALL LETTER LAMDA + '\u03bc' # 0xEC -> GREEK SMALL LETTER MU + '\u03bd' # 0xED -> GREEK SMALL LETTER NU + '\u03be' # 0xEE -> GREEK SMALL LETTER XI + '\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON + '\u03c0' # 0xF0 -> GREEK SMALL LETTER PI + '\u03c1' # 0xF1 -> GREEK SMALL LETTER RHO + '\u03c2' # 0xF2 -> GREEK SMALL LETTER FINAL SIGMA + '\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA + '\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU + '\u03c5' # 0xF5 -> GREEK SMALL LETTER UPSILON + '\u03c6' # 0xF6 -> GREEK SMALL LETTER PHI + '\u03c7' # 0xF7 -> GREEK SMALL LETTER CHI + '\u03c8' # 0xF8 -> GREEK SMALL LETTER PSI + '\u03c9' # 0xF9 -> GREEK SMALL LETTER OMEGA + '\u03ca' # 0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA + '\u03cb' # 0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA + '\u03cc' # 0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS + '\u03cd' # 0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS + '\u03ce' # 0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS + '\ufffe' ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_8.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_8.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_8.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\ufffe' - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xd7' # 0xAA -> MULTIPLICATION SIGN - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xf7' # 0xBA -> DIVISION SIGN - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u2017' # 0xDF -> DOUBLE LOW LINE - u'\u05d0' # 0xE0 -> HEBREW LETTER ALEF - u'\u05d1' # 0xE1 -> HEBREW LETTER BET - u'\u05d2' # 0xE2 -> HEBREW LETTER GIMEL - u'\u05d3' # 0xE3 -> HEBREW LETTER DALET - u'\u05d4' # 0xE4 -> HEBREW LETTER HE - u'\u05d5' # 0xE5 -> HEBREW LETTER VAV - u'\u05d6' # 0xE6 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0xE7 -> HEBREW LETTER HET - u'\u05d8' # 0xE8 -> HEBREW LETTER TET - u'\u05d9' # 0xE9 -> HEBREW LETTER YOD - u'\u05da' # 0xEA -> HEBREW LETTER FINAL KAF - u'\u05db' # 0xEB -> HEBREW LETTER KAF - u'\u05dc' # 0xEC -> HEBREW LETTER LAMED - u'\u05dd' # 0xED -> HEBREW LETTER FINAL MEM - u'\u05de' # 0xEE -> HEBREW LETTER MEM - u'\u05df' # 0xEF -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0xF0 -> HEBREW LETTER NUN - u'\u05e1' # 0xF1 -> HEBREW LETTER SAMEKH - u'\u05e2' # 0xF2 -> HEBREW LETTER AYIN - u'\u05e3' # 0xF3 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0xF4 -> HEBREW LETTER PE - u'\u05e5' # 0xF5 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0xF6 -> HEBREW LETTER TSADI - u'\u05e7' # 0xF7 -> HEBREW LETTER QOF - u'\u05e8' # 0xF8 -> HEBREW LETTER RESH - u'\u05e9' # 0xF9 -> HEBREW LETTER SHIN - u'\u05ea' # 0xFA -> HEBREW LETTER TAV - u'\ufffe' - u'\ufffe' - u'\u200e' # 0xFD -> LEFT-TO-RIGHT MARK - u'\u200f' # 0xFE -> RIGHT-TO-LEFT MARK - u'\ufffe' + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\ufffe' + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\xd7' # 0xAA -> MULTIPLICATION SIGN + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\xf7' # 0xBA -> DIVISION SIGN + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\u2017' # 0xDF -> DOUBLE LOW LINE + '\u05d0' # 0xE0 -> HEBREW LETTER ALEF + '\u05d1' # 0xE1 -> HEBREW LETTER BET + '\u05d2' # 0xE2 -> HEBREW LETTER GIMEL + '\u05d3' # 0xE3 -> HEBREW LETTER DALET + '\u05d4' # 0xE4 -> HEBREW LETTER HE + '\u05d5' # 0xE5 -> HEBREW LETTER VAV + '\u05d6' # 0xE6 -> HEBREW LETTER ZAYIN + '\u05d7' # 0xE7 -> HEBREW LETTER HET + '\u05d8' # 0xE8 -> HEBREW LETTER TET + '\u05d9' # 0xE9 -> HEBREW LETTER YOD + '\u05da' # 0xEA -> HEBREW LETTER FINAL KAF + '\u05db' # 0xEB -> HEBREW LETTER KAF + '\u05dc' # 0xEC -> HEBREW LETTER LAMED + '\u05dd' # 0xED -> HEBREW LETTER FINAL MEM + '\u05de' # 0xEE -> HEBREW LETTER MEM + '\u05df' # 0xEF -> HEBREW LETTER FINAL NUN + '\u05e0' # 0xF0 -> HEBREW LETTER NUN + '\u05e1' # 0xF1 -> HEBREW LETTER SAMEKH + '\u05e2' # 0xF2 -> HEBREW LETTER AYIN + '\u05e3' # 0xF3 -> HEBREW LETTER FINAL PE + '\u05e4' # 0xF4 -> HEBREW LETTER PE + '\u05e5' # 0xF5 -> HEBREW LETTER FINAL TSADI + '\u05e6' # 0xF6 -> HEBREW LETTER TSADI + '\u05e7' # 0xF7 -> HEBREW LETTER QOF + '\u05e8' # 0xF8 -> HEBREW LETTER RESH + '\u05e9' # 0xF9 -> HEBREW LETTER SHIN + '\u05ea' # 0xFA -> HEBREW LETTER TAV + '\ufffe' + '\ufffe' + '\u200e' # 0xFD -> LEFT-TO-RIGHT MARK + '\u200f' # 0xFE -> RIGHT-TO-LEFT MARK + '\ufffe' ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/iso8859_9.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/iso8859_9.py (original) +++ python/branches/py3k-struni/Lib/encodings/iso8859_9.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u011e' # 0xD0 -> LATIN CAPITAL LETTER G WITH BREVE - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0130' # 0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u011f' # 0xF0 -> LATIN SMALL LETTER G WITH BREVE - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u0131' # 0xFD -> LATIN SMALL LETTER DOTLESS I - u'\u015f' # 0xFE -> LATIN SMALL LETTER S WITH CEDILLA - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\xa0' # 0xA0 -> NO-BREAK SPACE + '\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa4' # 0xA4 -> CURRENCY SIGN + '\xa5' # 0xA5 -> YEN SIGN + '\xa6' # 0xA6 -> BROKEN BAR + '\xa7' # 0xA7 -> SECTION SIGN + '\xa8' # 0xA8 -> DIAERESIS + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR + '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xac' # 0xAC -> NOT SIGN + '\xad' # 0xAD -> SOFT HYPHEN + '\xae' # 0xAE -> REGISTERED SIGN + '\xaf' # 0xAF -> MACRON + '\xb0' # 0xB0 -> DEGREE SIGN + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\xb2' # 0xB2 -> SUPERSCRIPT TWO + '\xb3' # 0xB3 -> SUPERSCRIPT THREE + '\xb4' # 0xB4 -> ACUTE ACCENT + '\xb5' # 0xB5 -> MICRO SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xb7' # 0xB7 -> MIDDLE DOT + '\xb8' # 0xB8 -> CEDILLA + '\xb9' # 0xB9 -> SUPERSCRIPT ONE + '\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR + '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF + '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS + '\xbf' # 0xBF -> INVERTED QUESTION MARK + '\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE + '\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE + '\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\u011e' # 0xD0 -> LATIN CAPITAL LETTER G WITH BREVE + '\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE + '\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd7' # 0xD7 -> MULTIPLICATION SIGN + '\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE + '\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u0130' # 0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE + '\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA + '\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S + '\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE + '\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE + '\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe6' # 0xE6 -> LATIN SMALL LETTER AE + '\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA + '\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE + '\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS + '\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE + '\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS + '\u011f' # 0xF0 -> LATIN SMALL LETTER G WITH BREVE + '\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE + '\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE + '\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE + '\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0xF7 -> DIVISION SIGN + '\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE + '\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE + '\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS + '\u0131' # 0xFD -> LATIN SMALL LETTER DOTLESS I + '\u015f' # 0xFE -> LATIN SMALL LETTER S WITH CEDILLA + '\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/koi8_r.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/koi8_r.py (original) +++ python/branches/py3k-struni/Lib/encodings/koi8_r.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u2500' # 0x80 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u2502' # 0x81 -> BOX DRAWINGS LIGHT VERTICAL - u'\u250c' # 0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2510' # 0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2518' # 0x85 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u251c' # 0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2524' # 0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u252c' # 0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u2534' # 0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u253c' # 0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u2580' # 0x8B -> UPPER HALF BLOCK - u'\u2584' # 0x8C -> LOWER HALF BLOCK - u'\u2588' # 0x8D -> FULL BLOCK - u'\u258c' # 0x8E -> LEFT HALF BLOCK - u'\u2590' # 0x8F -> RIGHT HALF BLOCK - u'\u2591' # 0x90 -> LIGHT SHADE - u'\u2592' # 0x91 -> MEDIUM SHADE - u'\u2593' # 0x92 -> DARK SHADE - u'\u2320' # 0x93 -> TOP HALF INTEGRAL - u'\u25a0' # 0x94 -> BLACK SQUARE - u'\u2219' # 0x95 -> BULLET OPERATOR - u'\u221a' # 0x96 -> SQUARE ROOT - u'\u2248' # 0x97 -> ALMOST EQUAL TO - u'\u2264' # 0x98 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0x99 -> GREATER-THAN OR EQUAL TO - u'\xa0' # 0x9A -> NO-BREAK SPACE - u'\u2321' # 0x9B -> BOTTOM HALF INTEGRAL - u'\xb0' # 0x9C -> DEGREE SIGN - u'\xb2' # 0x9D -> SUPERSCRIPT TWO - u'\xb7' # 0x9E -> MIDDLE DOT - u'\xf7' # 0x9F -> DIVISION SIGN - u'\u2550' # 0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u2551' # 0xA1 -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2552' # 0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u0451' # 0xA3 -> CYRILLIC SMALL LETTER IO - u'\u2553' # 0xA4 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u2554' # 0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2555' # 0xA6 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2556' # 0xA7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2557' # 0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u2558' # 0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2559' # 0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u255a' # 0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u255b' # 0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u255c' # 0xAD -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255d' # 0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255e' # 0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u2560' # 0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2561' # 0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u0401' # 0xB3 -> CYRILLIC CAPITAL LETTER IO - u'\u2562' # 0xB4 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2563' # 0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2564' # 0xB6 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0xB7 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2566' # 0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2567' # 0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2569' # 0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u256a' # 0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u256b' # 0xBD -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256c' # 0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa9' # 0xBF -> COPYRIGHT SIGN - u'\u044e' # 0xC0 -> CYRILLIC SMALL LETTER YU - u'\u0430' # 0xC1 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xC2 -> CYRILLIC SMALL LETTER BE - u'\u0446' # 0xC3 -> CYRILLIC SMALL LETTER TSE - u'\u0434' # 0xC4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xC5 -> CYRILLIC SMALL LETTER IE - u'\u0444' # 0xC6 -> CYRILLIC SMALL LETTER EF - u'\u0433' # 0xC7 -> CYRILLIC SMALL LETTER GHE - u'\u0445' # 0xC8 -> CYRILLIC SMALL LETTER HA - u'\u0438' # 0xC9 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xCA -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xCB -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xCC -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xCD -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xCE -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xCF -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xD0 -> CYRILLIC SMALL LETTER PE - u'\u044f' # 0xD1 -> CYRILLIC SMALL LETTER YA - u'\u0440' # 0xD2 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xD3 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xD4 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xD5 -> CYRILLIC SMALL LETTER U - u'\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE - u'\u0432' # 0xD7 -> CYRILLIC SMALL LETTER VE - u'\u044c' # 0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044b' # 0xD9 -> CYRILLIC SMALL LETTER YERU - u'\u0437' # 0xDA -> CYRILLIC SMALL LETTER ZE - u'\u0448' # 0xDB -> CYRILLIC SMALL LETTER SHA - u'\u044d' # 0xDC -> CYRILLIC SMALL LETTER E - u'\u0449' # 0xDD -> CYRILLIC SMALL LETTER SHCHA - u'\u0447' # 0xDE -> CYRILLIC SMALL LETTER CHE - u'\u044a' # 0xDF -> CYRILLIC SMALL LETTER HARD SIGN - u'\u042e' # 0xE0 -> CYRILLIC CAPITAL LETTER YU - u'\u0410' # 0xE1 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0xE2 -> CYRILLIC CAPITAL LETTER BE - u'\u0426' # 0xE3 -> CYRILLIC CAPITAL LETTER TSE - u'\u0414' # 0xE4 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0xE5 -> CYRILLIC CAPITAL LETTER IE - u'\u0424' # 0xE6 -> CYRILLIC CAPITAL LETTER EF - u'\u0413' # 0xE7 -> CYRILLIC CAPITAL LETTER GHE - u'\u0425' # 0xE8 -> CYRILLIC CAPITAL LETTER HA - u'\u0418' # 0xE9 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0xEA -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0xEB -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0xEC -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0xED -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0xEE -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0xEF -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0xF0 -> CYRILLIC CAPITAL LETTER PE - u'\u042f' # 0xF1 -> CYRILLIC CAPITAL LETTER YA - u'\u0420' # 0xF2 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0xF3 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0xF4 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0xF5 -> CYRILLIC CAPITAL LETTER U - u'\u0416' # 0xF6 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0412' # 0xF7 -> CYRILLIC CAPITAL LETTER VE - u'\u042c' # 0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042b' # 0xF9 -> CYRILLIC CAPITAL LETTER YERU - u'\u0417' # 0xFA -> CYRILLIC CAPITAL LETTER ZE - u'\u0428' # 0xFB -> CYRILLIC CAPITAL LETTER SHA - u'\u042d' # 0xFC -> CYRILLIC CAPITAL LETTER E - u'\u0429' # 0xFD -> CYRILLIC CAPITAL LETTER SHCHA - u'\u0427' # 0xFE -> CYRILLIC CAPITAL LETTER CHE - u'\u042a' # 0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u2500' # 0x80 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u2502' # 0x81 -> BOX DRAWINGS LIGHT VERTICAL + '\u250c' # 0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2510' # 0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2518' # 0x85 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u251c' # 0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2524' # 0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u252c' # 0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u2534' # 0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u253c' # 0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u2580' # 0x8B -> UPPER HALF BLOCK + '\u2584' # 0x8C -> LOWER HALF BLOCK + '\u2588' # 0x8D -> FULL BLOCK + '\u258c' # 0x8E -> LEFT HALF BLOCK + '\u2590' # 0x8F -> RIGHT HALF BLOCK + '\u2591' # 0x90 -> LIGHT SHADE + '\u2592' # 0x91 -> MEDIUM SHADE + '\u2593' # 0x92 -> DARK SHADE + '\u2320' # 0x93 -> TOP HALF INTEGRAL + '\u25a0' # 0x94 -> BLACK SQUARE + '\u2219' # 0x95 -> BULLET OPERATOR + '\u221a' # 0x96 -> SQUARE ROOT + '\u2248' # 0x97 -> ALMOST EQUAL TO + '\u2264' # 0x98 -> LESS-THAN OR EQUAL TO + '\u2265' # 0x99 -> GREATER-THAN OR EQUAL TO + '\xa0' # 0x9A -> NO-BREAK SPACE + '\u2321' # 0x9B -> BOTTOM HALF INTEGRAL + '\xb0' # 0x9C -> DEGREE SIGN + '\xb2' # 0x9D -> SUPERSCRIPT TWO + '\xb7' # 0x9E -> MIDDLE DOT + '\xf7' # 0x9F -> DIVISION SIGN + '\u2550' # 0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u2551' # 0xA1 -> BOX DRAWINGS DOUBLE VERTICAL + '\u2552' # 0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u0451' # 0xA3 -> CYRILLIC SMALL LETTER IO + '\u2553' # 0xA4 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE + '\u2554' # 0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u2555' # 0xA6 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE + '\u2556' # 0xA7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE + '\u2557' # 0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u2558' # 0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2559' # 0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u255a' # 0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u255b' # 0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u255c' # 0xAD -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE + '\u255d' # 0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255e' # 0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u2560' # 0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2561' # 0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u0401' # 0xB3 -> CYRILLIC CAPITAL LETTER IO + '\u2562' # 0xB4 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE + '\u2563' # 0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u2564' # 0xB6 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE + '\u2565' # 0xB7 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE + '\u2566' # 0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2567' # 0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2569' # 0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u256a' # 0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u256b' # 0xBD -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE + '\u256c' # 0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\xa9' # 0xBF -> COPYRIGHT SIGN + '\u044e' # 0xC0 -> CYRILLIC SMALL LETTER YU + '\u0430' # 0xC1 -> CYRILLIC SMALL LETTER A + '\u0431' # 0xC2 -> CYRILLIC SMALL LETTER BE + '\u0446' # 0xC3 -> CYRILLIC SMALL LETTER TSE + '\u0434' # 0xC4 -> CYRILLIC SMALL LETTER DE + '\u0435' # 0xC5 -> CYRILLIC SMALL LETTER IE + '\u0444' # 0xC6 -> CYRILLIC SMALL LETTER EF + '\u0433' # 0xC7 -> CYRILLIC SMALL LETTER GHE + '\u0445' # 0xC8 -> CYRILLIC SMALL LETTER HA + '\u0438' # 0xC9 -> CYRILLIC SMALL LETTER I + '\u0439' # 0xCA -> CYRILLIC SMALL LETTER SHORT I + '\u043a' # 0xCB -> CYRILLIC SMALL LETTER KA + '\u043b' # 0xCC -> CYRILLIC SMALL LETTER EL + '\u043c' # 0xCD -> CYRILLIC SMALL LETTER EM + '\u043d' # 0xCE -> CYRILLIC SMALL LETTER EN + '\u043e' # 0xCF -> CYRILLIC SMALL LETTER O + '\u043f' # 0xD0 -> CYRILLIC SMALL LETTER PE + '\u044f' # 0xD1 -> CYRILLIC SMALL LETTER YA + '\u0440' # 0xD2 -> CYRILLIC SMALL LETTER ER + '\u0441' # 0xD3 -> CYRILLIC SMALL LETTER ES + '\u0442' # 0xD4 -> CYRILLIC SMALL LETTER TE + '\u0443' # 0xD5 -> CYRILLIC SMALL LETTER U + '\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE + '\u0432' # 0xD7 -> CYRILLIC SMALL LETTER VE + '\u044c' # 0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN + '\u044b' # 0xD9 -> CYRILLIC SMALL LETTER YERU + '\u0437' # 0xDA -> CYRILLIC SMALL LETTER ZE + '\u0448' # 0xDB -> CYRILLIC SMALL LETTER SHA + '\u044d' # 0xDC -> CYRILLIC SMALL LETTER E + '\u0449' # 0xDD -> CYRILLIC SMALL LETTER SHCHA + '\u0447' # 0xDE -> CYRILLIC SMALL LETTER CHE + '\u044a' # 0xDF -> CYRILLIC SMALL LETTER HARD SIGN + '\u042e' # 0xE0 -> CYRILLIC CAPITAL LETTER YU + '\u0410' # 0xE1 -> CYRILLIC CAPITAL LETTER A + '\u0411' # 0xE2 -> CYRILLIC CAPITAL LETTER BE + '\u0426' # 0xE3 -> CYRILLIC CAPITAL LETTER TSE + '\u0414' # 0xE4 -> CYRILLIC CAPITAL LETTER DE + '\u0415' # 0xE5 -> CYRILLIC CAPITAL LETTER IE + '\u0424' # 0xE6 -> CYRILLIC CAPITAL LETTER EF + '\u0413' # 0xE7 -> CYRILLIC CAPITAL LETTER GHE + '\u0425' # 0xE8 -> CYRILLIC CAPITAL LETTER HA + '\u0418' # 0xE9 -> CYRILLIC CAPITAL LETTER I + '\u0419' # 0xEA -> CYRILLIC CAPITAL LETTER SHORT I + '\u041a' # 0xEB -> CYRILLIC CAPITAL LETTER KA + '\u041b' # 0xEC -> CYRILLIC CAPITAL LETTER EL + '\u041c' # 0xED -> CYRILLIC CAPITAL LETTER EM + '\u041d' # 0xEE -> CYRILLIC CAPITAL LETTER EN + '\u041e' # 0xEF -> CYRILLIC CAPITAL LETTER O + '\u041f' # 0xF0 -> CYRILLIC CAPITAL LETTER PE + '\u042f' # 0xF1 -> CYRILLIC CAPITAL LETTER YA + '\u0420' # 0xF2 -> CYRILLIC CAPITAL LETTER ER + '\u0421' # 0xF3 -> CYRILLIC CAPITAL LETTER ES + '\u0422' # 0xF4 -> CYRILLIC CAPITAL LETTER TE + '\u0423' # 0xF5 -> CYRILLIC CAPITAL LETTER U + '\u0416' # 0xF6 -> CYRILLIC CAPITAL LETTER ZHE + '\u0412' # 0xF7 -> CYRILLIC CAPITAL LETTER VE + '\u042c' # 0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN + '\u042b' # 0xF9 -> CYRILLIC CAPITAL LETTER YERU + '\u0417' # 0xFA -> CYRILLIC CAPITAL LETTER ZE + '\u0428' # 0xFB -> CYRILLIC CAPITAL LETTER SHA + '\u042d' # 0xFC -> CYRILLIC CAPITAL LETTER E + '\u0429' # 0xFD -> CYRILLIC CAPITAL LETTER SHCHA + '\u0427' # 0xFE -> CYRILLIC CAPITAL LETTER CHE + '\u042a' # 0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/koi8_u.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/koi8_u.py (original) +++ python/branches/py3k-struni/Lib/encodings/koi8_u.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u2500' # 0x80 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u2502' # 0x81 -> BOX DRAWINGS LIGHT VERTICAL - u'\u250c' # 0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2510' # 0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2518' # 0x85 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u251c' # 0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2524' # 0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u252c' # 0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u2534' # 0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u253c' # 0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u2580' # 0x8B -> UPPER HALF BLOCK - u'\u2584' # 0x8C -> LOWER HALF BLOCK - u'\u2588' # 0x8D -> FULL BLOCK - u'\u258c' # 0x8E -> LEFT HALF BLOCK - u'\u2590' # 0x8F -> RIGHT HALF BLOCK - u'\u2591' # 0x90 -> LIGHT SHADE - u'\u2592' # 0x91 -> MEDIUM SHADE - u'\u2593' # 0x92 -> DARK SHADE - u'\u2320' # 0x93 -> TOP HALF INTEGRAL - u'\u25a0' # 0x94 -> BLACK SQUARE - u'\u2219' # 0x95 -> BULLET OPERATOR - u'\u221a' # 0x96 -> SQUARE ROOT - u'\u2248' # 0x97 -> ALMOST EQUAL TO - u'\u2264' # 0x98 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0x99 -> GREATER-THAN OR EQUAL TO - u'\xa0' # 0x9A -> NO-BREAK SPACE - u'\u2321' # 0x9B -> BOTTOM HALF INTEGRAL - u'\xb0' # 0x9C -> DEGREE SIGN - u'\xb2' # 0x9D -> SUPERSCRIPT TWO - u'\xb7' # 0x9E -> MIDDLE DOT - u'\xf7' # 0x9F -> DIVISION SIGN - u'\u2550' # 0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u2551' # 0xA1 -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2552' # 0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u0451' # 0xA3 -> CYRILLIC SMALL LETTER IO - u'\u0454' # 0xA4 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u2554' # 0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u0456' # 0xA6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0457' # 0xA7 -> CYRILLIC SMALL LETTER YI (UKRAINIAN) - u'\u2557' # 0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u2558' # 0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2559' # 0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u255a' # 0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u255b' # 0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u0491' # 0xAD -> CYRILLIC SMALL LETTER UKRAINIAN GHE WITH UPTURN - u'\u255d' # 0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255e' # 0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u2560' # 0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2561' # 0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u0401' # 0xB3 -> CYRILLIC CAPITAL LETTER IO - u'\u0404' # 0xB4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u2563' # 0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u0406' # 0xB6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0407' # 0xB7 -> CYRILLIC CAPITAL LETTER YI (UKRAINIAN) - u'\u2566' # 0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2567' # 0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2569' # 0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u256a' # 0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u0490' # 0xBD -> CYRILLIC CAPITAL LETTER UKRAINIAN GHE WITH UPTURN - u'\u256c' # 0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa9' # 0xBF -> COPYRIGHT SIGN - u'\u044e' # 0xC0 -> CYRILLIC SMALL LETTER YU - u'\u0430' # 0xC1 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xC2 -> CYRILLIC SMALL LETTER BE - u'\u0446' # 0xC3 -> CYRILLIC SMALL LETTER TSE - u'\u0434' # 0xC4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xC5 -> CYRILLIC SMALL LETTER IE - u'\u0444' # 0xC6 -> CYRILLIC SMALL LETTER EF - u'\u0433' # 0xC7 -> CYRILLIC SMALL LETTER GHE - u'\u0445' # 0xC8 -> CYRILLIC SMALL LETTER HA - u'\u0438' # 0xC9 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xCA -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xCB -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xCC -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xCD -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xCE -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xCF -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xD0 -> CYRILLIC SMALL LETTER PE - u'\u044f' # 0xD1 -> CYRILLIC SMALL LETTER YA - u'\u0440' # 0xD2 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xD3 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xD4 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xD5 -> CYRILLIC SMALL LETTER U - u'\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE - u'\u0432' # 0xD7 -> CYRILLIC SMALL LETTER VE - u'\u044c' # 0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044b' # 0xD9 -> CYRILLIC SMALL LETTER YERU - u'\u0437' # 0xDA -> CYRILLIC SMALL LETTER ZE - u'\u0448' # 0xDB -> CYRILLIC SMALL LETTER SHA - u'\u044d' # 0xDC -> CYRILLIC SMALL LETTER E - u'\u0449' # 0xDD -> CYRILLIC SMALL LETTER SHCHA - u'\u0447' # 0xDE -> CYRILLIC SMALL LETTER CHE - u'\u044a' # 0xDF -> CYRILLIC SMALL LETTER HARD SIGN - u'\u042e' # 0xE0 -> CYRILLIC CAPITAL LETTER YU - u'\u0410' # 0xE1 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0xE2 -> CYRILLIC CAPITAL LETTER BE - u'\u0426' # 0xE3 -> CYRILLIC CAPITAL LETTER TSE - u'\u0414' # 0xE4 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0xE5 -> CYRILLIC CAPITAL LETTER IE - u'\u0424' # 0xE6 -> CYRILLIC CAPITAL LETTER EF - u'\u0413' # 0xE7 -> CYRILLIC CAPITAL LETTER GHE - u'\u0425' # 0xE8 -> CYRILLIC CAPITAL LETTER HA - u'\u0418' # 0xE9 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0xEA -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0xEB -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0xEC -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0xED -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0xEE -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0xEF -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0xF0 -> CYRILLIC CAPITAL LETTER PE - u'\u042f' # 0xF1 -> CYRILLIC CAPITAL LETTER YA - u'\u0420' # 0xF2 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0xF3 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0xF4 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0xF5 -> CYRILLIC CAPITAL LETTER U - u'\u0416' # 0xF6 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0412' # 0xF7 -> CYRILLIC CAPITAL LETTER VE - u'\u042c' # 0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042b' # 0xF9 -> CYRILLIC CAPITAL LETTER YERU - u'\u0417' # 0xFA -> CYRILLIC CAPITAL LETTER ZE - u'\u0428' # 0xFB -> CYRILLIC CAPITAL LETTER SHA - u'\u042d' # 0xFC -> CYRILLIC CAPITAL LETTER E - u'\u0429' # 0xFD -> CYRILLIC CAPITAL LETTER SHCHA - u'\u0427' # 0xFE -> CYRILLIC CAPITAL LETTER CHE - u'\u042a' # 0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\u2500' # 0x80 -> BOX DRAWINGS LIGHT HORIZONTAL + '\u2502' # 0x81 -> BOX DRAWINGS LIGHT VERTICAL + '\u250c' # 0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT + '\u2510' # 0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT + '\u2514' # 0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT + '\u2518' # 0x85 -> BOX DRAWINGS LIGHT UP AND LEFT + '\u251c' # 0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT + '\u2524' # 0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT + '\u252c' # 0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL + '\u2534' # 0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL + '\u253c' # 0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL + '\u2580' # 0x8B -> UPPER HALF BLOCK + '\u2584' # 0x8C -> LOWER HALF BLOCK + '\u2588' # 0x8D -> FULL BLOCK + '\u258c' # 0x8E -> LEFT HALF BLOCK + '\u2590' # 0x8F -> RIGHT HALF BLOCK + '\u2591' # 0x90 -> LIGHT SHADE + '\u2592' # 0x91 -> MEDIUM SHADE + '\u2593' # 0x92 -> DARK SHADE + '\u2320' # 0x93 -> TOP HALF INTEGRAL + '\u25a0' # 0x94 -> BLACK SQUARE + '\u2219' # 0x95 -> BULLET OPERATOR + '\u221a' # 0x96 -> SQUARE ROOT + '\u2248' # 0x97 -> ALMOST EQUAL TO + '\u2264' # 0x98 -> LESS-THAN OR EQUAL TO + '\u2265' # 0x99 -> GREATER-THAN OR EQUAL TO + '\xa0' # 0x9A -> NO-BREAK SPACE + '\u2321' # 0x9B -> BOTTOM HALF INTEGRAL + '\xb0' # 0x9C -> DEGREE SIGN + '\xb2' # 0x9D -> SUPERSCRIPT TWO + '\xb7' # 0x9E -> MIDDLE DOT + '\xf7' # 0x9F -> DIVISION SIGN + '\u2550' # 0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL + '\u2551' # 0xA1 -> BOX DRAWINGS DOUBLE VERTICAL + '\u2552' # 0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE + '\u0451' # 0xA3 -> CYRILLIC SMALL LETTER IO + '\u0454' # 0xA4 -> CYRILLIC SMALL LETTER UKRAINIAN IE + '\u2554' # 0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT + '\u0456' # 0xA6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I + '\u0457' # 0xA7 -> CYRILLIC SMALL LETTER YI (UKRAINIAN) + '\u2557' # 0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT + '\u2558' # 0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE + '\u2559' # 0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE + '\u255a' # 0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT + '\u255b' # 0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE + '\u0491' # 0xAD -> CYRILLIC SMALL LETTER UKRAINIAN GHE WITH UPTURN + '\u255d' # 0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT + '\u255e' # 0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE + '\u255f' # 0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE + '\u2560' # 0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT + '\u2561' # 0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE + '\u0401' # 0xB3 -> CYRILLIC CAPITAL LETTER IO + '\u0404' # 0xB4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE + '\u2563' # 0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT + '\u0406' # 0xB6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I + '\u0407' # 0xB7 -> CYRILLIC CAPITAL LETTER YI (UKRAINIAN) + '\u2566' # 0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL + '\u2567' # 0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE + '\u2568' # 0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE + '\u2569' # 0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL + '\u256a' # 0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE + '\u0490' # 0xBD -> CYRILLIC CAPITAL LETTER UKRAINIAN GHE WITH UPTURN + '\u256c' # 0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL + '\xa9' # 0xBF -> COPYRIGHT SIGN + '\u044e' # 0xC0 -> CYRILLIC SMALL LETTER YU + '\u0430' # 0xC1 -> CYRILLIC SMALL LETTER A + '\u0431' # 0xC2 -> CYRILLIC SMALL LETTER BE + '\u0446' # 0xC3 -> CYRILLIC SMALL LETTER TSE + '\u0434' # 0xC4 -> CYRILLIC SMALL LETTER DE + '\u0435' # 0xC5 -> CYRILLIC SMALL LETTER IE + '\u0444' # 0xC6 -> CYRILLIC SMALL LETTER EF + '\u0433' # 0xC7 -> CYRILLIC SMALL LETTER GHE + '\u0445' # 0xC8 -> CYRILLIC SMALL LETTER HA + '\u0438' # 0xC9 -> CYRILLIC SMALL LETTER I + '\u0439' # 0xCA -> CYRILLIC SMALL LETTER SHORT I + '\u043a' # 0xCB -> CYRILLIC SMALL LETTER KA + '\u043b' # 0xCC -> CYRILLIC SMALL LETTER EL + '\u043c' # 0xCD -> CYRILLIC SMALL LETTER EM + '\u043d' # 0xCE -> CYRILLIC SMALL LETTER EN + '\u043e' # 0xCF -> CYRILLIC SMALL LETTER O + '\u043f' # 0xD0 -> CYRILLIC SMALL LETTER PE + '\u044f' # 0xD1 -> CYRILLIC SMALL LETTER YA + '\u0440' # 0xD2 -> CYRILLIC SMALL LETTER ER + '\u0441' # 0xD3 -> CYRILLIC SMALL LETTER ES + '\u0442' # 0xD4 -> CYRILLIC SMALL LETTER TE + '\u0443' # 0xD5 -> CYRILLIC SMALL LETTER U + '\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE + '\u0432' # 0xD7 -> CYRILLIC SMALL LETTER VE + '\u044c' # 0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN + '\u044b' # 0xD9 -> CYRILLIC SMALL LETTER YERU + '\u0437' # 0xDA -> CYRILLIC SMALL LETTER ZE + '\u0448' # 0xDB -> CYRILLIC SMALL LETTER SHA + '\u044d' # 0xDC -> CYRILLIC SMALL LETTER E + '\u0449' # 0xDD -> CYRILLIC SMALL LETTER SHCHA + '\u0447' # 0xDE -> CYRILLIC SMALL LETTER CHE + '\u044a' # 0xDF -> CYRILLIC SMALL LETTER HARD SIGN + '\u042e' # 0xE0 -> CYRILLIC CAPITAL LETTER YU + '\u0410' # 0xE1 -> CYRILLIC CAPITAL LETTER A + '\u0411' # 0xE2 -> CYRILLIC CAPITAL LETTER BE + '\u0426' # 0xE3 -> CYRILLIC CAPITAL LETTER TSE + '\u0414' # 0xE4 -> CYRILLIC CAPITAL LETTER DE + '\u0415' # 0xE5 -> CYRILLIC CAPITAL LETTER IE + '\u0424' # 0xE6 -> CYRILLIC CAPITAL LETTER EF + '\u0413' # 0xE7 -> CYRILLIC CAPITAL LETTER GHE + '\u0425' # 0xE8 -> CYRILLIC CAPITAL LETTER HA + '\u0418' # 0xE9 -> CYRILLIC CAPITAL LETTER I + '\u0419' # 0xEA -> CYRILLIC CAPITAL LETTER SHORT I + '\u041a' # 0xEB -> CYRILLIC CAPITAL LETTER KA + '\u041b' # 0xEC -> CYRILLIC CAPITAL LETTER EL + '\u041c' # 0xED -> CYRILLIC CAPITAL LETTER EM + '\u041d' # 0xEE -> CYRILLIC CAPITAL LETTER EN + '\u041e' # 0xEF -> CYRILLIC CAPITAL LETTER O + '\u041f' # 0xF0 -> CYRILLIC CAPITAL LETTER PE + '\u042f' # 0xF1 -> CYRILLIC CAPITAL LETTER YA + '\u0420' # 0xF2 -> CYRILLIC CAPITAL LETTER ER + '\u0421' # 0xF3 -> CYRILLIC CAPITAL LETTER ES + '\u0422' # 0xF4 -> CYRILLIC CAPITAL LETTER TE + '\u0423' # 0xF5 -> CYRILLIC CAPITAL LETTER U + '\u0416' # 0xF6 -> CYRILLIC CAPITAL LETTER ZHE + '\u0412' # 0xF7 -> CYRILLIC CAPITAL LETTER VE + '\u042c' # 0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN + '\u042b' # 0xF9 -> CYRILLIC CAPITAL LETTER YERU + '\u0417' # 0xFA -> CYRILLIC CAPITAL LETTER ZE + '\u0428' # 0xFB -> CYRILLIC CAPITAL LETTER SHA + '\u042d' # 0xFC -> CYRILLIC CAPITAL LETTER E + '\u0429' # 0xFD -> CYRILLIC CAPITAL LETTER SHCHA + '\u0427' # 0xFE -> CYRILLIC CAPITAL LETTER CHE + '\u042a' # 0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/mac_arabic.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_arabic.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_arabic.py Wed May 2 21:09:54 2007 @@ -178,262 +178,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x0000 -> CONTROL CHARACTER - u'\x01' # 0x0001 -> CONTROL CHARACTER - u'\x02' # 0x0002 -> CONTROL CHARACTER - u'\x03' # 0x0003 -> CONTROL CHARACTER - u'\x04' # 0x0004 -> CONTROL CHARACTER - u'\x05' # 0x0005 -> CONTROL CHARACTER - u'\x06' # 0x0006 -> CONTROL CHARACTER - u'\x07' # 0x0007 -> CONTROL CHARACTER - u'\x08' # 0x0008 -> CONTROL CHARACTER - u'\t' # 0x0009 -> CONTROL CHARACTER - u'\n' # 0x000a -> CONTROL CHARACTER - u'\x0b' # 0x000b -> CONTROL CHARACTER - u'\x0c' # 0x000c -> CONTROL CHARACTER - u'\r' # 0x000d -> CONTROL CHARACTER - u'\x0e' # 0x000e -> CONTROL CHARACTER - u'\x0f' # 0x000f -> CONTROL CHARACTER - u'\x10' # 0x0010 -> CONTROL CHARACTER - u'\x11' # 0x0011 -> CONTROL CHARACTER - u'\x12' # 0x0012 -> CONTROL CHARACTER - u'\x13' # 0x0013 -> CONTROL CHARACTER - u'\x14' # 0x0014 -> CONTROL CHARACTER - u'\x15' # 0x0015 -> CONTROL CHARACTER - u'\x16' # 0x0016 -> CONTROL CHARACTER - u'\x17' # 0x0017 -> CONTROL CHARACTER - u'\x18' # 0x0018 -> CONTROL CHARACTER - u'\x19' # 0x0019 -> CONTROL CHARACTER - u'\x1a' # 0x001a -> CONTROL CHARACTER - u'\x1b' # 0x001b -> CONTROL CHARACTER - u'\x1c' # 0x001c -> CONTROL CHARACTER - u'\x1d' # 0x001d -> CONTROL CHARACTER - u'\x1e' # 0x001e -> CONTROL CHARACTER - u'\x1f' # 0x001f -> CONTROL CHARACTER - u' ' # 0x0020 -> SPACE, left-right - u'!' # 0x0021 -> EXCLAMATION MARK, left-right - u'"' # 0x0022 -> QUOTATION MARK, left-right - u'#' # 0x0023 -> NUMBER SIGN, left-right - u'$' # 0x0024 -> DOLLAR SIGN, left-right - u'%' # 0x0025 -> PERCENT SIGN, left-right - u'&' # 0x0026 -> AMPERSAND, left-right - u"'" # 0x0027 -> APOSTROPHE, left-right - u'(' # 0x0028 -> LEFT PARENTHESIS, left-right - u')' # 0x0029 -> RIGHT PARENTHESIS, left-right - u'*' # 0x002a -> ASTERISK, left-right - u'+' # 0x002b -> PLUS SIGN, left-right - u',' # 0x002c -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR - u'-' # 0x002d -> HYPHEN-MINUS, left-right - u'.' # 0x002e -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR - u'/' # 0x002f -> SOLIDUS, left-right - u'0' # 0x0030 -> DIGIT ZERO; in Arabic-script context, displayed as 0x0660 ARABIC-INDIC DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE; in Arabic-script context, displayed as 0x0661 ARABIC-INDIC DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO; in Arabic-script context, displayed as 0x0662 ARABIC-INDIC DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE; in Arabic-script context, displayed as 0x0663 ARABIC-INDIC DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR; in Arabic-script context, displayed as 0x0664 ARABIC-INDIC DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE; in Arabic-script context, displayed as 0x0665 ARABIC-INDIC DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX; in Arabic-script context, displayed as 0x0666 ARABIC-INDIC DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x0667 ARABIC-INDIC DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x0668 ARABIC-INDIC DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE; in Arabic-script context, displayed as 0x0669 ARABIC-INDIC DIGIT NINE - u':' # 0x003a -> COLON, left-right - u';' # 0x003b -> SEMICOLON, left-right - u'<' # 0x003c -> LESS-THAN SIGN, left-right - u'=' # 0x003d -> EQUALS SIGN, left-right - u'>' # 0x003e -> GREATER-THAN SIGN, left-right - u'?' # 0x003f -> QUESTION MARK, left-right - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET, left-right - u'\\' # 0x005c -> REVERSE SOLIDUS, left-right - u']' # 0x005d -> RIGHT SQUARE BRACKET, left-right - u'^' # 0x005e -> CIRCUMFLEX ACCENT, left-right - u'_' # 0x005f -> LOW LINE, left-right - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET, left-right - u'|' # 0x007c -> VERTICAL LINE, left-right - u'}' # 0x007d -> RIGHT CURLY BRACKET, left-right - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> CONTROL CHARACTER - u'\xc4' # 0x0080 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xa0' # 0x0081 -> NO-BREAK SPACE, right-left - u'\xc7' # 0x0082 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x0083 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x0084 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x0085 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x0086 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x0087 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x0088 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x0089 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x008a -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u06ba' # 0x008b -> ARABIC LETTER NOON GHUNNA - u'\xab' # 0x008c -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - u'\xe7' # 0x008d -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x008e -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x008f -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x0090 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0091 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x0092 -> LATIN SMALL LETTER I WITH ACUTE - u'\u2026' # 0x0093 -> HORIZONTAL ELLIPSIS, right-left - u'\xee' # 0x0094 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x0095 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x0096 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x0097 -> LATIN SMALL LETTER O WITH ACUTE - u'\xbb' # 0x0098 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - u'\xf4' # 0x0099 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x009a -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0x009b -> DIVISION SIGN, right-left - u'\xfa' # 0x009c -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x009d -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x009e -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x009f -> LATIN SMALL LETTER U WITH DIAERESIS - u' ' # 0x00a0 -> SPACE, right-left - u'!' # 0x00a1 -> EXCLAMATION MARK, right-left - u'"' # 0x00a2 -> QUOTATION MARK, right-left - u'#' # 0x00a3 -> NUMBER SIGN, right-left - u'$' # 0x00a4 -> DOLLAR SIGN, right-left - u'\u066a' # 0x00a5 -> ARABIC PERCENT SIGN - u'&' # 0x00a6 -> AMPERSAND, right-left - u"'" # 0x00a7 -> APOSTROPHE, right-left - u'(' # 0x00a8 -> LEFT PARENTHESIS, right-left - u')' # 0x00a9 -> RIGHT PARENTHESIS, right-left - u'*' # 0x00aa -> ASTERISK, right-left - u'+' # 0x00ab -> PLUS SIGN, right-left - u'\u060c' # 0x00ac -> ARABIC COMMA - u'-' # 0x00ad -> HYPHEN-MINUS, right-left - u'.' # 0x00ae -> FULL STOP, right-left - u'/' # 0x00af -> SOLIDUS, right-left - u'\u0660' # 0x00b0 -> ARABIC-INDIC DIGIT ZERO, right-left (need override) - u'\u0661' # 0x00b1 -> ARABIC-INDIC DIGIT ONE, right-left (need override) - u'\u0662' # 0x00b2 -> ARABIC-INDIC DIGIT TWO, right-left (need override) - u'\u0663' # 0x00b3 -> ARABIC-INDIC DIGIT THREE, right-left (need override) - u'\u0664' # 0x00b4 -> ARABIC-INDIC DIGIT FOUR, right-left (need override) - u'\u0665' # 0x00b5 -> ARABIC-INDIC DIGIT FIVE, right-left (need override) - u'\u0666' # 0x00b6 -> ARABIC-INDIC DIGIT SIX, right-left (need override) - u'\u0667' # 0x00b7 -> ARABIC-INDIC DIGIT SEVEN, right-left (need override) - u'\u0668' # 0x00b8 -> ARABIC-INDIC DIGIT EIGHT, right-left (need override) - u'\u0669' # 0x00b9 -> ARABIC-INDIC DIGIT NINE, right-left (need override) - u':' # 0x00ba -> COLON, right-left - u'\u061b' # 0x00bb -> ARABIC SEMICOLON - u'<' # 0x00bc -> LESS-THAN SIGN, right-left - u'=' # 0x00bd -> EQUALS SIGN, right-left - u'>' # 0x00be -> GREATER-THAN SIGN, right-left - u'\u061f' # 0x00bf -> ARABIC QUESTION MARK - u'\u274a' # 0x00c0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left - u'\u0621' # 0x00c1 -> ARABIC LETTER HAMZA - u'\u0622' # 0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE - u'\u0623' # 0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE - u'\u0624' # 0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE - u'\u0625' # 0x00c5 -> ARABIC LETTER ALEF WITH HAMZA BELOW - u'\u0626' # 0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE - u'\u0627' # 0x00c7 -> ARABIC LETTER ALEF - u'\u0628' # 0x00c8 -> ARABIC LETTER BEH - u'\u0629' # 0x00c9 -> ARABIC LETTER TEH MARBUTA - u'\u062a' # 0x00ca -> ARABIC LETTER TEH - u'\u062b' # 0x00cb -> ARABIC LETTER THEH - u'\u062c' # 0x00cc -> ARABIC LETTER JEEM - u'\u062d' # 0x00cd -> ARABIC LETTER HAH - u'\u062e' # 0x00ce -> ARABIC LETTER KHAH - u'\u062f' # 0x00cf -> ARABIC LETTER DAL - u'\u0630' # 0x00d0 -> ARABIC LETTER THAL - u'\u0631' # 0x00d1 -> ARABIC LETTER REH - u'\u0632' # 0x00d2 -> ARABIC LETTER ZAIN - u'\u0633' # 0x00d3 -> ARABIC LETTER SEEN - u'\u0634' # 0x00d4 -> ARABIC LETTER SHEEN - u'\u0635' # 0x00d5 -> ARABIC LETTER SAD - u'\u0636' # 0x00d6 -> ARABIC LETTER DAD - u'\u0637' # 0x00d7 -> ARABIC LETTER TAH - u'\u0638' # 0x00d8 -> ARABIC LETTER ZAH - u'\u0639' # 0x00d9 -> ARABIC LETTER AIN - u'\u063a' # 0x00da -> ARABIC LETTER GHAIN - u'[' # 0x00db -> LEFT SQUARE BRACKET, right-left - u'\\' # 0x00dc -> REVERSE SOLIDUS, right-left - u']' # 0x00dd -> RIGHT SQUARE BRACKET, right-left - u'^' # 0x00de -> CIRCUMFLEX ACCENT, right-left - u'_' # 0x00df -> LOW LINE, right-left - u'\u0640' # 0x00e0 -> ARABIC TATWEEL - u'\u0641' # 0x00e1 -> ARABIC LETTER FEH - u'\u0642' # 0x00e2 -> ARABIC LETTER QAF - u'\u0643' # 0x00e3 -> ARABIC LETTER KAF - u'\u0644' # 0x00e4 -> ARABIC LETTER LAM - u'\u0645' # 0x00e5 -> ARABIC LETTER MEEM - u'\u0646' # 0x00e6 -> ARABIC LETTER NOON - u'\u0647' # 0x00e7 -> ARABIC LETTER HEH - u'\u0648' # 0x00e8 -> ARABIC LETTER WAW - u'\u0649' # 0x00e9 -> ARABIC LETTER ALEF MAKSURA - u'\u064a' # 0x00ea -> ARABIC LETTER YEH - u'\u064b' # 0x00eb -> ARABIC FATHATAN - u'\u064c' # 0x00ec -> ARABIC DAMMATAN - u'\u064d' # 0x00ed -> ARABIC KASRATAN - u'\u064e' # 0x00ee -> ARABIC FATHA - u'\u064f' # 0x00ef -> ARABIC DAMMA - u'\u0650' # 0x00f0 -> ARABIC KASRA - u'\u0651' # 0x00f1 -> ARABIC SHADDA - u'\u0652' # 0x00f2 -> ARABIC SUKUN - u'\u067e' # 0x00f3 -> ARABIC LETTER PEH - u'\u0679' # 0x00f4 -> ARABIC LETTER TTEH - u'\u0686' # 0x00f5 -> ARABIC LETTER TCHEH - u'\u06d5' # 0x00f6 -> ARABIC LETTER AE - u'\u06a4' # 0x00f7 -> ARABIC LETTER VEH - u'\u06af' # 0x00f8 -> ARABIC LETTER GAF - u'\u0688' # 0x00f9 -> ARABIC LETTER DDAL - u'\u0691' # 0x00fa -> ARABIC LETTER RREH - u'{' # 0x00fb -> LEFT CURLY BRACKET, right-left - u'|' # 0x00fc -> VERTICAL LINE, right-left - u'}' # 0x00fd -> RIGHT CURLY BRACKET, right-left - u'\u0698' # 0x00fe -> ARABIC LETTER JEH - u'\u06d2' # 0x00ff -> ARABIC LETTER YEH BARREE + '\x00' # 0x0000 -> CONTROL CHARACTER + '\x01' # 0x0001 -> CONTROL CHARACTER + '\x02' # 0x0002 -> CONTROL CHARACTER + '\x03' # 0x0003 -> CONTROL CHARACTER + '\x04' # 0x0004 -> CONTROL CHARACTER + '\x05' # 0x0005 -> CONTROL CHARACTER + '\x06' # 0x0006 -> CONTROL CHARACTER + '\x07' # 0x0007 -> CONTROL CHARACTER + '\x08' # 0x0008 -> CONTROL CHARACTER + '\t' # 0x0009 -> CONTROL CHARACTER + '\n' # 0x000a -> CONTROL CHARACTER + '\x0b' # 0x000b -> CONTROL CHARACTER + '\x0c' # 0x000c -> CONTROL CHARACTER + '\r' # 0x000d -> CONTROL CHARACTER + '\x0e' # 0x000e -> CONTROL CHARACTER + '\x0f' # 0x000f -> CONTROL CHARACTER + '\x10' # 0x0010 -> CONTROL CHARACTER + '\x11' # 0x0011 -> CONTROL CHARACTER + '\x12' # 0x0012 -> CONTROL CHARACTER + '\x13' # 0x0013 -> CONTROL CHARACTER + '\x14' # 0x0014 -> CONTROL CHARACTER + '\x15' # 0x0015 -> CONTROL CHARACTER + '\x16' # 0x0016 -> CONTROL CHARACTER + '\x17' # 0x0017 -> CONTROL CHARACTER + '\x18' # 0x0018 -> CONTROL CHARACTER + '\x19' # 0x0019 -> CONTROL CHARACTER + '\x1a' # 0x001a -> CONTROL CHARACTER + '\x1b' # 0x001b -> CONTROL CHARACTER + '\x1c' # 0x001c -> CONTROL CHARACTER + '\x1d' # 0x001d -> CONTROL CHARACTER + '\x1e' # 0x001e -> CONTROL CHARACTER + '\x1f' # 0x001f -> CONTROL CHARACTER + ' ' # 0x0020 -> SPACE, left-right + '!' # 0x0021 -> EXCLAMATION MARK, left-right + '"' # 0x0022 -> QUOTATION MARK, left-right + '#' # 0x0023 -> NUMBER SIGN, left-right + '$' # 0x0024 -> DOLLAR SIGN, left-right + '%' # 0x0025 -> PERCENT SIGN, left-right + '&' # 0x0026 -> AMPERSAND, left-right + "'" # 0x0027 -> APOSTROPHE, left-right + '(' # 0x0028 -> LEFT PARENTHESIS, left-right + ')' # 0x0029 -> RIGHT PARENTHESIS, left-right + '*' # 0x002a -> ASTERISK, left-right + '+' # 0x002b -> PLUS SIGN, left-right + ',' # 0x002c -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR + '-' # 0x002d -> HYPHEN-MINUS, left-right + '.' # 0x002e -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR + '/' # 0x002f -> SOLIDUS, left-right + '0' # 0x0030 -> DIGIT ZERO; in Arabic-script context, displayed as 0x0660 ARABIC-INDIC DIGIT ZERO + '1' # 0x0031 -> DIGIT ONE; in Arabic-script context, displayed as 0x0661 ARABIC-INDIC DIGIT ONE + '2' # 0x0032 -> DIGIT TWO; in Arabic-script context, displayed as 0x0662 ARABIC-INDIC DIGIT TWO + '3' # 0x0033 -> DIGIT THREE; in Arabic-script context, displayed as 0x0663 ARABIC-INDIC DIGIT THREE + '4' # 0x0034 -> DIGIT FOUR; in Arabic-script context, displayed as 0x0664 ARABIC-INDIC DIGIT FOUR + '5' # 0x0035 -> DIGIT FIVE; in Arabic-script context, displayed as 0x0665 ARABIC-INDIC DIGIT FIVE + '6' # 0x0036 -> DIGIT SIX; in Arabic-script context, displayed as 0x0666 ARABIC-INDIC DIGIT SIX + '7' # 0x0037 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x0667 ARABIC-INDIC DIGIT SEVEN + '8' # 0x0038 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x0668 ARABIC-INDIC DIGIT EIGHT + '9' # 0x0039 -> DIGIT NINE; in Arabic-script context, displayed as 0x0669 ARABIC-INDIC DIGIT NINE + ':' # 0x003a -> COLON, left-right + ';' # 0x003b -> SEMICOLON, left-right + '<' # 0x003c -> LESS-THAN SIGN, left-right + '=' # 0x003d -> EQUALS SIGN, left-right + '>' # 0x003e -> GREATER-THAN SIGN, left-right + '?' # 0x003f -> QUESTION MARK, left-right + '@' # 0x0040 -> COMMERCIAL AT + 'A' # 0x0041 -> LATIN CAPITAL LETTER A + 'B' # 0x0042 -> LATIN CAPITAL LETTER B + 'C' # 0x0043 -> LATIN CAPITAL LETTER C + 'D' # 0x0044 -> LATIN CAPITAL LETTER D + 'E' # 0x0045 -> LATIN CAPITAL LETTER E + 'F' # 0x0046 -> LATIN CAPITAL LETTER F + 'G' # 0x0047 -> LATIN CAPITAL LETTER G + 'H' # 0x0048 -> LATIN CAPITAL LETTER H + 'I' # 0x0049 -> LATIN CAPITAL LETTER I + 'J' # 0x004a -> LATIN CAPITAL LETTER J + 'K' # 0x004b -> LATIN CAPITAL LETTER K + 'L' # 0x004c -> LATIN CAPITAL LETTER L + 'M' # 0x004d -> LATIN CAPITAL LETTER M + 'N' # 0x004e -> LATIN CAPITAL LETTER N + 'O' # 0x004f -> LATIN CAPITAL LETTER O + 'P' # 0x0050 -> LATIN CAPITAL LETTER P + 'Q' # 0x0051 -> LATIN CAPITAL LETTER Q + 'R' # 0x0052 -> LATIN CAPITAL LETTER R + 'S' # 0x0053 -> LATIN CAPITAL LETTER S + 'T' # 0x0054 -> LATIN CAPITAL LETTER T + 'U' # 0x0055 -> LATIN CAPITAL LETTER U + 'V' # 0x0056 -> LATIN CAPITAL LETTER V + 'W' # 0x0057 -> LATIN CAPITAL LETTER W + 'X' # 0x0058 -> LATIN CAPITAL LETTER X + 'Y' # 0x0059 -> LATIN CAPITAL LETTER Y + 'Z' # 0x005a -> LATIN CAPITAL LETTER Z + '[' # 0x005b -> LEFT SQUARE BRACKET, left-right + '\\' # 0x005c -> REVERSE SOLIDUS, left-right + ']' # 0x005d -> RIGHT SQUARE BRACKET, left-right + '^' # 0x005e -> CIRCUMFLEX ACCENT, left-right + '_' # 0x005f -> LOW LINE, left-right + '`' # 0x0060 -> GRAVE ACCENT + 'a' # 0x0061 -> LATIN SMALL LETTER A + 'b' # 0x0062 -> LATIN SMALL LETTER B + 'c' # 0x0063 -> LATIN SMALL LETTER C + 'd' # 0x0064 -> LATIN SMALL LETTER D + 'e' # 0x0065 -> LATIN SMALL LETTER E + 'f' # 0x0066 -> LATIN SMALL LETTER F + 'g' # 0x0067 -> LATIN SMALL LETTER G + 'h' # 0x0068 -> LATIN SMALL LETTER H + 'i' # 0x0069 -> LATIN SMALL LETTER I + 'j' # 0x006a -> LATIN SMALL LETTER J + 'k' # 0x006b -> LATIN SMALL LETTER K + 'l' # 0x006c -> LATIN SMALL LETTER L + 'm' # 0x006d -> LATIN SMALL LETTER M + 'n' # 0x006e -> LATIN SMALL LETTER N + 'o' # 0x006f -> LATIN SMALL LETTER O + 'p' # 0x0070 -> LATIN SMALL LETTER P + 'q' # 0x0071 -> LATIN SMALL LETTER Q + 'r' # 0x0072 -> LATIN SMALL LETTER R + 's' # 0x0073 -> LATIN SMALL LETTER S + 't' # 0x0074 -> LATIN SMALL LETTER T + 'u' # 0x0075 -> LATIN SMALL LETTER U + 'v' # 0x0076 -> LATIN SMALL LETTER V + 'w' # 0x0077 -> LATIN SMALL LETTER W + 'x' # 0x0078 -> LATIN SMALL LETTER X + 'y' # 0x0079 -> LATIN SMALL LETTER Y + 'z' # 0x007a -> LATIN SMALL LETTER Z + '{' # 0x007b -> LEFT CURLY BRACKET, left-right + '|' # 0x007c -> VERTICAL LINE, left-right + '}' # 0x007d -> RIGHT CURLY BRACKET, left-right + '~' # 0x007e -> TILDE + '\x7f' # 0x007f -> CONTROL CHARACTER + '\xc4' # 0x0080 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xa0' # 0x0081 -> NO-BREAK SPACE, right-left + '\xc7' # 0x0082 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc9' # 0x0083 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xd1' # 0x0084 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd6' # 0x0085 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x0086 -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xe1' # 0x0087 -> LATIN SMALL LETTER A WITH ACUTE + '\xe0' # 0x0088 -> LATIN SMALL LETTER A WITH GRAVE + '\xe2' # 0x0089 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x008a -> LATIN SMALL LETTER A WITH DIAERESIS + '\u06ba' # 0x008b -> ARABIC LETTER NOON GHUNNA + '\xab' # 0x008c -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left + '\xe7' # 0x008d -> LATIN SMALL LETTER C WITH CEDILLA + '\xe9' # 0x008e -> LATIN SMALL LETTER E WITH ACUTE + '\xe8' # 0x008f -> LATIN SMALL LETTER E WITH GRAVE + '\xea' # 0x0090 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x0091 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xed' # 0x0092 -> LATIN SMALL LETTER I WITH ACUTE + '\u2026' # 0x0093 -> HORIZONTAL ELLIPSIS, right-left + '\xee' # 0x0094 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x0095 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf1' # 0x0096 -> LATIN SMALL LETTER N WITH TILDE + '\xf3' # 0x0097 -> LATIN SMALL LETTER O WITH ACUTE + '\xbb' # 0x0098 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left + '\xf4' # 0x0099 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x009a -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0x009b -> DIVISION SIGN, right-left + '\xfa' # 0x009c -> LATIN SMALL LETTER U WITH ACUTE + '\xf9' # 0x009d -> LATIN SMALL LETTER U WITH GRAVE + '\xfb' # 0x009e -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0x009f -> LATIN SMALL LETTER U WITH DIAERESIS + ' ' # 0x00a0 -> SPACE, right-left + '!' # 0x00a1 -> EXCLAMATION MARK, right-left + '"' # 0x00a2 -> QUOTATION MARK, right-left + '#' # 0x00a3 -> NUMBER SIGN, right-left + '$' # 0x00a4 -> DOLLAR SIGN, right-left + '\u066a' # 0x00a5 -> ARABIC PERCENT SIGN + '&' # 0x00a6 -> AMPERSAND, right-left + "'" # 0x00a7 -> APOSTROPHE, right-left + '(' # 0x00a8 -> LEFT PARENTHESIS, right-left + ')' # 0x00a9 -> RIGHT PARENTHESIS, right-left + '*' # 0x00aa -> ASTERISK, right-left + '+' # 0x00ab -> PLUS SIGN, right-left + '\u060c' # 0x00ac -> ARABIC COMMA + '-' # 0x00ad -> HYPHEN-MINUS, right-left + '.' # 0x00ae -> FULL STOP, right-left + '/' # 0x00af -> SOLIDUS, right-left + '\u0660' # 0x00b0 -> ARABIC-INDIC DIGIT ZERO, right-left (need override) + '\u0661' # 0x00b1 -> ARABIC-INDIC DIGIT ONE, right-left (need override) + '\u0662' # 0x00b2 -> ARABIC-INDIC DIGIT TWO, right-left (need override) + '\u0663' # 0x00b3 -> ARABIC-INDIC DIGIT THREE, right-left (need override) + '\u0664' # 0x00b4 -> ARABIC-INDIC DIGIT FOUR, right-left (need override) + '\u0665' # 0x00b5 -> ARABIC-INDIC DIGIT FIVE, right-left (need override) + '\u0666' # 0x00b6 -> ARABIC-INDIC DIGIT SIX, right-left (need override) + '\u0667' # 0x00b7 -> ARABIC-INDIC DIGIT SEVEN, right-left (need override) + '\u0668' # 0x00b8 -> ARABIC-INDIC DIGIT EIGHT, right-left (need override) + '\u0669' # 0x00b9 -> ARABIC-INDIC DIGIT NINE, right-left (need override) + ':' # 0x00ba -> COLON, right-left + '\u061b' # 0x00bb -> ARABIC SEMICOLON + '<' # 0x00bc -> LESS-THAN SIGN, right-left + '=' # 0x00bd -> EQUALS SIGN, right-left + '>' # 0x00be -> GREATER-THAN SIGN, right-left + '\u061f' # 0x00bf -> ARABIC QUESTION MARK + '\u274a' # 0x00c0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left + '\u0621' # 0x00c1 -> ARABIC LETTER HAMZA + '\u0622' # 0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE + '\u0623' # 0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE + '\u0624' # 0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE + '\u0625' # 0x00c5 -> ARABIC LETTER ALEF WITH HAMZA BELOW + '\u0626' # 0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE + '\u0627' # 0x00c7 -> ARABIC LETTER ALEF + '\u0628' # 0x00c8 -> ARABIC LETTER BEH + '\u0629' # 0x00c9 -> ARABIC LETTER TEH MARBUTA + '\u062a' # 0x00ca -> ARABIC LETTER TEH + '\u062b' # 0x00cb -> ARABIC LETTER THEH + '\u062c' # 0x00cc -> ARABIC LETTER JEEM + '\u062d' # 0x00cd -> ARABIC LETTER HAH + '\u062e' # 0x00ce -> ARABIC LETTER KHAH + '\u062f' # 0x00cf -> ARABIC LETTER DAL + '\u0630' # 0x00d0 -> ARABIC LETTER THAL + '\u0631' # 0x00d1 -> ARABIC LETTER REH + '\u0632' # 0x00d2 -> ARABIC LETTER ZAIN + '\u0633' # 0x00d3 -> ARABIC LETTER SEEN + '\u0634' # 0x00d4 -> ARABIC LETTER SHEEN + '\u0635' # 0x00d5 -> ARABIC LETTER SAD + '\u0636' # 0x00d6 -> ARABIC LETTER DAD + '\u0637' # 0x00d7 -> ARABIC LETTER TAH + '\u0638' # 0x00d8 -> ARABIC LETTER ZAH + '\u0639' # 0x00d9 -> ARABIC LETTER AIN + '\u063a' # 0x00da -> ARABIC LETTER GHAIN + '[' # 0x00db -> LEFT SQUARE BRACKET, right-left + '\\' # 0x00dc -> REVERSE SOLIDUS, right-left + ']' # 0x00dd -> RIGHT SQUARE BRACKET, right-left + '^' # 0x00de -> CIRCUMFLEX ACCENT, right-left + '_' # 0x00df -> LOW LINE, right-left + '\u0640' # 0x00e0 -> ARABIC TATWEEL + '\u0641' # 0x00e1 -> ARABIC LETTER FEH + '\u0642' # 0x00e2 -> ARABIC LETTER QAF + '\u0643' # 0x00e3 -> ARABIC LETTER KAF + '\u0644' # 0x00e4 -> ARABIC LETTER LAM + '\u0645' # 0x00e5 -> ARABIC LETTER MEEM + '\u0646' # 0x00e6 -> ARABIC LETTER NOON + '\u0647' # 0x00e7 -> ARABIC LETTER HEH + '\u0648' # 0x00e8 -> ARABIC LETTER WAW + '\u0649' # 0x00e9 -> ARABIC LETTER ALEF MAKSURA + '\u064a' # 0x00ea -> ARABIC LETTER YEH + '\u064b' # 0x00eb -> ARABIC FATHATAN + '\u064c' # 0x00ec -> ARABIC DAMMATAN + '\u064d' # 0x00ed -> ARABIC KASRATAN + '\u064e' # 0x00ee -> ARABIC FATHA + '\u064f' # 0x00ef -> ARABIC DAMMA + '\u0650' # 0x00f0 -> ARABIC KASRA + '\u0651' # 0x00f1 -> ARABIC SHADDA + '\u0652' # 0x00f2 -> ARABIC SUKUN + '\u067e' # 0x00f3 -> ARABIC LETTER PEH + '\u0679' # 0x00f4 -> ARABIC LETTER TTEH + '\u0686' # 0x00f5 -> ARABIC LETTER TCHEH + '\u06d5' # 0x00f6 -> ARABIC LETTER AE + '\u06a4' # 0x00f7 -> ARABIC LETTER VEH + '\u06af' # 0x00f8 -> ARABIC LETTER GAF + '\u0688' # 0x00f9 -> ARABIC LETTER DDAL + '\u0691' # 0x00fa -> ARABIC LETTER RREH + '{' # 0x00fb -> LEFT CURLY BRACKET, right-left + '|' # 0x00fc -> VERTICAL LINE, right-left + '}' # 0x00fd -> RIGHT CURLY BRACKET, right-left + '\u0698' # 0x00fe -> ARABIC LETTER JEH + '\u06d2' # 0x00ff -> ARABIC LETTER YEH BARREE ) ### Encoding Map Modified: python/branches/py3k-struni/Lib/encodings/mac_centeuro.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_centeuro.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_centeuro.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0100' # 0x81 -> LATIN CAPITAL LETTER A WITH MACRON - u'\u0101' # 0x82 -> LATIN SMALL LETTER A WITH MACRON - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0104' # 0x84 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\u0105' # 0x88 -> LATIN SMALL LETTER A WITH OGONEK - u'\u010c' # 0x89 -> LATIN CAPITAL LETTER C WITH CARON - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u010d' # 0x8B -> LATIN SMALL LETTER C WITH CARON - u'\u0106' # 0x8C -> LATIN CAPITAL LETTER C WITH ACUTE - u'\u0107' # 0x8D -> LATIN SMALL LETTER C WITH ACUTE - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\u0179' # 0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\u017a' # 0x90 -> LATIN SMALL LETTER Z WITH ACUTE - u'\u010e' # 0x91 -> LATIN CAPITAL LETTER D WITH CARON - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\u010f' # 0x93 -> LATIN SMALL LETTER D WITH CARON - u'\u0112' # 0x94 -> LATIN CAPITAL LETTER E WITH MACRON - u'\u0113' # 0x95 -> LATIN SMALL LETTER E WITH MACRON - u'\u0116' # 0x96 -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\u0117' # 0x98 -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\u011a' # 0x9D -> LATIN CAPITAL LETTER E WITH CARON - u'\u011b' # 0x9E -> LATIN SMALL LETTER E WITH CARON - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\u0118' # 0xA2 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\u0119' # 0xAB -> LATIN SMALL LETTER E WITH OGONEK - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\u0123' # 0xAE -> LATIN SMALL LETTER G WITH CEDILLA - u'\u012e' # 0xAF -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u012f' # 0xB0 -> LATIN SMALL LETTER I WITH OGONEK - u'\u012a' # 0xB1 -> LATIN CAPITAL LETTER I WITH MACRON - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\u012b' # 0xB4 -> LATIN SMALL LETTER I WITH MACRON - u'\u0136' # 0xB5 -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u0142' # 0xB8 -> LATIN SMALL LETTER L WITH STROKE - u'\u013b' # 0xB9 -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u013c' # 0xBA -> LATIN SMALL LETTER L WITH CEDILLA - u'\u013d' # 0xBB -> LATIN CAPITAL LETTER L WITH CARON - u'\u013e' # 0xBC -> LATIN SMALL LETTER L WITH CARON - u'\u0139' # 0xBD -> LATIN CAPITAL LETTER L WITH ACUTE - u'\u013a' # 0xBE -> LATIN SMALL LETTER L WITH ACUTE - u'\u0145' # 0xBF -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\u0146' # 0xC0 -> LATIN SMALL LETTER N WITH CEDILLA - u'\u0143' # 0xC1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0144' # 0xC4 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0147' # 0xC5 -> LATIN CAPITAL LETTER N WITH CARON - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\u0148' # 0xCB -> LATIN SMALL LETTER N WITH CARON - u'\u0150' # 0xCC -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0151' # 0xCE -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\u014c' # 0xCF -> LATIN CAPITAL LETTER O WITH MACRON - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\u014d' # 0xD8 -> LATIN SMALL LETTER O WITH MACRON - u'\u0154' # 0xD9 -> LATIN CAPITAL LETTER R WITH ACUTE - u'\u0155' # 0xDA -> LATIN SMALL LETTER R WITH ACUTE - u'\u0158' # 0xDB -> LATIN CAPITAL LETTER R WITH CARON - u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0159' # 0xDE -> LATIN SMALL LETTER R WITH CARON - u'\u0156' # 0xDF -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\u0157' # 0xE0 -> LATIN SMALL LETTER R WITH CEDILLA - u'\u0160' # 0xE1 -> LATIN CAPITAL LETTER S WITH CARON - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u0161' # 0xE4 -> LATIN SMALL LETTER S WITH CARON - u'\u015a' # 0xE5 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u015b' # 0xE6 -> LATIN SMALL LETTER S WITH ACUTE - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\u0164' # 0xE8 -> LATIN CAPITAL LETTER T WITH CARON - u'\u0165' # 0xE9 -> LATIN SMALL LETTER T WITH CARON - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\u017d' # 0xEB -> LATIN CAPITAL LETTER Z WITH CARON - u'\u017e' # 0xEC -> LATIN SMALL LETTER Z WITH CARON - u'\u016a' # 0xED -> LATIN CAPITAL LETTER U WITH MACRON - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u016b' # 0xF0 -> LATIN SMALL LETTER U WITH MACRON - u'\u016e' # 0xF1 -> LATIN CAPITAL LETTER U WITH RING ABOVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\u016f' # 0xF3 -> LATIN SMALL LETTER U WITH RING ABOVE - u'\u0170' # 0xF4 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\u0171' # 0xF5 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\u0172' # 0xF6 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\u0173' # 0xF7 -> LATIN SMALL LETTER U WITH OGONEK - u'\xdd' # 0xF8 -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xfd' # 0xF9 -> LATIN SMALL LETTER Y WITH ACUTE - u'\u0137' # 0xFA -> LATIN SMALL LETTER K WITH CEDILLA - u'\u017b' # 0xFB -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u0141' # 0xFC -> LATIN CAPITAL LETTER L WITH STROKE - u'\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u0122' # 0xFE -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u02c7' # 0xFF -> CARON + '\x00' # 0x00 -> CONTROL CHARACTER + '\x01' # 0x01 -> CONTROL CHARACTER + '\x02' # 0x02 -> CONTROL CHARACTER + '\x03' # 0x03 -> CONTROL CHARACTER + '\x04' # 0x04 -> CONTROL CHARACTER + '\x05' # 0x05 -> CONTROL CHARACTER + '\x06' # 0x06 -> CONTROL CHARACTER + '\x07' # 0x07 -> CONTROL CHARACTER + '\x08' # 0x08 -> CONTROL CHARACTER + '\t' # 0x09 -> CONTROL CHARACTER + '\n' # 0x0A -> CONTROL CHARACTER + '\x0b' # 0x0B -> CONTROL CHARACTER + '\x0c' # 0x0C -> CONTROL CHARACTER + '\r' # 0x0D -> CONTROL CHARACTER + '\x0e' # 0x0E -> CONTROL CHARACTER + '\x0f' # 0x0F -> CONTROL CHARACTER + '\x10' # 0x10 -> CONTROL CHARACTER + '\x11' # 0x11 -> CONTROL CHARACTER + '\x12' # 0x12 -> CONTROL CHARACTER + '\x13' # 0x13 -> CONTROL CHARACTER + '\x14' # 0x14 -> CONTROL CHARACTER + '\x15' # 0x15 -> CONTROL CHARACTER + '\x16' # 0x16 -> CONTROL CHARACTER + '\x17' # 0x17 -> CONTROL CHARACTER + '\x18' # 0x18 -> CONTROL CHARACTER + '\x19' # 0x19 -> CONTROL CHARACTER + '\x1a' # 0x1A -> CONTROL CHARACTER + '\x1b' # 0x1B -> CONTROL CHARACTER + '\x1c' # 0x1C -> CONTROL CHARACTER + '\x1d' # 0x1D -> CONTROL CHARACTER + '\x1e' # 0x1E -> CONTROL CHARACTER + '\x1f' # 0x1F -> CONTROL CHARACTER + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> CONTROL CHARACTER + '\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\u0100' # 0x81 -> LATIN CAPITAL LETTER A WITH MACRON + '\u0101' # 0x82 -> LATIN SMALL LETTER A WITH MACRON + '\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE + '\u0104' # 0x84 -> LATIN CAPITAL LETTER A WITH OGONEK + '\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE + '\u0105' # 0x88 -> LATIN SMALL LETTER A WITH OGONEK + '\u010c' # 0x89 -> LATIN CAPITAL LETTER C WITH CARON + '\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS + '\u010d' # 0x8B -> LATIN SMALL LETTER C WITH CARON + '\u0106' # 0x8C -> LATIN CAPITAL LETTER C WITH ACUTE + '\u0107' # 0x8D -> LATIN SMALL LETTER C WITH ACUTE + '\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE + '\u0179' # 0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE + '\u017a' # 0x90 -> LATIN SMALL LETTER Z WITH ACUTE + '\u010e' # 0x91 -> LATIN CAPITAL LETTER D WITH CARON + '\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE + '\u010f' # 0x93 -> LATIN SMALL LETTER D WITH CARON + '\u0112' # 0x94 -> LATIN CAPITAL LETTER E WITH MACRON + '\u0113' # 0x95 -> LATIN SMALL LETTER E WITH MACRON + '\u0116' # 0x96 -> LATIN CAPITAL LETTER E WITH DOT ABOVE + '\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE + '\u0117' # 0x98 -> LATIN SMALL LETTER E WITH DOT ABOVE + '\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE + '\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE + '\u011a' # 0x9D -> LATIN CAPITAL LETTER E WITH CARON + '\u011b' # 0x9E -> LATIN SMALL LETTER E WITH CARON + '\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS + '\u2020' # 0xA0 -> DAGGER + '\xb0' # 0xA1 -> DEGREE SIGN + '\u0118' # 0xA2 -> LATIN CAPITAL LETTER E WITH OGONEK + '\xa3' # 0xA3 -> POUND SIGN + '\xa7' # 0xA4 -> SECTION SIGN + '\u2022' # 0xA5 -> BULLET + '\xb6' # 0xA6 -> PILCROW SIGN + '\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S + '\xae' # 0xA8 -> REGISTERED SIGN + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u2122' # 0xAA -> TRADE MARK SIGN + '\u0119' # 0xAB -> LATIN SMALL LETTER E WITH OGONEK + '\xa8' # 0xAC -> DIAERESIS + '\u2260' # 0xAD -> NOT EQUAL TO + '\u0123' # 0xAE -> LATIN SMALL LETTER G WITH CEDILLA + '\u012e' # 0xAF -> LATIN CAPITAL LETTER I WITH OGONEK + '\u012f' # 0xB0 -> LATIN SMALL LETTER I WITH OGONEK + '\u012a' # 0xB1 -> LATIN CAPITAL LETTER I WITH MACRON + '\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO + '\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO + '\u012b' # 0xB4 -> LATIN SMALL LETTER I WITH MACRON + '\u0136' # 0xB5 -> LATIN CAPITAL LETTER K WITH CEDILLA + '\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL + '\u2211' # 0xB7 -> N-ARY SUMMATION + '\u0142' # 0xB8 -> LATIN SMALL LETTER L WITH STROKE + '\u013b' # 0xB9 -> LATIN CAPITAL LETTER L WITH CEDILLA + '\u013c' # 0xBA -> LATIN SMALL LETTER L WITH CEDILLA + '\u013d' # 0xBB -> LATIN CAPITAL LETTER L WITH CARON + '\u013e' # 0xBC -> LATIN SMALL LETTER L WITH CARON + '\u0139' # 0xBD -> LATIN CAPITAL LETTER L WITH ACUTE + '\u013a' # 0xBE -> LATIN SMALL LETTER L WITH ACUTE + '\u0145' # 0xBF -> LATIN CAPITAL LETTER N WITH CEDILLA + '\u0146' # 0xC0 -> LATIN SMALL LETTER N WITH CEDILLA + '\u0143' # 0xC1 -> LATIN CAPITAL LETTER N WITH ACUTE + '\xac' # 0xC2 -> NOT SIGN + '\u221a' # 0xC3 -> SQUARE ROOT + '\u0144' # 0xC4 -> LATIN SMALL LETTER N WITH ACUTE + '\u0147' # 0xC5 -> LATIN CAPITAL LETTER N WITH CARON + '\u2206' # 0xC6 -> INCREMENT + '\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS + '\xa0' # 0xCA -> NO-BREAK SPACE + '\u0148' # 0xCB -> LATIN SMALL LETTER N WITH CARON + '\u0150' # 0xCC -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE + '\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE + '\u0151' # 0xCE -> LATIN SMALL LETTER O WITH DOUBLE ACUTE + '\u014c' # 0xCF -> LATIN CAPITAL LETTER O WITH MACRON + '\u2013' # 0xD0 -> EN DASH + '\u2014' # 0xD1 -> EM DASH + '\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK + '\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK + '\xf7' # 0xD6 -> DIVISION SIGN + '\u25ca' # 0xD7 -> LOZENGE + '\u014d' # 0xD8 -> LATIN SMALL LETTER O WITH MACRON + '\u0154' # 0xD9 -> LATIN CAPITAL LETTER R WITH ACUTE + '\u0155' # 0xDA -> LATIN SMALL LETTER R WITH ACUTE + '\u0158' # 0xDB -> LATIN CAPITAL LETTER R WITH CARON + '\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\u0159' # 0xDE -> LATIN SMALL LETTER R WITH CARON + '\u0156' # 0xDF -> LATIN CAPITAL LETTER R WITH CEDILLA + '\u0157' # 0xE0 -> LATIN SMALL LETTER R WITH CEDILLA + '\u0160' # 0xE1 -> LATIN CAPITAL LETTER S WITH CARON + '\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK + '\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK + '\u0161' # 0xE4 -> LATIN SMALL LETTER S WITH CARON + '\u015a' # 0xE5 -> LATIN CAPITAL LETTER S WITH ACUTE + '\u015b' # 0xE6 -> LATIN SMALL LETTER S WITH ACUTE + '\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE + '\u0164' # 0xE8 -> LATIN CAPITAL LETTER T WITH CARON + '\u0165' # 0xE9 -> LATIN SMALL LETTER T WITH CARON + '\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE + '\u017d' # 0xEB -> LATIN CAPITAL LETTER Z WITH CARON + '\u017e' # 0xEC -> LATIN SMALL LETTER Z WITH CARON + '\u016a' # 0xED -> LATIN CAPITAL LETTER U WITH MACRON + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\u016b' # 0xF0 -> LATIN SMALL LETTER U WITH MACRON + '\u016e' # 0xF1 -> LATIN CAPITAL LETTER U WITH RING ABOVE + '\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE + '\u016f' # 0xF3 -> LATIN SMALL LETTER U WITH RING ABOVE + '\u0170' # 0xF4 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE + '\u0171' # 0xF5 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE + '\u0172' # 0xF6 -> LATIN CAPITAL LETTER U WITH OGONEK + '\u0173' # 0xF7 -> LATIN SMALL LETTER U WITH OGONEK + '\xdd' # 0xF8 -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xfd' # 0xF9 -> LATIN SMALL LETTER Y WITH ACUTE + '\u0137' # 0xFA -> LATIN SMALL LETTER K WITH CEDILLA + '\u017b' # 0xFB -> LATIN CAPITAL LETTER Z WITH DOT ABOVE + '\u0141' # 0xFC -> LATIN CAPITAL LETTER L WITH STROKE + '\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE + '\u0122' # 0xFE -> LATIN CAPITAL LETTER G WITH CEDILLA + '\u02c7' # 0xFF -> CARON ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/mac_croatian.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_croatian.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_croatian.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON - u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\u2206' # 0xB4 -> INCREMENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON - u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\uf8ff' # 0xD8 -> Apple logo - u'\xa9' # 0xD9 -> COPYRIGHT SIGN - u'\u2044' # 0xDA -> FRACTION SLASH - u'\u20ac' # 0xDB -> EURO SIGN - u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\xc6' # 0xDE -> LATIN CAPITAL LETTER AE - u'\xbb' # 0xDF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2013' # 0xE0 -> EN DASH - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u03c0' # 0xF9 -> GREEK SMALL LETTER PI - u'\xcb' # 0xFA -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\xca' # 0xFD -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xe6' # 0xFE -> LATIN SMALL LETTER AE - u'\u02c7' # 0xFF -> CARON + '\x00' # 0x00 -> CONTROL CHARACTER + '\x01' # 0x01 -> CONTROL CHARACTER + '\x02' # 0x02 -> CONTROL CHARACTER + '\x03' # 0x03 -> CONTROL CHARACTER + '\x04' # 0x04 -> CONTROL CHARACTER + '\x05' # 0x05 -> CONTROL CHARACTER + '\x06' # 0x06 -> CONTROL CHARACTER + '\x07' # 0x07 -> CONTROL CHARACTER + '\x08' # 0x08 -> CONTROL CHARACTER + '\t' # 0x09 -> CONTROL CHARACTER + '\n' # 0x0A -> CONTROL CHARACTER + '\x0b' # 0x0B -> CONTROL CHARACTER + '\x0c' # 0x0C -> CONTROL CHARACTER + '\r' # 0x0D -> CONTROL CHARACTER + '\x0e' # 0x0E -> CONTROL CHARACTER + '\x0f' # 0x0F -> CONTROL CHARACTER + '\x10' # 0x10 -> CONTROL CHARACTER + '\x11' # 0x11 -> CONTROL CHARACTER + '\x12' # 0x12 -> CONTROL CHARACTER + '\x13' # 0x13 -> CONTROL CHARACTER + '\x14' # 0x14 -> CONTROL CHARACTER + '\x15' # 0x15 -> CONTROL CHARACTER + '\x16' # 0x16 -> CONTROL CHARACTER + '\x17' # 0x17 -> CONTROL CHARACTER + '\x18' # 0x18 -> CONTROL CHARACTER + '\x19' # 0x19 -> CONTROL CHARACTER + '\x1a' # 0x1A -> CONTROL CHARACTER + '\x1b' # 0x1B -> CONTROL CHARACTER + '\x1c' # 0x1C -> CONTROL CHARACTER + '\x1d' # 0x1D -> CONTROL CHARACTER + '\x1e' # 0x1E -> CONTROL CHARACTER + '\x1f' # 0x1F -> CONTROL CHARACTER + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> CONTROL CHARACTER + '\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE + '\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE + '\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA + '\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE + '\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE + '\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE + '\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE + '\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE + '\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE + '\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE + '\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE + '\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE + '\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE + '\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS + '\u2020' # 0xA0 -> DAGGER + '\xb0' # 0xA1 -> DEGREE SIGN + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa7' # 0xA4 -> SECTION SIGN + '\u2022' # 0xA5 -> BULLET + '\xb6' # 0xA6 -> PILCROW SIGN + '\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S + '\xae' # 0xA8 -> REGISTERED SIGN + '\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON + '\u2122' # 0xAA -> TRADE MARK SIGN + '\xb4' # 0xAB -> ACUTE ACCENT + '\xa8' # 0xAC -> DIAERESIS + '\u2260' # 0xAD -> NOT EQUAL TO + '\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON + '\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE + '\u221e' # 0xB0 -> INFINITY + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO + '\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO + '\u2206' # 0xB4 -> INCREMENT + '\xb5' # 0xB5 -> MICRO SIGN + '\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL + '\u2211' # 0xB7 -> N-ARY SUMMATION + '\u220f' # 0xB8 -> N-ARY PRODUCT + '\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON + '\u222b' # 0xBA -> INTEGRAL + '\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR + '\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR + '\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA + '\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON + '\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE + '\xbf' # 0xC0 -> INVERTED QUESTION MARK + '\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK + '\xac' # 0xC2 -> NOT SIGN + '\u221a' # 0xC3 -> SQUARE ROOT + '\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK + '\u2248' # 0xC5 -> ALMOST EQUAL TO + '\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE + '\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON + '\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS + '\xa0' # 0xCA -> NO-BREAK SPACE + '\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE + '\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE + '\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE + '\u0153' # 0xCF -> LATIN SMALL LIGATURE OE + '\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE + '\u2014' # 0xD1 -> EM DASH + '\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK + '\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK + '\xf7' # 0xD6 -> DIVISION SIGN + '\u25ca' # 0xD7 -> LOZENGE + '\uf8ff' # 0xD8 -> Apple logo + '\xa9' # 0xD9 -> COPYRIGHT SIGN + '\u2044' # 0xDA -> FRACTION SLASH + '\u20ac' # 0xDB -> EURO SIGN + '\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\xc6' # 0xDE -> LATIN CAPITAL LETTER AE + '\xbb' # 0xDF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2013' # 0xE0 -> EN DASH + '\xb7' # 0xE1 -> MIDDLE DOT + '\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK + '\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK + '\u2030' # 0xE4 -> PER MILLE SIGN + '\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE + '\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE + '\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON + '\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE + '\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE + '\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I + '\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u02dc' # 0xF7 -> SMALL TILDE + '\xaf' # 0xF8 -> MACRON + '\u03c0' # 0xF9 -> GREEK SMALL LETTER PI + '\xcb' # 0xFA -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\u02da' # 0xFB -> RING ABOVE + '\xb8' # 0xFC -> CEDILLA + '\xca' # 0xFD -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xe6' # 0xFE -> LATIN SMALL LETTER AE + '\u02c7' # 0xFF -> CARON ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/mac_cyrillic.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_cyrillic.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_cyrillic.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\u0410' # 0x80 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0x81 -> CYRILLIC CAPITAL LETTER BE - u'\u0412' # 0x82 -> CYRILLIC CAPITAL LETTER VE - u'\u0413' # 0x83 -> CYRILLIC CAPITAL LETTER GHE - u'\u0414' # 0x84 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0x85 -> CYRILLIC CAPITAL LETTER IE - u'\u0416' # 0x86 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0417' # 0x87 -> CYRILLIC CAPITAL LETTER ZE - u'\u0418' # 0x88 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0x89 -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0x8A -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0x8B -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0x8C -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0x8D -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0x8E -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0x8F -> CYRILLIC CAPITAL LETTER PE - u'\u0420' # 0x90 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0x91 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0x92 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0x93 -> CYRILLIC CAPITAL LETTER U - u'\u0424' # 0x94 -> CYRILLIC CAPITAL LETTER EF - u'\u0425' # 0x95 -> CYRILLIC CAPITAL LETTER HA - u'\u0426' # 0x96 -> CYRILLIC CAPITAL LETTER TSE - u'\u0427' # 0x97 -> CYRILLIC CAPITAL LETTER CHE - u'\u0428' # 0x98 -> CYRILLIC CAPITAL LETTER SHA - u'\u0429' # 0x99 -> CYRILLIC CAPITAL LETTER SHCHA - u'\u042a' # 0x9A -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u042b' # 0x9B -> CYRILLIC CAPITAL LETTER YERU - u'\u042c' # 0x9C -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042d' # 0x9D -> CYRILLIC CAPITAL LETTER E - u'\u042e' # 0x9E -> CYRILLIC CAPITAL LETTER YU - u'\u042f' # 0x9F -> CYRILLIC CAPITAL LETTER YA - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\u0490' # 0xA2 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\u0406' # 0xA7 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\u0402' # 0xAB -> CYRILLIC CAPITAL LETTER DJE - u'\u0452' # 0xAC -> CYRILLIC SMALL LETTER DJE - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\u0403' # 0xAE -> CYRILLIC CAPITAL LETTER GJE - u'\u0453' # 0xAF -> CYRILLIC SMALL LETTER GJE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\u0456' # 0xB4 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u0491' # 0xB6 -> CYRILLIC SMALL LETTER GHE WITH UPTURN - u'\u0408' # 0xB7 -> CYRILLIC CAPITAL LETTER JE - u'\u0404' # 0xB8 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u0454' # 0xB9 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u0407' # 0xBA -> CYRILLIC CAPITAL LETTER YI - u'\u0457' # 0xBB -> CYRILLIC SMALL LETTER YI - u'\u0409' # 0xBC -> CYRILLIC CAPITAL LETTER LJE - u'\u0459' # 0xBD -> CYRILLIC SMALL LETTER LJE - u'\u040a' # 0xBE -> CYRILLIC CAPITAL LETTER NJE - u'\u045a' # 0xBF -> CYRILLIC SMALL LETTER NJE - u'\u0458' # 0xC0 -> CYRILLIC SMALL LETTER JE - u'\u0405' # 0xC1 -> CYRILLIC CAPITAL LETTER DZE - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\u040b' # 0xCB -> CYRILLIC CAPITAL LETTER TSHE - u'\u045b' # 0xCC -> CYRILLIC SMALL LETTER TSHE - u'\u040c' # 0xCD -> CYRILLIC CAPITAL LETTER KJE - u'\u045c' # 0xCE -> CYRILLIC SMALL LETTER KJE - u'\u0455' # 0xCF -> CYRILLIC SMALL LETTER DZE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u201e' # 0xD7 -> DOUBLE LOW-9 QUOTATION MARK - u'\u040e' # 0xD8 -> CYRILLIC CAPITAL LETTER SHORT U - u'\u045e' # 0xD9 -> CYRILLIC SMALL LETTER SHORT U - u'\u040f' # 0xDA -> CYRILLIC CAPITAL LETTER DZHE - u'\u045f' # 0xDB -> CYRILLIC SMALL LETTER DZHE - u'\u2116' # 0xDC -> NUMERO SIGN - u'\u0401' # 0xDD -> CYRILLIC CAPITAL LETTER IO - u'\u0451' # 0xDE -> CYRILLIC SMALL LETTER IO - u'\u044f' # 0xDF -> CYRILLIC SMALL LETTER YA - u'\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE - u'\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE - u'\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE - u'\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE - u'\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE - u'\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE - u'\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xED -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xEE -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE - u'\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U - u'\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF - u'\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA - u'\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE - u'\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE - u'\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA - u'\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA - u'\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN - u'\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU - u'\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044d' # 0xFD -> CYRILLIC SMALL LETTER E - u'\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU - u'\u20ac' # 0xFF -> EURO SIGN + '\x00' # 0x00 -> CONTROL CHARACTER + '\x01' # 0x01 -> CONTROL CHARACTER + '\x02' # 0x02 -> CONTROL CHARACTER + '\x03' # 0x03 -> CONTROL CHARACTER + '\x04' # 0x04 -> CONTROL CHARACTER + '\x05' # 0x05 -> CONTROL CHARACTER + '\x06' # 0x06 -> CONTROL CHARACTER + '\x07' # 0x07 -> CONTROL CHARACTER + '\x08' # 0x08 -> CONTROL CHARACTER + '\t' # 0x09 -> CONTROL CHARACTER + '\n' # 0x0A -> CONTROL CHARACTER + '\x0b' # 0x0B -> CONTROL CHARACTER + '\x0c' # 0x0C -> CONTROL CHARACTER + '\r' # 0x0D -> CONTROL CHARACTER + '\x0e' # 0x0E -> CONTROL CHARACTER + '\x0f' # 0x0F -> CONTROL CHARACTER + '\x10' # 0x10 -> CONTROL CHARACTER + '\x11' # 0x11 -> CONTROL CHARACTER + '\x12' # 0x12 -> CONTROL CHARACTER + '\x13' # 0x13 -> CONTROL CHARACTER + '\x14' # 0x14 -> CONTROL CHARACTER + '\x15' # 0x15 -> CONTROL CHARACTER + '\x16' # 0x16 -> CONTROL CHARACTER + '\x17' # 0x17 -> CONTROL CHARACTER + '\x18' # 0x18 -> CONTROL CHARACTER + '\x19' # 0x19 -> CONTROL CHARACTER + '\x1a' # 0x1A -> CONTROL CHARACTER + '\x1b' # 0x1B -> CONTROL CHARACTER + '\x1c' # 0x1C -> CONTROL CHARACTER + '\x1d' # 0x1D -> CONTROL CHARACTER + '\x1e' # 0x1E -> CONTROL CHARACTER + '\x1f' # 0x1F -> CONTROL CHARACTER + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> CONTROL CHARACTER + '\u0410' # 0x80 -> CYRILLIC CAPITAL LETTER A + '\u0411' # 0x81 -> CYRILLIC CAPITAL LETTER BE + '\u0412' # 0x82 -> CYRILLIC CAPITAL LETTER VE + '\u0413' # 0x83 -> CYRILLIC CAPITAL LETTER GHE + '\u0414' # 0x84 -> CYRILLIC CAPITAL LETTER DE + '\u0415' # 0x85 -> CYRILLIC CAPITAL LETTER IE + '\u0416' # 0x86 -> CYRILLIC CAPITAL LETTER ZHE + '\u0417' # 0x87 -> CYRILLIC CAPITAL LETTER ZE + '\u0418' # 0x88 -> CYRILLIC CAPITAL LETTER I + '\u0419' # 0x89 -> CYRILLIC CAPITAL LETTER SHORT I + '\u041a' # 0x8A -> CYRILLIC CAPITAL LETTER KA + '\u041b' # 0x8B -> CYRILLIC CAPITAL LETTER EL + '\u041c' # 0x8C -> CYRILLIC CAPITAL LETTER EM + '\u041d' # 0x8D -> CYRILLIC CAPITAL LETTER EN + '\u041e' # 0x8E -> CYRILLIC CAPITAL LETTER O + '\u041f' # 0x8F -> CYRILLIC CAPITAL LETTER PE + '\u0420' # 0x90 -> CYRILLIC CAPITAL LETTER ER + '\u0421' # 0x91 -> CYRILLIC CAPITAL LETTER ES + '\u0422' # 0x92 -> CYRILLIC CAPITAL LETTER TE + '\u0423' # 0x93 -> CYRILLIC CAPITAL LETTER U + '\u0424' # 0x94 -> CYRILLIC CAPITAL LETTER EF + '\u0425' # 0x95 -> CYRILLIC CAPITAL LETTER HA + '\u0426' # 0x96 -> CYRILLIC CAPITAL LETTER TSE + '\u0427' # 0x97 -> CYRILLIC CAPITAL LETTER CHE + '\u0428' # 0x98 -> CYRILLIC CAPITAL LETTER SHA + '\u0429' # 0x99 -> CYRILLIC CAPITAL LETTER SHCHA + '\u042a' # 0x9A -> CYRILLIC CAPITAL LETTER HARD SIGN + '\u042b' # 0x9B -> CYRILLIC CAPITAL LETTER YERU + '\u042c' # 0x9C -> CYRILLIC CAPITAL LETTER SOFT SIGN + '\u042d' # 0x9D -> CYRILLIC CAPITAL LETTER E + '\u042e' # 0x9E -> CYRILLIC CAPITAL LETTER YU + '\u042f' # 0x9F -> CYRILLIC CAPITAL LETTER YA + '\u2020' # 0xA0 -> DAGGER + '\xb0' # 0xA1 -> DEGREE SIGN + '\u0490' # 0xA2 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN + '\xa3' # 0xA3 -> POUND SIGN + '\xa7' # 0xA4 -> SECTION SIGN + '\u2022' # 0xA5 -> BULLET + '\xb6' # 0xA6 -> PILCROW SIGN + '\u0406' # 0xA7 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I + '\xae' # 0xA8 -> REGISTERED SIGN + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u2122' # 0xAA -> TRADE MARK SIGN + '\u0402' # 0xAB -> CYRILLIC CAPITAL LETTER DJE + '\u0452' # 0xAC -> CYRILLIC SMALL LETTER DJE + '\u2260' # 0xAD -> NOT EQUAL TO + '\u0403' # 0xAE -> CYRILLIC CAPITAL LETTER GJE + '\u0453' # 0xAF -> CYRILLIC SMALL LETTER GJE + '\u221e' # 0xB0 -> INFINITY + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO + '\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO + '\u0456' # 0xB4 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I + '\xb5' # 0xB5 -> MICRO SIGN + '\u0491' # 0xB6 -> CYRILLIC SMALL LETTER GHE WITH UPTURN + '\u0408' # 0xB7 -> CYRILLIC CAPITAL LETTER JE + '\u0404' # 0xB8 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE + '\u0454' # 0xB9 -> CYRILLIC SMALL LETTER UKRAINIAN IE + '\u0407' # 0xBA -> CYRILLIC CAPITAL LETTER YI + '\u0457' # 0xBB -> CYRILLIC SMALL LETTER YI + '\u0409' # 0xBC -> CYRILLIC CAPITAL LETTER LJE + '\u0459' # 0xBD -> CYRILLIC SMALL LETTER LJE + '\u040a' # 0xBE -> CYRILLIC CAPITAL LETTER NJE + '\u045a' # 0xBF -> CYRILLIC SMALL LETTER NJE + '\u0458' # 0xC0 -> CYRILLIC SMALL LETTER JE + '\u0405' # 0xC1 -> CYRILLIC CAPITAL LETTER DZE + '\xac' # 0xC2 -> NOT SIGN + '\u221a' # 0xC3 -> SQUARE ROOT + '\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK + '\u2248' # 0xC5 -> ALMOST EQUAL TO + '\u2206' # 0xC6 -> INCREMENT + '\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS + '\xa0' # 0xCA -> NO-BREAK SPACE + '\u040b' # 0xCB -> CYRILLIC CAPITAL LETTER TSHE + '\u045b' # 0xCC -> CYRILLIC SMALL LETTER TSHE + '\u040c' # 0xCD -> CYRILLIC CAPITAL LETTER KJE + '\u045c' # 0xCE -> CYRILLIC SMALL LETTER KJE + '\u0455' # 0xCF -> CYRILLIC SMALL LETTER DZE + '\u2013' # 0xD0 -> EN DASH + '\u2014' # 0xD1 -> EM DASH + '\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK + '\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK + '\xf7' # 0xD6 -> DIVISION SIGN + '\u201e' # 0xD7 -> DOUBLE LOW-9 QUOTATION MARK + '\u040e' # 0xD8 -> CYRILLIC CAPITAL LETTER SHORT U + '\u045e' # 0xD9 -> CYRILLIC SMALL LETTER SHORT U + '\u040f' # 0xDA -> CYRILLIC CAPITAL LETTER DZHE + '\u045f' # 0xDB -> CYRILLIC SMALL LETTER DZHE + '\u2116' # 0xDC -> NUMERO SIGN + '\u0401' # 0xDD -> CYRILLIC CAPITAL LETTER IO + '\u0451' # 0xDE -> CYRILLIC SMALL LETTER IO + '\u044f' # 0xDF -> CYRILLIC SMALL LETTER YA + '\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A + '\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE + '\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE + '\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE + '\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE + '\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE + '\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE + '\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE + '\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I + '\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I + '\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA + '\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL + '\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM + '\u043d' # 0xED -> CYRILLIC SMALL LETTER EN + '\u043e' # 0xEE -> CYRILLIC SMALL LETTER O + '\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE + '\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER + '\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES + '\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE + '\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U + '\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF + '\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA + '\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE + '\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE + '\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA + '\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA + '\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN + '\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU + '\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN + '\u044d' # 0xFD -> CYRILLIC SMALL LETTER E + '\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU + '\u20ac' # 0xFF -> EURO SIGN ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/mac_farsi.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_farsi.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_farsi.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE, left-right - u'!' # 0x21 -> EXCLAMATION MARK, left-right - u'"' # 0x22 -> QUOTATION MARK, left-right - u'#' # 0x23 -> NUMBER SIGN, left-right - u'$' # 0x24 -> DOLLAR SIGN, left-right - u'%' # 0x25 -> PERCENT SIGN, left-right - u'&' # 0x26 -> AMPERSAND, left-right - u"'" # 0x27 -> APOSTROPHE, left-right - u'(' # 0x28 -> LEFT PARENTHESIS, left-right - u')' # 0x29 -> RIGHT PARENTHESIS, left-right - u'*' # 0x2A -> ASTERISK, left-right - u'+' # 0x2B -> PLUS SIGN, left-right - u',' # 0x2C -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR - u'-' # 0x2D -> HYPHEN-MINUS, left-right - u'.' # 0x2E -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR - u'/' # 0x2F -> SOLIDUS, left-right - u'0' # 0x30 -> DIGIT ZERO; in Arabic-script context, displayed as 0x06F0 EXTENDED ARABIC-INDIC DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE; in Arabic-script context, displayed as 0x06F1 EXTENDED ARABIC-INDIC DIGIT ONE - u'2' # 0x32 -> DIGIT TWO; in Arabic-script context, displayed as 0x06F2 EXTENDED ARABIC-INDIC DIGIT TWO - u'3' # 0x33 -> DIGIT THREE; in Arabic-script context, displayed as 0x06F3 EXTENDED ARABIC-INDIC DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR; in Arabic-script context, displayed as 0x06F4 EXTENDED ARABIC-INDIC DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE; in Arabic-script context, displayed as 0x06F5 EXTENDED ARABIC-INDIC DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX; in Arabic-script context, displayed as 0x06F6 EXTENDED ARABIC-INDIC DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE; in Arabic-script context, displayed as 0x06F9 EXTENDED ARABIC-INDIC DIGIT NINE - u':' # 0x3A -> COLON, left-right - u';' # 0x3B -> SEMICOLON, left-right - u'<' # 0x3C -> LESS-THAN SIGN, left-right - u'=' # 0x3D -> EQUALS SIGN, left-right - u'>' # 0x3E -> GREATER-THAN SIGN, left-right - u'?' # 0x3F -> QUESTION MARK, left-right - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET, left-right - u'\\' # 0x5C -> REVERSE SOLIDUS, left-right - u']' # 0x5D -> RIGHT SQUARE BRACKET, left-right - u'^' # 0x5E -> CIRCUMFLEX ACCENT, left-right - u'_' # 0x5F -> LOW LINE, left-right - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET, left-right - u'|' # 0x7C -> VERTICAL LINE, left-right - u'}' # 0x7D -> RIGHT CURLY BRACKET, left-right - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xa0' # 0x81 -> NO-BREAK SPACE, right-left - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u06ba' # 0x8B -> ARABIC LETTER NOON GHUNNA - u'\xab' # 0x8C -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\u2026' # 0x93 -> HORIZONTAL ELLIPSIS, right-left - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xbb' # 0x98 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0x9B -> DIVISION SIGN, right-left - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u' ' # 0xA0 -> SPACE, right-left - u'!' # 0xA1 -> EXCLAMATION MARK, right-left - u'"' # 0xA2 -> QUOTATION MARK, right-left - u'#' # 0xA3 -> NUMBER SIGN, right-left - u'$' # 0xA4 -> DOLLAR SIGN, right-left - u'\u066a' # 0xA5 -> ARABIC PERCENT SIGN - u'&' # 0xA6 -> AMPERSAND, right-left - u"'" # 0xA7 -> APOSTROPHE, right-left - u'(' # 0xA8 -> LEFT PARENTHESIS, right-left - u')' # 0xA9 -> RIGHT PARENTHESIS, right-left - u'*' # 0xAA -> ASTERISK, right-left - u'+' # 0xAB -> PLUS SIGN, right-left - u'\u060c' # 0xAC -> ARABIC COMMA - u'-' # 0xAD -> HYPHEN-MINUS, right-left - u'.' # 0xAE -> FULL STOP, right-left - u'/' # 0xAF -> SOLIDUS, right-left - u'\u06f0' # 0xB0 -> EXTENDED ARABIC-INDIC DIGIT ZERO, right-left (need override) - u'\u06f1' # 0xB1 -> EXTENDED ARABIC-INDIC DIGIT ONE, right-left (need override) - u'\u06f2' # 0xB2 -> EXTENDED ARABIC-INDIC DIGIT TWO, right-left (need override) - u'\u06f3' # 0xB3 -> EXTENDED ARABIC-INDIC DIGIT THREE, right-left (need override) - u'\u06f4' # 0xB4 -> EXTENDED ARABIC-INDIC DIGIT FOUR, right-left (need override) - u'\u06f5' # 0xB5 -> EXTENDED ARABIC-INDIC DIGIT FIVE, right-left (need override) - u'\u06f6' # 0xB6 -> EXTENDED ARABIC-INDIC DIGIT SIX, right-left (need override) - u'\u06f7' # 0xB7 -> EXTENDED ARABIC-INDIC DIGIT SEVEN, right-left (need override) - u'\u06f8' # 0xB8 -> EXTENDED ARABIC-INDIC DIGIT EIGHT, right-left (need override) - u'\u06f9' # 0xB9 -> EXTENDED ARABIC-INDIC DIGIT NINE, right-left (need override) - u':' # 0xBA -> COLON, right-left - u'\u061b' # 0xBB -> ARABIC SEMICOLON - u'<' # 0xBC -> LESS-THAN SIGN, right-left - u'=' # 0xBD -> EQUALS SIGN, right-left - u'>' # 0xBE -> GREATER-THAN SIGN, right-left - u'\u061f' # 0xBF -> ARABIC QUESTION MARK - u'\u274a' # 0xC0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left - u'\u0621' # 0xC1 -> ARABIC LETTER HAMZA - u'\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE - u'\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE - u'\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE - u'\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW - u'\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE - u'\u0627' # 0xC7 -> ARABIC LETTER ALEF - u'\u0628' # 0xC8 -> ARABIC LETTER BEH - u'\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA - u'\u062a' # 0xCA -> ARABIC LETTER TEH - u'\u062b' # 0xCB -> ARABIC LETTER THEH - u'\u062c' # 0xCC -> ARABIC LETTER JEEM - u'\u062d' # 0xCD -> ARABIC LETTER HAH - u'\u062e' # 0xCE -> ARABIC LETTER KHAH - u'\u062f' # 0xCF -> ARABIC LETTER DAL - u'\u0630' # 0xD0 -> ARABIC LETTER THAL - u'\u0631' # 0xD1 -> ARABIC LETTER REH - u'\u0632' # 0xD2 -> ARABIC LETTER ZAIN - u'\u0633' # 0xD3 -> ARABIC LETTER SEEN - u'\u0634' # 0xD4 -> ARABIC LETTER SHEEN - u'\u0635' # 0xD5 -> ARABIC LETTER SAD - u'\u0636' # 0xD6 -> ARABIC LETTER DAD - u'\u0637' # 0xD7 -> ARABIC LETTER TAH - u'\u0638' # 0xD8 -> ARABIC LETTER ZAH - u'\u0639' # 0xD9 -> ARABIC LETTER AIN - u'\u063a' # 0xDA -> ARABIC LETTER GHAIN - u'[' # 0xDB -> LEFT SQUARE BRACKET, right-left - u'\\' # 0xDC -> REVERSE SOLIDUS, right-left - u']' # 0xDD -> RIGHT SQUARE BRACKET, right-left - u'^' # 0xDE -> CIRCUMFLEX ACCENT, right-left - u'_' # 0xDF -> LOW LINE, right-left - u'\u0640' # 0xE0 -> ARABIC TATWEEL - u'\u0641' # 0xE1 -> ARABIC LETTER FEH - u'\u0642' # 0xE2 -> ARABIC LETTER QAF - u'\u0643' # 0xE3 -> ARABIC LETTER KAF - u'\u0644' # 0xE4 -> ARABIC LETTER LAM - u'\u0645' # 0xE5 -> ARABIC LETTER MEEM - u'\u0646' # 0xE6 -> ARABIC LETTER NOON - u'\u0647' # 0xE7 -> ARABIC LETTER HEH - u'\u0648' # 0xE8 -> ARABIC LETTER WAW - u'\u0649' # 0xE9 -> ARABIC LETTER ALEF MAKSURA - u'\u064a' # 0xEA -> ARABIC LETTER YEH - u'\u064b' # 0xEB -> ARABIC FATHATAN - u'\u064c' # 0xEC -> ARABIC DAMMATAN - u'\u064d' # 0xED -> ARABIC KASRATAN - u'\u064e' # 0xEE -> ARABIC FATHA - u'\u064f' # 0xEF -> ARABIC DAMMA - u'\u0650' # 0xF0 -> ARABIC KASRA - u'\u0651' # 0xF1 -> ARABIC SHADDA - u'\u0652' # 0xF2 -> ARABIC SUKUN - u'\u067e' # 0xF3 -> ARABIC LETTER PEH - u'\u0679' # 0xF4 -> ARABIC LETTER TTEH - u'\u0686' # 0xF5 -> ARABIC LETTER TCHEH - u'\u06d5' # 0xF6 -> ARABIC LETTER AE - u'\u06a4' # 0xF7 -> ARABIC LETTER VEH - u'\u06af' # 0xF8 -> ARABIC LETTER GAF - u'\u0688' # 0xF9 -> ARABIC LETTER DDAL - u'\u0691' # 0xFA -> ARABIC LETTER RREH - u'{' # 0xFB -> LEFT CURLY BRACKET, right-left - u'|' # 0xFC -> VERTICAL LINE, right-left - u'}' # 0xFD -> RIGHT CURLY BRACKET, right-left - u'\u0698' # 0xFE -> ARABIC LETTER JEH - u'\u06d2' # 0xFF -> ARABIC LETTER YEH BARREE + '\x00' # 0x00 -> CONTROL CHARACTER + '\x01' # 0x01 -> CONTROL CHARACTER + '\x02' # 0x02 -> CONTROL CHARACTER + '\x03' # 0x03 -> CONTROL CHARACTER + '\x04' # 0x04 -> CONTROL CHARACTER + '\x05' # 0x05 -> CONTROL CHARACTER + '\x06' # 0x06 -> CONTROL CHARACTER + '\x07' # 0x07 -> CONTROL CHARACTER + '\x08' # 0x08 -> CONTROL CHARACTER + '\t' # 0x09 -> CONTROL CHARACTER + '\n' # 0x0A -> CONTROL CHARACTER + '\x0b' # 0x0B -> CONTROL CHARACTER + '\x0c' # 0x0C -> CONTROL CHARACTER + '\r' # 0x0D -> CONTROL CHARACTER + '\x0e' # 0x0E -> CONTROL CHARACTER + '\x0f' # 0x0F -> CONTROL CHARACTER + '\x10' # 0x10 -> CONTROL CHARACTER + '\x11' # 0x11 -> CONTROL CHARACTER + '\x12' # 0x12 -> CONTROL CHARACTER + '\x13' # 0x13 -> CONTROL CHARACTER + '\x14' # 0x14 -> CONTROL CHARACTER + '\x15' # 0x15 -> CONTROL CHARACTER + '\x16' # 0x16 -> CONTROL CHARACTER + '\x17' # 0x17 -> CONTROL CHARACTER + '\x18' # 0x18 -> CONTROL CHARACTER + '\x19' # 0x19 -> CONTROL CHARACTER + '\x1a' # 0x1A -> CONTROL CHARACTER + '\x1b' # 0x1B -> CONTROL CHARACTER + '\x1c' # 0x1C -> CONTROL CHARACTER + '\x1d' # 0x1D -> CONTROL CHARACTER + '\x1e' # 0x1E -> CONTROL CHARACTER + '\x1f' # 0x1F -> CONTROL CHARACTER + ' ' # 0x20 -> SPACE, left-right + '!' # 0x21 -> EXCLAMATION MARK, left-right + '"' # 0x22 -> QUOTATION MARK, left-right + '#' # 0x23 -> NUMBER SIGN, left-right + '$' # 0x24 -> DOLLAR SIGN, left-right + '%' # 0x25 -> PERCENT SIGN, left-right + '&' # 0x26 -> AMPERSAND, left-right + "'" # 0x27 -> APOSTROPHE, left-right + '(' # 0x28 -> LEFT PARENTHESIS, left-right + ')' # 0x29 -> RIGHT PARENTHESIS, left-right + '*' # 0x2A -> ASTERISK, left-right + '+' # 0x2B -> PLUS SIGN, left-right + ',' # 0x2C -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR + '-' # 0x2D -> HYPHEN-MINUS, left-right + '.' # 0x2E -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR + '/' # 0x2F -> SOLIDUS, left-right + '0' # 0x30 -> DIGIT ZERO; in Arabic-script context, displayed as 0x06F0 EXTENDED ARABIC-INDIC DIGIT ZERO + '1' # 0x31 -> DIGIT ONE; in Arabic-script context, displayed as 0x06F1 EXTENDED ARABIC-INDIC DIGIT ONE + '2' # 0x32 -> DIGIT TWO; in Arabic-script context, displayed as 0x06F2 EXTENDED ARABIC-INDIC DIGIT TWO + '3' # 0x33 -> DIGIT THREE; in Arabic-script context, displayed as 0x06F3 EXTENDED ARABIC-INDIC DIGIT THREE + '4' # 0x34 -> DIGIT FOUR; in Arabic-script context, displayed as 0x06F4 EXTENDED ARABIC-INDIC DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE; in Arabic-script context, displayed as 0x06F5 EXTENDED ARABIC-INDIC DIGIT FIVE + '6' # 0x36 -> DIGIT SIX; in Arabic-script context, displayed as 0x06F6 EXTENDED ARABIC-INDIC DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE; in Arabic-script context, displayed as 0x06F9 EXTENDED ARABIC-INDIC DIGIT NINE + ':' # 0x3A -> COLON, left-right + ';' # 0x3B -> SEMICOLON, left-right + '<' # 0x3C -> LESS-THAN SIGN, left-right + '=' # 0x3D -> EQUALS SIGN, left-right + '>' # 0x3E -> GREATER-THAN SIGN, left-right + '?' # 0x3F -> QUESTION MARK, left-right + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET, left-right + '\\' # 0x5C -> REVERSE SOLIDUS, left-right + ']' # 0x5D -> RIGHT SQUARE BRACKET, left-right + '^' # 0x5E -> CIRCUMFLEX ACCENT, left-right + '_' # 0x5F -> LOW LINE, left-right + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET, left-right + '|' # 0x7C -> VERTICAL LINE, left-right + '}' # 0x7D -> RIGHT CURLY BRACKET, left-right + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> CONTROL CHARACTER + '\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xa0' # 0x81 -> NO-BREAK SPACE, right-left + '\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE + '\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE + '\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS + '\u06ba' # 0x8B -> ARABIC LETTER NOON GHUNNA + '\xab' # 0x8C -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left + '\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA + '\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE + '\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE + '\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE + '\u2026' # 0x93 -> HORIZONTAL ELLIPSIS, right-left + '\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE + '\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE + '\xbb' # 0x98 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left + '\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf7' # 0x9B -> DIVISION SIGN, right-left + '\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE + '\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE + '\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS + ' ' # 0xA0 -> SPACE, right-left + '!' # 0xA1 -> EXCLAMATION MARK, right-left + '"' # 0xA2 -> QUOTATION MARK, right-left + '#' # 0xA3 -> NUMBER SIGN, right-left + '$' # 0xA4 -> DOLLAR SIGN, right-left + '\u066a' # 0xA5 -> ARABIC PERCENT SIGN + '&' # 0xA6 -> AMPERSAND, right-left + "'" # 0xA7 -> APOSTROPHE, right-left + '(' # 0xA8 -> LEFT PARENTHESIS, right-left + ')' # 0xA9 -> RIGHT PARENTHESIS, right-left + '*' # 0xAA -> ASTERISK, right-left + '+' # 0xAB -> PLUS SIGN, right-left + '\u060c' # 0xAC -> ARABIC COMMA + '-' # 0xAD -> HYPHEN-MINUS, right-left + '.' # 0xAE -> FULL STOP, right-left + '/' # 0xAF -> SOLIDUS, right-left + '\u06f0' # 0xB0 -> EXTENDED ARABIC-INDIC DIGIT ZERO, right-left (need override) + '\u06f1' # 0xB1 -> EXTENDED ARABIC-INDIC DIGIT ONE, right-left (need override) + '\u06f2' # 0xB2 -> EXTENDED ARABIC-INDIC DIGIT TWO, right-left (need override) + '\u06f3' # 0xB3 -> EXTENDED ARABIC-INDIC DIGIT THREE, right-left (need override) + '\u06f4' # 0xB4 -> EXTENDED ARABIC-INDIC DIGIT FOUR, right-left (need override) + '\u06f5' # 0xB5 -> EXTENDED ARABIC-INDIC DIGIT FIVE, right-left (need override) + '\u06f6' # 0xB6 -> EXTENDED ARABIC-INDIC DIGIT SIX, right-left (need override) + '\u06f7' # 0xB7 -> EXTENDED ARABIC-INDIC DIGIT SEVEN, right-left (need override) + '\u06f8' # 0xB8 -> EXTENDED ARABIC-INDIC DIGIT EIGHT, right-left (need override) + '\u06f9' # 0xB9 -> EXTENDED ARABIC-INDIC DIGIT NINE, right-left (need override) + ':' # 0xBA -> COLON, right-left + '\u061b' # 0xBB -> ARABIC SEMICOLON + '<' # 0xBC -> LESS-THAN SIGN, right-left + '=' # 0xBD -> EQUALS SIGN, right-left + '>' # 0xBE -> GREATER-THAN SIGN, right-left + '\u061f' # 0xBF -> ARABIC QUESTION MARK + '\u274a' # 0xC0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left + '\u0621' # 0xC1 -> ARABIC LETTER HAMZA + '\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE + '\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE + '\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE + '\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW + '\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE + '\u0627' # 0xC7 -> ARABIC LETTER ALEF + '\u0628' # 0xC8 -> ARABIC LETTER BEH + '\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA + '\u062a' # 0xCA -> ARABIC LETTER TEH + '\u062b' # 0xCB -> ARABIC LETTER THEH + '\u062c' # 0xCC -> ARABIC LETTER JEEM + '\u062d' # 0xCD -> ARABIC LETTER HAH + '\u062e' # 0xCE -> ARABIC LETTER KHAH + '\u062f' # 0xCF -> ARABIC LETTER DAL + '\u0630' # 0xD0 -> ARABIC LETTER THAL + '\u0631' # 0xD1 -> ARABIC LETTER REH + '\u0632' # 0xD2 -> ARABIC LETTER ZAIN + '\u0633' # 0xD3 -> ARABIC LETTER SEEN + '\u0634' # 0xD4 -> ARABIC LETTER SHEEN + '\u0635' # 0xD5 -> ARABIC LETTER SAD + '\u0636' # 0xD6 -> ARABIC LETTER DAD + '\u0637' # 0xD7 -> ARABIC LETTER TAH + '\u0638' # 0xD8 -> ARABIC LETTER ZAH + '\u0639' # 0xD9 -> ARABIC LETTER AIN + '\u063a' # 0xDA -> ARABIC LETTER GHAIN + '[' # 0xDB -> LEFT SQUARE BRACKET, right-left + '\\' # 0xDC -> REVERSE SOLIDUS, right-left + ']' # 0xDD -> RIGHT SQUARE BRACKET, right-left + '^' # 0xDE -> CIRCUMFLEX ACCENT, right-left + '_' # 0xDF -> LOW LINE, right-left + '\u0640' # 0xE0 -> ARABIC TATWEEL + '\u0641' # 0xE1 -> ARABIC LETTER FEH + '\u0642' # 0xE2 -> ARABIC LETTER QAF + '\u0643' # 0xE3 -> ARABIC LETTER KAF + '\u0644' # 0xE4 -> ARABIC LETTER LAM + '\u0645' # 0xE5 -> ARABIC LETTER MEEM + '\u0646' # 0xE6 -> ARABIC LETTER NOON + '\u0647' # 0xE7 -> ARABIC LETTER HEH + '\u0648' # 0xE8 -> ARABIC LETTER WAW + '\u0649' # 0xE9 -> ARABIC LETTER ALEF MAKSURA + '\u064a' # 0xEA -> ARABIC LETTER YEH + '\u064b' # 0xEB -> ARABIC FATHATAN + '\u064c' # 0xEC -> ARABIC DAMMATAN + '\u064d' # 0xED -> ARABIC KASRATAN + '\u064e' # 0xEE -> ARABIC FATHA + '\u064f' # 0xEF -> ARABIC DAMMA + '\u0650' # 0xF0 -> ARABIC KASRA + '\u0651' # 0xF1 -> ARABIC SHADDA + '\u0652' # 0xF2 -> ARABIC SUKUN + '\u067e' # 0xF3 -> ARABIC LETTER PEH + '\u0679' # 0xF4 -> ARABIC LETTER TTEH + '\u0686' # 0xF5 -> ARABIC LETTER TCHEH + '\u06d5' # 0xF6 -> ARABIC LETTER AE + '\u06a4' # 0xF7 -> ARABIC LETTER VEH + '\u06af' # 0xF8 -> ARABIC LETTER GAF + '\u0688' # 0xF9 -> ARABIC LETTER DDAL + '\u0691' # 0xFA -> ARABIC LETTER RREH + '{' # 0xFB -> LEFT CURLY BRACKET, right-left + '|' # 0xFC -> VERTICAL LINE, right-left + '}' # 0xFD -> RIGHT CURLY BRACKET, right-left + '\u0698' # 0xFE -> ARABIC LETTER JEH + '\u06d2' # 0xFF -> ARABIC LETTER YEH BARREE ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/mac_greek.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_greek.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_greek.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xb9' # 0x81 -> SUPERSCRIPT ONE - u'\xb2' # 0x82 -> SUPERSCRIPT TWO - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xb3' # 0x84 -> SUPERSCRIPT THREE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0385' # 0x87 -> GREEK DIALYTIKA TONOS - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u0384' # 0x8B -> GREEK TONOS - u'\xa8' # 0x8C -> DIAERESIS - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xa3' # 0x92 -> POUND SIGN - u'\u2122' # 0x93 -> TRADE MARK SIGN - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u2022' # 0x96 -> BULLET - u'\xbd' # 0x97 -> VULGAR FRACTION ONE HALF - u'\u2030' # 0x98 -> PER MILLE SIGN - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xa6' # 0x9B -> BROKEN BAR - u'\u20ac' # 0x9C -> EURO SIGN # before Mac OS 9.2.2, was SOFT HYPHEN - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\u0393' # 0xA1 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0xA2 -> GREEK CAPITAL LETTER DELTA - u'\u0398' # 0xA3 -> GREEK CAPITAL LETTER THETA - u'\u039b' # 0xA4 -> GREEK CAPITAL LETTER LAMDA - u'\u039e' # 0xA5 -> GREEK CAPITAL LETTER XI - u'\u03a0' # 0xA6 -> GREEK CAPITAL LETTER PI - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u03a3' # 0xAA -> GREEK CAPITAL LETTER SIGMA - u'\u03aa' # 0xAB -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\xa7' # 0xAC -> SECTION SIGN - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\xb0' # 0xAE -> DEGREE SIGN - u'\xb7' # 0xAF -> MIDDLE DOT - u'\u0391' # 0xB0 -> GREEK CAPITAL LETTER ALPHA - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\u0392' # 0xB5 -> GREEK CAPITAL LETTER BETA - u'\u0395' # 0xB6 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0xB7 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0xB8 -> GREEK CAPITAL LETTER ETA - u'\u0399' # 0xB9 -> GREEK CAPITAL LETTER IOTA - u'\u039a' # 0xBA -> GREEK CAPITAL LETTER KAPPA - u'\u039c' # 0xBB -> GREEK CAPITAL LETTER MU - u'\u03a6' # 0xBC -> GREEK CAPITAL LETTER PHI - u'\u03ab' # 0xBD -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\u03a8' # 0xBE -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0xBF -> GREEK CAPITAL LETTER OMEGA - u'\u03ac' # 0xC0 -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u039d' # 0xC1 -> GREEK CAPITAL LETTER NU - u'\xac' # 0xC2 -> NOT SIGN - u'\u039f' # 0xC3 -> GREEK CAPITAL LETTER OMICRON - u'\u03a1' # 0xC4 -> GREEK CAPITAL LETTER RHO - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u03a4' # 0xC6 -> GREEK CAPITAL LETTER TAU - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\u03a5' # 0xCB -> GREEK CAPITAL LETTER UPSILON - u'\u03a7' # 0xCC -> GREEK CAPITAL LETTER CHI - u'\u0386' # 0xCD -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\u0388' # 0xCE -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2015' # 0xD1 -> HORIZONTAL BAR - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u0389' # 0xD7 -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0xD8 -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\u038c' # 0xD9 -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\u038e' # 0xDA -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u03ad' # 0xDB -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0xDC -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03af' # 0xDD -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03cc' # 0xDE -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u038f' # 0xDF -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\u03cd' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA - u'\u03c8' # 0xE3 -> GREEK SMALL LETTER PSI - u'\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON - u'\u03c6' # 0xE6 -> GREEK SMALL LETTER PHI - u'\u03b3' # 0xE7 -> GREEK SMALL LETTER GAMMA - u'\u03b7' # 0xE8 -> GREEK SMALL LETTER ETA - u'\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA - u'\u03be' # 0xEA -> GREEK SMALL LETTER XI - u'\u03ba' # 0xEB -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0xEC -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0xED -> GREEK SMALL LETTER MU - u'\u03bd' # 0xEE -> GREEK SMALL LETTER NU - u'\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0xF0 -> GREEK SMALL LETTER PI - u'\u03ce' # 0xF1 -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\u03c1' # 0xF2 -> GREEK SMALL LETTER RHO - u'\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA - u'\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU - u'\u03b8' # 0xF5 -> GREEK SMALL LETTER THETA - u'\u03c9' # 0xF6 -> GREEK SMALL LETTER OMEGA - u'\u03c2' # 0xF7 -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c7' # 0xF8 -> GREEK SMALL LETTER CHI - u'\u03c5' # 0xF9 -> GREEK SMALL LETTER UPSILON - u'\u03b6' # 0xFA -> GREEK SMALL LETTER ZETA - u'\u03ca' # 0xFB -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03cb' # 0xFC -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u0390' # 0xFD -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u03b0' # 0xFE -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\xad' # 0xFF -> SOFT HYPHEN # before Mac OS 9.2.2, was undefined + '\x00' # 0x00 -> CONTROL CHARACTER + '\x01' # 0x01 -> CONTROL CHARACTER + '\x02' # 0x02 -> CONTROL CHARACTER + '\x03' # 0x03 -> CONTROL CHARACTER + '\x04' # 0x04 -> CONTROL CHARACTER + '\x05' # 0x05 -> CONTROL CHARACTER + '\x06' # 0x06 -> CONTROL CHARACTER + '\x07' # 0x07 -> CONTROL CHARACTER + '\x08' # 0x08 -> CONTROL CHARACTER + '\t' # 0x09 -> CONTROL CHARACTER + '\n' # 0x0A -> CONTROL CHARACTER + '\x0b' # 0x0B -> CONTROL CHARACTER + '\x0c' # 0x0C -> CONTROL CHARACTER + '\r' # 0x0D -> CONTROL CHARACTER + '\x0e' # 0x0E -> CONTROL CHARACTER + '\x0f' # 0x0F -> CONTROL CHARACTER + '\x10' # 0x10 -> CONTROL CHARACTER + '\x11' # 0x11 -> CONTROL CHARACTER + '\x12' # 0x12 -> CONTROL CHARACTER + '\x13' # 0x13 -> CONTROL CHARACTER + '\x14' # 0x14 -> CONTROL CHARACTER + '\x15' # 0x15 -> CONTROL CHARACTER + '\x16' # 0x16 -> CONTROL CHARACTER + '\x17' # 0x17 -> CONTROL CHARACTER + '\x18' # 0x18 -> CONTROL CHARACTER + '\x19' # 0x19 -> CONTROL CHARACTER + '\x1a' # 0x1A -> CONTROL CHARACTER + '\x1b' # 0x1B -> CONTROL CHARACTER + '\x1c' # 0x1C -> CONTROL CHARACTER + '\x1d' # 0x1D -> CONTROL CHARACTER + '\x1e' # 0x1E -> CONTROL CHARACTER + '\x1f' # 0x1F -> CONTROL CHARACTER + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> CONTROL CHARACTER + '\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xb9' # 0x81 -> SUPERSCRIPT ONE + '\xb2' # 0x82 -> SUPERSCRIPT TWO + '\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xb3' # 0x84 -> SUPERSCRIPT THREE + '\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\u0385' # 0x87 -> GREEK DIALYTIKA TONOS + '\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE + '\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS + '\u0384' # 0x8B -> GREEK TONOS + '\xa8' # 0x8C -> DIAERESIS + '\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA + '\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE + '\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE + '\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xa3' # 0x92 -> POUND SIGN + '\u2122' # 0x93 -> TRADE MARK SIGN + '\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS + '\u2022' # 0x96 -> BULLET + '\xbd' # 0x97 -> VULGAR FRACTION ONE HALF + '\u2030' # 0x98 -> PER MILLE SIGN + '\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS + '\xa6' # 0x9B -> BROKEN BAR + '\u20ac' # 0x9C -> EURO SIGN # before Mac OS 9.2.2, was SOFT HYPHEN + '\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE + '\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS + '\u2020' # 0xA0 -> DAGGER + '\u0393' # 0xA1 -> GREEK CAPITAL LETTER GAMMA + '\u0394' # 0xA2 -> GREEK CAPITAL LETTER DELTA + '\u0398' # 0xA3 -> GREEK CAPITAL LETTER THETA + '\u039b' # 0xA4 -> GREEK CAPITAL LETTER LAMDA + '\u039e' # 0xA5 -> GREEK CAPITAL LETTER XI + '\u03a0' # 0xA6 -> GREEK CAPITAL LETTER PI + '\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S + '\xae' # 0xA8 -> REGISTERED SIGN + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u03a3' # 0xAA -> GREEK CAPITAL LETTER SIGMA + '\u03aa' # 0xAB -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA + '\xa7' # 0xAC -> SECTION SIGN + '\u2260' # 0xAD -> NOT EQUAL TO + '\xb0' # 0xAE -> DEGREE SIGN + '\xb7' # 0xAF -> MIDDLE DOT + '\u0391' # 0xB0 -> GREEK CAPITAL LETTER ALPHA + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO + '\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO + '\xa5' # 0xB4 -> YEN SIGN + '\u0392' # 0xB5 -> GREEK CAPITAL LETTER BETA + '\u0395' # 0xB6 -> GREEK CAPITAL LETTER EPSILON + '\u0396' # 0xB7 -> GREEK CAPITAL LETTER ZETA + '\u0397' # 0xB8 -> GREEK CAPITAL LETTER ETA + '\u0399' # 0xB9 -> GREEK CAPITAL LETTER IOTA + '\u039a' # 0xBA -> GREEK CAPITAL LETTER KAPPA + '\u039c' # 0xBB -> GREEK CAPITAL LETTER MU + '\u03a6' # 0xBC -> GREEK CAPITAL LETTER PHI + '\u03ab' # 0xBD -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA + '\u03a8' # 0xBE -> GREEK CAPITAL LETTER PSI + '\u03a9' # 0xBF -> GREEK CAPITAL LETTER OMEGA + '\u03ac' # 0xC0 -> GREEK SMALL LETTER ALPHA WITH TONOS + '\u039d' # 0xC1 -> GREEK CAPITAL LETTER NU + '\xac' # 0xC2 -> NOT SIGN + '\u039f' # 0xC3 -> GREEK CAPITAL LETTER OMICRON + '\u03a1' # 0xC4 -> GREEK CAPITAL LETTER RHO + '\u2248' # 0xC5 -> ALMOST EQUAL TO + '\u03a4' # 0xC6 -> GREEK CAPITAL LETTER TAU + '\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS + '\xa0' # 0xCA -> NO-BREAK SPACE + '\u03a5' # 0xCB -> GREEK CAPITAL LETTER UPSILON + '\u03a7' # 0xCC -> GREEK CAPITAL LETTER CHI + '\u0386' # 0xCD -> GREEK CAPITAL LETTER ALPHA WITH TONOS + '\u0388' # 0xCE -> GREEK CAPITAL LETTER EPSILON WITH TONOS + '\u0153' # 0xCF -> LATIN SMALL LIGATURE OE + '\u2013' # 0xD0 -> EN DASH + '\u2015' # 0xD1 -> HORIZONTAL BAR + '\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK + '\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK + '\xf7' # 0xD6 -> DIVISION SIGN + '\u0389' # 0xD7 -> GREEK CAPITAL LETTER ETA WITH TONOS + '\u038a' # 0xD8 -> GREEK CAPITAL LETTER IOTA WITH TONOS + '\u038c' # 0xD9 -> GREEK CAPITAL LETTER OMICRON WITH TONOS + '\u038e' # 0xDA -> GREEK CAPITAL LETTER UPSILON WITH TONOS + '\u03ad' # 0xDB -> GREEK SMALL LETTER EPSILON WITH TONOS + '\u03ae' # 0xDC -> GREEK SMALL LETTER ETA WITH TONOS + '\u03af' # 0xDD -> GREEK SMALL LETTER IOTA WITH TONOS + '\u03cc' # 0xDE -> GREEK SMALL LETTER OMICRON WITH TONOS + '\u038f' # 0xDF -> GREEK CAPITAL LETTER OMEGA WITH TONOS + '\u03cd' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH TONOS + '\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA + '\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA + '\u03c8' # 0xE3 -> GREEK SMALL LETTER PSI + '\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA + '\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON + '\u03c6' # 0xE6 -> GREEK SMALL LETTER PHI + '\u03b3' # 0xE7 -> GREEK SMALL LETTER GAMMA + '\u03b7' # 0xE8 -> GREEK SMALL LETTER ETA + '\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA + '\u03be' # 0xEA -> GREEK SMALL LETTER XI + '\u03ba' # 0xEB -> GREEK SMALL LETTER KAPPA + '\u03bb' # 0xEC -> GREEK SMALL LETTER LAMDA + '\u03bc' # 0xED -> GREEK SMALL LETTER MU + '\u03bd' # 0xEE -> GREEK SMALL LETTER NU + '\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON + '\u03c0' # 0xF0 -> GREEK SMALL LETTER PI + '\u03ce' # 0xF1 -> GREEK SMALL LETTER OMEGA WITH TONOS + '\u03c1' # 0xF2 -> GREEK SMALL LETTER RHO + '\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA + '\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU + '\u03b8' # 0xF5 -> GREEK SMALL LETTER THETA + '\u03c9' # 0xF6 -> GREEK SMALL LETTER OMEGA + '\u03c2' # 0xF7 -> GREEK SMALL LETTER FINAL SIGMA + '\u03c7' # 0xF8 -> GREEK SMALL LETTER CHI + '\u03c5' # 0xF9 -> GREEK SMALL LETTER UPSILON + '\u03b6' # 0xFA -> GREEK SMALL LETTER ZETA + '\u03ca' # 0xFB -> GREEK SMALL LETTER IOTA WITH DIALYTIKA + '\u03cb' # 0xFC -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA + '\u0390' # 0xFD -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS + '\u03b0' # 0xFE -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS + '\xad' # 0xFF -> SOFT HYPHEN # before Mac OS 9.2.2, was undefined ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/mac_iceland.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_iceland.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_iceland.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xdd' # 0xA0 -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\xc6' # 0xAE -> LATIN CAPITAL LETTER AE - u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\xe6' # 0xBE -> LATIN SMALL LETTER AE - u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u2044' # 0xDA -> FRACTION SLASH - u'\u20ac' # 0xDB -> EURO SIGN - u'\xd0' # 0xDC -> LATIN CAPITAL LETTER ETH - u'\xf0' # 0xDD -> LATIN SMALL LETTER ETH - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN - u'\xfe' # 0xDF -> LATIN SMALL LETTER THORN - u'\xfd' # 0xE0 -> LATIN SMALL LETTER Y WITH ACUTE - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\uf8ff' # 0xF0 -> Apple logo - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u02d8' # 0xF9 -> BREVE - u'\u02d9' # 0xFA -> DOT ABOVE - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT - u'\u02db' # 0xFE -> OGONEK - u'\u02c7' # 0xFF -> CARON + '\x00' # 0x00 -> CONTROL CHARACTER + '\x01' # 0x01 -> CONTROL CHARACTER + '\x02' # 0x02 -> CONTROL CHARACTER + '\x03' # 0x03 -> CONTROL CHARACTER + '\x04' # 0x04 -> CONTROL CHARACTER + '\x05' # 0x05 -> CONTROL CHARACTER + '\x06' # 0x06 -> CONTROL CHARACTER + '\x07' # 0x07 -> CONTROL CHARACTER + '\x08' # 0x08 -> CONTROL CHARACTER + '\t' # 0x09 -> CONTROL CHARACTER + '\n' # 0x0A -> CONTROL CHARACTER + '\x0b' # 0x0B -> CONTROL CHARACTER + '\x0c' # 0x0C -> CONTROL CHARACTER + '\r' # 0x0D -> CONTROL CHARACTER + '\x0e' # 0x0E -> CONTROL CHARACTER + '\x0f' # 0x0F -> CONTROL CHARACTER + '\x10' # 0x10 -> CONTROL CHARACTER + '\x11' # 0x11 -> CONTROL CHARACTER + '\x12' # 0x12 -> CONTROL CHARACTER + '\x13' # 0x13 -> CONTROL CHARACTER + '\x14' # 0x14 -> CONTROL CHARACTER + '\x15' # 0x15 -> CONTROL CHARACTER + '\x16' # 0x16 -> CONTROL CHARACTER + '\x17' # 0x17 -> CONTROL CHARACTER + '\x18' # 0x18 -> CONTROL CHARACTER + '\x19' # 0x19 -> CONTROL CHARACTER + '\x1a' # 0x1A -> CONTROL CHARACTER + '\x1b' # 0x1B -> CONTROL CHARACTER + '\x1c' # 0x1C -> CONTROL CHARACTER + '\x1d' # 0x1D -> CONTROL CHARACTER + '\x1e' # 0x1E -> CONTROL CHARACTER + '\x1f' # 0x1F -> CONTROL CHARACTER + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> CONTROL CHARACTER + '\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE + '\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE + '\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA + '\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE + '\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE + '\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE + '\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE + '\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE + '\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE + '\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE + '\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE + '\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE + '\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE + '\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS + '\xdd' # 0xA0 -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xb0' # 0xA1 -> DEGREE SIGN + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa7' # 0xA4 -> SECTION SIGN + '\u2022' # 0xA5 -> BULLET + '\xb6' # 0xA6 -> PILCROW SIGN + '\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S + '\xae' # 0xA8 -> REGISTERED SIGN + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u2122' # 0xAA -> TRADE MARK SIGN + '\xb4' # 0xAB -> ACUTE ACCENT + '\xa8' # 0xAC -> DIAERESIS + '\u2260' # 0xAD -> NOT EQUAL TO + '\xc6' # 0xAE -> LATIN CAPITAL LETTER AE + '\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE + '\u221e' # 0xB0 -> INFINITY + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO + '\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO + '\xa5' # 0xB4 -> YEN SIGN + '\xb5' # 0xB5 -> MICRO SIGN + '\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL + '\u2211' # 0xB7 -> N-ARY SUMMATION + '\u220f' # 0xB8 -> N-ARY PRODUCT + '\u03c0' # 0xB9 -> GREEK SMALL LETTER PI + '\u222b' # 0xBA -> INTEGRAL + '\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR + '\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR + '\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA + '\xe6' # 0xBE -> LATIN SMALL LETTER AE + '\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE + '\xbf' # 0xC0 -> INVERTED QUESTION MARK + '\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK + '\xac' # 0xC2 -> NOT SIGN + '\u221a' # 0xC3 -> SQUARE ROOT + '\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK + '\u2248' # 0xC5 -> ALMOST EQUAL TO + '\u2206' # 0xC6 -> INCREMENT + '\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS + '\xa0' # 0xCA -> NO-BREAK SPACE + '\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE + '\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE + '\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE + '\u0153' # 0xCF -> LATIN SMALL LIGATURE OE + '\u2013' # 0xD0 -> EN DASH + '\u2014' # 0xD1 -> EM DASH + '\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK + '\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK + '\xf7' # 0xD6 -> DIVISION SIGN + '\u25ca' # 0xD7 -> LOZENGE + '\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS + '\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\u2044' # 0xDA -> FRACTION SLASH + '\u20ac' # 0xDB -> EURO SIGN + '\xd0' # 0xDC -> LATIN CAPITAL LETTER ETH + '\xf0' # 0xDD -> LATIN SMALL LETTER ETH + '\xde' # 0xDE -> LATIN CAPITAL LETTER THORN + '\xfe' # 0xDF -> LATIN SMALL LETTER THORN + '\xfd' # 0xE0 -> LATIN SMALL LETTER Y WITH ACUTE + '\xb7' # 0xE1 -> MIDDLE DOT + '\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK + '\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK + '\u2030' # 0xE4 -> PER MILLE SIGN + '\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\uf8ff' # 0xF0 -> Apple logo + '\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE + '\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I + '\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u02dc' # 0xF7 -> SMALL TILDE + '\xaf' # 0xF8 -> MACRON + '\u02d8' # 0xF9 -> BREVE + '\u02d9' # 0xFA -> DOT ABOVE + '\u02da' # 0xFB -> RING ABOVE + '\xb8' # 0xFC -> CEDILLA + '\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT + '\u02db' # 0xFE -> OGONEK + '\u02c7' # 0xFF -> CARON ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/mac_roman.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_roman.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_roman.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\xc6' # 0xAE -> LATIN CAPITAL LETTER AE - u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\xe6' # 0xBE -> LATIN SMALL LETTER AE - u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u2044' # 0xDA -> FRACTION SLASH - u'\u20ac' # 0xDB -> EURO SIGN - u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\ufb01' # 0xDE -> LATIN SMALL LIGATURE FI - u'\ufb02' # 0xDF -> LATIN SMALL LIGATURE FL - u'\u2021' # 0xE0 -> DOUBLE DAGGER - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\uf8ff' # 0xF0 -> Apple logo - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u02d8' # 0xF9 -> BREVE - u'\u02d9' # 0xFA -> DOT ABOVE - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT - u'\u02db' # 0xFE -> OGONEK - u'\u02c7' # 0xFF -> CARON + '\x00' # 0x00 -> CONTROL CHARACTER + '\x01' # 0x01 -> CONTROL CHARACTER + '\x02' # 0x02 -> CONTROL CHARACTER + '\x03' # 0x03 -> CONTROL CHARACTER + '\x04' # 0x04 -> CONTROL CHARACTER + '\x05' # 0x05 -> CONTROL CHARACTER + '\x06' # 0x06 -> CONTROL CHARACTER + '\x07' # 0x07 -> CONTROL CHARACTER + '\x08' # 0x08 -> CONTROL CHARACTER + '\t' # 0x09 -> CONTROL CHARACTER + '\n' # 0x0A -> CONTROL CHARACTER + '\x0b' # 0x0B -> CONTROL CHARACTER + '\x0c' # 0x0C -> CONTROL CHARACTER + '\r' # 0x0D -> CONTROL CHARACTER + '\x0e' # 0x0E -> CONTROL CHARACTER + '\x0f' # 0x0F -> CONTROL CHARACTER + '\x10' # 0x10 -> CONTROL CHARACTER + '\x11' # 0x11 -> CONTROL CHARACTER + '\x12' # 0x12 -> CONTROL CHARACTER + '\x13' # 0x13 -> CONTROL CHARACTER + '\x14' # 0x14 -> CONTROL CHARACTER + '\x15' # 0x15 -> CONTROL CHARACTER + '\x16' # 0x16 -> CONTROL CHARACTER + '\x17' # 0x17 -> CONTROL CHARACTER + '\x18' # 0x18 -> CONTROL CHARACTER + '\x19' # 0x19 -> CONTROL CHARACTER + '\x1a' # 0x1A -> CONTROL CHARACTER + '\x1b' # 0x1B -> CONTROL CHARACTER + '\x1c' # 0x1C -> CONTROL CHARACTER + '\x1d' # 0x1D -> CONTROL CHARACTER + '\x1e' # 0x1E -> CONTROL CHARACTER + '\x1f' # 0x1F -> CONTROL CHARACTER + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> CONTROL CHARACTER + '\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE + '\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE + '\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA + '\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE + '\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE + '\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE + '\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE + '\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE + '\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE + '\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE + '\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE + '\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE + '\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE + '\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS + '\u2020' # 0xA0 -> DAGGER + '\xb0' # 0xA1 -> DEGREE SIGN + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa7' # 0xA4 -> SECTION SIGN + '\u2022' # 0xA5 -> BULLET + '\xb6' # 0xA6 -> PILCROW SIGN + '\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S + '\xae' # 0xA8 -> REGISTERED SIGN + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u2122' # 0xAA -> TRADE MARK SIGN + '\xb4' # 0xAB -> ACUTE ACCENT + '\xa8' # 0xAC -> DIAERESIS + '\u2260' # 0xAD -> NOT EQUAL TO + '\xc6' # 0xAE -> LATIN CAPITAL LETTER AE + '\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE + '\u221e' # 0xB0 -> INFINITY + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO + '\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO + '\xa5' # 0xB4 -> YEN SIGN + '\xb5' # 0xB5 -> MICRO SIGN + '\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL + '\u2211' # 0xB7 -> N-ARY SUMMATION + '\u220f' # 0xB8 -> N-ARY PRODUCT + '\u03c0' # 0xB9 -> GREEK SMALL LETTER PI + '\u222b' # 0xBA -> INTEGRAL + '\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR + '\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR + '\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA + '\xe6' # 0xBE -> LATIN SMALL LETTER AE + '\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE + '\xbf' # 0xC0 -> INVERTED QUESTION MARK + '\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK + '\xac' # 0xC2 -> NOT SIGN + '\u221a' # 0xC3 -> SQUARE ROOT + '\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK + '\u2248' # 0xC5 -> ALMOST EQUAL TO + '\u2206' # 0xC6 -> INCREMENT + '\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS + '\xa0' # 0xCA -> NO-BREAK SPACE + '\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE + '\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE + '\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE + '\u0153' # 0xCF -> LATIN SMALL LIGATURE OE + '\u2013' # 0xD0 -> EN DASH + '\u2014' # 0xD1 -> EM DASH + '\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK + '\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK + '\xf7' # 0xD6 -> DIVISION SIGN + '\u25ca' # 0xD7 -> LOZENGE + '\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS + '\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\u2044' # 0xDA -> FRACTION SLASH + '\u20ac' # 0xDB -> EURO SIGN + '\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\ufb01' # 0xDE -> LATIN SMALL LIGATURE FI + '\ufb02' # 0xDF -> LATIN SMALL LIGATURE FL + '\u2021' # 0xE0 -> DOUBLE DAGGER + '\xb7' # 0xE1 -> MIDDLE DOT + '\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK + '\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK + '\u2030' # 0xE4 -> PER MILLE SIGN + '\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\uf8ff' # 0xF0 -> Apple logo + '\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE + '\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I + '\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u02dc' # 0xF7 -> SMALL TILDE + '\xaf' # 0xF8 -> MACRON + '\u02d8' # 0xF9 -> BREVE + '\u02d9' # 0xFA -> DOT ABOVE + '\u02da' # 0xFB -> RING ABOVE + '\xb8' # 0xFC -> CEDILLA + '\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT + '\u02db' # 0xFE -> OGONEK + '\u02c7' # 0xFF -> CARON ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/mac_romanian.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_romanian.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_romanian.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\u0102' # 0xAE -> LATIN CAPITAL LETTER A WITH BREVE - u'\u0218' # 0xAF -> LATIN CAPITAL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\u0103' # 0xBE -> LATIN SMALL LETTER A WITH BREVE - u'\u0219' # 0xBF -> LATIN SMALL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u2044' # 0xDA -> FRACTION SLASH - u'\u20ac' # 0xDB -> EURO SIGN - u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u021a' # 0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later - u'\u021b' # 0xDF -> LATIN SMALL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later - u'\u2021' # 0xE0 -> DOUBLE DAGGER - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\uf8ff' # 0xF0 -> Apple logo - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u02d8' # 0xF9 -> BREVE - u'\u02d9' # 0xFA -> DOT ABOVE - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT - u'\u02db' # 0xFE -> OGONEK - u'\u02c7' # 0xFF -> CARON + '\x00' # 0x00 -> CONTROL CHARACTER + '\x01' # 0x01 -> CONTROL CHARACTER + '\x02' # 0x02 -> CONTROL CHARACTER + '\x03' # 0x03 -> CONTROL CHARACTER + '\x04' # 0x04 -> CONTROL CHARACTER + '\x05' # 0x05 -> CONTROL CHARACTER + '\x06' # 0x06 -> CONTROL CHARACTER + '\x07' # 0x07 -> CONTROL CHARACTER + '\x08' # 0x08 -> CONTROL CHARACTER + '\t' # 0x09 -> CONTROL CHARACTER + '\n' # 0x0A -> CONTROL CHARACTER + '\x0b' # 0x0B -> CONTROL CHARACTER + '\x0c' # 0x0C -> CONTROL CHARACTER + '\r' # 0x0D -> CONTROL CHARACTER + '\x0e' # 0x0E -> CONTROL CHARACTER + '\x0f' # 0x0F -> CONTROL CHARACTER + '\x10' # 0x10 -> CONTROL CHARACTER + '\x11' # 0x11 -> CONTROL CHARACTER + '\x12' # 0x12 -> CONTROL CHARACTER + '\x13' # 0x13 -> CONTROL CHARACTER + '\x14' # 0x14 -> CONTROL CHARACTER + '\x15' # 0x15 -> CONTROL CHARACTER + '\x16' # 0x16 -> CONTROL CHARACTER + '\x17' # 0x17 -> CONTROL CHARACTER + '\x18' # 0x18 -> CONTROL CHARACTER + '\x19' # 0x19 -> CONTROL CHARACTER + '\x1a' # 0x1A -> CONTROL CHARACTER + '\x1b' # 0x1B -> CONTROL CHARACTER + '\x1c' # 0x1C -> CONTROL CHARACTER + '\x1d' # 0x1D -> CONTROL CHARACTER + '\x1e' # 0x1E -> CONTROL CHARACTER + '\x1f' # 0x1F -> CONTROL CHARACTER + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> CONTROL CHARACTER + '\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE + '\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE + '\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA + '\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE + '\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE + '\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE + '\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE + '\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE + '\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE + '\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE + '\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE + '\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE + '\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE + '\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS + '\u2020' # 0xA0 -> DAGGER + '\xb0' # 0xA1 -> DEGREE SIGN + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa7' # 0xA4 -> SECTION SIGN + '\u2022' # 0xA5 -> BULLET + '\xb6' # 0xA6 -> PILCROW SIGN + '\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S + '\xae' # 0xA8 -> REGISTERED SIGN + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u2122' # 0xAA -> TRADE MARK SIGN + '\xb4' # 0xAB -> ACUTE ACCENT + '\xa8' # 0xAC -> DIAERESIS + '\u2260' # 0xAD -> NOT EQUAL TO + '\u0102' # 0xAE -> LATIN CAPITAL LETTER A WITH BREVE + '\u0218' # 0xAF -> LATIN CAPITAL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later + '\u221e' # 0xB0 -> INFINITY + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO + '\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO + '\xa5' # 0xB4 -> YEN SIGN + '\xb5' # 0xB5 -> MICRO SIGN + '\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL + '\u2211' # 0xB7 -> N-ARY SUMMATION + '\u220f' # 0xB8 -> N-ARY PRODUCT + '\u03c0' # 0xB9 -> GREEK SMALL LETTER PI + '\u222b' # 0xBA -> INTEGRAL + '\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR + '\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR + '\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA + '\u0103' # 0xBE -> LATIN SMALL LETTER A WITH BREVE + '\u0219' # 0xBF -> LATIN SMALL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later + '\xbf' # 0xC0 -> INVERTED QUESTION MARK + '\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK + '\xac' # 0xC2 -> NOT SIGN + '\u221a' # 0xC3 -> SQUARE ROOT + '\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK + '\u2248' # 0xC5 -> ALMOST EQUAL TO + '\u2206' # 0xC6 -> INCREMENT + '\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS + '\xa0' # 0xCA -> NO-BREAK SPACE + '\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE + '\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE + '\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE + '\u0153' # 0xCF -> LATIN SMALL LIGATURE OE + '\u2013' # 0xD0 -> EN DASH + '\u2014' # 0xD1 -> EM DASH + '\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK + '\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK + '\xf7' # 0xD6 -> DIVISION SIGN + '\u25ca' # 0xD7 -> LOZENGE + '\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS + '\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\u2044' # 0xDA -> FRACTION SLASH + '\u20ac' # 0xDB -> EURO SIGN + '\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK + '\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + '\u021a' # 0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later + '\u021b' # 0xDF -> LATIN SMALL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later + '\u2021' # 0xE0 -> DOUBLE DAGGER + '\xb7' # 0xE1 -> MIDDLE DOT + '\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK + '\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK + '\u2030' # 0xE4 -> PER MILLE SIGN + '\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\uf8ff' # 0xF0 -> Apple logo + '\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE + '\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I + '\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u02dc' # 0xF7 -> SMALL TILDE + '\xaf' # 0xF8 -> MACRON + '\u02d8' # 0xF9 -> BREVE + '\u02d9' # 0xFA -> DOT ABOVE + '\u02da' # 0xFB -> RING ABOVE + '\xb8' # 0xFC -> CEDILLA + '\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT + '\u02db' # 0xFE -> OGONEK + '\u02c7' # 0xFF -> CARON ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/mac_turkish.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/mac_turkish.py (original) +++ python/branches/py3k-struni/Lib/encodings/mac_turkish.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\xc6' # 0xAE -> LATIN CAPITAL LETTER AE - u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\xe6' # 0xBE -> LATIN SMALL LETTER AE - u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u011e' # 0xDA -> LATIN CAPITAL LETTER G WITH BREVE - u'\u011f' # 0xDB -> LATIN SMALL LETTER G WITH BREVE - u'\u0130' # 0xDC -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\u0131' # 0xDD -> LATIN SMALL LETTER DOTLESS I - u'\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u015f' # 0xDF -> LATIN SMALL LETTER S WITH CEDILLA - u'\u2021' # 0xE0 -> DOUBLE DAGGER - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\uf8ff' # 0xF0 -> Apple logo - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\uf8a0' # 0xF5 -> undefined1 - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u02d8' # 0xF9 -> BREVE - u'\u02d9' # 0xFA -> DOT ABOVE - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT - u'\u02db' # 0xFE -> OGONEK - u'\u02c7' # 0xFF -> CARON + '\x00' # 0x00 -> CONTROL CHARACTER + '\x01' # 0x01 -> CONTROL CHARACTER + '\x02' # 0x02 -> CONTROL CHARACTER + '\x03' # 0x03 -> CONTROL CHARACTER + '\x04' # 0x04 -> CONTROL CHARACTER + '\x05' # 0x05 -> CONTROL CHARACTER + '\x06' # 0x06 -> CONTROL CHARACTER + '\x07' # 0x07 -> CONTROL CHARACTER + '\x08' # 0x08 -> CONTROL CHARACTER + '\t' # 0x09 -> CONTROL CHARACTER + '\n' # 0x0A -> CONTROL CHARACTER + '\x0b' # 0x0B -> CONTROL CHARACTER + '\x0c' # 0x0C -> CONTROL CHARACTER + '\r' # 0x0D -> CONTROL CHARACTER + '\x0e' # 0x0E -> CONTROL CHARACTER + '\x0f' # 0x0F -> CONTROL CHARACTER + '\x10' # 0x10 -> CONTROL CHARACTER + '\x11' # 0x11 -> CONTROL CHARACTER + '\x12' # 0x12 -> CONTROL CHARACTER + '\x13' # 0x13 -> CONTROL CHARACTER + '\x14' # 0x14 -> CONTROL CHARACTER + '\x15' # 0x15 -> CONTROL CHARACTER + '\x16' # 0x16 -> CONTROL CHARACTER + '\x17' # 0x17 -> CONTROL CHARACTER + '\x18' # 0x18 -> CONTROL CHARACTER + '\x19' # 0x19 -> CONTROL CHARACTER + '\x1a' # 0x1A -> CONTROL CHARACTER + '\x1b' # 0x1B -> CONTROL CHARACTER + '\x1c' # 0x1C -> CONTROL CHARACTER + '\x1d' # 0x1D -> CONTROL CHARACTER + '\x1e' # 0x1E -> CONTROL CHARACTER + '\x1f' # 0x1F -> CONTROL CHARACTER + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> CONTROL CHARACTER + '\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE + '\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE + '\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE + '\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA + '\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE + '\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE + '\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE + '\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE + '\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE + '\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE + '\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE + '\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE + '\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE + '\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE + '\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS + '\u2020' # 0xA0 -> DAGGER + '\xb0' # 0xA1 -> DEGREE SIGN + '\xa2' # 0xA2 -> CENT SIGN + '\xa3' # 0xA3 -> POUND SIGN + '\xa7' # 0xA4 -> SECTION SIGN + '\u2022' # 0xA5 -> BULLET + '\xb6' # 0xA6 -> PILCROW SIGN + '\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S + '\xae' # 0xA8 -> REGISTERED SIGN + '\xa9' # 0xA9 -> COPYRIGHT SIGN + '\u2122' # 0xAA -> TRADE MARK SIGN + '\xb4' # 0xAB -> ACUTE ACCENT + '\xa8' # 0xAC -> DIAERESIS + '\u2260' # 0xAD -> NOT EQUAL TO + '\xc6' # 0xAE -> LATIN CAPITAL LETTER AE + '\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE + '\u221e' # 0xB0 -> INFINITY + '\xb1' # 0xB1 -> PLUS-MINUS SIGN + '\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO + '\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO + '\xa5' # 0xB4 -> YEN SIGN + '\xb5' # 0xB5 -> MICRO SIGN + '\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL + '\u2211' # 0xB7 -> N-ARY SUMMATION + '\u220f' # 0xB8 -> N-ARY PRODUCT + '\u03c0' # 0xB9 -> GREEK SMALL LETTER PI + '\u222b' # 0xBA -> INTEGRAL + '\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR + '\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR + '\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA + '\xe6' # 0xBE -> LATIN SMALL LETTER AE + '\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE + '\xbf' # 0xC0 -> INVERTED QUESTION MARK + '\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK + '\xac' # 0xC2 -> NOT SIGN + '\u221a' # 0xC3 -> SQUARE ROOT + '\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK + '\u2248' # 0xC5 -> ALMOST EQUAL TO + '\u2206' # 0xC6 -> INCREMENT + '\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS + '\xa0' # 0xCA -> NO-BREAK SPACE + '\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE + '\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE + '\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE + '\u0153' # 0xCF -> LATIN SMALL LIGATURE OE + '\u2013' # 0xD0 -> EN DASH + '\u2014' # 0xD1 -> EM DASH + '\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK + '\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK + '\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK + '\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK + '\xf7' # 0xD6 -> DIVISION SIGN + '\u25ca' # 0xD7 -> LOZENGE + '\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS + '\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS + '\u011e' # 0xDA -> LATIN CAPITAL LETTER G WITH BREVE + '\u011f' # 0xDB -> LATIN SMALL LETTER G WITH BREVE + '\u0130' # 0xDC -> LATIN CAPITAL LETTER I WITH DOT ABOVE + '\u0131' # 0xDD -> LATIN SMALL LETTER DOTLESS I + '\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA + '\u015f' # 0xDF -> LATIN SMALL LETTER S WITH CEDILLA + '\u2021' # 0xE0 -> DOUBLE DAGGER + '\xb7' # 0xE1 -> MIDDLE DOT + '\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK + '\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK + '\u2030' # 0xE4 -> PER MILLE SIGN + '\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\uf8ff' # 0xF0 -> Apple logo + '\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE + '\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE + '\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE + '\uf8a0' # 0xF5 -> undefined1 + '\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT + '\u02dc' # 0xF7 -> SMALL TILDE + '\xaf' # 0xF8 -> MACRON + '\u02d8' # 0xF9 -> BREVE + '\u02d9' # 0xFA -> DOT ABOVE + '\u02da' # 0xFB -> RING ABOVE + '\xb8' # 0xFC -> CEDILLA + '\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT + '\u02db' # 0xFE -> OGONEK + '\u02c7' # 0xFF -> CARON ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/punycode.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/punycode.py (original) +++ python/branches/py3k-struni/Lib/encodings/punycode.py Wed May 2 21:09:54 2007 @@ -189,7 +189,7 @@ else: base = text[:pos] extended = text[pos+1:] - base = unicode(base, "ascii", errors) + base = str(base, "ascii", errors) extended = extended.upper() return insertion_sort(base, extended, errors) Modified: python/branches/py3k-struni/Lib/encodings/tis_620.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/tis_620.py (original) +++ python/branches/py3k-struni/Lib/encodings/tis_620.py Wed May 2 21:09:54 2007 @@ -45,262 +45,262 @@ ### Decoding Table decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\ufffe' - u'\u0e01' # 0xA1 -> THAI CHARACTER KO KAI - u'\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI - u'\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT - u'\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI - u'\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON - u'\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG - u'\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU - u'\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN - u'\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING - u'\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG - u'\u0e0b' # 0xAB -> THAI CHARACTER SO SO - u'\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE - u'\u0e0d' # 0xAD -> THAI CHARACTER YO YING - u'\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA - u'\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK - u'\u0e10' # 0xB0 -> THAI CHARACTER THO THAN - u'\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO - u'\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO - u'\u0e13' # 0xB3 -> THAI CHARACTER NO NEN - u'\u0e14' # 0xB4 -> THAI CHARACTER DO DEK - u'\u0e15' # 0xB5 -> THAI CHARACTER TO TAO - u'\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG - u'\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN - u'\u0e18' # 0xB8 -> THAI CHARACTER THO THONG - u'\u0e19' # 0xB9 -> THAI CHARACTER NO NU - u'\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI - u'\u0e1b' # 0xBB -> THAI CHARACTER PO PLA - u'\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG - u'\u0e1d' # 0xBD -> THAI CHARACTER FO FA - u'\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN - u'\u0e1f' # 0xBF -> THAI CHARACTER FO FAN - u'\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO - u'\u0e21' # 0xC1 -> THAI CHARACTER MO MA - u'\u0e22' # 0xC2 -> THAI CHARACTER YO YAK - u'\u0e23' # 0xC3 -> THAI CHARACTER RO RUA - u'\u0e24' # 0xC4 -> THAI CHARACTER RU - u'\u0e25' # 0xC5 -> THAI CHARACTER LO LING - u'\u0e26' # 0xC6 -> THAI CHARACTER LU - u'\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN - u'\u0e28' # 0xC8 -> THAI CHARACTER SO SALA - u'\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI - u'\u0e2a' # 0xCA -> THAI CHARACTER SO SUA - u'\u0e2b' # 0xCB -> THAI CHARACTER HO HIP - u'\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA - u'\u0e2d' # 0xCD -> THAI CHARACTER O ANG - u'\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK - u'\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI - u'\u0e30' # 0xD0 -> THAI CHARACTER SARA A - u'\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT - u'\u0e32' # 0xD2 -> THAI CHARACTER SARA AA - u'\u0e33' # 0xD3 -> THAI CHARACTER SARA AM - u'\u0e34' # 0xD4 -> THAI CHARACTER SARA I - u'\u0e35' # 0xD5 -> THAI CHARACTER SARA II - u'\u0e36' # 0xD6 -> THAI CHARACTER SARA UE - u'\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE - u'\u0e38' # 0xD8 -> THAI CHARACTER SARA U - u'\u0e39' # 0xD9 -> THAI CHARACTER SARA UU - u'\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT - u'\u0e40' # 0xE0 -> THAI CHARACTER SARA E - u'\u0e41' # 0xE1 -> THAI CHARACTER SARA AE - u'\u0e42' # 0xE2 -> THAI CHARACTER SARA O - u'\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN - u'\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI - u'\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO - u'\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK - u'\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU - u'\u0e48' # 0xE8 -> THAI CHARACTER MAI EK - u'\u0e49' # 0xE9 -> THAI CHARACTER MAI THO - u'\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI - u'\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA - u'\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT - u'\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT - u'\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN - u'\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN - u'\u0e50' # 0xF0 -> THAI DIGIT ZERO - u'\u0e51' # 0xF1 -> THAI DIGIT ONE - u'\u0e52' # 0xF2 -> THAI DIGIT TWO - u'\u0e53' # 0xF3 -> THAI DIGIT THREE - u'\u0e54' # 0xF4 -> THAI DIGIT FOUR - u'\u0e55' # 0xF5 -> THAI DIGIT FIVE - u'\u0e56' # 0xF6 -> THAI DIGIT SIX - u'\u0e57' # 0xF7 -> THAI DIGIT SEVEN - u'\u0e58' # 0xF8 -> THAI DIGIT EIGHT - u'\u0e59' # 0xF9 -> THAI DIGIT NINE - u'\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU - u'\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x04' # 0x04 -> END OF TRANSMISSION + '\x05' # 0x05 -> ENQUIRY + '\x06' # 0x06 -> ACKNOWLEDGE + '\x07' # 0x07 -> BELL + '\x08' # 0x08 -> BACKSPACE + '\t' # 0x09 -> HORIZONTAL TABULATION + '\n' # 0x0A -> LINE FEED + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x14' # 0x14 -> DEVICE CONTROL FOUR + '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE + '\x16' # 0x16 -> SYNCHRONOUS IDLE + '\x17' # 0x17 -> END OF TRANSMISSION BLOCK + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x1a' # 0x1A -> SUBSTITUTE + '\x1b' # 0x1B -> ESCAPE + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + ' ' # 0x20 -> SPACE + '!' # 0x21 -> EXCLAMATION MARK + '"' # 0x22 -> QUOTATION MARK + '#' # 0x23 -> NUMBER SIGN + '$' # 0x24 -> DOLLAR SIGN + '%' # 0x25 -> PERCENT SIGN + '&' # 0x26 -> AMPERSAND + "'" # 0x27 -> APOSTROPHE + '(' # 0x28 -> LEFT PARENTHESIS + ')' # 0x29 -> RIGHT PARENTHESIS + '*' # 0x2A -> ASTERISK + '+' # 0x2B -> PLUS SIGN + ',' # 0x2C -> COMMA + '-' # 0x2D -> HYPHEN-MINUS + '.' # 0x2E -> FULL STOP + '/' # 0x2F -> SOLIDUS + '0' # 0x30 -> DIGIT ZERO + '1' # 0x31 -> DIGIT ONE + '2' # 0x32 -> DIGIT TWO + '3' # 0x33 -> DIGIT THREE + '4' # 0x34 -> DIGIT FOUR + '5' # 0x35 -> DIGIT FIVE + '6' # 0x36 -> DIGIT SIX + '7' # 0x37 -> DIGIT SEVEN + '8' # 0x38 -> DIGIT EIGHT + '9' # 0x39 -> DIGIT NINE + ':' # 0x3A -> COLON + ';' # 0x3B -> SEMICOLON + '<' # 0x3C -> LESS-THAN SIGN + '=' # 0x3D -> EQUALS SIGN + '>' # 0x3E -> GREATER-THAN SIGN + '?' # 0x3F -> QUESTION MARK + '@' # 0x40 -> COMMERCIAL AT + 'A' # 0x41 -> LATIN CAPITAL LETTER A + 'B' # 0x42 -> LATIN CAPITAL LETTER B + 'C' # 0x43 -> LATIN CAPITAL LETTER C + 'D' # 0x44 -> LATIN CAPITAL LETTER D + 'E' # 0x45 -> LATIN CAPITAL LETTER E + 'F' # 0x46 -> LATIN CAPITAL LETTER F + 'G' # 0x47 -> LATIN CAPITAL LETTER G + 'H' # 0x48 -> LATIN CAPITAL LETTER H + 'I' # 0x49 -> LATIN CAPITAL LETTER I + 'J' # 0x4A -> LATIN CAPITAL LETTER J + 'K' # 0x4B -> LATIN CAPITAL LETTER K + 'L' # 0x4C -> LATIN CAPITAL LETTER L + 'M' # 0x4D -> LATIN CAPITAL LETTER M + 'N' # 0x4E -> LATIN CAPITAL LETTER N + 'O' # 0x4F -> LATIN CAPITAL LETTER O + 'P' # 0x50 -> LATIN CAPITAL LETTER P + 'Q' # 0x51 -> LATIN CAPITAL LETTER Q + 'R' # 0x52 -> LATIN CAPITAL LETTER R + 'S' # 0x53 -> LATIN CAPITAL LETTER S + 'T' # 0x54 -> LATIN CAPITAL LETTER T + 'U' # 0x55 -> LATIN CAPITAL LETTER U + 'V' # 0x56 -> LATIN CAPITAL LETTER V + 'W' # 0x57 -> LATIN CAPITAL LETTER W + 'X' # 0x58 -> LATIN CAPITAL LETTER X + 'Y' # 0x59 -> LATIN CAPITAL LETTER Y + 'Z' # 0x5A -> LATIN CAPITAL LETTER Z + '[' # 0x5B -> LEFT SQUARE BRACKET + '\\' # 0x5C -> REVERSE SOLIDUS + ']' # 0x5D -> RIGHT SQUARE BRACKET + '^' # 0x5E -> CIRCUMFLEX ACCENT + '_' # 0x5F -> LOW LINE + '`' # 0x60 -> GRAVE ACCENT + 'a' # 0x61 -> LATIN SMALL LETTER A + 'b' # 0x62 -> LATIN SMALL LETTER B + 'c' # 0x63 -> LATIN SMALL LETTER C + 'd' # 0x64 -> LATIN SMALL LETTER D + 'e' # 0x65 -> LATIN SMALL LETTER E + 'f' # 0x66 -> LATIN SMALL LETTER F + 'g' # 0x67 -> LATIN SMALL LETTER G + 'h' # 0x68 -> LATIN SMALL LETTER H + 'i' # 0x69 -> LATIN SMALL LETTER I + 'j' # 0x6A -> LATIN SMALL LETTER J + 'k' # 0x6B -> LATIN SMALL LETTER K + 'l' # 0x6C -> LATIN SMALL LETTER L + 'm' # 0x6D -> LATIN SMALL LETTER M + 'n' # 0x6E -> LATIN SMALL LETTER N + 'o' # 0x6F -> LATIN SMALL LETTER O + 'p' # 0x70 -> LATIN SMALL LETTER P + 'q' # 0x71 -> LATIN SMALL LETTER Q + 'r' # 0x72 -> LATIN SMALL LETTER R + 's' # 0x73 -> LATIN SMALL LETTER S + 't' # 0x74 -> LATIN SMALL LETTER T + 'u' # 0x75 -> LATIN SMALL LETTER U + 'v' # 0x76 -> LATIN SMALL LETTER V + 'w' # 0x77 -> LATIN SMALL LETTER W + 'x' # 0x78 -> LATIN SMALL LETTER X + 'y' # 0x79 -> LATIN SMALL LETTER Y + 'z' # 0x7A -> LATIN SMALL LETTER Z + '{' # 0x7B -> LEFT CURLY BRACKET + '|' # 0x7C -> VERTICAL LINE + '}' # 0x7D -> RIGHT CURLY BRACKET + '~' # 0x7E -> TILDE + '\x7f' # 0x7F -> DELETE + '\x80' # 0x80 -> + '\x81' # 0x81 -> + '\x82' # 0x82 -> + '\x83' # 0x83 -> + '\x84' # 0x84 -> + '\x85' # 0x85 -> + '\x86' # 0x86 -> + '\x87' # 0x87 -> + '\x88' # 0x88 -> + '\x89' # 0x89 -> + '\x8a' # 0x8A -> + '\x8b' # 0x8B -> + '\x8c' # 0x8C -> + '\x8d' # 0x8D -> + '\x8e' # 0x8E -> + '\x8f' # 0x8F -> + '\x90' # 0x90 -> + '\x91' # 0x91 -> + '\x92' # 0x92 -> + '\x93' # 0x93 -> + '\x94' # 0x94 -> + '\x95' # 0x95 -> + '\x96' # 0x96 -> + '\x97' # 0x97 -> + '\x98' # 0x98 -> + '\x99' # 0x99 -> + '\x9a' # 0x9A -> + '\x9b' # 0x9B -> + '\x9c' # 0x9C -> + '\x9d' # 0x9D -> + '\x9e' # 0x9E -> + '\x9f' # 0x9F -> + '\ufffe' + '\u0e01' # 0xA1 -> THAI CHARACTER KO KAI + '\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI + '\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT + '\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI + '\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON + '\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG + '\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU + '\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN + '\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING + '\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG + '\u0e0b' # 0xAB -> THAI CHARACTER SO SO + '\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE + '\u0e0d' # 0xAD -> THAI CHARACTER YO YING + '\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA + '\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK + '\u0e10' # 0xB0 -> THAI CHARACTER THO THAN + '\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO + '\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO + '\u0e13' # 0xB3 -> THAI CHARACTER NO NEN + '\u0e14' # 0xB4 -> THAI CHARACTER DO DEK + '\u0e15' # 0xB5 -> THAI CHARACTER TO TAO + '\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG + '\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN + '\u0e18' # 0xB8 -> THAI CHARACTER THO THONG + '\u0e19' # 0xB9 -> THAI CHARACTER NO NU + '\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI + '\u0e1b' # 0xBB -> THAI CHARACTER PO PLA + '\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG + '\u0e1d' # 0xBD -> THAI CHARACTER FO FA + '\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN + '\u0e1f' # 0xBF -> THAI CHARACTER FO FAN + '\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO + '\u0e21' # 0xC1 -> THAI CHARACTER MO MA + '\u0e22' # 0xC2 -> THAI CHARACTER YO YAK + '\u0e23' # 0xC3 -> THAI CHARACTER RO RUA + '\u0e24' # 0xC4 -> THAI CHARACTER RU + '\u0e25' # 0xC5 -> THAI CHARACTER LO LING + '\u0e26' # 0xC6 -> THAI CHARACTER LU + '\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN + '\u0e28' # 0xC8 -> THAI CHARACTER SO SALA + '\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI + '\u0e2a' # 0xCA -> THAI CHARACTER SO SUA + '\u0e2b' # 0xCB -> THAI CHARACTER HO HIP + '\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA + '\u0e2d' # 0xCD -> THAI CHARACTER O ANG + '\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK + '\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI + '\u0e30' # 0xD0 -> THAI CHARACTER SARA A + '\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT + '\u0e32' # 0xD2 -> THAI CHARACTER SARA AA + '\u0e33' # 0xD3 -> THAI CHARACTER SARA AM + '\u0e34' # 0xD4 -> THAI CHARACTER SARA I + '\u0e35' # 0xD5 -> THAI CHARACTER SARA II + '\u0e36' # 0xD6 -> THAI CHARACTER SARA UE + '\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE + '\u0e38' # 0xD8 -> THAI CHARACTER SARA U + '\u0e39' # 0xD9 -> THAI CHARACTER SARA UU + '\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' + '\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT + '\u0e40' # 0xE0 -> THAI CHARACTER SARA E + '\u0e41' # 0xE1 -> THAI CHARACTER SARA AE + '\u0e42' # 0xE2 -> THAI CHARACTER SARA O + '\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN + '\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI + '\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO + '\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK + '\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU + '\u0e48' # 0xE8 -> THAI CHARACTER MAI EK + '\u0e49' # 0xE9 -> THAI CHARACTER MAI THO + '\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI + '\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA + '\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT + '\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT + '\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN + '\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN + '\u0e50' # 0xF0 -> THAI DIGIT ZERO + '\u0e51' # 0xF1 -> THAI DIGIT ONE + '\u0e52' # 0xF2 -> THAI DIGIT TWO + '\u0e53' # 0xF3 -> THAI DIGIT THREE + '\u0e54' # 0xF4 -> THAI DIGIT FOUR + '\u0e55' # 0xF5 -> THAI DIGIT FIVE + '\u0e56' # 0xF6 -> THAI DIGIT SIX + '\u0e57' # 0xF7 -> THAI DIGIT SEVEN + '\u0e58' # 0xF8 -> THAI DIGIT EIGHT + '\u0e59' # 0xF9 -> THAI DIGIT NINE + '\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU + '\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT + '\ufffe' + '\ufffe' + '\ufffe' + '\ufffe' ) ### Encoding table Modified: python/branches/py3k-struni/Lib/encodings/utf_8_sig.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/utf_8_sig.py (original) +++ python/branches/py3k-struni/Lib/encodings/utf_8_sig.py Wed May 2 21:09:54 2007 @@ -57,7 +57,7 @@ if codecs.BOM_UTF8.startswith(input): # not enough data to decide if this really is a BOM # => try again on the next call - return (u"", 0) + return ("", 0) else: self.first = 0 else: @@ -106,7 +106,7 @@ if len(input) < 3 and codecs.BOM_UTF8.startswith(input): # not enough data to decide if this is a BOM # => try again on the next call - return (u"", 0) + return ("", 0) self.decode = codecs.utf_8_decode return decode(input, errors) Modified: python/branches/py3k-struni/Lib/gettext.py ============================================================================== --- python/branches/py3k-struni/Lib/gettext.py (original) +++ python/branches/py3k-struni/Lib/gettext.py Wed May 2 21:09:54 2007 @@ -217,15 +217,15 @@ def ugettext(self, message): if self._fallback: return self._fallback.ugettext(message) - return unicode(message) + return str(message) def ungettext(self, msgid1, msgid2, n): if self._fallback: return self._fallback.ungettext(msgid1, msgid2, n) if n == 1: - return unicode(msgid1) + return str(msgid1) else: - return unicode(msgid2) + return str(msgid2) def info(self): return self._info @@ -239,14 +239,14 @@ def set_output_charset(self, charset): self._output_charset = charset - def install(self, unicode=False, names=None): + def install(self, str=False, names=None): import __builtin__ - __builtin__.__dict__['_'] = unicode and self.ugettext or self.gettext + __builtin__.__dict__['_'] = str and self.ugettext or self.gettext if hasattr(names, "__contains__"): if "gettext" in names: __builtin__.__dict__['gettext'] = __builtin__.__dict__['_'] if "ngettext" in names: - __builtin__.__dict__['ngettext'] = (unicode and self.ungettext + __builtin__.__dict__['ngettext'] = (str and self.ungettext or self.ngettext) if "lgettext" in names: __builtin__.__dict__['lgettext'] = self.lgettext @@ -327,14 +327,14 @@ msgid1, msgid2 = msg.split('\x00') tmsg = tmsg.split('\x00') if self._charset: - msgid1 = unicode(msgid1, self._charset) - tmsg = [unicode(x, self._charset) for x in tmsg] + msgid1 = str(msgid1, self._charset) + tmsg = [str(x, self._charset) for x in tmsg] for i in range(len(tmsg)): catalog[(msgid1, i)] = tmsg[i] else: if self._charset: - msg = unicode(msg, self._charset) - tmsg = unicode(tmsg, self._charset) + msg = str(msg, self._charset) + tmsg = str(tmsg, self._charset) catalog[msg] = tmsg # advance to next entry in the seek tables masteridx += 8 @@ -401,7 +401,7 @@ if tmsg is missing: if self._fallback: return self._fallback.ugettext(message) - return unicode(message) + return str(message) return tmsg def ungettext(self, msgid1, msgid2, n): @@ -411,9 +411,9 @@ if self._fallback: return self._fallback.ungettext(msgid1, msgid2, n) if n == 1: - tmsg = unicode(msgid1) + tmsg = str(msgid1) else: - tmsg = unicode(msgid2) + tmsg = str(msgid2) return tmsg @@ -489,9 +489,9 @@ return result -def install(domain, localedir=None, unicode=False, codeset=None, names=None): +def install(domain, localedir=None, str=False, codeset=None, names=None): t = translation(domain, localedir, fallback=True, codeset=codeset) - t.install(unicode, names) + t.install(str, names) Modified: python/branches/py3k-struni/Lib/glob.py ============================================================================== --- python/branches/py3k-struni/Lib/glob.py (original) +++ python/branches/py3k-struni/Lib/glob.py Wed May 2 21:09:54 2007 @@ -49,8 +49,8 @@ def glob1(dirname, pattern): if not dirname: dirname = os.curdir - if isinstance(pattern, unicode) and not isinstance(dirname, unicode): - dirname = unicode(dirname, sys.getfilesystemencoding() or + if isinstance(pattern, str) and not isinstance(dirname, str): + dirname = str(dirname, sys.getfilesystemencoding() or sys.getdefaultencoding()) try: names = os.listdir(dirname) Modified: python/branches/py3k-struni/Lib/idlelib/EditorWindow.py ============================================================================== --- python/branches/py3k-struni/Lib/idlelib/EditorWindow.py (original) +++ python/branches/py3k-struni/Lib/idlelib/EditorWindow.py Wed May 2 21:09:54 2007 @@ -276,7 +276,7 @@ def _filename_to_unicode(self, filename): """convert filename to unicode in order to display it in Tk""" - if isinstance(filename, unicode) or not filename: + if isinstance(filename, str) or not filename: return filename else: try: Modified: python/branches/py3k-struni/Lib/idlelib/IOBinding.py ============================================================================== --- python/branches/py3k-struni/Lib/idlelib/IOBinding.py (original) +++ python/branches/py3k-struni/Lib/idlelib/IOBinding.py Wed May 2 21:09:54 2007 @@ -255,7 +255,7 @@ firsteol = self.eol_re.search(chars) if firsteol: self.eol_convention = firsteol.group(0) - if isinstance(self.eol_convention, unicode): + if isinstance(self.eol_convention, str): # Make sure it is an ASCII string self.eol_convention = self.eol_convention.encode("ascii") chars = self.eol_re.sub(r"\n", chars) @@ -298,18 +298,18 @@ enc = None if enc: try: - return unicode(chars, enc) + return str(chars, enc) except UnicodeError: pass # If it is ASCII, we need not to record anything try: - return unicode(chars, 'ascii') + return str(chars, 'ascii') except UnicodeError: pass # Finally, try the locale's encoding. This is deprecated; # the user should declare a non-ASCII encoding try: - chars = unicode(chars, encoding) + chars = str(chars, encoding) self.fileencoding = encoding except UnicodeError: pass @@ -522,7 +522,7 @@ self.opendialog = tkFileDialog.Open(master=self.text, filetypes=self.filetypes) filename = self.opendialog.show(initialdir=dir, initialfile=base) - if isinstance(filename, unicode): + if isinstance(filename, str): filename = filename.encode(filesystemencoding) return filename @@ -544,7 +544,7 @@ self.savedialog = tkFileDialog.SaveAs(master=self.text, filetypes=self.filetypes) filename = self.savedialog.show(initialdir=dir, initialfile=base) - if isinstance(filename, unicode): + if isinstance(filename, str): filename = filename.encode(filesystemencoding) return filename Modified: python/branches/py3k-struni/Lib/idlelib/OutputWindow.py ============================================================================== --- python/branches/py3k-struni/Lib/idlelib/OutputWindow.py (original) +++ python/branches/py3k-struni/Lib/idlelib/OutputWindow.py Wed May 2 21:09:54 2007 @@ -39,7 +39,7 @@ # we assume that they are in the locale's encoding if isinstance(s, str): try: - s = unicode(s, IOBinding.encoding) + s = str(s, IOBinding.encoding) except UnicodeError: # some other encoding; let Tcl deal with it pass Modified: python/branches/py3k-struni/Lib/idlelib/PyParse.py ============================================================================== --- python/branches/py3k-struni/Lib/idlelib/PyParse.py (original) +++ python/branches/py3k-struni/Lib/idlelib/PyParse.py Wed May 2 21:09:54 2007 @@ -105,7 +105,7 @@ del ch try: - UnicodeType = type(unicode("")) + UnicodeType = type(str("")) except NameError: UnicodeType = None Modified: python/branches/py3k-struni/Lib/idlelib/PyShell.py ============================================================================== --- python/branches/py3k-struni/Lib/idlelib/PyShell.py (original) +++ python/branches/py3k-struni/Lib/idlelib/PyShell.py Wed May 2 21:09:54 2007 @@ -1008,7 +1008,7 @@ line = self.text.get("iomark", "end-1c") if len(line) == 0: # may be EOF if we quit our mainloop with Ctrl-C line = "\n" - if isinstance(line, unicode): + if isinstance(line, str): import IOBinding try: line = line.encode(IOBinding.encoding) Modified: python/branches/py3k-struni/Lib/lib-tk/Tkinter.py ============================================================================== --- python/branches/py3k-struni/Lib/lib-tk/Tkinter.py (original) +++ python/branches/py3k-struni/Lib/lib-tk/Tkinter.py Wed May 2 21:09:54 2007 @@ -3736,7 +3736,7 @@ text = "This is Tcl/Tk version %s" % TclVersion if TclVersion >= 8.1: try: - text = text + unicode("\nThis should be a cedilla: \347", + text = text + str("\nThis should be a cedilla: \347", "iso-8859-1") except NameError: pass # no unicode support Modified: python/branches/py3k-struni/Lib/msilib/schema.py ============================================================================== --- python/branches/py3k-struni/Lib/msilib/schema.py (original) +++ python/branches/py3k-struni/Lib/msilib/schema.py Wed May 2 21:09:54 2007 @@ -580,428 +580,428 @@ tables=[_Validation, ActionText, AdminExecuteSequence, Condition, AdminUISequence, AdvtExecuteSequence, AdvtUISequence, AppId, AppSearch, Property, BBControl, Billboard, Feature, Binary, BindImage, File, CCPSearch, CheckBox, Class, Component, Icon, ProgId, ComboBox, CompLocator, Complus, Directory, Control, Dialog, ControlCondition, ControlEvent, CreateFolder, CustomAction, DrLocator, DuplicateFile, Environment, Error, EventMapping, Extension, MIME, FeatureComponents, FileSFPCatalog, SFPCatalog, Font, IniFile, IniLocator, InstallExecuteSequence, InstallUISequence, IsolatedComponent, LaunchCondition, ListBox, ListView, LockPermissions, Media, MoveFile, MsiAssembly, MsiAssemblyName, MsiDigitalCertificate, MsiDigitalSignature, MsiFileHash, MsiPatchHeaders, ODBCAttribute, ODBCDriver, ODBCDataSource, ODBCSourceAttribute, ODBCTranslator, Patch, PatchPackage, PublishComponent, RadioButton, Registry, RegLocator, RemoveFile, RemoveIniFile, RemoveRegistry, ReserveCost, SelfReg, ServiceControl, ServiceInstall, Shortcut, Signature, TextStyle, TypeLib, UIText, Upgrade, Verb] _Validation_records = [ -(u'_Validation',u'Table',u'N',None, None, None, None, u'Identifier',None, u'Name of table',), -(u'_Validation',u'Column',u'N',None, None, None, None, u'Identifier',None, u'Name of column',), -(u'_Validation',u'Description',u'Y',None, None, None, None, u'Text',None, u'Description of column',), -(u'_Validation',u'Set',u'Y',None, None, None, None, u'Text',None, u'Set of values that are permitted',), -(u'_Validation',u'Category',u'Y',None, None, None, None, None, u'Text;Formatted;Template;Condition;Guid;Path;Version;Language;Identifier;Binary;UpperCase;LowerCase;Filename;Paths;AnyPath;WildCardFilename;RegPath;KeyFormatted;CustomSource;Property;Cabinet;Shortcut;URL',u'String category',), -(u'_Validation',u'KeyColumn',u'Y',1,32,None, None, None, None, u'Column to which foreign key connects',), -(u'_Validation',u'KeyTable',u'Y',None, None, None, None, u'Identifier',None, u'For foreign key, Name of table to which data must link',), -(u'_Validation',u'MaxValue',u'Y',-2147483647,2147483647,None, None, None, None, u'Maximum value allowed',), -(u'_Validation',u'MinValue',u'Y',-2147483647,2147483647,None, None, None, None, u'Minimum value allowed',), -(u'_Validation',u'Nullable',u'N',None, None, None, None, None, u'Y;N;@',u'Whether the column is nullable',), -(u'ActionText',u'Description',u'Y',None, None, None, None, u'Text',None, u'Localized description displayed in progress dialog and log when action is executing.',), -(u'ActionText',u'Action',u'N',None, None, None, None, u'Identifier',None, u'Name of action to be described.',), -(u'ActionText',u'Template',u'Y',None, None, None, None, u'Template',None, u'Optional localized format template used to format action data records for display during action execution.',), -(u'AdminExecuteSequence',u'Action',u'N',None, None, None, None, u'Identifier',None, u'Name of action to invoke, either in the engine or the handler DLL.',), -(u'AdminExecuteSequence',u'Condition',u'Y',None, None, None, None, u'Condition',None, u'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), -(u'AdminExecuteSequence',u'Sequence',u'Y',-4,32767,None, None, None, None, u'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), -(u'Condition',u'Condition',u'Y',None, None, None, None, u'Condition',None, u'Expression evaluated to determine if Level in the Feature table is to change.',), -(u'Condition',u'Feature_',u'N',None, None, u'Feature',1,u'Identifier',None, u'Reference to a Feature entry in Feature table.',), -(u'Condition',u'Level',u'N',0,32767,None, None, None, None, u'New selection Level to set in Feature table if Condition evaluates to TRUE.',), -(u'AdminUISequence',u'Action',u'N',None, None, None, None, u'Identifier',None, u'Name of action to invoke, either in the engine or the handler DLL.',), -(u'AdminUISequence',u'Condition',u'Y',None, None, None, None, u'Condition',None, u'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), -(u'AdminUISequence',u'Sequence',u'Y',-4,32767,None, None, None, None, u'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), -(u'AdvtExecuteSequence',u'Action',u'N',None, None, None, None, u'Identifier',None, u'Name of action to invoke, either in the engine or the handler DLL.',), -(u'AdvtExecuteSequence',u'Condition',u'Y',None, None, None, None, u'Condition',None, u'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), -(u'AdvtExecuteSequence',u'Sequence',u'Y',-4,32767,None, None, None, None, u'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), -(u'AdvtUISequence',u'Action',u'N',None, None, None, None, u'Identifier',None, u'Name of action to invoke, either in the engine or the handler DLL.',), -(u'AdvtUISequence',u'Condition',u'Y',None, None, None, None, u'Condition',None, u'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), -(u'AdvtUISequence',u'Sequence',u'Y',-4,32767,None, None, None, None, u'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), -(u'AppId',u'AppId',u'N',None, None, None, None, u'Guid',None, None, ), -(u'AppId',u'ActivateAtStorage',u'Y',0,1,None, None, None, None, None, ), -(u'AppId',u'DllSurrogate',u'Y',None, None, None, None, u'Text',None, None, ), -(u'AppId',u'LocalService',u'Y',None, None, None, None, u'Text',None, None, ), -(u'AppId',u'RemoteServerName',u'Y',None, None, None, None, u'Formatted',None, None, ), -(u'AppId',u'RunAsInteractiveUser',u'Y',0,1,None, None, None, None, None, ), -(u'AppId',u'ServiceParameters',u'Y',None, None, None, None, u'Text',None, None, ), -(u'AppSearch',u'Property',u'N',None, None, None, None, u'Identifier',None, u'The property associated with a Signature',), -(u'AppSearch',u'Signature_',u'N',None, None, u'Signature;RegLocator;IniLocator;DrLocator;CompLocator',1,u'Identifier',None, u'The Signature_ represents a unique file signature and is also the foreign key in the Signature, RegLocator, IniLocator, CompLocator and the DrLocator tables.',), -(u'Property',u'Property',u'N',None, None, None, None, u'Identifier',None, u'Name of property, uppercase if settable by launcher or loader.',), -(u'Property',u'Value',u'N',None, None, None, None, u'Text',None, u'String value for property. Never null or empty.',), -(u'BBControl',u'Type',u'N',None, None, None, None, u'Identifier',None, u'The type of the control.',), -(u'BBControl',u'Y',u'N',0,32767,None, None, None, None, u'Vertical coordinate of the upper left corner of the bounding rectangle of the control.',), -(u'BBControl',u'Text',u'Y',None, None, None, None, u'Text',None, u'A string used to set the initial text contained within a control (if appropriate).',), -(u'BBControl',u'BBControl',u'N',None, None, None, None, u'Identifier',None, u'Name of the control. This name must be unique within a billboard, but can repeat on different billboard.',), -(u'BBControl',u'Attributes',u'Y',0,2147483647,None, None, None, None, u'A 32-bit word that specifies the attribute flags to be applied to this control.',), -(u'BBControl',u'Billboard_',u'N',None, None, u'Billboard',1,u'Identifier',None, u'External key to the Billboard table, name of the billboard.',), -(u'BBControl',u'Height',u'N',0,32767,None, None, None, None, u'Height of the bounding rectangle of the control.',), -(u'BBControl',u'Width',u'N',0,32767,None, None, None, None, u'Width of the bounding rectangle of the control.',), -(u'BBControl',u'X',u'N',0,32767,None, None, None, None, u'Horizontal coordinate of the upper left corner of the bounding rectangle of the control.',), -(u'Billboard',u'Action',u'Y',None, None, None, None, u'Identifier',None, u'The name of an action. The billboard is displayed during the progress messages received from this action.',), -(u'Billboard',u'Billboard',u'N',None, None, None, None, u'Identifier',None, u'Name of the billboard.',), -(u'Billboard',u'Feature_',u'N',None, None, u'Feature',1,u'Identifier',None, u'An external key to the Feature Table. The billboard is shown only if this feature is being installed.',), -(u'Billboard',u'Ordering',u'Y',0,32767,None, None, None, None, u'A positive integer. If there is more than one billboard corresponding to an action they will be shown in the order defined by this column.',), -(u'Feature',u'Description',u'Y',None, None, None, None, u'Text',None, u'Longer descriptive text describing a visible feature item.',), -(u'Feature',u'Attributes',u'N',None, None, None, None, None, u'0;1;2;4;5;6;8;9;10;16;17;18;20;21;22;24;25;26;32;33;34;36;37;38;48;49;50;52;53;54',u'Feature attributes',), -(u'Feature',u'Feature',u'N',None, None, None, None, u'Identifier',None, u'Primary key used to identify a particular feature record.',), -(u'Feature',u'Directory_',u'Y',None, None, u'Directory',1,u'UpperCase',None, u'The name of the Directory that can be configured by the UI. A non-null value will enable the browse button.',), -(u'Feature',u'Level',u'N',0,32767,None, None, None, None, u'The install level at which record will be initially selected. An install level of 0 will disable an item and prevent its display.',), -(u'Feature',u'Title',u'Y',None, None, None, None, u'Text',None, u'Short text identifying a visible feature item.',), -(u'Feature',u'Display',u'Y',0,32767,None, None, None, None, u'Numeric sort order, used to force a specific display ordering.',), -(u'Feature',u'Feature_Parent',u'Y',None, None, u'Feature',1,u'Identifier',None, u'Optional key of a parent record in the same table. If the parent is not selected, then the record will not be installed. Null indicates a root item.',), -(u'Binary',u'Name',u'N',None, None, None, None, u'Identifier',None, u'Unique key identifying the binary data.',), -(u'Binary',u'Data',u'N',None, None, None, None, u'Binary',None, u'The unformatted binary data.',), -(u'BindImage',u'File_',u'N',None, None, u'File',1,u'Identifier',None, u'The index into the File table. This must be an executable file.',), -(u'BindImage',u'Path',u'Y',None, None, None, None, u'Paths',None, u'A list of ; delimited paths that represent the paths to be searched for the import DLLS. The list is usually a list of properties each enclosed within square brackets [] .',), -(u'File',u'Sequence',u'N',1,32767,None, None, None, None, u'Sequence with respect to the media images; order must track cabinet order.',), -(u'File',u'Attributes',u'Y',0,32767,None, None, None, None, u'Integer containing bit flags representing file attributes (with the decimal value of each bit position in parentheses)',), -(u'File',u'File',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized token, must match identifier in cabinet. For uncompressed files, this field is ignored.',), -(u'File',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key referencing Component that controls the file.',), -(u'File',u'FileName',u'N',None, None, None, None, u'Filename',None, u'File name used for installation, may be localized. This may contain a "short name|long name" pair.',), -(u'File',u'FileSize',u'N',0,2147483647,None, None, None, None, u'Size of file in bytes (long integer).',), -(u'File',u'Language',u'Y',None, None, None, None, u'Language',None, u'List of decimal language Ids, comma-separated if more than one.',), -(u'File',u'Version',u'Y',None, None, u'File',1,u'Version',None, u'Version string for versioned files; Blank for unversioned files.',), -(u'CCPSearch',u'Signature_',u'N',None, None, u'Signature;RegLocator;IniLocator;DrLocator;CompLocator',1,u'Identifier',None, u'The Signature_ represents a unique file signature and is also the foreign key in the Signature, RegLocator, IniLocator, CompLocator and the DrLocator tables.',), -(u'CheckBox',u'Property',u'N',None, None, None, None, u'Identifier',None, u'A named property to be tied to the item.',), -(u'CheckBox',u'Value',u'Y',None, None, None, None, u'Formatted',None, u'The value string associated with the item.',), -(u'Class',u'Description',u'Y',None, None, None, None, u'Text',None, u'Localized description for the Class.',), -(u'Class',u'Attributes',u'Y',None, 32767,None, None, None, None, u'Class registration attributes.',), -(u'Class',u'Feature_',u'N',None, None, u'Feature',1,u'Identifier',None, u'Required foreign key into the Feature Table, specifying the feature to validate or install in order for the CLSID factory to be operational.',), -(u'Class',u'AppId_',u'Y',None, None, u'AppId',1,u'Guid',None, u'Optional AppID containing DCOM information for associated application (string GUID).',), -(u'Class',u'Argument',u'Y',None, None, None, None, u'Formatted',None, u'optional argument for LocalServers.',), -(u'Class',u'CLSID',u'N',None, None, None, None, u'Guid',None, u'The CLSID of an OLE factory.',), -(u'Class',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Required foreign key into the Component Table, specifying the component for which to return a path when called through LocateComponent.',), -(u'Class',u'Context',u'N',None, None, None, None, u'Identifier',None, u'The numeric server context for this server. CLSCTX_xxxx',), -(u'Class',u'DefInprocHandler',u'Y',None, None, None, None, u'Filename',u'1;2;3',u'Optional default inproc handler. Only optionally provided if Context=CLSCTX_LOCAL_SERVER. Typically "ole32.dll" or "mapi32.dll"',), -(u'Class',u'FileTypeMask',u'Y',None, None, None, None, u'Text',None, u'Optional string containing information for the HKCRthis CLSID) key. If multiple patterns exist, they must be delimited by a semicolon, and numeric subkeys will be generated: 0,1,2...',), -(u'Class',u'Icon_',u'Y',None, None, u'Icon',1,u'Identifier',None, u'Optional foreign key into the Icon Table, specifying the icon file associated with this CLSID. Will be written under the DefaultIcon key.',), -(u'Class',u'IconIndex',u'Y',-32767,32767,None, None, None, None, u'Optional icon index.',), -(u'Class',u'ProgId_Default',u'Y',None, None, u'ProgId',1,u'Text',None, u'Optional ProgId associated with this CLSID.',), -(u'Component',u'Condition',u'Y',None, None, None, None, u'Condition',None, u"A conditional statement that will disable this component if the specified condition evaluates to the 'True' state. If a component is disabled, it will not be installed, regardless of the 'Action' state associated with the component.",), -(u'Component',u'Attributes',u'N',None, None, None, None, None, None, u'Remote execution option, one of irsEnum',), -(u'Component',u'Component',u'N',None, None, None, None, u'Identifier',None, u'Primary key used to identify a particular component record.',), -(u'Component',u'ComponentId',u'Y',None, None, None, None, u'Guid',None, u'A string GUID unique to this component, version, and language.',), -(u'Component',u'Directory_',u'N',None, None, u'Directory',1,u'Identifier',None, u'Required key of a Directory table record. This is actually a property name whose value contains the actual path, set either by the AppSearch action or with the default setting obtained from the Directory table.',), -(u'Component',u'KeyPath',u'Y',None, None, u'File;Registry;ODBCDataSource',1,u'Identifier',None, u'Either the primary key into the File table, Registry table, or ODBCDataSource table. This extract path is stored when the component is installed, and is used to detect the presence of the component and to return the path to it.',), -(u'Icon',u'Name',u'N',None, None, None, None, u'Identifier',None, u'Primary key. Name of the icon file.',), -(u'Icon',u'Data',u'N',None, None, None, None, u'Binary',None, u'Binary stream. The binary icon data in PE (.DLL or .EXE) or icon (.ICO) format.',), -(u'ProgId',u'Description',u'Y',None, None, None, None, u'Text',None, u'Localized description for the Program identifier.',), -(u'ProgId',u'Icon_',u'Y',None, None, u'Icon',1,u'Identifier',None, u'Optional foreign key into the Icon Table, specifying the icon file associated with this ProgId. Will be written under the DefaultIcon key.',), -(u'ProgId',u'IconIndex',u'Y',-32767,32767,None, None, None, None, u'Optional icon index.',), -(u'ProgId',u'ProgId',u'N',None, None, None, None, u'Text',None, u'The Program Identifier. Primary key.',), -(u'ProgId',u'Class_',u'Y',None, None, u'Class',1,u'Guid',None, u'The CLSID of an OLE factory corresponding to the ProgId.',), -(u'ProgId',u'ProgId_Parent',u'Y',None, None, u'ProgId',1,u'Text',None, u'The Parent Program Identifier. If specified, the ProgId column becomes a version independent prog id.',), -(u'ComboBox',u'Text',u'Y',None, None, None, None, u'Formatted',None, u'The visible text to be assigned to the item. Optional. If this entry or the entire column is missing, the text is the same as the value.',), -(u'ComboBox',u'Property',u'N',None, None, None, None, u'Identifier',None, u'A named property to be tied to this item. All the items tied to the same property become part of the same combobox.',), -(u'ComboBox',u'Value',u'N',None, None, None, None, u'Formatted',None, u'The value string associated with this item. Selecting the line will set the associated property to this value.',), -(u'ComboBox',u'Order',u'N',1,32767,None, None, None, None, u'A positive integer used to determine the ordering of the items within one list.\tThe integers do not have to be consecutive.',), -(u'CompLocator',u'Type',u'Y',0,1,None, None, None, None, u'A boolean value that determines if the registry value is a filename or a directory location.',), -(u'CompLocator',u'Signature_',u'N',None, None, None, None, u'Identifier',None, u'The table key. The Signature_ represents a unique file signature and is also the foreign key in the Signature table.',), -(u'CompLocator',u'ComponentId',u'N',None, None, None, None, u'Guid',None, u'A string GUID unique to this component, version, and language.',), -(u'Complus',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key referencing Component that controls the ComPlus component.',), -(u'Complus',u'ExpType',u'Y',0,32767,None, None, None, None, u'ComPlus component attributes.',), -(u'Directory',u'Directory',u'N',None, None, None, None, u'Identifier',None, u'Unique identifier for directory entry, primary key. If a property by this name is defined, it contains the full path to the directory.',), -(u'Directory',u'DefaultDir',u'N',None, None, None, None, u'DefaultDir',None, u"The default sub-path under parent's path.",), -(u'Directory',u'Directory_Parent',u'Y',None, None, u'Directory',1,u'Identifier',None, u'Reference to the entry in this table specifying the default parent directory. A record parented to itself or with a Null parent represents a root of the install tree.',), -(u'Control',u'Type',u'N',None, None, None, None, u'Identifier',None, u'The type of the control.',), -(u'Control',u'Y',u'N',0,32767,None, None, None, None, u'Vertical coordinate of the upper left corner of the bounding rectangle of the control.',), -(u'Control',u'Text',u'Y',None, None, None, None, u'Formatted',None, u'A string used to set the initial text contained within a control (if appropriate).',), -(u'Control',u'Property',u'Y',None, None, None, None, u'Identifier',None, u'The name of a defined property to be linked to this control. ',), -(u'Control',u'Attributes',u'Y',0,2147483647,None, None, None, None, u'A 32-bit word that specifies the attribute flags to be applied to this control.',), -(u'Control',u'Height',u'N',0,32767,None, None, None, None, u'Height of the bounding rectangle of the control.',), -(u'Control',u'Width',u'N',0,32767,None, None, None, None, u'Width of the bounding rectangle of the control.',), -(u'Control',u'X',u'N',0,32767,None, None, None, None, u'Horizontal coordinate of the upper left corner of the bounding rectangle of the control.',), -(u'Control',u'Control',u'N',None, None, None, None, u'Identifier',None, u'Name of the control. This name must be unique within a dialog, but can repeat on different dialogs. ',), -(u'Control',u'Control_Next',u'Y',None, None, u'Control',2,u'Identifier',None, u'The name of an other control on the same dialog. This link defines the tab order of the controls. The links have to form one or more cycles!',), -(u'Control',u'Dialog_',u'N',None, None, u'Dialog',1,u'Identifier',None, u'External key to the Dialog table, name of the dialog.',), -(u'Control',u'Help',u'Y',None, None, None, None, u'Text',None, u'The help strings used with the button. The text is optional. ',), -(u'Dialog',u'Attributes',u'Y',0,2147483647,None, None, None, None, u'A 32-bit word that specifies the attribute flags to be applied to this dialog.',), -(u'Dialog',u'Height',u'N',0,32767,None, None, None, None, u'Height of the bounding rectangle of the dialog.',), -(u'Dialog',u'Width',u'N',0,32767,None, None, None, None, u'Width of the bounding rectangle of the dialog.',), -(u'Dialog',u'Dialog',u'N',None, None, None, None, u'Identifier',None, u'Name of the dialog.',), -(u'Dialog',u'Control_Cancel',u'Y',None, None, u'Control',2,u'Identifier',None, u'Defines the cancel control. Hitting escape or clicking on the close icon on the dialog is equivalent to pushing this button.',), -(u'Dialog',u'Control_Default',u'Y',None, None, u'Control',2,u'Identifier',None, u'Defines the default control. Hitting return is equivalent to pushing this button.',), -(u'Dialog',u'Control_First',u'N',None, None, u'Control',2,u'Identifier',None, u'Defines the control that has the focus when the dialog is created.',), -(u'Dialog',u'HCentering',u'N',0,100,None, None, None, None, u'Horizontal position of the dialog on a 0-100 scale. 0 means left end, 100 means right end of the screen, 50 center.',), -(u'Dialog',u'Title',u'Y',None, None, None, None, u'Formatted',None, u"A text string specifying the title to be displayed in the title bar of the dialog's window.",), -(u'Dialog',u'VCentering',u'N',0,100,None, None, None, None, u'Vertical position of the dialog on a 0-100 scale. 0 means top end, 100 means bottom end of the screen, 50 center.',), -(u'ControlCondition',u'Action',u'N',None, None, None, None, None, u'Default;Disable;Enable;Hide;Show',u'The desired action to be taken on the specified control.',), -(u'ControlCondition',u'Condition',u'N',None, None, None, None, u'Condition',None, u'A standard conditional statement that specifies under which conditions the action should be triggered.',), -(u'ControlCondition',u'Dialog_',u'N',None, None, u'Dialog',1,u'Identifier',None, u'A foreign key to the Dialog table, name of the dialog.',), -(u'ControlCondition',u'Control_',u'N',None, None, u'Control',2,u'Identifier',None, u'A foreign key to the Control table, name of the control.',), -(u'ControlEvent',u'Condition',u'Y',None, None, None, None, u'Condition',None, u'A standard conditional statement that specifies under which conditions an event should be triggered.',), -(u'ControlEvent',u'Ordering',u'Y',0,2147483647,None, None, None, None, u'An integer used to order several events tied to the same control. Can be left blank.',), -(u'ControlEvent',u'Argument',u'N',None, None, None, None, u'Formatted',None, u'A value to be used as a modifier when triggering a particular event.',), -(u'ControlEvent',u'Dialog_',u'N',None, None, u'Dialog',1,u'Identifier',None, u'A foreign key to the Dialog table, name of the dialog.',), -(u'ControlEvent',u'Control_',u'N',None, None, u'Control',2,u'Identifier',None, u'A foreign key to the Control table, name of the control',), -(u'ControlEvent',u'Event',u'N',None, None, None, None, u'Formatted',None, u'An identifier that specifies the type of the event that should take place when the user interacts with control specified by the first two entries.',), -(u'CreateFolder',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table.',), -(u'CreateFolder',u'Directory_',u'N',None, None, u'Directory',1,u'Identifier',None, u'Primary key, could be foreign key into the Directory table.',), -(u'CustomAction',u'Type',u'N',1,16383,None, None, None, None, u'The numeric custom action type, consisting of source location, code type, entry, option flags.',), -(u'CustomAction',u'Action',u'N',None, None, None, None, u'Identifier',None, u'Primary key, name of action, normally appears in sequence table unless private use.',), -(u'CustomAction',u'Source',u'Y',None, None, None, None, u'CustomSource',None, u'The table reference of the source of the code.',), -(u'CustomAction',u'Target',u'Y',None, None, None, None, u'Formatted',None, u'Excecution parameter, depends on the type of custom action',), -(u'DrLocator',u'Signature_',u'N',None, None, None, None, u'Identifier',None, u'The Signature_ represents a unique file signature and is also the foreign key in the Signature table.',), -(u'DrLocator',u'Path',u'Y',None, None, None, None, u'AnyPath',None, u'The path on the user system. This is a either a subpath below the value of the Parent or a full path. The path may contain properties enclosed within [ ] that will be expanded.',), -(u'DrLocator',u'Depth',u'Y',0,32767,None, None, None, None, u'The depth below the path to which the Signature_ is recursively searched. If absent, the depth is assumed to be 0.',), -(u'DrLocator',u'Parent',u'Y',None, None, None, None, u'Identifier',None, u'The parent file signature. It is also a foreign key in the Signature table. If null and the Path column does not expand to a full path, then all the fixed drives of the user system are searched using the Path.',), -(u'DuplicateFile',u'File_',u'N',None, None, u'File',1,u'Identifier',None, u'Foreign key referencing the source file to be duplicated.',), -(u'DuplicateFile',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key referencing Component that controls the duplicate file.',), -(u'DuplicateFile',u'DestFolder',u'Y',None, None, None, None, u'Identifier',None, u'Name of a property whose value is assumed to resolve to the full pathname to a destination folder.',), -(u'DuplicateFile',u'DestName',u'Y',None, None, None, None, u'Filename',None, u'Filename to be given to the duplicate file.',), -(u'DuplicateFile',u'FileKey',u'N',None, None, None, None, u'Identifier',None, u'Primary key used to identify a particular file entry',), -(u'Environment',u'Name',u'N',None, None, None, None, u'Text',None, u'The name of the environmental value.',), -(u'Environment',u'Value',u'Y',None, None, None, None, u'Formatted',None, u'The value to set in the environmental settings.',), -(u'Environment',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table referencing component that controls the installing of the environmental value.',), -(u'Environment',u'Environment',u'N',None, None, None, None, u'Identifier',None, u'Unique identifier for the environmental variable setting',), -(u'Error',u'Error',u'N',0,32767,None, None, None, None, u'Integer error number, obtained from header file IError(...) macros.',), -(u'Error',u'Message',u'Y',None, None, None, None, u'Template',None, u'Error formatting template, obtained from user ed. or localizers.',), -(u'EventMapping',u'Dialog_',u'N',None, None, u'Dialog',1,u'Identifier',None, u'A foreign key to the Dialog table, name of the Dialog.',), -(u'EventMapping',u'Control_',u'N',None, None, u'Control',2,u'Identifier',None, u'A foreign key to the Control table, name of the control.',), -(u'EventMapping',u'Event',u'N',None, None, None, None, u'Identifier',None, u'An identifier that specifies the type of the event that the control subscribes to.',), -(u'EventMapping',u'Attribute',u'N',None, None, None, None, u'Identifier',None, u'The name of the control attribute, that is set when this event is received.',), -(u'Extension',u'Feature_',u'N',None, None, u'Feature',1,u'Identifier',None, u'Required foreign key into the Feature Table, specifying the feature to validate or install in order for the CLSID factory to be operational.',), -(u'Extension',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Required foreign key into the Component Table, specifying the component for which to return a path when called through LocateComponent.',), -(u'Extension',u'Extension',u'N',None, None, None, None, u'Text',None, u'The extension associated with the table row.',), -(u'Extension',u'MIME_',u'Y',None, None, u'MIME',1,u'Text',None, u'Optional Context identifier, typically "type/format" associated with the extension',), -(u'Extension',u'ProgId_',u'Y',None, None, u'ProgId',1,u'Text',None, u'Optional ProgId associated with this extension.',), -(u'MIME',u'CLSID',u'Y',None, None, None, None, u'Guid',None, u'Optional associated CLSID.',), -(u'MIME',u'ContentType',u'N',None, None, None, None, u'Text',None, u'Primary key. Context identifier, typically "type/format".',), -(u'MIME',u'Extension_',u'N',None, None, u'Extension',1,u'Text',None, u'Optional associated extension (without dot)',), -(u'FeatureComponents',u'Feature_',u'N',None, None, u'Feature',1,u'Identifier',None, u'Foreign key into Feature table.',), -(u'FeatureComponents',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into Component table.',), -(u'FileSFPCatalog',u'File_',u'N',None, None, u'File',1,u'Identifier',None, u'File associated with the catalog',), -(u'FileSFPCatalog',u'SFPCatalog_',u'N',None, None, u'SFPCatalog',1,u'Filename',None, u'Catalog associated with the file',), -(u'SFPCatalog',u'SFPCatalog',u'N',None, None, None, None, u'Filename',None, u'File name for the catalog.',), -(u'SFPCatalog',u'Catalog',u'N',None, None, None, None, u'Binary',None, u'SFP Catalog',), -(u'SFPCatalog',u'Dependency',u'Y',None, None, None, None, u'Formatted',None, u'Parent catalog - only used by SFP',), -(u'Font',u'File_',u'N',None, None, u'File',1,u'Identifier',None, u'Primary key, foreign key into File table referencing font file.',), -(u'Font',u'FontTitle',u'Y',None, None, None, None, u'Text',None, u'Font name.',), -(u'IniFile',u'Action',u'N',None, None, None, None, None, u'0;1;3',u'The type of modification to be made, one of iifEnum',), -(u'IniFile',u'Value',u'N',None, None, None, None, u'Formatted',None, u'The value to be written.',), -(u'IniFile',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table referencing component that controls the installing of the .INI value.',), -(u'IniFile',u'FileName',u'N',None, None, None, None, u'Filename',None, u'The .INI file name in which to write the information',), -(u'IniFile',u'IniFile',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized token.',), -(u'IniFile',u'DirProperty',u'Y',None, None, None, None, u'Identifier',None, u'Foreign key into the Directory table denoting the directory where the .INI file is.',), -(u'IniFile',u'Key',u'N',None, None, None, None, u'Formatted',None, u'The .INI file key below Section.',), -(u'IniFile',u'Section',u'N',None, None, None, None, u'Formatted',None, u'The .INI file Section.',), -(u'IniLocator',u'Type',u'Y',0,2,None, None, None, None, u'An integer value that determines if the .INI value read is a filename or a directory location or to be used as is w/o interpretation.',), -(u'IniLocator',u'Signature_',u'N',None, None, None, None, u'Identifier',None, u'The table key. The Signature_ represents a unique file signature and is also the foreign key in the Signature table.',), -(u'IniLocator',u'FileName',u'N',None, None, None, None, u'Filename',None, u'The .INI file name.',), -(u'IniLocator',u'Key',u'N',None, None, None, None, u'Text',None, u'Key value (followed by an equals sign in INI file).',), -(u'IniLocator',u'Section',u'N',None, None, None, None, u'Text',None, u'Section name within in file (within square brackets in INI file).',), -(u'IniLocator',u'Field',u'Y',0,32767,None, None, None, None, u'The field in the .INI line. If Field is null or 0 the entire line is read.',), -(u'InstallExecuteSequence',u'Action',u'N',None, None, None, None, u'Identifier',None, u'Name of action to invoke, either in the engine or the handler DLL.',), -(u'InstallExecuteSequence',u'Condition',u'Y',None, None, None, None, u'Condition',None, u'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), -(u'InstallExecuteSequence',u'Sequence',u'Y',-4,32767,None, None, None, None, u'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), -(u'InstallUISequence',u'Action',u'N',None, None, None, None, u'Identifier',None, u'Name of action to invoke, either in the engine or the handler DLL.',), -(u'InstallUISequence',u'Condition',u'Y',None, None, None, None, u'Condition',None, u'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), -(u'InstallUISequence',u'Sequence',u'Y',-4,32767,None, None, None, None, u'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), -(u'IsolatedComponent',u'Component_Application',u'N',None, None, u'Component',1,u'Identifier',None, u'Key to Component table item for application',), -(u'IsolatedComponent',u'Component_Shared',u'N',None, None, u'Component',1,u'Identifier',None, u'Key to Component table item to be isolated',), -(u'LaunchCondition',u'Description',u'N',None, None, None, None, u'Formatted',None, u'Localizable text to display when condition fails and install must abort.',), -(u'LaunchCondition',u'Condition',u'N',None, None, None, None, u'Condition',None, u'Expression which must evaluate to TRUE in order for install to commence.',), -(u'ListBox',u'Text',u'Y',None, None, None, None, u'Text',None, u'The visible text to be assigned to the item. Optional. If this entry or the entire column is missing, the text is the same as the value.',), -(u'ListBox',u'Property',u'N',None, None, None, None, u'Identifier',None, u'A named property to be tied to this item. All the items tied to the same property become part of the same listbox.',), -(u'ListBox',u'Value',u'N',None, None, None, None, u'Formatted',None, u'The value string associated with this item. Selecting the line will set the associated property to this value.',), -(u'ListBox',u'Order',u'N',1,32767,None, None, None, None, u'A positive integer used to determine the ordering of the items within one list..The integers do not have to be consecutive.',), -(u'ListView',u'Text',u'Y',None, None, None, None, u'Text',None, u'The visible text to be assigned to the item. Optional. If this entry or the entire column is missing, the text is the same as the value.',), -(u'ListView',u'Property',u'N',None, None, None, None, u'Identifier',None, u'A named property to be tied to this item. All the items tied to the same property become part of the same listview.',), -(u'ListView',u'Value',u'N',None, None, None, None, u'Identifier',None, u'The value string associated with this item. Selecting the line will set the associated property to this value.',), -(u'ListView',u'Order',u'N',1,32767,None, None, None, None, u'A positive integer used to determine the ordering of the items within one list..The integers do not have to be consecutive.',), -(u'ListView',u'Binary_',u'Y',None, None, u'Binary',1,u'Identifier',None, u'The name of the icon to be displayed with the icon. The binary information is looked up from the Binary Table.',), -(u'LockPermissions',u'Table',u'N',None, None, None, None, u'Identifier',u'Directory;File;Registry',u'Reference to another table name',), -(u'LockPermissions',u'Domain',u'Y',None, None, None, None, u'Formatted',None, u'Domain name for user whose permissions are being set. (usually a property)',), -(u'LockPermissions',u'LockObject',u'N',None, None, None, None, u'Identifier',None, u'Foreign key into Registry or File table',), -(u'LockPermissions',u'Permission',u'Y',-2147483647,2147483647,None, None, None, None, u'Permission Access mask. Full Control = 268435456 (GENERIC_ALL = 0x10000000)',), -(u'LockPermissions',u'User',u'N',None, None, None, None, u'Formatted',None, u'User for permissions to be set. (usually a property)',), -(u'Media',u'Source',u'Y',None, None, None, None, u'Property',None, u'The property defining the location of the cabinet file.',), -(u'Media',u'Cabinet',u'Y',None, None, None, None, u'Cabinet',None, u'If some or all of the files stored on the media are compressed in a cabinet, the name of that cabinet.',), -(u'Media',u'DiskId',u'N',1,32767,None, None, None, None, u'Primary key, integer to determine sort order for table.',), -(u'Media',u'DiskPrompt',u'Y',None, None, None, None, u'Text',None, u'Disk name: the visible text actually printed on the disk. This will be used to prompt the user when this disk needs to be inserted.',), -(u'Media',u'LastSequence',u'N',0,32767,None, None, None, None, u'File sequence number for the last file for this media.',), -(u'Media',u'VolumeLabel',u'Y',None, None, None, None, u'Text',None, u'The label attributed to the volume.',), -(u'ModuleComponents',u'Component',u'N',None, None, u'Component',1,u'Identifier',None, u'Component contained in the module.',), -(u'ModuleComponents',u'Language',u'N',None, None, u'ModuleSignature',2,None, None, u'Default language ID for module (may be changed by transform).',), -(u'ModuleComponents',u'ModuleID',u'N',None, None, u'ModuleSignature',1,u'Identifier',None, u'Module containing the component.',), -(u'ModuleSignature',u'Language',u'N',None, None, None, None, None, None, u'Default decimal language of module.',), -(u'ModuleSignature',u'Version',u'N',None, None, None, None, u'Version',None, u'Version of the module.',), -(u'ModuleSignature',u'ModuleID',u'N',None, None, None, None, u'Identifier',None, u'Module identifier (String.GUID).',), -(u'ModuleDependency',u'ModuleID',u'N',None, None, u'ModuleSignature',1,u'Identifier',None, u'Module requiring the dependency.',), -(u'ModuleDependency',u'ModuleLanguage',u'N',None, None, u'ModuleSignature',2,None, None, u'Language of module requiring the dependency.',), -(u'ModuleDependency',u'RequiredID',u'N',None, None, None, None, None, None, u'String.GUID of required module.',), -(u'ModuleDependency',u'RequiredLanguage',u'N',None, None, None, None, None, None, u'LanguageID of the required module.',), -(u'ModuleDependency',u'RequiredVersion',u'Y',None, None, None, None, u'Version',None, u'Version of the required version.',), -(u'ModuleExclusion',u'ModuleID',u'N',None, None, u'ModuleSignature',1,u'Identifier',None, u'String.GUID of module with exclusion requirement.',), -(u'ModuleExclusion',u'ModuleLanguage',u'N',None, None, u'ModuleSignature',2,None, None, u'LanguageID of module with exclusion requirement.',), -(u'ModuleExclusion',u'ExcludedID',u'N',None, None, None, None, None, None, u'String.GUID of excluded module.',), -(u'ModuleExclusion',u'ExcludedLanguage',u'N',None, None, None, None, None, None, u'Language of excluded module.',), -(u'ModuleExclusion',u'ExcludedMaxVersion',u'Y',None, None, None, None, u'Version',None, u'Maximum version of excluded module.',), -(u'ModuleExclusion',u'ExcludedMinVersion',u'Y',None, None, None, None, u'Version',None, u'Minimum version of excluded module.',), -(u'MoveFile',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'If this component is not "selected" for installation or removal, no action will be taken on the associated MoveFile entry',), -(u'MoveFile',u'DestFolder',u'N',None, None, None, None, u'Identifier',None, u'Name of a property whose value is assumed to resolve to the full path to the destination directory',), -(u'MoveFile',u'DestName',u'Y',None, None, None, None, u'Filename',None, u'Name to be given to the original file after it is moved or copied. If blank, the destination file will be given the same name as the source file',), -(u'MoveFile',u'FileKey',u'N',None, None, None, None, u'Identifier',None, u'Primary key that uniquely identifies a particular MoveFile record',), -(u'MoveFile',u'Options',u'N',0,1,None, None, None, None, u'Integer value specifying the MoveFile operating mode, one of imfoEnum',), -(u'MoveFile',u'SourceFolder',u'Y',None, None, None, None, u'Identifier',None, u'Name of a property whose value is assumed to resolve to the full path to the source directory',), -(u'MoveFile',u'SourceName',u'Y',None, None, None, None, u'Text',None, u"Name of the source file(s) to be moved or copied. Can contain the '*' or '?' wildcards.",), -(u'MsiAssembly',u'Attributes',u'Y',None, None, None, None, None, None, u'Assembly attributes',), -(u'MsiAssembly',u'Feature_',u'N',None, None, u'Feature',1,u'Identifier',None, u'Foreign key into Feature table.',), -(u'MsiAssembly',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into Component table.',), -(u'MsiAssembly',u'File_Application',u'Y',None, None, u'File',1,u'Identifier',None, u'Foreign key into File table, denoting the application context for private assemblies. Null for global assemblies.',), -(u'MsiAssembly',u'File_Manifest',u'Y',None, None, u'File',1,u'Identifier',None, u'Foreign key into the File table denoting the manifest file for the assembly.',), -(u'MsiAssemblyName',u'Name',u'N',None, None, None, None, u'Text',None, u'The name part of the name-value pairs for the assembly name.',), -(u'MsiAssemblyName',u'Value',u'N',None, None, None, None, u'Text',None, u'The value part of the name-value pairs for the assembly name.',), -(u'MsiAssemblyName',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into Component table.',), -(u'MsiDigitalCertificate',u'CertData',u'N',None, None, None, None, u'Binary',None, u'A certificate context blob for a signer certificate',), -(u'MsiDigitalCertificate',u'DigitalCertificate',u'N',None, None, None, None, u'Identifier',None, u'A unique identifier for the row',), -(u'MsiDigitalSignature',u'Table',u'N',None, None, None, None, None, u'Media',u'Reference to another table name (only Media table is supported)',), -(u'MsiDigitalSignature',u'DigitalCertificate_',u'N',None, None, u'MsiDigitalCertificate',1,u'Identifier',None, u'Foreign key to MsiDigitalCertificate table identifying the signer certificate',), -(u'MsiDigitalSignature',u'Hash',u'Y',None, None, None, None, u'Binary',None, u'The encoded hash blob from the digital signature',), -(u'MsiDigitalSignature',u'SignObject',u'N',None, None, None, None, u'Text',None, u'Foreign key to Media table',), -(u'MsiFileHash',u'File_',u'N',None, None, u'File',1,u'Identifier',None, u'Primary key, foreign key into File table referencing file with this hash',), -(u'MsiFileHash',u'Options',u'N',0,32767,None, None, None, None, u'Various options and attributes for this hash.',), -(u'MsiFileHash',u'HashPart1',u'N',None, None, None, None, None, None, u'Size of file in bytes (long integer).',), -(u'MsiFileHash',u'HashPart2',u'N',None, None, None, None, None, None, u'Size of file in bytes (long integer).',), -(u'MsiFileHash',u'HashPart3',u'N',None, None, None, None, None, None, u'Size of file in bytes (long integer).',), -(u'MsiFileHash',u'HashPart4',u'N',None, None, None, None, None, None, u'Size of file in bytes (long integer).',), -(u'MsiPatchHeaders',u'StreamRef',u'N',None, None, None, None, u'Identifier',None, u'Primary key. A unique identifier for the row.',), -(u'MsiPatchHeaders',u'Header',u'N',None, None, None, None, u'Binary',None, u'Binary stream. The patch header, used for patch validation.',), -(u'ODBCAttribute',u'Value',u'Y',None, None, None, None, u'Text',None, u'Value for ODBC driver attribute',), -(u'ODBCAttribute',u'Attribute',u'N',None, None, None, None, u'Text',None, u'Name of ODBC driver attribute',), -(u'ODBCAttribute',u'Driver_',u'N',None, None, u'ODBCDriver',1,u'Identifier',None, u'Reference to ODBC driver in ODBCDriver table',), -(u'ODBCDriver',u'Description',u'N',None, None, None, None, u'Text',None, u'Text used as registered name for driver, non-localized',), -(u'ODBCDriver',u'File_',u'N',None, None, u'File',1,u'Identifier',None, u'Reference to key driver file',), -(u'ODBCDriver',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Reference to associated component',), -(u'ODBCDriver',u'Driver',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized.internal token for driver',), -(u'ODBCDriver',u'File_Setup',u'Y',None, None, u'File',1,u'Identifier',None, u'Optional reference to key driver setup DLL',), -(u'ODBCDataSource',u'Description',u'N',None, None, None, None, u'Text',None, u'Text used as registered name for data source',), -(u'ODBCDataSource',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Reference to associated component',), -(u'ODBCDataSource',u'DataSource',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized.internal token for data source',), -(u'ODBCDataSource',u'DriverDescription',u'N',None, None, None, None, u'Text',None, u'Reference to driver description, may be existing driver',), -(u'ODBCDataSource',u'Registration',u'N',0,1,None, None, None, None, u'Registration option: 0=machine, 1=user, others t.b.d.',), -(u'ODBCSourceAttribute',u'Value',u'Y',None, None, None, None, u'Text',None, u'Value for ODBC data source attribute',), -(u'ODBCSourceAttribute',u'Attribute',u'N',None, None, None, None, u'Text',None, u'Name of ODBC data source attribute',), -(u'ODBCSourceAttribute',u'DataSource_',u'N',None, None, u'ODBCDataSource',1,u'Identifier',None, u'Reference to ODBC data source in ODBCDataSource table',), -(u'ODBCTranslator',u'Description',u'N',None, None, None, None, u'Text',None, u'Text used as registered name for translator',), -(u'ODBCTranslator',u'File_',u'N',None, None, u'File',1,u'Identifier',None, u'Reference to key translator file',), -(u'ODBCTranslator',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Reference to associated component',), -(u'ODBCTranslator',u'File_Setup',u'Y',None, None, u'File',1,u'Identifier',None, u'Optional reference to key translator setup DLL',), -(u'ODBCTranslator',u'Translator',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized.internal token for translator',), -(u'Patch',u'Sequence',u'N',0,32767,None, None, None, None, u'Primary key, sequence with respect to the media images; order must track cabinet order.',), -(u'Patch',u'Attributes',u'N',0,32767,None, None, None, None, u'Integer containing bit flags representing patch attributes',), -(u'Patch',u'File_',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized token, foreign key to File table, must match identifier in cabinet.',), -(u'Patch',u'Header',u'Y',None, None, None, None, u'Binary',None, u'Binary stream. The patch header, used for patch validation.',), -(u'Patch',u'PatchSize',u'N',0,2147483647,None, None, None, None, u'Size of patch in bytes (long integer).',), -(u'Patch',u'StreamRef_',u'Y',None, None, None, None, u'Identifier',None, u'Identifier. Foreign key to the StreamRef column of the MsiPatchHeaders table.',), -(u'PatchPackage',u'Media_',u'N',0,32767,None, None, None, None, u'Foreign key to DiskId column of Media table. Indicates the disk containing the patch package.',), -(u'PatchPackage',u'PatchId',u'N',None, None, None, None, u'Guid',None, u'A unique string GUID representing this patch.',), -(u'PublishComponent',u'Feature_',u'N',None, None, u'Feature',1,u'Identifier',None, u'Foreign key into the Feature table.',), -(u'PublishComponent',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table.',), -(u'PublishComponent',u'ComponentId',u'N',None, None, None, None, u'Guid',None, u'A string GUID that represents the component id that will be requested by the alien product.',), -(u'PublishComponent',u'AppData',u'Y',None, None, None, None, u'Text',None, u'This is localisable Application specific data that can be associated with a Qualified Component.',), -(u'PublishComponent',u'Qualifier',u'N',None, None, None, None, u'Text',None, u'This is defined only when the ComponentId column is an Qualified Component Id. This is the Qualifier for ProvideComponentIndirect.',), -(u'RadioButton',u'Y',u'N',0,32767,None, None, None, None, u'The vertical coordinate of the upper left corner of the bounding rectangle of the radio button.',), -(u'RadioButton',u'Text',u'Y',None, None, None, None, u'Text',None, u'The visible title to be assigned to the radio button.',), -(u'RadioButton',u'Property',u'N',None, None, None, None, u'Identifier',None, u'A named property to be tied to this radio button. All the buttons tied to the same property become part of the same group.',), -(u'RadioButton',u'Height',u'N',0,32767,None, None, None, None, u'The height of the button.',), -(u'RadioButton',u'Width',u'N',0,32767,None, None, None, None, u'The width of the button.',), -(u'RadioButton',u'X',u'N',0,32767,None, None, None, None, u'The horizontal coordinate of the upper left corner of the bounding rectangle of the radio button.',), -(u'RadioButton',u'Value',u'N',None, None, None, None, u'Formatted',None, u'The value string associated with this button. Selecting the button will set the associated property to this value.',), -(u'RadioButton',u'Order',u'N',1,32767,None, None, None, None, u'A positive integer used to determine the ordering of the items within one list..The integers do not have to be consecutive.',), -(u'RadioButton',u'Help',u'Y',None, None, None, None, u'Text',None, u'The help strings used with the button. The text is optional.',), -(u'Registry',u'Name',u'Y',None, None, None, None, u'Formatted',None, u'The registry value name.',), -(u'Registry',u'Value',u'Y',None, None, None, None, u'Formatted',None, u'The registry value.',), -(u'Registry',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table referencing component that controls the installing of the registry value.',), -(u'Registry',u'Key',u'N',None, None, None, None, u'RegPath',None, u'The key for the registry value.',), -(u'Registry',u'Registry',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized token.',), -(u'Registry',u'Root',u'N',-1,3,None, None, None, None, u'The predefined root key for the registry value, one of rrkEnum.',), -(u'RegLocator',u'Name',u'Y',None, None, None, None, u'Formatted',None, u'The registry value name.',), -(u'RegLocator',u'Type',u'Y',0,18,None, None, None, None, u'An integer value that determines if the registry value is a filename or a directory location or to be used as is w/o interpretation.',), -(u'RegLocator',u'Signature_',u'N',None, None, None, None, u'Identifier',None, u'The table key. The Signature_ represents a unique file signature and is also the foreign key in the Signature table. If the type is 0, the registry values refers a directory, and _Signature is not a foreign key.',), -(u'RegLocator',u'Key',u'N',None, None, None, None, u'RegPath',None, u'The key for the registry value.',), -(u'RegLocator',u'Root',u'N',0,3,None, None, None, None, u'The predefined root key for the registry value, one of rrkEnum.',), -(u'RemoveFile',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key referencing Component that controls the file to be removed.',), -(u'RemoveFile',u'FileKey',u'N',None, None, None, None, u'Identifier',None, u'Primary key used to identify a particular file entry',), -(u'RemoveFile',u'FileName',u'Y',None, None, None, None, u'WildCardFilename',None, u'Name of the file to be removed.',), -(u'RemoveFile',u'DirProperty',u'N',None, None, None, None, u'Identifier',None, u'Name of a property whose value is assumed to resolve to the full pathname to the folder of the file to be removed.',), -(u'RemoveFile',u'InstallMode',u'N',None, None, None, None, None, u'1;2;3',u'Installation option, one of iimEnum.',), -(u'RemoveIniFile',u'Action',u'N',None, None, None, None, None, u'2;4',u'The type of modification to be made, one of iifEnum.',), -(u'RemoveIniFile',u'Value',u'Y',None, None, None, None, u'Formatted',None, u'The value to be deleted. The value is required when Action is iifIniRemoveTag',), -(u'RemoveIniFile',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table referencing component that controls the deletion of the .INI value.',), -(u'RemoveIniFile',u'FileName',u'N',None, None, None, None, u'Filename',None, u'The .INI file name in which to delete the information',), -(u'RemoveIniFile',u'DirProperty',u'Y',None, None, None, None, u'Identifier',None, u'Foreign key into the Directory table denoting the directory where the .INI file is.',), -(u'RemoveIniFile',u'Key',u'N',None, None, None, None, u'Formatted',None, u'The .INI file key below Section.',), -(u'RemoveIniFile',u'Section',u'N',None, None, None, None, u'Formatted',None, u'The .INI file Section.',), -(u'RemoveIniFile',u'RemoveIniFile',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized token.',), -(u'RemoveRegistry',u'Name',u'Y',None, None, None, None, u'Formatted',None, u'The registry value name.',), -(u'RemoveRegistry',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table referencing component that controls the deletion of the registry value.',), -(u'RemoveRegistry',u'Key',u'N',None, None, None, None, u'RegPath',None, u'The key for the registry value.',), -(u'RemoveRegistry',u'Root',u'N',-1,3,None, None, None, None, u'The predefined root key for the registry value, one of rrkEnum',), -(u'RemoveRegistry',u'RemoveRegistry',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized token.',), -(u'ReserveCost',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Reserve a specified amount of space if this component is to be installed.',), -(u'ReserveCost',u'ReserveFolder',u'Y',None, None, None, None, u'Identifier',None, u'Name of a property whose value is assumed to resolve to the full path to the destination directory',), -(u'ReserveCost',u'ReserveKey',u'N',None, None, None, None, u'Identifier',None, u'Primary key that uniquely identifies a particular ReserveCost record',), -(u'ReserveCost',u'ReserveLocal',u'N',0,2147483647,None, None, None, None, u'Disk space to reserve if linked component is installed locally.',), -(u'ReserveCost',u'ReserveSource',u'N',0,2147483647,None, None, None, None, u'Disk space to reserve if linked component is installed to run from the source location.',), -(u'SelfReg',u'File_',u'N',None, None, u'File',1,u'Identifier',None, u'Foreign key into the File table denoting the module that needs to be registered.',), -(u'SelfReg',u'Cost',u'Y',0,32767,None, None, None, None, u'The cost of registering the module.',), -(u'ServiceControl',u'Name',u'N',None, None, None, None, u'Formatted',None, u'Name of a service. /, \\, comma and space are invalid',), -(u'ServiceControl',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Required foreign key into the Component Table that controls the startup of the service',), -(u'ServiceControl',u'Event',u'N',0,187,None, None, None, None, u'Bit field: Install: 0x1 = Start, 0x2 = Stop, 0x8 = Delete, Uninstall: 0x10 = Start, 0x20 = Stop, 0x80 = Delete',), -(u'ServiceControl',u'ServiceControl',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized token.',), -(u'ServiceControl',u'Arguments',u'Y',None, None, None, None, u'Formatted',None, u'Arguments for the service. Separate by [~].',), -(u'ServiceControl',u'Wait',u'Y',0,1,None, None, None, None, u'Boolean for whether to wait for the service to fully start',), -(u'ServiceInstall',u'Name',u'N',None, None, None, None, u'Formatted',None, u'Internal Name of the Service',), -(u'ServiceInstall',u'Description',u'Y',None, None, None, None, u'Text',None, u'Description of service.',), -(u'ServiceInstall',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Required foreign key into the Component Table that controls the startup of the service',), -(u'ServiceInstall',u'Arguments',u'Y',None, None, None, None, u'Formatted',None, u'Arguments to include in every start of the service, passed to WinMain',), -(u'ServiceInstall',u'ServiceInstall',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized token.',), -(u'ServiceInstall',u'Dependencies',u'Y',None, None, None, None, u'Formatted',None, u'Other services this depends on to start. Separate by [~], and end with [~][~]',), -(u'ServiceInstall',u'DisplayName',u'Y',None, None, None, None, u'Formatted',None, u'External Name of the Service',), -(u'ServiceInstall',u'ErrorControl',u'N',-2147483647,2147483647,None, None, None, None, u'Severity of error if service fails to start',), -(u'ServiceInstall',u'LoadOrderGroup',u'Y',None, None, None, None, u'Formatted',None, u'LoadOrderGroup',), -(u'ServiceInstall',u'Password',u'Y',None, None, None, None, u'Formatted',None, u'password to run service with. (with StartName)',), -(u'ServiceInstall',u'ServiceType',u'N',-2147483647,2147483647,None, None, None, None, u'Type of the service',), -(u'ServiceInstall',u'StartName',u'Y',None, None, None, None, u'Formatted',None, u'User or object name to run service as',), -(u'ServiceInstall',u'StartType',u'N',0,4,None, None, None, None, u'Type of the service',), -(u'Shortcut',u'Name',u'N',None, None, None, None, u'Filename',None, u'The name of the shortcut to be created.',), -(u'Shortcut',u'Description',u'Y',None, None, None, None, u'Text',None, u'The description for the shortcut.',), -(u'Shortcut',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table denoting the component whose selection gates the the shortcut creation/deletion.',), -(u'Shortcut',u'Icon_',u'Y',None, None, u'Icon',1,u'Identifier',None, u'Foreign key into the File table denoting the external icon file for the shortcut.',), -(u'Shortcut',u'IconIndex',u'Y',-32767,32767,None, None, None, None, u'The icon index for the shortcut.',), -(u'Shortcut',u'Directory_',u'N',None, None, u'Directory',1,u'Identifier',None, u'Foreign key into the Directory table denoting the directory where the shortcut file is created.',), -(u'Shortcut',u'Target',u'N',None, None, None, None, u'Shortcut',None, u'The shortcut target. This is usually a property that is expanded to a file or a folder that the shortcut points to.',), -(u'Shortcut',u'Arguments',u'Y',None, None, None, None, u'Formatted',None, u'The command-line arguments for the shortcut.',), -(u'Shortcut',u'Shortcut',u'N',None, None, None, None, u'Identifier',None, u'Primary key, non-localized token.',), -(u'Shortcut',u'Hotkey',u'Y',0,32767,None, None, None, None, u'The hotkey for the shortcut. It has the virtual-key code for the key in the low-order byte, and the modifier flags in the high-order byte. ',), -(u'Shortcut',u'ShowCmd',u'Y',None, None, None, None, None, u'1;3;7',u'The show command for the application window.The following values may be used.',), -(u'Shortcut',u'WkDir',u'Y',None, None, None, None, u'Identifier',None, u'Name of property defining location of working directory.',), -(u'Signature',u'FileName',u'N',None, None, None, None, u'Filename',None, u'The name of the file. This may contain a "short name|long name" pair.',), -(u'Signature',u'Signature',u'N',None, None, None, None, u'Identifier',None, u'The table key. The Signature represents a unique file signature.',), -(u'Signature',u'Languages',u'Y',None, None, None, None, u'Language',None, u'The languages supported by the file.',), -(u'Signature',u'MaxDate',u'Y',0,2147483647,None, None, None, None, u'The maximum creation date of the file.',), -(u'Signature',u'MaxSize',u'Y',0,2147483647,None, None, None, None, u'The maximum size of the file. ',), -(u'Signature',u'MaxVersion',u'Y',None, None, None, None, u'Text',None, u'The maximum version of the file.',), -(u'Signature',u'MinDate',u'Y',0,2147483647,None, None, None, None, u'The minimum creation date of the file.',), -(u'Signature',u'MinSize',u'Y',0,2147483647,None, None, None, None, u'The minimum size of the file.',), -(u'Signature',u'MinVersion',u'Y',None, None, None, None, u'Text',None, u'The minimum version of the file.',), -(u'TextStyle',u'TextStyle',u'N',None, None, None, None, u'Identifier',None, u'Name of the style. The primary key of this table. This name is embedded in the texts to indicate a style change.',), -(u'TextStyle',u'Color',u'Y',0,16777215,None, None, None, None, u'A long integer indicating the color of the string in the RGB format (Red, Green, Blue each 0-255, RGB = R + 256*G + 256^2*B).',), -(u'TextStyle',u'FaceName',u'N',None, None, None, None, u'Text',None, u'A string indicating the name of the font used. Required. The string must be at most 31 characters long.',), -(u'TextStyle',u'Size',u'N',0,32767,None, None, None, None, u'The size of the font used. This size is given in our units (1/12 of the system font height). Assuming that the system font is set to 12 point size, this is equivalent to the point size.',), -(u'TextStyle',u'StyleBits',u'Y',0,15,None, None, None, None, u'A combination of style bits.',), -(u'TypeLib',u'Description',u'Y',None, None, None, None, u'Text',None, None, ), -(u'TypeLib',u'Feature_',u'N',None, None, u'Feature',1,u'Identifier',None, u'Required foreign key into the Feature Table, specifying the feature to validate or install in order for the type library to be operational.',), -(u'TypeLib',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Required foreign key into the Component Table, specifying the component for which to return a path when called through LocateComponent.',), -(u'TypeLib',u'Directory_',u'Y',None, None, u'Directory',1,u'Identifier',None, u'Optional. The foreign key into the Directory table denoting the path to the help file for the type library.',), -(u'TypeLib',u'Language',u'N',0,32767,None, None, None, None, u'The language of the library.',), -(u'TypeLib',u'Version',u'Y',0,16777215,None, None, None, None, u'The version of the library. The minor version is in the lower 8 bits of the integer. The major version is in the next 16 bits. ',), -(u'TypeLib',u'Cost',u'Y',0,2147483647,None, None, None, None, u'The cost associated with the registration of the typelib. This column is currently optional.',), -(u'TypeLib',u'LibID',u'N',None, None, None, None, u'Guid',None, u'The GUID that represents the library.',), -(u'UIText',u'Text',u'Y',None, None, None, None, u'Text',None, u'The localized version of the string.',), -(u'UIText',u'Key',u'N',None, None, None, None, u'Identifier',None, u'A unique key that identifies the particular string.',), -(u'Upgrade',u'Attributes',u'N',0,2147483647,None, None, None, None, u'The attributes of this product set.',), -(u'Upgrade',u'Language',u'Y',None, None, None, None, u'Language',None, u'A comma-separated list of languages for either products in this set or products not in this set.',), -(u'Upgrade',u'ActionProperty',u'N',None, None, None, None, u'UpperCase',None, u'The property to set when a product in this set is found.',), -(u'Upgrade',u'Remove',u'Y',None, None, None, None, u'Formatted',None, u'The list of features to remove when uninstalling a product from this set. The default is "ALL".',), -(u'Upgrade',u'UpgradeCode',u'N',None, None, None, None, u'Guid',None, u'The UpgradeCode GUID belonging to the products in this set.',), -(u'Upgrade',u'VersionMax',u'Y',None, None, None, None, u'Text',None, u'The maximum ProductVersion of the products in this set. The set may or may not include products with this particular version.',), -(u'Upgrade',u'VersionMin',u'Y',None, None, None, None, u'Text',None, u'The minimum ProductVersion of the products in this set. The set may or may not include products with this particular version.',), -(u'Verb',u'Sequence',u'Y',0,32767,None, None, None, None, u'Order within the verbs for a particular extension. Also used simply to specify the default verb.',), -(u'Verb',u'Argument',u'Y',None, None, None, None, u'Formatted',None, u'Optional value for the command arguments.',), -(u'Verb',u'Extension_',u'N',None, None, u'Extension',1,u'Text',None, u'The extension associated with the table row.',), -(u'Verb',u'Verb',u'N',None, None, None, None, u'Text',None, u'The verb for the command.',), -(u'Verb',u'Command',u'Y',None, None, None, None, u'Formatted',None, u'The command text.',), +('_Validation','Table','N',None, None, None, None, 'Identifier',None, 'Name of table',), +('_Validation','Column','N',None, None, None, None, 'Identifier',None, 'Name of column',), +('_Validation','Description','Y',None, None, None, None, 'Text',None, 'Description of column',), +('_Validation','Set','Y',None, None, None, None, 'Text',None, 'Set of values that are permitted',), +('_Validation','Category','Y',None, None, None, None, None, 'Text;Formatted;Template;Condition;Guid;Path;Version;Language;Identifier;Binary;UpperCase;LowerCase;Filename;Paths;AnyPath;WildCardFilename;RegPath;KeyFormatted;CustomSource;Property;Cabinet;Shortcut;URL','String category',), +('_Validation','KeyColumn','Y',1,32,None, None, None, None, 'Column to which foreign key connects',), +('_Validation','KeyTable','Y',None, None, None, None, 'Identifier',None, 'For foreign key, Name of table to which data must link',), +('_Validation','MaxValue','Y',-2147483647,2147483647,None, None, None, None, 'Maximum value allowed',), +('_Validation','MinValue','Y',-2147483647,2147483647,None, None, None, None, 'Minimum value allowed',), +('_Validation','Nullable','N',None, None, None, None, None, 'Y;N;@','Whether the column is nullable',), +('ActionText','Description','Y',None, None, None, None, 'Text',None, 'Localized description displayed in progress dialog and log when action is executing.',), +('ActionText','Action','N',None, None, None, None, 'Identifier',None, 'Name of action to be described.',), +('ActionText','Template','Y',None, None, None, None, 'Template',None, 'Optional localized format template used to format action data records for display during action execution.',), +('AdminExecuteSequence','Action','N',None, None, None, None, 'Identifier',None, 'Name of action to invoke, either in the engine or the handler DLL.',), +('AdminExecuteSequence','Condition','Y',None, None, None, None, 'Condition',None, 'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), +('AdminExecuteSequence','Sequence','Y',-4,32767,None, None, None, None, 'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), +('Condition','Condition','Y',None, None, None, None, 'Condition',None, 'Expression evaluated to determine if Level in the Feature table is to change.',), +('Condition','Feature_','N',None, None, 'Feature',1,'Identifier',None, 'Reference to a Feature entry in Feature table.',), +('Condition','Level','N',0,32767,None, None, None, None, 'New selection Level to set in Feature table if Condition evaluates to TRUE.',), +('AdminUISequence','Action','N',None, None, None, None, 'Identifier',None, 'Name of action to invoke, either in the engine or the handler DLL.',), +('AdminUISequence','Condition','Y',None, None, None, None, 'Condition',None, 'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), +('AdminUISequence','Sequence','Y',-4,32767,None, None, None, None, 'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), +('AdvtExecuteSequence','Action','N',None, None, None, None, 'Identifier',None, 'Name of action to invoke, either in the engine or the handler DLL.',), +('AdvtExecuteSequence','Condition','Y',None, None, None, None, 'Condition',None, 'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), +('AdvtExecuteSequence','Sequence','Y',-4,32767,None, None, None, None, 'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), +('AdvtUISequence','Action','N',None, None, None, None, 'Identifier',None, 'Name of action to invoke, either in the engine or the handler DLL.',), +('AdvtUISequence','Condition','Y',None, None, None, None, 'Condition',None, 'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), +('AdvtUISequence','Sequence','Y',-4,32767,None, None, None, None, 'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), +('AppId','AppId','N',None, None, None, None, 'Guid',None, None, ), +('AppId','ActivateAtStorage','Y',0,1,None, None, None, None, None, ), +('AppId','DllSurrogate','Y',None, None, None, None, 'Text',None, None, ), +('AppId','LocalService','Y',None, None, None, None, 'Text',None, None, ), +('AppId','RemoteServerName','Y',None, None, None, None, 'Formatted',None, None, ), +('AppId','RunAsInteractiveUser','Y',0,1,None, None, None, None, None, ), +('AppId','ServiceParameters','Y',None, None, None, None, 'Text',None, None, ), +('AppSearch','Property','N',None, None, None, None, 'Identifier',None, 'The property associated with a Signature',), +('AppSearch','Signature_','N',None, None, 'Signature;RegLocator;IniLocator;DrLocator;CompLocator',1,'Identifier',None, 'The Signature_ represents a unique file signature and is also the foreign key in the Signature, RegLocator, IniLocator, CompLocator and the DrLocator tables.',), +('Property','Property','N',None, None, None, None, 'Identifier',None, 'Name of property, uppercase if settable by launcher or loader.',), +('Property','Value','N',None, None, None, None, 'Text',None, 'String value for property. Never null or empty.',), +('BBControl','Type','N',None, None, None, None, 'Identifier',None, 'The type of the control.',), +('BBControl','Y','N',0,32767,None, None, None, None, 'Vertical coordinate of the upper left corner of the bounding rectangle of the control.',), +('BBControl','Text','Y',None, None, None, None, 'Text',None, 'A string used to set the initial text contained within a control (if appropriate).',), +('BBControl','BBControl','N',None, None, None, None, 'Identifier',None, 'Name of the control. This name must be unique within a billboard, but can repeat on different billboard.',), +('BBControl','Attributes','Y',0,2147483647,None, None, None, None, 'A 32-bit word that specifies the attribute flags to be applied to this control.',), +('BBControl','Billboard_','N',None, None, 'Billboard',1,'Identifier',None, 'External key to the Billboard table, name of the billboard.',), +('BBControl','Height','N',0,32767,None, None, None, None, 'Height of the bounding rectangle of the control.',), +('BBControl','Width','N',0,32767,None, None, None, None, 'Width of the bounding rectangle of the control.',), +('BBControl','X','N',0,32767,None, None, None, None, 'Horizontal coordinate of the upper left corner of the bounding rectangle of the control.',), +('Billboard','Action','Y',None, None, None, None, 'Identifier',None, 'The name of an action. The billboard is displayed during the progress messages received from this action.',), +('Billboard','Billboard','N',None, None, None, None, 'Identifier',None, 'Name of the billboard.',), +('Billboard','Feature_','N',None, None, 'Feature',1,'Identifier',None, 'An external key to the Feature Table. The billboard is shown only if this feature is being installed.',), +('Billboard','Ordering','Y',0,32767,None, None, None, None, 'A positive integer. If there is more than one billboard corresponding to an action they will be shown in the order defined by this column.',), +('Feature','Description','Y',None, None, None, None, 'Text',None, 'Longer descriptive text describing a visible feature item.',), +('Feature','Attributes','N',None, None, None, None, None, '0;1;2;4;5;6;8;9;10;16;17;18;20;21;22;24;25;26;32;33;34;36;37;38;48;49;50;52;53;54','Feature attributes',), +('Feature','Feature','N',None, None, None, None, 'Identifier',None, 'Primary key used to identify a particular feature record.',), +('Feature','Directory_','Y',None, None, 'Directory',1,'UpperCase',None, 'The name of the Directory that can be configured by the UI. A non-null value will enable the browse button.',), +('Feature','Level','N',0,32767,None, None, None, None, 'The install level at which record will be initially selected. An install level of 0 will disable an item and prevent its display.',), +('Feature','Title','Y',None, None, None, None, 'Text',None, 'Short text identifying a visible feature item.',), +('Feature','Display','Y',0,32767,None, None, None, None, 'Numeric sort order, used to force a specific display ordering.',), +('Feature','Feature_Parent','Y',None, None, 'Feature',1,'Identifier',None, 'Optional key of a parent record in the same table. If the parent is not selected, then the record will not be installed. Null indicates a root item.',), +('Binary','Name','N',None, None, None, None, 'Identifier',None, 'Unique key identifying the binary data.',), +('Binary','Data','N',None, None, None, None, 'Binary',None, 'The unformatted binary data.',), +('BindImage','File_','N',None, None, 'File',1,'Identifier',None, 'The index into the File table. This must be an executable file.',), +('BindImage','Path','Y',None, None, None, None, 'Paths',None, 'A list of ; delimited paths that represent the paths to be searched for the import DLLS. The list is usually a list of properties each enclosed within square brackets [] .',), +('File','Sequence','N',1,32767,None, None, None, None, 'Sequence with respect to the media images; order must track cabinet order.',), +('File','Attributes','Y',0,32767,None, None, None, None, 'Integer containing bit flags representing file attributes (with the decimal value of each bit position in parentheses)',), +('File','File','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized token, must match identifier in cabinet. For uncompressed files, this field is ignored.',), +('File','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key referencing Component that controls the file.',), +('File','FileName','N',None, None, None, None, 'Filename',None, 'File name used for installation, may be localized. This may contain a "short name|long name" pair.',), +('File','FileSize','N',0,2147483647,None, None, None, None, 'Size of file in bytes (long integer).',), +('File','Language','Y',None, None, None, None, 'Language',None, 'List of decimal language Ids, comma-separated if more than one.',), +('File','Version','Y',None, None, 'File',1,'Version',None, 'Version string for versioned files; Blank for unversioned files.',), +('CCPSearch','Signature_','N',None, None, 'Signature;RegLocator;IniLocator;DrLocator;CompLocator',1,'Identifier',None, 'The Signature_ represents a unique file signature and is also the foreign key in the Signature, RegLocator, IniLocator, CompLocator and the DrLocator tables.',), +('CheckBox','Property','N',None, None, None, None, 'Identifier',None, 'A named property to be tied to the item.',), +('CheckBox','Value','Y',None, None, None, None, 'Formatted',None, 'The value string associated with the item.',), +('Class','Description','Y',None, None, None, None, 'Text',None, 'Localized description for the Class.',), +('Class','Attributes','Y',None, 32767,None, None, None, None, 'Class registration attributes.',), +('Class','Feature_','N',None, None, 'Feature',1,'Identifier',None, 'Required foreign key into the Feature Table, specifying the feature to validate or install in order for the CLSID factory to be operational.',), +('Class','AppId_','Y',None, None, 'AppId',1,'Guid',None, 'Optional AppID containing DCOM information for associated application (string GUID).',), +('Class','Argument','Y',None, None, None, None, 'Formatted',None, 'optional argument for LocalServers.',), +('Class','CLSID','N',None, None, None, None, 'Guid',None, 'The CLSID of an OLE factory.',), +('Class','Component_','N',None, None, 'Component',1,'Identifier',None, 'Required foreign key into the Component Table, specifying the component for which to return a path when called through LocateComponent.',), +('Class','Context','N',None, None, None, None, 'Identifier',None, 'The numeric server context for this server. CLSCTX_xxxx',), +('Class','DefInprocHandler','Y',None, None, None, None, 'Filename','1;2;3','Optional default inproc handler. Only optionally provided if Context=CLSCTX_LOCAL_SERVER. Typically "ole32.dll" or "mapi32.dll"',), +('Class','FileTypeMask','Y',None, None, None, None, 'Text',None, 'Optional string containing information for the HKCRthis CLSID) key. If multiple patterns exist, they must be delimited by a semicolon, and numeric subkeys will be generated: 0,1,2...',), +('Class','Icon_','Y',None, None, 'Icon',1,'Identifier',None, 'Optional foreign key into the Icon Table, specifying the icon file associated with this CLSID. Will be written under the DefaultIcon key.',), +('Class','IconIndex','Y',-32767,32767,None, None, None, None, 'Optional icon index.',), +('Class','ProgId_Default','Y',None, None, 'ProgId',1,'Text',None, 'Optional ProgId associated with this CLSID.',), +('Component','Condition','Y',None, None, None, None, 'Condition',None, "A conditional statement that will disable this component if the specified condition evaluates to the 'True' state. If a component is disabled, it will not be installed, regardless of the 'Action' state associated with the component.",), +('Component','Attributes','N',None, None, None, None, None, None, 'Remote execution option, one of irsEnum',), +('Component','Component','N',None, None, None, None, 'Identifier',None, 'Primary key used to identify a particular component record.',), +('Component','ComponentId','Y',None, None, None, None, 'Guid',None, 'A string GUID unique to this component, version, and language.',), +('Component','Directory_','N',None, None, 'Directory',1,'Identifier',None, 'Required key of a Directory table record. This is actually a property name whose value contains the actual path, set either by the AppSearch action or with the default setting obtained from the Directory table.',), +('Component','KeyPath','Y',None, None, 'File;Registry;ODBCDataSource',1,'Identifier',None, 'Either the primary key into the File table, Registry table, or ODBCDataSource table. This extract path is stored when the component is installed, and is used to detect the presence of the component and to return the path to it.',), +('Icon','Name','N',None, None, None, None, 'Identifier',None, 'Primary key. Name of the icon file.',), +('Icon','Data','N',None, None, None, None, 'Binary',None, 'Binary stream. The binary icon data in PE (.DLL or .EXE) or icon (.ICO) format.',), +('ProgId','Description','Y',None, None, None, None, 'Text',None, 'Localized description for the Program identifier.',), +('ProgId','Icon_','Y',None, None, 'Icon',1,'Identifier',None, 'Optional foreign key into the Icon Table, specifying the icon file associated with this ProgId. Will be written under the DefaultIcon key.',), +('ProgId','IconIndex','Y',-32767,32767,None, None, None, None, 'Optional icon index.',), +('ProgId','ProgId','N',None, None, None, None, 'Text',None, 'The Program Identifier. Primary key.',), +('ProgId','Class_','Y',None, None, 'Class',1,'Guid',None, 'The CLSID of an OLE factory corresponding to the ProgId.',), +('ProgId','ProgId_Parent','Y',None, None, 'ProgId',1,'Text',None, 'The Parent Program Identifier. If specified, the ProgId column becomes a version independent prog id.',), +('ComboBox','Text','Y',None, None, None, None, 'Formatted',None, 'The visible text to be assigned to the item. Optional. If this entry or the entire column is missing, the text is the same as the value.',), +('ComboBox','Property','N',None, None, None, None, 'Identifier',None, 'A named property to be tied to this item. All the items tied to the same property become part of the same combobox.',), +('ComboBox','Value','N',None, None, None, None, 'Formatted',None, 'The value string associated with this item. Selecting the line will set the associated property to this value.',), +('ComboBox','Order','N',1,32767,None, None, None, None, 'A positive integer used to determine the ordering of the items within one list.\tThe integers do not have to be consecutive.',), +('CompLocator','Type','Y',0,1,None, None, None, None, 'A boolean value that determines if the registry value is a filename or a directory location.',), +('CompLocator','Signature_','N',None, None, None, None, 'Identifier',None, 'The table key. The Signature_ represents a unique file signature and is also the foreign key in the Signature table.',), +('CompLocator','ComponentId','N',None, None, None, None, 'Guid',None, 'A string GUID unique to this component, version, and language.',), +('Complus','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key referencing Component that controls the ComPlus component.',), +('Complus','ExpType','Y',0,32767,None, None, None, None, 'ComPlus component attributes.',), +('Directory','Directory','N',None, None, None, None, 'Identifier',None, 'Unique identifier for directory entry, primary key. If a property by this name is defined, it contains the full path to the directory.',), +('Directory','DefaultDir','N',None, None, None, None, 'DefaultDir',None, "The default sub-path under parent's path.",), +('Directory','Directory_Parent','Y',None, None, 'Directory',1,'Identifier',None, 'Reference to the entry in this table specifying the default parent directory. A record parented to itself or with a Null parent represents a root of the install tree.',), +('Control','Type','N',None, None, None, None, 'Identifier',None, 'The type of the control.',), +('Control','Y','N',0,32767,None, None, None, None, 'Vertical coordinate of the upper left corner of the bounding rectangle of the control.',), +('Control','Text','Y',None, None, None, None, 'Formatted',None, 'A string used to set the initial text contained within a control (if appropriate).',), +('Control','Property','Y',None, None, None, None, 'Identifier',None, 'The name of a defined property to be linked to this control. ',), +('Control','Attributes','Y',0,2147483647,None, None, None, None, 'A 32-bit word that specifies the attribute flags to be applied to this control.',), +('Control','Height','N',0,32767,None, None, None, None, 'Height of the bounding rectangle of the control.',), +('Control','Width','N',0,32767,None, None, None, None, 'Width of the bounding rectangle of the control.',), +('Control','X','N',0,32767,None, None, None, None, 'Horizontal coordinate of the upper left corner of the bounding rectangle of the control.',), +('Control','Control','N',None, None, None, None, 'Identifier',None, 'Name of the control. This name must be unique within a dialog, but can repeat on different dialogs. ',), +('Control','Control_Next','Y',None, None, 'Control',2,'Identifier',None, 'The name of an other control on the same dialog. This link defines the tab order of the controls. The links have to form one or more cycles!',), +('Control','Dialog_','N',None, None, 'Dialog',1,'Identifier',None, 'External key to the Dialog table, name of the dialog.',), +('Control','Help','Y',None, None, None, None, 'Text',None, 'The help strings used with the button. The text is optional. ',), +('Dialog','Attributes','Y',0,2147483647,None, None, None, None, 'A 32-bit word that specifies the attribute flags to be applied to this dialog.',), +('Dialog','Height','N',0,32767,None, None, None, None, 'Height of the bounding rectangle of the dialog.',), +('Dialog','Width','N',0,32767,None, None, None, None, 'Width of the bounding rectangle of the dialog.',), +('Dialog','Dialog','N',None, None, None, None, 'Identifier',None, 'Name of the dialog.',), +('Dialog','Control_Cancel','Y',None, None, 'Control',2,'Identifier',None, 'Defines the cancel control. Hitting escape or clicking on the close icon on the dialog is equivalent to pushing this button.',), +('Dialog','Control_Default','Y',None, None, 'Control',2,'Identifier',None, 'Defines the default control. Hitting return is equivalent to pushing this button.',), +('Dialog','Control_First','N',None, None, 'Control',2,'Identifier',None, 'Defines the control that has the focus when the dialog is created.',), +('Dialog','HCentering','N',0,100,None, None, None, None, 'Horizontal position of the dialog on a 0-100 scale. 0 means left end, 100 means right end of the screen, 50 center.',), +('Dialog','Title','Y',None, None, None, None, 'Formatted',None, "A text string specifying the title to be displayed in the title bar of the dialog's window.",), +('Dialog','VCentering','N',0,100,None, None, None, None, 'Vertical position of the dialog on a 0-100 scale. 0 means top end, 100 means bottom end of the screen, 50 center.',), +('ControlCondition','Action','N',None, None, None, None, None, 'Default;Disable;Enable;Hide;Show','The desired action to be taken on the specified control.',), +('ControlCondition','Condition','N',None, None, None, None, 'Condition',None, 'A standard conditional statement that specifies under which conditions the action should be triggered.',), +('ControlCondition','Dialog_','N',None, None, 'Dialog',1,'Identifier',None, 'A foreign key to the Dialog table, name of the dialog.',), +('ControlCondition','Control_','N',None, None, 'Control',2,'Identifier',None, 'A foreign key to the Control table, name of the control.',), +('ControlEvent','Condition','Y',None, None, None, None, 'Condition',None, 'A standard conditional statement that specifies under which conditions an event should be triggered.',), +('ControlEvent','Ordering','Y',0,2147483647,None, None, None, None, 'An integer used to order several events tied to the same control. Can be left blank.',), +('ControlEvent','Argument','N',None, None, None, None, 'Formatted',None, 'A value to be used as a modifier when triggering a particular event.',), +('ControlEvent','Dialog_','N',None, None, 'Dialog',1,'Identifier',None, 'A foreign key to the Dialog table, name of the dialog.',), +('ControlEvent','Control_','N',None, None, 'Control',2,'Identifier',None, 'A foreign key to the Control table, name of the control',), +('ControlEvent','Event','N',None, None, None, None, 'Formatted',None, 'An identifier that specifies the type of the event that should take place when the user interacts with control specified by the first two entries.',), +('CreateFolder','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into the Component table.',), +('CreateFolder','Directory_','N',None, None, 'Directory',1,'Identifier',None, 'Primary key, could be foreign key into the Directory table.',), +('CustomAction','Type','N',1,16383,None, None, None, None, 'The numeric custom action type, consisting of source location, code type, entry, option flags.',), +('CustomAction','Action','N',None, None, None, None, 'Identifier',None, 'Primary key, name of action, normally appears in sequence table unless private use.',), +('CustomAction','Source','Y',None, None, None, None, 'CustomSource',None, 'The table reference of the source of the code.',), +('CustomAction','Target','Y',None, None, None, None, 'Formatted',None, 'Excecution parameter, depends on the type of custom action',), +('DrLocator','Signature_','N',None, None, None, None, 'Identifier',None, 'The Signature_ represents a unique file signature and is also the foreign key in the Signature table.',), +('DrLocator','Path','Y',None, None, None, None, 'AnyPath',None, 'The path on the user system. This is a either a subpath below the value of the Parent or a full path. The path may contain properties enclosed within [ ] that will be expanded.',), +('DrLocator','Depth','Y',0,32767,None, None, None, None, 'The depth below the path to which the Signature_ is recursively searched. If absent, the depth is assumed to be 0.',), +('DrLocator','Parent','Y',None, None, None, None, 'Identifier',None, 'The parent file signature. It is also a foreign key in the Signature table. If null and the Path column does not expand to a full path, then all the fixed drives of the user system are searched using the Path.',), +('DuplicateFile','File_','N',None, None, 'File',1,'Identifier',None, 'Foreign key referencing the source file to be duplicated.',), +('DuplicateFile','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key referencing Component that controls the duplicate file.',), +('DuplicateFile','DestFolder','Y',None, None, None, None, 'Identifier',None, 'Name of a property whose value is assumed to resolve to the full pathname to a destination folder.',), +('DuplicateFile','DestName','Y',None, None, None, None, 'Filename',None, 'Filename to be given to the duplicate file.',), +('DuplicateFile','FileKey','N',None, None, None, None, 'Identifier',None, 'Primary key used to identify a particular file entry',), +('Environment','Name','N',None, None, None, None, 'Text',None, 'The name of the environmental value.',), +('Environment','Value','Y',None, None, None, None, 'Formatted',None, 'The value to set in the environmental settings.',), +('Environment','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into the Component table referencing component that controls the installing of the environmental value.',), +('Environment','Environment','N',None, None, None, None, 'Identifier',None, 'Unique identifier for the environmental variable setting',), +('Error','Error','N',0,32767,None, None, None, None, 'Integer error number, obtained from header file IError(...) macros.',), +('Error','Message','Y',None, None, None, None, 'Template',None, 'Error formatting template, obtained from user ed. or localizers.',), +('EventMapping','Dialog_','N',None, None, 'Dialog',1,'Identifier',None, 'A foreign key to the Dialog table, name of the Dialog.',), +('EventMapping','Control_','N',None, None, 'Control',2,'Identifier',None, 'A foreign key to the Control table, name of the control.',), +('EventMapping','Event','N',None, None, None, None, 'Identifier',None, 'An identifier that specifies the type of the event that the control subscribes to.',), +('EventMapping','Attribute','N',None, None, None, None, 'Identifier',None, 'The name of the control attribute, that is set when this event is received.',), +('Extension','Feature_','N',None, None, 'Feature',1,'Identifier',None, 'Required foreign key into the Feature Table, specifying the feature to validate or install in order for the CLSID factory to be operational.',), +('Extension','Component_','N',None, None, 'Component',1,'Identifier',None, 'Required foreign key into the Component Table, specifying the component for which to return a path when called through LocateComponent.',), +('Extension','Extension','N',None, None, None, None, 'Text',None, 'The extension associated with the table row.',), +('Extension','MIME_','Y',None, None, 'MIME',1,'Text',None, 'Optional Context identifier, typically "type/format" associated with the extension',), +('Extension','ProgId_','Y',None, None, 'ProgId',1,'Text',None, 'Optional ProgId associated with this extension.',), +('MIME','CLSID','Y',None, None, None, None, 'Guid',None, 'Optional associated CLSID.',), +('MIME','ContentType','N',None, None, None, None, 'Text',None, 'Primary key. Context identifier, typically "type/format".',), +('MIME','Extension_','N',None, None, 'Extension',1,'Text',None, 'Optional associated extension (without dot)',), +('FeatureComponents','Feature_','N',None, None, 'Feature',1,'Identifier',None, 'Foreign key into Feature table.',), +('FeatureComponents','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into Component table.',), +('FileSFPCatalog','File_','N',None, None, 'File',1,'Identifier',None, 'File associated with the catalog',), +('FileSFPCatalog','SFPCatalog_','N',None, None, 'SFPCatalog',1,'Filename',None, 'Catalog associated with the file',), +('SFPCatalog','SFPCatalog','N',None, None, None, None, 'Filename',None, 'File name for the catalog.',), +('SFPCatalog','Catalog','N',None, None, None, None, 'Binary',None, 'SFP Catalog',), +('SFPCatalog','Dependency','Y',None, None, None, None, 'Formatted',None, 'Parent catalog - only used by SFP',), +('Font','File_','N',None, None, 'File',1,'Identifier',None, 'Primary key, foreign key into File table referencing font file.',), +('Font','FontTitle','Y',None, None, None, None, 'Text',None, 'Font name.',), +('IniFile','Action','N',None, None, None, None, None, '0;1;3','The type of modification to be made, one of iifEnum',), +('IniFile','Value','N',None, None, None, None, 'Formatted',None, 'The value to be written.',), +('IniFile','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into the Component table referencing component that controls the installing of the .INI value.',), +('IniFile','FileName','N',None, None, None, None, 'Filename',None, 'The .INI file name in which to write the information',), +('IniFile','IniFile','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized token.',), +('IniFile','DirProperty','Y',None, None, None, None, 'Identifier',None, 'Foreign key into the Directory table denoting the directory where the .INI file is.',), +('IniFile','Key','N',None, None, None, None, 'Formatted',None, 'The .INI file key below Section.',), +('IniFile','Section','N',None, None, None, None, 'Formatted',None, 'The .INI file Section.',), +('IniLocator','Type','Y',0,2,None, None, None, None, 'An integer value that determines if the .INI value read is a filename or a directory location or to be used as is w/o interpretation.',), +('IniLocator','Signature_','N',None, None, None, None, 'Identifier',None, 'The table key. The Signature_ represents a unique file signature and is also the foreign key in the Signature table.',), +('IniLocator','FileName','N',None, None, None, None, 'Filename',None, 'The .INI file name.',), +('IniLocator','Key','N',None, None, None, None, 'Text',None, 'Key value (followed by an equals sign in INI file).',), +('IniLocator','Section','N',None, None, None, None, 'Text',None, 'Section name within in file (within square brackets in INI file).',), +('IniLocator','Field','Y',0,32767,None, None, None, None, 'The field in the .INI line. If Field is null or 0 the entire line is read.',), +('InstallExecuteSequence','Action','N',None, None, None, None, 'Identifier',None, 'Name of action to invoke, either in the engine or the handler DLL.',), +('InstallExecuteSequence','Condition','Y',None, None, None, None, 'Condition',None, 'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), +('InstallExecuteSequence','Sequence','Y',-4,32767,None, None, None, None, 'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), +('InstallUISequence','Action','N',None, None, None, None, 'Identifier',None, 'Name of action to invoke, either in the engine or the handler DLL.',), +('InstallUISequence','Condition','Y',None, None, None, None, 'Condition',None, 'Optional expression which skips the action if evaluates to expFalse.If the expression syntax is invalid, the engine will terminate, returning iesBadActionData.',), +('InstallUISequence','Sequence','Y',-4,32767,None, None, None, None, 'Number that determines the sort order in which the actions are to be executed. Leave blank to suppress action.',), +('IsolatedComponent','Component_Application','N',None, None, 'Component',1,'Identifier',None, 'Key to Component table item for application',), +('IsolatedComponent','Component_Shared','N',None, None, 'Component',1,'Identifier',None, 'Key to Component table item to be isolated',), +('LaunchCondition','Description','N',None, None, None, None, 'Formatted',None, 'Localizable text to display when condition fails and install must abort.',), +('LaunchCondition','Condition','N',None, None, None, None, 'Condition',None, 'Expression which must evaluate to TRUE in order for install to commence.',), +('ListBox','Text','Y',None, None, None, None, 'Text',None, 'The visible text to be assigned to the item. Optional. If this entry or the entire column is missing, the text is the same as the value.',), +('ListBox','Property','N',None, None, None, None, 'Identifier',None, 'A named property to be tied to this item. All the items tied to the same property become part of the same listbox.',), +('ListBox','Value','N',None, None, None, None, 'Formatted',None, 'The value string associated with this item. Selecting the line will set the associated property to this value.',), +('ListBox','Order','N',1,32767,None, None, None, None, 'A positive integer used to determine the ordering of the items within one list..The integers do not have to be consecutive.',), +('ListView','Text','Y',None, None, None, None, 'Text',None, 'The visible text to be assigned to the item. Optional. If this entry or the entire column is missing, the text is the same as the value.',), +('ListView','Property','N',None, None, None, None, 'Identifier',None, 'A named property to be tied to this item. All the items tied to the same property become part of the same listview.',), +('ListView','Value','N',None, None, None, None, 'Identifier',None, 'The value string associated with this item. Selecting the line will set the associated property to this value.',), +('ListView','Order','N',1,32767,None, None, None, None, 'A positive integer used to determine the ordering of the items within one list..The integers do not have to be consecutive.',), +('ListView','Binary_','Y',None, None, 'Binary',1,'Identifier',None, 'The name of the icon to be displayed with the icon. The binary information is looked up from the Binary Table.',), +('LockPermissions','Table','N',None, None, None, None, 'Identifier','Directory;File;Registry','Reference to another table name',), +('LockPermissions','Domain','Y',None, None, None, None, 'Formatted',None, 'Domain name for user whose permissions are being set. (usually a property)',), +('LockPermissions','LockObject','N',None, None, None, None, 'Identifier',None, 'Foreign key into Registry or File table',), +('LockPermissions','Permission','Y',-2147483647,2147483647,None, None, None, None, 'Permission Access mask. Full Control = 268435456 (GENERIC_ALL = 0x10000000)',), +('LockPermissions','User','N',None, None, None, None, 'Formatted',None, 'User for permissions to be set. (usually a property)',), +('Media','Source','Y',None, None, None, None, 'Property',None, 'The property defining the location of the cabinet file.',), +('Media','Cabinet','Y',None, None, None, None, 'Cabinet',None, 'If some or all of the files stored on the media are compressed in a cabinet, the name of that cabinet.',), +('Media','DiskId','N',1,32767,None, None, None, None, 'Primary key, integer to determine sort order for table.',), +('Media','DiskPrompt','Y',None, None, None, None, 'Text',None, 'Disk name: the visible text actually printed on the disk. This will be used to prompt the user when this disk needs to be inserted.',), +('Media','LastSequence','N',0,32767,None, None, None, None, 'File sequence number for the last file for this media.',), +('Media','VolumeLabel','Y',None, None, None, None, 'Text',None, 'The label attributed to the volume.',), +('ModuleComponents','Component','N',None, None, 'Component',1,'Identifier',None, 'Component contained in the module.',), +('ModuleComponents','Language','N',None, None, 'ModuleSignature',2,None, None, 'Default language ID for module (may be changed by transform).',), +('ModuleComponents','ModuleID','N',None, None, 'ModuleSignature',1,'Identifier',None, 'Module containing the component.',), +('ModuleSignature','Language','N',None, None, None, None, None, None, 'Default decimal language of module.',), +('ModuleSignature','Version','N',None, None, None, None, 'Version',None, 'Version of the module.',), +('ModuleSignature','ModuleID','N',None, None, None, None, 'Identifier',None, 'Module identifier (String.GUID).',), +('ModuleDependency','ModuleID','N',None, None, 'ModuleSignature',1,'Identifier',None, 'Module requiring the dependency.',), +('ModuleDependency','ModuleLanguage','N',None, None, 'ModuleSignature',2,None, None, 'Language of module requiring the dependency.',), +('ModuleDependency','RequiredID','N',None, None, None, None, None, None, 'String.GUID of required module.',), +('ModuleDependency','RequiredLanguage','N',None, None, None, None, None, None, 'LanguageID of the required module.',), +('ModuleDependency','RequiredVersion','Y',None, None, None, None, 'Version',None, 'Version of the required version.',), +('ModuleExclusion','ModuleID','N',None, None, 'ModuleSignature',1,'Identifier',None, 'String.GUID of module with exclusion requirement.',), +('ModuleExclusion','ModuleLanguage','N',None, None, 'ModuleSignature',2,None, None, 'LanguageID of module with exclusion requirement.',), +('ModuleExclusion','ExcludedID','N',None, None, None, None, None, None, 'String.GUID of excluded module.',), +('ModuleExclusion','ExcludedLanguage','N',None, None, None, None, None, None, 'Language of excluded module.',), +('ModuleExclusion','ExcludedMaxVersion','Y',None, None, None, None, 'Version',None, 'Maximum version of excluded module.',), +('ModuleExclusion','ExcludedMinVersion','Y',None, None, None, None, 'Version',None, 'Minimum version of excluded module.',), +('MoveFile','Component_','N',None, None, 'Component',1,'Identifier',None, 'If this component is not "selected" for installation or removal, no action will be taken on the associated MoveFile entry',), +('MoveFile','DestFolder','N',None, None, None, None, 'Identifier',None, 'Name of a property whose value is assumed to resolve to the full path to the destination directory',), +('MoveFile','DestName','Y',None, None, None, None, 'Filename',None, 'Name to be given to the original file after it is moved or copied. If blank, the destination file will be given the same name as the source file',), +('MoveFile','FileKey','N',None, None, None, None, 'Identifier',None, 'Primary key that uniquely identifies a particular MoveFile record',), +('MoveFile','Options','N',0,1,None, None, None, None, 'Integer value specifying the MoveFile operating mode, one of imfoEnum',), +('MoveFile','SourceFolder','Y',None, None, None, None, 'Identifier',None, 'Name of a property whose value is assumed to resolve to the full path to the source directory',), +('MoveFile','SourceName','Y',None, None, None, None, 'Text',None, "Name of the source file(s) to be moved or copied. Can contain the '*' or '?' wildcards.",), +('MsiAssembly','Attributes','Y',None, None, None, None, None, None, 'Assembly attributes',), +('MsiAssembly','Feature_','N',None, None, 'Feature',1,'Identifier',None, 'Foreign key into Feature table.',), +('MsiAssembly','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into Component table.',), +('MsiAssembly','File_Application','Y',None, None, 'File',1,'Identifier',None, 'Foreign key into File table, denoting the application context for private assemblies. Null for global assemblies.',), +('MsiAssembly','File_Manifest','Y',None, None, 'File',1,'Identifier',None, 'Foreign key into the File table denoting the manifest file for the assembly.',), +('MsiAssemblyName','Name','N',None, None, None, None, 'Text',None, 'The name part of the name-value pairs for the assembly name.',), +('MsiAssemblyName','Value','N',None, None, None, None, 'Text',None, 'The value part of the name-value pairs for the assembly name.',), +('MsiAssemblyName','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into Component table.',), +('MsiDigitalCertificate','CertData','N',None, None, None, None, 'Binary',None, 'A certificate context blob for a signer certificate',), +('MsiDigitalCertificate','DigitalCertificate','N',None, None, None, None, 'Identifier',None, 'A unique identifier for the row',), +('MsiDigitalSignature','Table','N',None, None, None, None, None, 'Media','Reference to another table name (only Media table is supported)',), +('MsiDigitalSignature','DigitalCertificate_','N',None, None, 'MsiDigitalCertificate',1,'Identifier',None, 'Foreign key to MsiDigitalCertificate table identifying the signer certificate',), +('MsiDigitalSignature','Hash','Y',None, None, None, None, 'Binary',None, 'The encoded hash blob from the digital signature',), +('MsiDigitalSignature','SignObject','N',None, None, None, None, 'Text',None, 'Foreign key to Media table',), +('MsiFileHash','File_','N',None, None, 'File',1,'Identifier',None, 'Primary key, foreign key into File table referencing file with this hash',), +('MsiFileHash','Options','N',0,32767,None, None, None, None, 'Various options and attributes for this hash.',), +('MsiFileHash','HashPart1','N',None, None, None, None, None, None, 'Size of file in bytes (long integer).',), +('MsiFileHash','HashPart2','N',None, None, None, None, None, None, 'Size of file in bytes (long integer).',), +('MsiFileHash','HashPart3','N',None, None, None, None, None, None, 'Size of file in bytes (long integer).',), +('MsiFileHash','HashPart4','N',None, None, None, None, None, None, 'Size of file in bytes (long integer).',), +('MsiPatchHeaders','StreamRef','N',None, None, None, None, 'Identifier',None, 'Primary key. A unique identifier for the row.',), +('MsiPatchHeaders','Header','N',None, None, None, None, 'Binary',None, 'Binary stream. The patch header, used for patch validation.',), +('ODBCAttribute','Value','Y',None, None, None, None, 'Text',None, 'Value for ODBC driver attribute',), +('ODBCAttribute','Attribute','N',None, None, None, None, 'Text',None, 'Name of ODBC driver attribute',), +('ODBCAttribute','Driver_','N',None, None, 'ODBCDriver',1,'Identifier',None, 'Reference to ODBC driver in ODBCDriver table',), +('ODBCDriver','Description','N',None, None, None, None, 'Text',None, 'Text used as registered name for driver, non-localized',), +('ODBCDriver','File_','N',None, None, 'File',1,'Identifier',None, 'Reference to key driver file',), +('ODBCDriver','Component_','N',None, None, 'Component',1,'Identifier',None, 'Reference to associated component',), +('ODBCDriver','Driver','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized.internal token for driver',), +('ODBCDriver','File_Setup','Y',None, None, 'File',1,'Identifier',None, 'Optional reference to key driver setup DLL',), +('ODBCDataSource','Description','N',None, None, None, None, 'Text',None, 'Text used as registered name for data source',), +('ODBCDataSource','Component_','N',None, None, 'Component',1,'Identifier',None, 'Reference to associated component',), +('ODBCDataSource','DataSource','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized.internal token for data source',), +('ODBCDataSource','DriverDescription','N',None, None, None, None, 'Text',None, 'Reference to driver description, may be existing driver',), +('ODBCDataSource','Registration','N',0,1,None, None, None, None, 'Registration option: 0=machine, 1=user, others t.b.d.',), +('ODBCSourceAttribute','Value','Y',None, None, None, None, 'Text',None, 'Value for ODBC data source attribute',), +('ODBCSourceAttribute','Attribute','N',None, None, None, None, 'Text',None, 'Name of ODBC data source attribute',), +('ODBCSourceAttribute','DataSource_','N',None, None, 'ODBCDataSource',1,'Identifier',None, 'Reference to ODBC data source in ODBCDataSource table',), +('ODBCTranslator','Description','N',None, None, None, None, 'Text',None, 'Text used as registered name for translator',), +('ODBCTranslator','File_','N',None, None, 'File',1,'Identifier',None, 'Reference to key translator file',), +('ODBCTranslator','Component_','N',None, None, 'Component',1,'Identifier',None, 'Reference to associated component',), +('ODBCTranslator','File_Setup','Y',None, None, 'File',1,'Identifier',None, 'Optional reference to key translator setup DLL',), +('ODBCTranslator','Translator','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized.internal token for translator',), +('Patch','Sequence','N',0,32767,None, None, None, None, 'Primary key, sequence with respect to the media images; order must track cabinet order.',), +('Patch','Attributes','N',0,32767,None, None, None, None, 'Integer containing bit flags representing patch attributes',), +('Patch','File_','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized token, foreign key to File table, must match identifier in cabinet.',), +('Patch','Header','Y',None, None, None, None, 'Binary',None, 'Binary stream. The patch header, used for patch validation.',), +('Patch','PatchSize','N',0,2147483647,None, None, None, None, 'Size of patch in bytes (long integer).',), +('Patch','StreamRef_','Y',None, None, None, None, 'Identifier',None, 'Identifier. Foreign key to the StreamRef column of the MsiPatchHeaders table.',), +('PatchPackage','Media_','N',0,32767,None, None, None, None, 'Foreign key to DiskId column of Media table. Indicates the disk containing the patch package.',), +('PatchPackage','PatchId','N',None, None, None, None, 'Guid',None, 'A unique string GUID representing this patch.',), +('PublishComponent','Feature_','N',None, None, 'Feature',1,'Identifier',None, 'Foreign key into the Feature table.',), +('PublishComponent','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into the Component table.',), +('PublishComponent','ComponentId','N',None, None, None, None, 'Guid',None, 'A string GUID that represents the component id that will be requested by the alien product.',), +('PublishComponent','AppData','Y',None, None, None, None, 'Text',None, 'This is localisable Application specific data that can be associated with a Qualified Component.',), +('PublishComponent','Qualifier','N',None, None, None, None, 'Text',None, 'This is defined only when the ComponentId column is an Qualified Component Id. This is the Qualifier for ProvideComponentIndirect.',), +('RadioButton','Y','N',0,32767,None, None, None, None, 'The vertical coordinate of the upper left corner of the bounding rectangle of the radio button.',), +('RadioButton','Text','Y',None, None, None, None, 'Text',None, 'The visible title to be assigned to the radio button.',), +('RadioButton','Property','N',None, None, None, None, 'Identifier',None, 'A named property to be tied to this radio button. All the buttons tied to the same property become part of the same group.',), +('RadioButton','Height','N',0,32767,None, None, None, None, 'The height of the button.',), +('RadioButton','Width','N',0,32767,None, None, None, None, 'The width of the button.',), +('RadioButton','X','N',0,32767,None, None, None, None, 'The horizontal coordinate of the upper left corner of the bounding rectangle of the radio button.',), +('RadioButton','Value','N',None, None, None, None, 'Formatted',None, 'The value string associated with this button. Selecting the button will set the associated property to this value.',), +('RadioButton','Order','N',1,32767,None, None, None, None, 'A positive integer used to determine the ordering of the items within one list..The integers do not have to be consecutive.',), +('RadioButton','Help','Y',None, None, None, None, 'Text',None, 'The help strings used with the button. The text is optional.',), +('Registry','Name','Y',None, None, None, None, 'Formatted',None, 'The registry value name.',), +('Registry','Value','Y',None, None, None, None, 'Formatted',None, 'The registry value.',), +('Registry','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into the Component table referencing component that controls the installing of the registry value.',), +('Registry','Key','N',None, None, None, None, 'RegPath',None, 'The key for the registry value.',), +('Registry','Registry','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized token.',), +('Registry','Root','N',-1,3,None, None, None, None, 'The predefined root key for the registry value, one of rrkEnum.',), +('RegLocator','Name','Y',None, None, None, None, 'Formatted',None, 'The registry value name.',), +('RegLocator','Type','Y',0,18,None, None, None, None, 'An integer value that determines if the registry value is a filename or a directory location or to be used as is w/o interpretation.',), +('RegLocator','Signature_','N',None, None, None, None, 'Identifier',None, 'The table key. The Signature_ represents a unique file signature and is also the foreign key in the Signature table. If the type is 0, the registry values refers a directory, and _Signature is not a foreign key.',), +('RegLocator','Key','N',None, None, None, None, 'RegPath',None, 'The key for the registry value.',), +('RegLocator','Root','N',0,3,None, None, None, None, 'The predefined root key for the registry value, one of rrkEnum.',), +('RemoveFile','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key referencing Component that controls the file to be removed.',), +('RemoveFile','FileKey','N',None, None, None, None, 'Identifier',None, 'Primary key used to identify a particular file entry',), +('RemoveFile','FileName','Y',None, None, None, None, 'WildCardFilename',None, 'Name of the file to be removed.',), +('RemoveFile','DirProperty','N',None, None, None, None, 'Identifier',None, 'Name of a property whose value is assumed to resolve to the full pathname to the folder of the file to be removed.',), +('RemoveFile','InstallMode','N',None, None, None, None, None, '1;2;3','Installation option, one of iimEnum.',), +('RemoveIniFile','Action','N',None, None, None, None, None, '2;4','The type of modification to be made, one of iifEnum.',), +('RemoveIniFile','Value','Y',None, None, None, None, 'Formatted',None, 'The value to be deleted. The value is required when Action is iifIniRemoveTag',), +('RemoveIniFile','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into the Component table referencing component that controls the deletion of the .INI value.',), +('RemoveIniFile','FileName','N',None, None, None, None, 'Filename',None, 'The .INI file name in which to delete the information',), +('RemoveIniFile','DirProperty','Y',None, None, None, None, 'Identifier',None, 'Foreign key into the Directory table denoting the directory where the .INI file is.',), +('RemoveIniFile','Key','N',None, None, None, None, 'Formatted',None, 'The .INI file key below Section.',), +('RemoveIniFile','Section','N',None, None, None, None, 'Formatted',None, 'The .INI file Section.',), +('RemoveIniFile','RemoveIniFile','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized token.',), +('RemoveRegistry','Name','Y',None, None, None, None, 'Formatted',None, 'The registry value name.',), +('RemoveRegistry','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into the Component table referencing component that controls the deletion of the registry value.',), +('RemoveRegistry','Key','N',None, None, None, None, 'RegPath',None, 'The key for the registry value.',), +('RemoveRegistry','Root','N',-1,3,None, None, None, None, 'The predefined root key for the registry value, one of rrkEnum',), +('RemoveRegistry','RemoveRegistry','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized token.',), +('ReserveCost','Component_','N',None, None, 'Component',1,'Identifier',None, 'Reserve a specified amount of space if this component is to be installed.',), +('ReserveCost','ReserveFolder','Y',None, None, None, None, 'Identifier',None, 'Name of a property whose value is assumed to resolve to the full path to the destination directory',), +('ReserveCost','ReserveKey','N',None, None, None, None, 'Identifier',None, 'Primary key that uniquely identifies a particular ReserveCost record',), +('ReserveCost','ReserveLocal','N',0,2147483647,None, None, None, None, 'Disk space to reserve if linked component is installed locally.',), +('ReserveCost','ReserveSource','N',0,2147483647,None, None, None, None, 'Disk space to reserve if linked component is installed to run from the source location.',), +('SelfReg','File_','N',None, None, 'File',1,'Identifier',None, 'Foreign key into the File table denoting the module that needs to be registered.',), +('SelfReg','Cost','Y',0,32767,None, None, None, None, 'The cost of registering the module.',), +('ServiceControl','Name','N',None, None, None, None, 'Formatted',None, 'Name of a service. /, \\, comma and space are invalid',), +('ServiceControl','Component_','N',None, None, 'Component',1,'Identifier',None, 'Required foreign key into the Component Table that controls the startup of the service',), +('ServiceControl','Event','N',0,187,None, None, None, None, 'Bit field: Install: 0x1 = Start, 0x2 = Stop, 0x8 = Delete, Uninstall: 0x10 = Start, 0x20 = Stop, 0x80 = Delete',), +('ServiceControl','ServiceControl','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized token.',), +('ServiceControl','Arguments','Y',None, None, None, None, 'Formatted',None, 'Arguments for the service. Separate by [~].',), +('ServiceControl','Wait','Y',0,1,None, None, None, None, 'Boolean for whether to wait for the service to fully start',), +('ServiceInstall','Name','N',None, None, None, None, 'Formatted',None, 'Internal Name of the Service',), +('ServiceInstall','Description','Y',None, None, None, None, 'Text',None, 'Description of service.',), +('ServiceInstall','Component_','N',None, None, 'Component',1,'Identifier',None, 'Required foreign key into the Component Table that controls the startup of the service',), +('ServiceInstall','Arguments','Y',None, None, None, None, 'Formatted',None, 'Arguments to include in every start of the service, passed to WinMain',), +('ServiceInstall','ServiceInstall','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized token.',), +('ServiceInstall','Dependencies','Y',None, None, None, None, 'Formatted',None, 'Other services this depends on to start. Separate by [~], and end with [~][~]',), +('ServiceInstall','DisplayName','Y',None, None, None, None, 'Formatted',None, 'External Name of the Service',), +('ServiceInstall','ErrorControl','N',-2147483647,2147483647,None, None, None, None, 'Severity of error if service fails to start',), +('ServiceInstall','LoadOrderGroup','Y',None, None, None, None, 'Formatted',None, 'LoadOrderGroup',), +('ServiceInstall','Password','Y',None, None, None, None, 'Formatted',None, 'password to run service with. (with StartName)',), +('ServiceInstall','ServiceType','N',-2147483647,2147483647,None, None, None, None, 'Type of the service',), +('ServiceInstall','StartName','Y',None, None, None, None, 'Formatted',None, 'User or object name to run service as',), +('ServiceInstall','StartType','N',0,4,None, None, None, None, 'Type of the service',), +('Shortcut','Name','N',None, None, None, None, 'Filename',None, 'The name of the shortcut to be created.',), +('Shortcut','Description','Y',None, None, None, None, 'Text',None, 'The description for the shortcut.',), +('Shortcut','Component_','N',None, None, 'Component',1,'Identifier',None, 'Foreign key into the Component table denoting the component whose selection gates the the shortcut creation/deletion.',), +('Shortcut','Icon_','Y',None, None, 'Icon',1,'Identifier',None, 'Foreign key into the File table denoting the external icon file for the shortcut.',), +('Shortcut','IconIndex','Y',-32767,32767,None, None, None, None, 'The icon index for the shortcut.',), +('Shortcut','Directory_','N',None, None, 'Directory',1,'Identifier',None, 'Foreign key into the Directory table denoting the directory where the shortcut file is created.',), +('Shortcut','Target','N',None, None, None, None, 'Shortcut',None, 'The shortcut target. This is usually a property that is expanded to a file or a folder that the shortcut points to.',), +('Shortcut','Arguments','Y',None, None, None, None, 'Formatted',None, 'The command-line arguments for the shortcut.',), +('Shortcut','Shortcut','N',None, None, None, None, 'Identifier',None, 'Primary key, non-localized token.',), +('Shortcut','Hotkey','Y',0,32767,None, None, None, None, 'The hotkey for the shortcut. It has the virtual-key code for the key in the low-order byte, and the modifier flags in the high-order byte. ',), +('Shortcut','ShowCmd','Y',None, None, None, None, None, '1;3;7','The show command for the application window.The following values may be used.',), +('Shortcut','WkDir','Y',None, None, None, None, 'Identifier',None, 'Name of property defining location of working directory.',), +('Signature','FileName','N',None, None, None, None, 'Filename',None, 'The name of the file. This may contain a "short name|long name" pair.',), +('Signature','Signature','N',None, None, None, None, 'Identifier',None, 'The table key. The Signature represents a unique file signature.',), +('Signature','Languages','Y',None, None, None, None, 'Language',None, 'The languages supported by the file.',), +('Signature','MaxDate','Y',0,2147483647,None, None, None, None, 'The maximum creation date of the file.',), +('Signature','MaxSize','Y',0,2147483647,None, None, None, None, 'The maximum size of the file. ',), +('Signature','MaxVersion','Y',None, None, None, None, 'Text',None, 'The maximum version of the file.',), +('Signature','MinDate','Y',0,2147483647,None, None, None, None, 'The minimum creation date of the file.',), +('Signature','MinSize','Y',0,2147483647,None, None, None, None, 'The minimum size of the file.',), +('Signature','MinVersion','Y',None, None, None, None, 'Text',None, 'The minimum version of the file.',), +('TextStyle','TextStyle','N',None, None, None, None, 'Identifier',None, 'Name of the style. The primary key of this table. This name is embedded in the texts to indicate a style change.',), +('TextStyle','Color','Y',0,16777215,None, None, None, None, 'A long integer indicating the color of the string in the RGB format (Red, Green, Blue each 0-255, RGB = R + 256*G + 256^2*B).',), +('TextStyle','FaceName','N',None, None, None, None, 'Text',None, 'A string indicating the name of the font used. Required. The string must be at most 31 characters long.',), +('TextStyle','Size','N',0,32767,None, None, None, None, 'The size of the font used. This size is given in our units (1/12 of the system font height). Assuming that the system font is set to 12 point size, this is equivalent to the point size.',), +('TextStyle','StyleBits','Y',0,15,None, None, None, None, 'A combination of style bits.',), +('TypeLib','Description','Y',None, None, None, None, 'Text',None, None, ), +('TypeLib','Feature_','N',None, None, 'Feature',1,'Identifier',None, 'Required foreign key into the Feature Table, specifying the feature to validate or install in order for the type library to be operational.',), +('TypeLib','Component_','N',None, None, 'Component',1,'Identifier',None, 'Required foreign key into the Component Table, specifying the component for which to return a path when called through LocateComponent.',), +('TypeLib','Directory_','Y',None, None, 'Directory',1,'Identifier',None, 'Optional. The foreign key into the Directory table denoting the path to the help file for the type library.',), +('TypeLib','Language','N',0,32767,None, None, None, None, 'The language of the library.',), +('TypeLib','Version','Y',0,16777215,None, None, None, None, 'The version of the library. The minor version is in the lower 8 bits of the integer. The major version is in the next 16 bits. ',), +('TypeLib','Cost','Y',0,2147483647,None, None, None, None, 'The cost associated with the registration of the typelib. This column is currently optional.',), +('TypeLib','LibID','N',None, None, None, None, 'Guid',None, 'The GUID that represents the library.',), +('UIText','Text','Y',None, None, None, None, 'Text',None, 'The localized version of the string.',), +('UIText','Key','N',None, None, None, None, 'Identifier',None, 'A unique key that identifies the particular string.',), +('Upgrade','Attributes','N',0,2147483647,None, None, None, None, 'The attributes of this product set.',), +('Upgrade','Language','Y',None, None, None, None, 'Language',None, 'A comma-separated list of languages for either products in this set or products not in this set.',), +('Upgrade','ActionProperty','N',None, None, None, None, 'UpperCase',None, 'The property to set when a product in this set is found.',), +('Upgrade','Remove','Y',None, None, None, None, 'Formatted',None, 'The list of features to remove when uninstalling a product from this set. The default is "ALL".',), +('Upgrade','UpgradeCode','N',None, None, None, None, 'Guid',None, 'The UpgradeCode GUID belonging to the products in this set.',), +('Upgrade','VersionMax','Y',None, None, None, None, 'Text',None, 'The maximum ProductVersion of the products in this set. The set may or may not include products with this particular version.',), +('Upgrade','VersionMin','Y',None, None, None, None, 'Text',None, 'The minimum ProductVersion of the products in this set. The set may or may not include products with this particular version.',), +('Verb','Sequence','Y',0,32767,None, None, None, None, 'Order within the verbs for a particular extension. Also used simply to specify the default verb.',), +('Verb','Argument','Y',None, None, None, None, 'Formatted',None, 'Optional value for the command arguments.',), +('Verb','Extension_','N',None, None, 'Extension',1,'Text',None, 'The extension associated with the table row.',), +('Verb','Verb','N',None, None, None, None, 'Text',None, 'The verb for the command.',), +('Verb','Command','Y',None, None, None, None, 'Formatted',None, 'The command text.',), ] Modified: python/branches/py3k-struni/Lib/msilib/sequence.py ============================================================================== --- python/branches/py3k-struni/Lib/msilib/sequence.py (original) +++ python/branches/py3k-struni/Lib/msilib/sequence.py Wed May 2 21:09:54 2007 @@ -1,126 +1,126 @@ AdminExecuteSequence = [ -(u'InstallInitialize', None, 1500), -(u'InstallFinalize', None, 6600), -(u'InstallFiles', None, 4000), -(u'InstallAdminPackage', None, 3900), -(u'FileCost', None, 900), -(u'CostInitialize', None, 800), -(u'CostFinalize', None, 1000), -(u'InstallValidate', None, 1400), +('InstallInitialize', None, 1500), +('InstallFinalize', None, 6600), +('InstallFiles', None, 4000), +('InstallAdminPackage', None, 3900), +('FileCost', None, 900), +('CostInitialize', None, 800), +('CostFinalize', None, 1000), +('InstallValidate', None, 1400), ] AdminUISequence = [ -(u'FileCost', None, 900), -(u'CostInitialize', None, 800), -(u'CostFinalize', None, 1000), -(u'ExecuteAction', None, 1300), -(u'ExitDialog', None, -1), -(u'FatalError', None, -3), -(u'UserExit', None, -2), +('FileCost', None, 900), +('CostInitialize', None, 800), +('CostFinalize', None, 1000), +('ExecuteAction', None, 1300), +('ExitDialog', None, -1), +('FatalError', None, -3), +('UserExit', None, -2), ] AdvtExecuteSequence = [ -(u'InstallInitialize', None, 1500), -(u'InstallFinalize', None, 6600), -(u'CostInitialize', None, 800), -(u'CostFinalize', None, 1000), -(u'InstallValidate', None, 1400), -(u'CreateShortcuts', None, 4500), -(u'MsiPublishAssemblies', None, 6250), -(u'PublishComponents', None, 6200), -(u'PublishFeatures', None, 6300), -(u'PublishProduct', None, 6400), -(u'RegisterClassInfo', None, 4600), -(u'RegisterExtensionInfo', None, 4700), -(u'RegisterMIMEInfo', None, 4900), -(u'RegisterProgIdInfo', None, 4800), +('InstallInitialize', None, 1500), +('InstallFinalize', None, 6600), +('CostInitialize', None, 800), +('CostFinalize', None, 1000), +('InstallValidate', None, 1400), +('CreateShortcuts', None, 4500), +('MsiPublishAssemblies', None, 6250), +('PublishComponents', None, 6200), +('PublishFeatures', None, 6300), +('PublishProduct', None, 6400), +('RegisterClassInfo', None, 4600), +('RegisterExtensionInfo', None, 4700), +('RegisterMIMEInfo', None, 4900), +('RegisterProgIdInfo', None, 4800), ] InstallExecuteSequence = [ -(u'InstallInitialize', None, 1500), -(u'InstallFinalize', None, 6600), -(u'InstallFiles', None, 4000), -(u'FileCost', None, 900), -(u'CostInitialize', None, 800), -(u'CostFinalize', None, 1000), -(u'InstallValidate', None, 1400), -(u'CreateShortcuts', None, 4500), -(u'MsiPublishAssemblies', None, 6250), -(u'PublishComponents', None, 6200), -(u'PublishFeatures', None, 6300), -(u'PublishProduct', None, 6400), -(u'RegisterClassInfo', None, 4600), -(u'RegisterExtensionInfo', None, 4700), -(u'RegisterMIMEInfo', None, 4900), -(u'RegisterProgIdInfo', None, 4800), -(u'AllocateRegistrySpace', u'NOT Installed', 1550), -(u'AppSearch', None, 400), -(u'BindImage', None, 4300), -(u'CCPSearch', u'NOT Installed', 500), -(u'CreateFolders', None, 3700), -(u'DeleteServices', u'VersionNT', 2000), -(u'DuplicateFiles', None, 4210), -(u'FindRelatedProducts', None, 200), -(u'InstallODBC', None, 5400), -(u'InstallServices', u'VersionNT', 5800), -(u'IsolateComponents', None, 950), -(u'LaunchConditions', None, 100), -(u'MigrateFeatureStates', None, 1200), -(u'MoveFiles', None, 3800), -(u'PatchFiles', None, 4090), -(u'ProcessComponents', None, 1600), -(u'RegisterComPlus', None, 5700), -(u'RegisterFonts', None, 5300), -(u'RegisterProduct', None, 6100), -(u'RegisterTypeLibraries', None, 5500), -(u'RegisterUser', None, 6000), -(u'RemoveDuplicateFiles', None, 3400), -(u'RemoveEnvironmentStrings', None, 3300), -(u'RemoveExistingProducts', None, 6700), -(u'RemoveFiles', None, 3500), -(u'RemoveFolders', None, 3600), -(u'RemoveIniValues', None, 3100), -(u'RemoveODBC', None, 2400), -(u'RemoveRegistryValues', None, 2600), -(u'RemoveShortcuts', None, 3200), -(u'RMCCPSearch', u'NOT Installed', 600), -(u'SelfRegModules', None, 5600), -(u'SelfUnregModules', None, 2200), -(u'SetODBCFolders', None, 1100), -(u'StartServices', u'VersionNT', 5900), -(u'StopServices', u'VersionNT', 1900), -(u'MsiUnpublishAssemblies', None, 1750), -(u'UnpublishComponents', None, 1700), -(u'UnpublishFeatures', None, 1800), -(u'UnregisterClassInfo', None, 2700), -(u'UnregisterComPlus', None, 2100), -(u'UnregisterExtensionInfo', None, 2800), -(u'UnregisterFonts', None, 2500), -(u'UnregisterMIMEInfo', None, 3000), -(u'UnregisterProgIdInfo', None, 2900), -(u'UnregisterTypeLibraries', None, 2300), -(u'ValidateProductID', None, 700), -(u'WriteEnvironmentStrings', None, 5200), -(u'WriteIniValues', None, 5100), -(u'WriteRegistryValues', None, 5000), +('InstallInitialize', None, 1500), +('InstallFinalize', None, 6600), +('InstallFiles', None, 4000), +('FileCost', None, 900), +('CostInitialize', None, 800), +('CostFinalize', None, 1000), +('InstallValidate', None, 1400), +('CreateShortcuts', None, 4500), +('MsiPublishAssemblies', None, 6250), +('PublishComponents', None, 6200), +('PublishFeatures', None, 6300), +('PublishProduct', None, 6400), +('RegisterClassInfo', None, 4600), +('RegisterExtensionInfo', None, 4700), +('RegisterMIMEInfo', None, 4900), +('RegisterProgIdInfo', None, 4800), +('AllocateRegistrySpace', 'NOT Installed', 1550), +('AppSearch', None, 400), +('BindImage', None, 4300), +('CCPSearch', 'NOT Installed', 500), +('CreateFolders', None, 3700), +('DeleteServices', 'VersionNT', 2000), +('DuplicateFiles', None, 4210), +('FindRelatedProducts', None, 200), +('InstallODBC', None, 5400), +('InstallServices', 'VersionNT', 5800), +('IsolateComponents', None, 950), +('LaunchConditions', None, 100), +('MigrateFeatureStates', None, 1200), +('MoveFiles', None, 3800), +('PatchFiles', None, 4090), +('ProcessComponents', None, 1600), +('RegisterComPlus', None, 5700), +('RegisterFonts', None, 5300), +('RegisterProduct', None, 6100), +('RegisterTypeLibraries', None, 5500), +('RegisterUser', None, 6000), +('RemoveDuplicateFiles', None, 3400), +('RemoveEnvironmentStrings', None, 3300), +('RemoveExistingProducts', None, 6700), +('RemoveFiles', None, 3500), +('RemoveFolders', None, 3600), +('RemoveIniValues', None, 3100), +('RemoveODBC', None, 2400), +('RemoveRegistryValues', None, 2600), +('RemoveShortcuts', None, 3200), +('RMCCPSearch', 'NOT Installed', 600), +('SelfRegModules', None, 5600), +('SelfUnregModules', None, 2200), +('SetODBCFolders', None, 1100), +('StartServices', 'VersionNT', 5900), +('StopServices', 'VersionNT', 1900), +('MsiUnpublishAssemblies', None, 1750), +('UnpublishComponents', None, 1700), +('UnpublishFeatures', None, 1800), +('UnregisterClassInfo', None, 2700), +('UnregisterComPlus', None, 2100), +('UnregisterExtensionInfo', None, 2800), +('UnregisterFonts', None, 2500), +('UnregisterMIMEInfo', None, 3000), +('UnregisterProgIdInfo', None, 2900), +('UnregisterTypeLibraries', None, 2300), +('ValidateProductID', None, 700), +('WriteEnvironmentStrings', None, 5200), +('WriteIniValues', None, 5100), +('WriteRegistryValues', None, 5000), ] InstallUISequence = [ -(u'FileCost', None, 900), -(u'CostInitialize', None, 800), -(u'CostFinalize', None, 1000), -(u'ExecuteAction', None, 1300), -(u'ExitDialog', None, -1), -(u'FatalError', None, -3), -(u'UserExit', None, -2), -(u'AppSearch', None, 400), -(u'CCPSearch', u'NOT Installed', 500), -(u'FindRelatedProducts', None, 200), -(u'IsolateComponents', None, 950), -(u'LaunchConditions', None, 100), -(u'MigrateFeatureStates', None, 1200), -(u'RMCCPSearch', u'NOT Installed', 600), -(u'ValidateProductID', None, 700), +('FileCost', None, 900), +('CostInitialize', None, 800), +('CostFinalize', None, 1000), +('ExecuteAction', None, 1300), +('ExitDialog', None, -1), +('FatalError', None, -3), +('UserExit', None, -2), +('AppSearch', None, 400), +('CCPSearch', 'NOT Installed', 500), +('FindRelatedProducts', None, 200), +('IsolateComponents', None, 950), +('LaunchConditions', None, 100), +('MigrateFeatureStates', None, 1200), +('RMCCPSearch', 'NOT Installed', 600), +('ValidateProductID', None, 700), ] tables=['AdminExecuteSequence', 'AdminUISequence', 'AdvtExecuteSequence', 'InstallExecuteSequence', 'InstallUISequence'] Modified: python/branches/py3k-struni/Lib/msilib/text.py ============================================================================== --- python/branches/py3k-struni/Lib/msilib/text.py (original) +++ python/branches/py3k-struni/Lib/msilib/text.py Wed May 2 21:09:54 2007 @@ -1,129 +1,129 @@ import msilib,os;dirname=os.path.dirname(__file__) ActionText = [ -(u'InstallValidate', u'Validating install', None), -(u'InstallFiles', u'Copying new files', u'File: [1], Directory: [9], Size: [6]'), -(u'InstallAdminPackage', u'Copying network install files', u'File: [1], Directory: [9], Size: [6]'), -(u'FileCost', u'Computing space requirements', None), -(u'CostInitialize', u'Computing space requirements', None), -(u'CostFinalize', u'Computing space requirements', None), -(u'CreateShortcuts', u'Creating shortcuts', u'Shortcut: [1]'), -(u'PublishComponents', u'Publishing Qualified Components', u'Component ID: [1], Qualifier: [2]'), -(u'PublishFeatures', u'Publishing Product Features', u'Feature: [1]'), -(u'PublishProduct', u'Publishing product information', None), -(u'RegisterClassInfo', u'Registering Class servers', u'Class Id: [1]'), -(u'RegisterExtensionInfo', u'Registering extension servers', u'Extension: [1]'), -(u'RegisterMIMEInfo', u'Registering MIME info', u'MIME Content Type: [1], Extension: [2]'), -(u'RegisterProgIdInfo', u'Registering program identifiers', u'ProgId: [1]'), -(u'AllocateRegistrySpace', u'Allocating registry space', u'Free space: [1]'), -(u'AppSearch', u'Searching for installed applications', u'Property: [1], Signature: [2]'), -(u'BindImage', u'Binding executables', u'File: [1]'), -(u'CCPSearch', u'Searching for qualifying products', None), -(u'CreateFolders', u'Creating folders', u'Folder: [1]'), -(u'DeleteServices', u'Deleting services', u'Service: [1]'), -(u'DuplicateFiles', u'Creating duplicate files', u'File: [1], Directory: [9], Size: [6]'), -(u'FindRelatedProducts', u'Searching for related applications', u'Found application: [1]'), -(u'InstallODBC', u'Installing ODBC components', None), -(u'InstallServices', u'Installing new services', u'Service: [2]'), -(u'LaunchConditions', u'Evaluating launch conditions', None), -(u'MigrateFeatureStates', u'Migrating feature states from related applications', u'Application: [1]'), -(u'MoveFiles', u'Moving files', u'File: [1], Directory: [9], Size: [6]'), -(u'PatchFiles', u'Patching files', u'File: [1], Directory: [2], Size: [3]'), -(u'ProcessComponents', u'Updating component registration', None), -(u'RegisterComPlus', u'Registering COM+ Applications and Components', u'AppId: [1]{{, AppType: [2], Users: [3], RSN: [4]}}'), -(u'RegisterFonts', u'Registering fonts', u'Font: [1]'), -(u'RegisterProduct', u'Registering product', u'[1]'), -(u'RegisterTypeLibraries', u'Registering type libraries', u'LibID: [1]'), -(u'RegisterUser', u'Registering user', u'[1]'), -(u'RemoveDuplicateFiles', u'Removing duplicated files', u'File: [1], Directory: [9]'), -(u'RemoveEnvironmentStrings', u'Updating environment strings', u'Name: [1], Value: [2], Action [3]'), -(u'RemoveExistingProducts', u'Removing applications', u'Application: [1], Command line: [2]'), -(u'RemoveFiles', u'Removing files', u'File: [1], Directory: [9]'), -(u'RemoveFolders', u'Removing folders', u'Folder: [1]'), -(u'RemoveIniValues', u'Removing INI files entries', u'File: [1], Section: [2], Key: [3], Value: [4]'), -(u'RemoveODBC', u'Removing ODBC components', None), -(u'RemoveRegistryValues', u'Removing system registry values', u'Key: [1], Name: [2]'), -(u'RemoveShortcuts', u'Removing shortcuts', u'Shortcut: [1]'), -(u'RMCCPSearch', u'Searching for qualifying products', None), -(u'SelfRegModules', u'Registering modules', u'File: [1], Folder: [2]'), -(u'SelfUnregModules', u'Unregistering modules', u'File: [1], Folder: [2]'), -(u'SetODBCFolders', u'Initializing ODBC directories', None), -(u'StartServices', u'Starting services', u'Service: [1]'), -(u'StopServices', u'Stopping services', u'Service: [1]'), -(u'UnpublishComponents', u'Unpublishing Qualified Components', u'Component ID: [1], Qualifier: [2]'), -(u'UnpublishFeatures', u'Unpublishing Product Features', u'Feature: [1]'), -(u'UnregisterClassInfo', u'Unregister Class servers', u'Class Id: [1]'), -(u'UnregisterComPlus', u'Unregistering COM+ Applications and Components', u'AppId: [1]{{, AppType: [2]}}'), -(u'UnregisterExtensionInfo', u'Unregistering extension servers', u'Extension: [1]'), -(u'UnregisterFonts', u'Unregistering fonts', u'Font: [1]'), -(u'UnregisterMIMEInfo', u'Unregistering MIME info', u'MIME Content Type: [1], Extension: [2]'), -(u'UnregisterProgIdInfo', u'Unregistering program identifiers', u'ProgId: [1]'), -(u'UnregisterTypeLibraries', u'Unregistering type libraries', u'LibID: [1]'), -(u'WriteEnvironmentStrings', u'Updating environment strings', u'Name: [1], Value: [2], Action [3]'), -(u'WriteIniValues', u'Writing INI files values', u'File: [1], Section: [2], Key: [3], Value: [4]'), -(u'WriteRegistryValues', u'Writing system registry values', u'Key: [1], Name: [2], Value: [3]'), -(u'Advertise', u'Advertising application', None), -(u'GenerateScript', u'Generating script operations for action:', u'[1]'), -(u'InstallSFPCatalogFile', u'Installing system catalog', u'File: [1], Dependencies: [2]'), -(u'MsiPublishAssemblies', u'Publishing assembly information', u'Application Context:[1], Assembly Name:[2]'), -(u'MsiUnpublishAssemblies', u'Unpublishing assembly information', u'Application Context:[1], Assembly Name:[2]'), -(u'Rollback', u'Rolling back action:', u'[1]'), -(u'RollbackCleanup', u'Removing backup files', u'File: [1]'), -(u'UnmoveFiles', u'Removing moved files', u'File: [1], Directory: [9]'), -(u'UnpublishProduct', u'Unpublishing product information', None), +('InstallValidate', 'Validating install', None), +('InstallFiles', 'Copying new files', 'File: [1], Directory: [9], Size: [6]'), +('InstallAdminPackage', 'Copying network install files', 'File: [1], Directory: [9], Size: [6]'), +('FileCost', 'Computing space requirements', None), +('CostInitialize', 'Computing space requirements', None), +('CostFinalize', 'Computing space requirements', None), +('CreateShortcuts', 'Creating shortcuts', 'Shortcut: [1]'), +('PublishComponents', 'Publishing Qualified Components', 'Component ID: [1], Qualifier: [2]'), +('PublishFeatures', 'Publishing Product Features', 'Feature: [1]'), +('PublishProduct', 'Publishing product information', None), +('RegisterClassInfo', 'Registering Class servers', 'Class Id: [1]'), +('RegisterExtensionInfo', 'Registering extension servers', 'Extension: [1]'), +('RegisterMIMEInfo', 'Registering MIME info', 'MIME Content Type: [1], Extension: [2]'), +('RegisterProgIdInfo', 'Registering program identifiers', 'ProgId: [1]'), +('AllocateRegistrySpace', 'Allocating registry space', 'Free space: [1]'), +('AppSearch', 'Searching for installed applications', 'Property: [1], Signature: [2]'), +('BindImage', 'Binding executables', 'File: [1]'), +('CCPSearch', 'Searching for qualifying products', None), +('CreateFolders', 'Creating folders', 'Folder: [1]'), +('DeleteServices', 'Deleting services', 'Service: [1]'), +('DuplicateFiles', 'Creating duplicate files', 'File: [1], Directory: [9], Size: [6]'), +('FindRelatedProducts', 'Searching for related applications', 'Found application: [1]'), +('InstallODBC', 'Installing ODBC components', None), +('InstallServices', 'Installing new services', 'Service: [2]'), +('LaunchConditions', 'Evaluating launch conditions', None), +('MigrateFeatureStates', 'Migrating feature states from related applications', 'Application: [1]'), +('MoveFiles', 'Moving files', 'File: [1], Directory: [9], Size: [6]'), +('PatchFiles', 'Patching files', 'File: [1], Directory: [2], Size: [3]'), +('ProcessComponents', 'Updating component registration', None), +('RegisterComPlus', 'Registering COM+ Applications and Components', 'AppId: [1]{{, AppType: [2], Users: [3], RSN: [4]}}'), +('RegisterFonts', 'Registering fonts', 'Font: [1]'), +('RegisterProduct', 'Registering product', '[1]'), +('RegisterTypeLibraries', 'Registering type libraries', 'LibID: [1]'), +('RegisterUser', 'Registering user', '[1]'), +('RemoveDuplicateFiles', 'Removing duplicated files', 'File: [1], Directory: [9]'), +('RemoveEnvironmentStrings', 'Updating environment strings', 'Name: [1], Value: [2], Action [3]'), +('RemoveExistingProducts', 'Removing applications', 'Application: [1], Command line: [2]'), +('RemoveFiles', 'Removing files', 'File: [1], Directory: [9]'), +('RemoveFolders', 'Removing folders', 'Folder: [1]'), +('RemoveIniValues', 'Removing INI files entries', 'File: [1], Section: [2], Key: [3], Value: [4]'), +('RemoveODBC', 'Removing ODBC components', None), +('RemoveRegistryValues', 'Removing system registry values', 'Key: [1], Name: [2]'), +('RemoveShortcuts', 'Removing shortcuts', 'Shortcut: [1]'), +('RMCCPSearch', 'Searching for qualifying products', None), +('SelfRegModules', 'Registering modules', 'File: [1], Folder: [2]'), +('SelfUnregModules', 'Unregistering modules', 'File: [1], Folder: [2]'), +('SetODBCFolders', 'Initializing ODBC directories', None), +('StartServices', 'Starting services', 'Service: [1]'), +('StopServices', 'Stopping services', 'Service: [1]'), +('UnpublishComponents', 'Unpublishing Qualified Components', 'Component ID: [1], Qualifier: [2]'), +('UnpublishFeatures', 'Unpublishing Product Features', 'Feature: [1]'), +('UnregisterClassInfo', 'Unregister Class servers', 'Class Id: [1]'), +('UnregisterComPlus', 'Unregistering COM+ Applications and Components', 'AppId: [1]{{, AppType: [2]}}'), +('UnregisterExtensionInfo', 'Unregistering extension servers', 'Extension: [1]'), +('UnregisterFonts', 'Unregistering fonts', 'Font: [1]'), +('UnregisterMIMEInfo', 'Unregistering MIME info', 'MIME Content Type: [1], Extension: [2]'), +('UnregisterProgIdInfo', 'Unregistering program identifiers', 'ProgId: [1]'), +('UnregisterTypeLibraries', 'Unregistering type libraries', 'LibID: [1]'), +('WriteEnvironmentStrings', 'Updating environment strings', 'Name: [1], Value: [2], Action [3]'), +('WriteIniValues', 'Writing INI files values', 'File: [1], Section: [2], Key: [3], Value: [4]'), +('WriteRegistryValues', 'Writing system registry values', 'Key: [1], Name: [2], Value: [3]'), +('Advertise', 'Advertising application', None), +('GenerateScript', 'Generating script operations for action:', '[1]'), +('InstallSFPCatalogFile', 'Installing system catalog', 'File: [1], Dependencies: [2]'), +('MsiPublishAssemblies', 'Publishing assembly information', 'Application Context:[1], Assembly Name:[2]'), +('MsiUnpublishAssemblies', 'Unpublishing assembly information', 'Application Context:[1], Assembly Name:[2]'), +('Rollback', 'Rolling back action:', '[1]'), +('RollbackCleanup', 'Removing backup files', 'File: [1]'), +('UnmoveFiles', 'Removing moved files', 'File: [1], Directory: [9]'), +('UnpublishProduct', 'Unpublishing product information', None), ] UIText = [ -(u'AbsentPath', None), -(u'bytes', u'bytes'), -(u'GB', u'GB'), -(u'KB', u'KB'), -(u'MB', u'MB'), -(u'MenuAbsent', u'Entire feature will be unavailable'), -(u'MenuAdvertise', u'Feature will be installed when required'), -(u'MenuAllCD', u'Entire feature will be installed to run from CD'), -(u'MenuAllLocal', u'Entire feature will be installed on local hard drive'), -(u'MenuAllNetwork', u'Entire feature will be installed to run from network'), -(u'MenuCD', u'Will be installed to run from CD'), -(u'MenuLocal', u'Will be installed on local hard drive'), -(u'MenuNetwork', u'Will be installed to run from network'), -(u'ScriptInProgress', u'Gathering required information...'), -(u'SelAbsentAbsent', u'This feature will remain uninstalled'), -(u'SelAbsentAdvertise', u'This feature will be set to be installed when required'), -(u'SelAbsentCD', u'This feature will be installed to run from CD'), -(u'SelAbsentLocal', u'This feature will be installed on the local hard drive'), -(u'SelAbsentNetwork', u'This feature will be installed to run from the network'), -(u'SelAdvertiseAbsent', u'This feature will become unavailable'), -(u'SelAdvertiseAdvertise', u'Will be installed when required'), -(u'SelAdvertiseCD', u'This feature will be available to run from CD'), -(u'SelAdvertiseLocal', u'This feature will be installed on your local hard drive'), -(u'SelAdvertiseNetwork', u'This feature will be available to run from the network'), -(u'SelCDAbsent', u"This feature will be uninstalled completely, you won't be able to run it from CD"), -(u'SelCDAdvertise', u'This feature will change from run from CD state to set to be installed when required'), -(u'SelCDCD', u'This feature will remain to be run from CD'), -(u'SelCDLocal', u'This feature will change from run from CD state to be installed on the local hard drive'), -(u'SelChildCostNeg', u'This feature frees up [1] on your hard drive.'), -(u'SelChildCostPos', u'This feature requires [1] on your hard drive.'), -(u'SelCostPending', u'Compiling cost for this feature...'), -(u'SelLocalAbsent', u'This feature will be completely removed'), -(u'SelLocalAdvertise', u'This feature will be removed from your local hard drive, but will be set to be installed when required'), -(u'SelLocalCD', u'This feature will be removed from your local hard drive, but will be still available to run from CD'), -(u'SelLocalLocal', u'This feature will remain on you local hard drive'), -(u'SelLocalNetwork', u'This feature will be removed from your local hard drive, but will be still available to run from the network'), -(u'SelNetworkAbsent', u"This feature will be uninstalled completely, you won't be able to run it from the network"), -(u'SelNetworkAdvertise', u'This feature will change from run from network state to set to be installed when required'), -(u'SelNetworkLocal', u'This feature will change from run from network state to be installed on the local hard drive'), -(u'SelNetworkNetwork', u'This feature will remain to be run from the network'), -(u'SelParentCostNegNeg', u'This feature frees up [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures free up [4] on your hard drive.'), -(u'SelParentCostNegPos', u'This feature frees up [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures require [4] on your hard drive.'), -(u'SelParentCostPosNeg', u'This feature requires [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures free up [4] on your hard drive.'), -(u'SelParentCostPosPos', u'This feature requires [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures require [4] on your hard drive.'), -(u'TimeRemaining', u'Time remaining: {[1] minutes }{[2] seconds}'), -(u'VolumeCostAvailable', u'Available'), -(u'VolumeCostDifference', u'Difference'), -(u'VolumeCostRequired', u'Required'), -(u'VolumeCostSize', u'Disk Size'), -(u'VolumeCostVolume', u'Volume'), +('AbsentPath', None), +('bytes', 'bytes'), +('GB', 'GB'), +('KB', 'KB'), +('MB', 'MB'), +('MenuAbsent', 'Entire feature will be unavailable'), +('MenuAdvertise', 'Feature will be installed when required'), +('MenuAllCD', 'Entire feature will be installed to run from CD'), +('MenuAllLocal', 'Entire feature will be installed on local hard drive'), +('MenuAllNetwork', 'Entire feature will be installed to run from network'), +('MenuCD', 'Will be installed to run from CD'), +('MenuLocal', 'Will be installed on local hard drive'), +('MenuNetwork', 'Will be installed to run from network'), +('ScriptInProgress', 'Gathering required information...'), +('SelAbsentAbsent', 'This feature will remain uninstalled'), +('SelAbsentAdvertise', 'This feature will be set to be installed when required'), +('SelAbsentCD', 'This feature will be installed to run from CD'), +('SelAbsentLocal', 'This feature will be installed on the local hard drive'), +('SelAbsentNetwork', 'This feature will be installed to run from the network'), +('SelAdvertiseAbsent', 'This feature will become unavailable'), +('SelAdvertiseAdvertise', 'Will be installed when required'), +('SelAdvertiseCD', 'This feature will be available to run from CD'), +('SelAdvertiseLocal', 'This feature will be installed on your local hard drive'), +('SelAdvertiseNetwork', 'This feature will be available to run from the network'), +('SelCDAbsent', "This feature will be uninstalled completely, you won't be able to run it from CD"), +('SelCDAdvertise', 'This feature will change from run from CD state to set to be installed when required'), +('SelCDCD', 'This feature will remain to be run from CD'), +('SelCDLocal', 'This feature will change from run from CD state to be installed on the local hard drive'), +('SelChildCostNeg', 'This feature frees up [1] on your hard drive.'), +('SelChildCostPos', 'This feature requires [1] on your hard drive.'), +('SelCostPending', 'Compiling cost for this feature...'), +('SelLocalAbsent', 'This feature will be completely removed'), +('SelLocalAdvertise', 'This feature will be removed from your local hard drive, but will be set to be installed when required'), +('SelLocalCD', 'This feature will be removed from your local hard drive, but will be still available to run from CD'), +('SelLocalLocal', 'This feature will remain on you local hard drive'), +('SelLocalNetwork', 'This feature will be removed from your local hard drive, but will be still available to run from the network'), +('SelNetworkAbsent', "This feature will be uninstalled completely, you won't be able to run it from the network"), +('SelNetworkAdvertise', 'This feature will change from run from network state to set to be installed when required'), +('SelNetworkLocal', 'This feature will change from run from network state to be installed on the local hard drive'), +('SelNetworkNetwork', 'This feature will remain to be run from the network'), +('SelParentCostNegNeg', 'This feature frees up [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures free up [4] on your hard drive.'), +('SelParentCostNegPos', 'This feature frees up [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures require [4] on your hard drive.'), +('SelParentCostPosNeg', 'This feature requires [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures free up [4] on your hard drive.'), +('SelParentCostPosPos', 'This feature requires [1] on your hard drive. It has [2] of [3] subfeatures selected. The subfeatures require [4] on your hard drive.'), +('TimeRemaining', 'Time remaining: {[1] minutes }{[2] seconds}'), +('VolumeCostAvailable', 'Available'), +('VolumeCostDifference', 'Difference'), +('VolumeCostRequired', 'Required'), +('VolumeCostSize', 'Disk Size'), +('VolumeCostVolume', 'Volume'), ] tables=['ActionText', 'UIText'] Modified: python/branches/py3k-struni/Lib/pickle.py ============================================================================== --- python/branches/py3k-struni/Lib/pickle.py (original) +++ python/branches/py3k-struni/Lib/pickle.py Wed May 2 21:09:54 2007 @@ -523,22 +523,22 @@ if StringType == UnicodeType: # This is true for Jython def save_string(self, obj, pack=struct.pack): - unicode = obj.isunicode() + str = obj.isunicode() if self.bin: - if unicode: + if str: obj = obj.encode("utf-8") l = len(obj) - if l < 256 and not unicode: + if l < 256 and not str: self.write(SHORT_BINSTRING + chr(l) + obj) else: s = pack("'), unicode('<\\\u1234>'), - unicode('<\n>'), unicode('<\\>')] + endcases = [str(''), str('<\\u>'), str('<\\\u1234>'), + str('<\n>'), str('<\\>')] for proto in protocols: for u in endcases: p = self.dumps(u, proto) @@ -908,8 +908,8 @@ class MyStr(str): sample = "hello" -class MyUnicode(unicode): - sample = u"hello \u1234" +class MyUnicode(str): + sample = "hello \u1234" class MyTuple(tuple): sample = (1, 2, 3) Modified: python/branches/py3k-struni/Lib/test/string_tests.py ============================================================================== --- python/branches/py3k-struni/Lib/test/string_tests.py (original) +++ python/branches/py3k-struni/Lib/test/string_tests.py Wed May 2 21:09:54 2007 @@ -589,7 +589,7 @@ self.checkequal(['a']*19 + ['a '], aaa, 'split', None, 19) # mixed use of str and unicode - self.checkequal([u'a', u'b', u'c d'], 'a b c d', 'split', u' ', 2) + self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', ' ', 2) def test_additional_rsplit(self): self.checkequal(['this', 'is', 'the', 'rsplit', 'function'], @@ -622,7 +622,7 @@ self.checkequal([' a a'] + ['a']*18, aaa, 'rsplit', None, 18) # mixed use of str and unicode - self.checkequal([u'a b', u'c', u'd'], 'a b c d', 'rsplit', u' ', 2) + self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', ' ', 2) def test_strip(self): self.checkequal('hello', ' hello ', 'strip') @@ -644,14 +644,14 @@ # strip/lstrip/rstrip with unicode arg if test_support.have_unicode: - self.checkequal(unicode('hello', 'ascii'), 'xyzzyhelloxyzzy', - 'strip', unicode('xyz', 'ascii')) - self.checkequal(unicode('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy', - 'lstrip', unicode('xyz', 'ascii')) - self.checkequal(unicode('xyzzyhello', 'ascii'), 'xyzzyhelloxyzzy', - 'rstrip', unicode('xyz', 'ascii')) - self.checkequal(unicode('hello', 'ascii'), 'hello', - 'strip', unicode('xyz', 'ascii')) + self.checkequal(str('hello', 'ascii'), 'xyzzyhelloxyzzy', + 'strip', str('xyz', 'ascii')) + self.checkequal(str('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy', + 'lstrip', str('xyz', 'ascii')) + self.checkequal(str('xyzzyhello', 'ascii'), 'xyzzyhelloxyzzy', + 'rstrip', str('xyz', 'ascii')) + self.checkequal(str('hello', 'ascii'), 'hello', + 'strip', str('xyz', 'ascii')) self.checkraises(TypeError, 'hello', 'strip', 42, 42) self.checkraises(TypeError, 'hello', 'lstrip', 42, 42) @@ -908,13 +908,13 @@ self.checkequal(False, '', '__contains__', 'asdf') # vereq('asdf' in '', False) def test_subscript(self): - self.checkequal(u'a', 'abc', '__getitem__', 0) - self.checkequal(u'c', 'abc', '__getitem__', -1) - self.checkequal(u'a', 'abc', '__getitem__', 0) - self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 3)) - self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 1000)) - self.checkequal(u'a', 'abc', '__getitem__', slice(0, 1)) - self.checkequal(u'', 'abc', '__getitem__', slice(0, 0)) + self.checkequal('a', 'abc', '__getitem__', 0) + self.checkequal('c', 'abc', '__getitem__', -1) + self.checkequal('a', 'abc', '__getitem__', 0) + self.checkequal('abc', 'abc', '__getitem__', slice(0, 3)) + self.checkequal('abc', 'abc', '__getitem__', slice(0, 1000)) + self.checkequal('a', 'abc', '__getitem__', slice(0, 1)) + self.checkequal('', 'abc', '__getitem__', slice(0, 0)) # FIXME What about negative indices? This is handled differently by [] and __getitem__(slice) self.checkraises(TypeError, 'abc', '__getitem__', 'def') @@ -957,11 +957,11 @@ self.checkequal('abc', 'a', 'join', ('abc',)) self.checkequal('z', 'a', 'join', UserList(['z'])) if test_support.have_unicode: - self.checkequal(unicode('a.b.c'), unicode('.'), 'join', ['a', 'b', 'c']) - self.checkequal(unicode('a.b.c'), '.', 'join', [unicode('a'), 'b', 'c']) - self.checkequal(unicode('a.b.c'), '.', 'join', ['a', unicode('b'), 'c']) - self.checkequal(unicode('a.b.c'), '.', 'join', ['a', 'b', unicode('c')]) - self.checkraises(TypeError, '.', 'join', ['a', unicode('b'), 3]) + self.checkequal(str('a.b.c'), str('.'), 'join', ['a', 'b', 'c']) + self.checkequal(str('a.b.c'), '.', 'join', [str('a'), 'b', 'c']) + self.checkequal(str('a.b.c'), '.', 'join', ['a', str('b'), 'c']) + self.checkequal(str('a.b.c'), '.', 'join', ['a', 'b', str('c')]) + self.checkraises(TypeError, '.', 'join', ['a', str('b'), 3]) for i in [5, 25, 125]: self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join', ['a' * i] * i) @@ -1159,7 +1159,7 @@ self.assert_(s1 is s2) # Should also test mixed-type join. - if t is unicode: + if t is str: s1 = subclass("abcd") s2 = "".join([s1]) self.assert_(s1 is not s2) @@ -1171,14 +1171,14 @@ elif t is str: s1 = subclass("abcd") - s2 = u"".join([s1]) + s2 = "".join([s1]) self.assert_(s1 is not s2) - self.assert_(type(s2) is unicode) # promotes! + self.assert_(type(s2) is str) # promotes! s1 = t("abcd") - s2 = u"".join([s1]) + s2 = "".join([s1]) self.assert_(s1 is not s2) - self.assert_(type(s2) is unicode) # promotes! + self.assert_(type(s2) is str) # promotes! else: self.fail("unexpected type for MixinStrUnicodeTest %r" % t) Modified: python/branches/py3k-struni/Lib/test/test_StringIO.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_StringIO.py (original) +++ python/branches/py3k-struni/Lib/test/test_StringIO.py Wed May 2 21:09:54 2007 @@ -112,10 +112,10 @@ f = self.MODULE.StringIO() f.write(self._line[:6]) f.seek(3) - f.write(unicode(self._line[20:26])) - f.write(unicode(self._line[52])) + f.write(str(self._line[20:26])) + f.write(str(self._line[52])) s = f.getvalue() - self.assertEqual(s, unicode('abcuvwxyz!')) + self.assertEqual(s, str('abcuvwxyz!')) self.assertEqual(type(s), types.UnicodeType) class TestcStringIO(TestGenericStringIO): @@ -130,18 +130,18 @@ # Check that this works. f = self.MODULE.StringIO() - f.write(unicode(self._line[:5])) + f.write(str(self._line[:5])) s = f.getvalue() self.assertEqual(s, 'abcde') self.assertEqual(type(s), types.StringType) - f = self.MODULE.StringIO(unicode(self._line[:5])) + f = self.MODULE.StringIO(str(self._line[:5])) s = f.getvalue() self.assertEqual(s, 'abcde') self.assertEqual(type(s), types.StringType) self.assertRaises(UnicodeEncodeError, self.MODULE.StringIO, - unicode('\xf4', 'latin-1')) + str('\xf4', 'latin-1')) import sys if sys.platform.startswith('java'): Modified: python/branches/py3k-struni/Lib/test/test_array.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_array.py (original) +++ python/branches/py3k-struni/Lib/test/test_array.py Wed May 2 21:09:54 2007 @@ -747,7 +747,7 @@ def test_nounicode(self): a = array.array(self.typecode, self.example) - self.assertRaises(ValueError, a.fromunicode, unicode('')) + self.assertRaises(ValueError, a.fromunicode, str('')) self.assertRaises(ValueError, a.tounicode) tests.append(CharacterTest) @@ -755,27 +755,27 @@ if test_support.have_unicode: class UnicodeTest(StringTest): typecode = 'u' - example = unicode(r'\x01\u263a\x00\ufeff', 'unicode-escape') - smallerexample = unicode(r'\x01\u263a\x00\ufefe', 'unicode-escape') - biggerexample = unicode(r'\x01\u263a\x01\ufeff', 'unicode-escape') - outside = unicode('\x33') + example = str(r'\x01\u263a\x00\ufeff', 'unicode-escape') + smallerexample = str(r'\x01\u263a\x00\ufefe', 'unicode-escape') + biggerexample = str(r'\x01\u263a\x01\ufeff', 'unicode-escape') + outside = str('\x33') minitemsize = 2 def test_unicode(self): - self.assertRaises(TypeError, array.array, 'b', unicode('foo', 'ascii')) + self.assertRaises(TypeError, array.array, 'b', str('foo', 'ascii')) - a = array.array('u', unicode(r'\xa0\xc2\u1234', 'unicode-escape')) - a.fromunicode(unicode(' ', 'ascii')) - a.fromunicode(unicode('', 'ascii')) - a.fromunicode(unicode('', 'ascii')) - a.fromunicode(unicode(r'\x11abc\xff\u1234', 'unicode-escape')) + a = array.array('u', str(r'\xa0\xc2\u1234', 'unicode-escape')) + a.fromunicode(str(' ', 'ascii')) + a.fromunicode(str('', 'ascii')) + a.fromunicode(str('', 'ascii')) + a.fromunicode(str(r'\x11abc\xff\u1234', 'unicode-escape')) s = a.tounicode() self.assertEqual( s, - unicode(r'\xa0\xc2\u1234 \x11abc\xff\u1234', 'unicode-escape') + str(r'\xa0\xc2\u1234 \x11abc\xff\u1234', 'unicode-escape') ) - s = unicode(r'\x00="\'a\\b\x80\xff\u0000\u0001\u1234', 'unicode-escape') + s = str(r'\x00="\'a\\b\x80\xff\u0000\u0001\u1234', 'unicode-escape') a = array.array('u', s) self.assertEqual( repr(a), Modified: python/branches/py3k-struni/Lib/test/test_bigmem.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_bigmem.py (original) +++ python/branches/py3k-struni/Lib/test/test_bigmem.py Wed May 2 21:09:54 2007 @@ -562,11 +562,11 @@ @bigmemtest(minsize=_2G + 2, memuse=16) def test_compare(self, size): - t1 = (u'',) * size - t2 = (u'',) * size + t1 = ('',) * size + t2 = ('',) * size self.failUnless(t1 == t2) del t2 - t2 = (u'',) * (size + 1) + t2 = ('',) * (size + 1) self.failIf(t1 == t2) del t2 t2 = (1,) * size @@ -667,11 +667,11 @@ @bigmemtest(minsize=_2G + 2, memuse=16) def test_compare(self, size): - l1 = [u''] * size - l2 = [u''] * size + l1 = [''] * size + l2 = [''] * size self.failUnless(l1 == l2) del l2 - l2 = [u''] * (size + 1) + l2 = [''] * (size + 1) self.failIf(l1 == l2) del l2 l2 = [2] * size @@ -896,27 +896,27 @@ @bigmemtest(minsize=_2G // 5 + 4, memuse=8 * 5) def test_pop(self, size): - l = [u"a", u"b", u"c", u"d", u"e"] * size + l = ["a", "b", "c", "d", "e"] * size size *= 5 self.assertEquals(len(l), size) item = l.pop() size -= 1 self.assertEquals(len(l), size) - self.assertEquals(item, u"e") - self.assertEquals(l[-2:], [u"c", u"d"]) + self.assertEquals(item, "e") + self.assertEquals(l[-2:], ["c", "d"]) item = l.pop(0) size -= 1 self.assertEquals(len(l), size) - self.assertEquals(item, u"a") - self.assertEquals(l[:2], [u"b", u"c"]) + self.assertEquals(item, "a") + self.assertEquals(l[:2], ["b", "c"]) item = l.pop(size - 2) size -= 1 self.assertEquals(len(l), size) - self.assertEquals(item, u"c") - self.assertEquals(l[-2:], [u"b", u"d"]) + self.assertEquals(item, "c") + self.assertEquals(l[-2:], ["b", "d"]) @bigmemtest(minsize=_2G + 10, memuse=8) def test_remove(self, size): Modified: python/branches/py3k-struni/Lib/test/test_binascii.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_binascii.py (original) +++ python/branches/py3k-struni/Lib/test/test_binascii.py Wed May 2 21:09:54 2007 @@ -124,7 +124,7 @@ # Verify the treatment of Unicode strings if test_support.have_unicode: - self.assertEqual(binascii.hexlify(unicode('a', 'ascii')), '61') + self.assertEqual(binascii.hexlify(str('a', 'ascii')), '61') def test_qp(self): # A test for SF bug 534347 (segfaults without the proper fix) Modified: python/branches/py3k-struni/Lib/test/test_bool.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_bool.py (original) +++ python/branches/py3k-struni/Lib/test/test_bool.py Wed May 2 21:09:54 2007 @@ -208,28 +208,28 @@ self.assertIs("xyz".startswith("z"), False) if test_support.have_unicode: - self.assertIs(unicode("xyz", 'ascii').endswith(unicode("z", 'ascii')), True) - self.assertIs(unicode("xyz", 'ascii').endswith(unicode("x", 'ascii')), False) - self.assertIs(unicode("xyz0123", 'ascii').isalnum(), True) - self.assertIs(unicode("@#$%", 'ascii').isalnum(), False) - self.assertIs(unicode("xyz", 'ascii').isalpha(), True) - self.assertIs(unicode("@#$%", 'ascii').isalpha(), False) - self.assertIs(unicode("0123", 'ascii').isdecimal(), True) - self.assertIs(unicode("xyz", 'ascii').isdecimal(), False) - self.assertIs(unicode("0123", 'ascii').isdigit(), True) - self.assertIs(unicode("xyz", 'ascii').isdigit(), False) - self.assertIs(unicode("xyz", 'ascii').islower(), True) - self.assertIs(unicode("XYZ", 'ascii').islower(), False) - self.assertIs(unicode("0123", 'ascii').isnumeric(), True) - self.assertIs(unicode("xyz", 'ascii').isnumeric(), False) - self.assertIs(unicode(" ", 'ascii').isspace(), True) - self.assertIs(unicode("XYZ", 'ascii').isspace(), False) - self.assertIs(unicode("X", 'ascii').istitle(), True) - self.assertIs(unicode("x", 'ascii').istitle(), False) - self.assertIs(unicode("XYZ", 'ascii').isupper(), True) - self.assertIs(unicode("xyz", 'ascii').isupper(), False) - self.assertIs(unicode("xyz", 'ascii').startswith(unicode("x", 'ascii')), True) - self.assertIs(unicode("xyz", 'ascii').startswith(unicode("z", 'ascii')), False) + self.assertIs(str("xyz", 'ascii').endswith(str("z", 'ascii')), True) + self.assertIs(str("xyz", 'ascii').endswith(str("x", 'ascii')), False) + self.assertIs(str("xyz0123", 'ascii').isalnum(), True) + self.assertIs(str("@#$%", 'ascii').isalnum(), False) + self.assertIs(str("xyz", 'ascii').isalpha(), True) + self.assertIs(str("@#$%", 'ascii').isalpha(), False) + self.assertIs(str("0123", 'ascii').isdecimal(), True) + self.assertIs(str("xyz", 'ascii').isdecimal(), False) + self.assertIs(str("0123", 'ascii').isdigit(), True) + self.assertIs(str("xyz", 'ascii').isdigit(), False) + self.assertIs(str("xyz", 'ascii').islower(), True) + self.assertIs(str("XYZ", 'ascii').islower(), False) + self.assertIs(str("0123", 'ascii').isnumeric(), True) + self.assertIs(str("xyz", 'ascii').isnumeric(), False) + self.assertIs(str(" ", 'ascii').isspace(), True) + self.assertIs(str("XYZ", 'ascii').isspace(), False) + self.assertIs(str("X", 'ascii').istitle(), True) + self.assertIs(str("x", 'ascii').istitle(), False) + self.assertIs(str("XYZ", 'ascii').isupper(), True) + self.assertIs(str("xyz", 'ascii').isupper(), False) + self.assertIs(str("xyz", 'ascii').startswith(str("x", 'ascii')), True) + self.assertIs(str("xyz", 'ascii').startswith(str("z", 'ascii')), False) def test_boolean(self): self.assertEqual(True & 1, 1) Modified: python/branches/py3k-struni/Lib/test/test_builtin.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_builtin.py (original) +++ python/branches/py3k-struni/Lib/test/test_builtin.py Wed May 2 21:09:54 2007 @@ -74,22 +74,22 @@ ] if have_unicode: L += [ - (unicode('0'), 0), - (unicode('1'), 1), - (unicode('9'), 9), - (unicode('10'), 10), - (unicode('99'), 99), - (unicode('100'), 100), - (unicode('314'), 314), - (unicode(' 314'), 314), - (unicode(b'\u0663\u0661\u0664 ','raw-unicode-escape'), 314), - (unicode(' \t\t 314 \t\t '), 314), - (unicode(' 1x'), ValueError), - (unicode(' 1 '), 1), - (unicode(' 1\02 '), ValueError), - (unicode(''), ValueError), - (unicode(' '), ValueError), - (unicode(' \t\t '), ValueError), + (str('0'), 0), + (str('1'), 1), + (str('9'), 9), + (str('10'), 10), + (str('99'), 99), + (str('100'), 100), + (str('314'), 314), + (str(' 314'), 314), + (str(b'\u0663\u0661\u0664 ','raw-unicode-escape'), 314), + (str(' \t\t 314 \t\t '), 314), + (str(' 1x'), ValueError), + (str(' 1 '), 1), + (str(' 1\02 '), ValueError), + (str(''), ValueError), + (str(' '), ValueError), + (str(' \t\t '), ValueError), (unichr(0x200), ValueError), ] @@ -220,9 +220,9 @@ self.assertRaises(TypeError, compile, 'pass', '?', 'exec', mode='eval', source='0', filename='tmp') if have_unicode: - compile(unicode(b'print(u"\xc3\xa5")\n', 'utf8'), '', 'exec') + compile(str(b'print(u"\xc3\xa5")\n', 'utf8'), '', 'exec') self.assertRaises(TypeError, compile, unichr(0), 'f', 'exec') - self.assertRaises(ValueError, compile, unicode('a = 1'), 'f', 'bad') + self.assertRaises(ValueError, compile, str('a = 1'), 'f', 'bad') def test_delattr(self): @@ -329,19 +329,19 @@ self.assertEqual(eval('b', globals, locals), 200) self.assertEqual(eval('c', globals, locals), 300) if have_unicode: - self.assertEqual(eval(unicode('1+1')), 2) - self.assertEqual(eval(unicode(' 1+1\n')), 2) + self.assertEqual(eval(str('1+1')), 2) + self.assertEqual(eval(str(' 1+1\n')), 2) globals = {'a': 1, 'b': 2} locals = {'b': 200, 'c': 300} if have_unicode: - self.assertEqual(eval(unicode('a'), globals), 1) - self.assertEqual(eval(unicode('a'), globals, locals), 1) - self.assertEqual(eval(unicode('b'), globals, locals), 200) - self.assertEqual(eval(unicode('c'), globals, locals), 300) + self.assertEqual(eval(str('a'), globals), 1) + self.assertEqual(eval(str('a'), globals, locals), 1) + self.assertEqual(eval(str('b'), globals, locals), 200) + self.assertEqual(eval(str('c'), globals, locals), 300) bom = '\xef\xbb\xbf' self.assertEqual(eval((bom + 'a').encode("latin-1"), globals, locals), 1) - self.assertEqual(eval(unicode(b'u"\xc3\xa5"', 'utf8'), globals), - unicode(b'\xc3\xa5', 'utf8')) + self.assertEqual(eval(str(b'u"\xc3\xa5"', 'utf8'), globals), + str(b'\xc3\xa5', 'utf8')) self.assertRaises(TypeError, eval) self.assertRaises(TypeError, eval, ()) @@ -472,7 +472,7 @@ del g['__builtins__'] self.assertEqual(g, {'z': 1}) - exec(u'z = 1+1', g) + exec('z = 1+1', g) if '__builtins__' in g: del g['__builtins__'] self.assertEqual(g, {'z': 2}) @@ -539,28 +539,28 @@ if have_unicode: # test bltinmodule.c::filterunicode() - self.assertEqual(filter(None, unicode("12")), unicode("12")) - self.assertEqual(filter(lambda x: x>="3", unicode("1234")), unicode("34")) - self.assertRaises(TypeError, filter, 42, unicode("12")) - self.assertRaises(ValueError, filter, lambda x: x >="3", badstr(unicode("1234"))) + self.assertEqual(filter(None, str("12")), str("12")) + self.assertEqual(filter(lambda x: x>="3", str("1234")), str("34")) + self.assertRaises(TypeError, filter, 42, str("12")) + self.assertRaises(ValueError, filter, lambda x: x >="3", badstr(str("1234"))) - class badunicode(unicode): + class badunicode(str): def __getitem__(self, index): return 42 self.assertRaises(TypeError, filter, lambda x: x >=42, badunicode("1234")) - class weirdunicode(unicode): + class weirdunicode(str): def __getitem__(self, index): - return weirdunicode(2*unicode.__getitem__(self, index)) + return weirdunicode(2*str.__getitem__(self, index)) self.assertEqual( - filter(lambda x: x>=unicode("33"), weirdunicode("1234")), unicode("3344")) + filter(lambda x: x>=str("33"), weirdunicode("1234")), str("3344")) - class shiftunicode(unicode): + class shiftunicode(str): def __getitem__(self, index): - return unichr(ord(unicode.__getitem__(self, index))+1) + return unichr(ord(str.__getitem__(self, index))+1) self.assertEqual( - filter(lambda x: x>=unicode("3"), shiftunicode("1234")), - unicode("345") + filter(lambda x: x>=str("3"), shiftunicode("1234")), + str("345") ) def test_filter_subclasses(self): @@ -578,12 +578,12 @@ str2: {"": "", "123": "112233"} } if have_unicode: - class unicode2(unicode): + class unicode2(str): def __getitem__(self, index): - return 2*unicode.__getitem__(self, index) + return 2*str.__getitem__(self, index) inputs[unicode2] = { - unicode(): unicode(), - unicode("123"): unicode("112233") + str(): str(), + str("123"): str("112233") } for (cls, inps) in inputs.items(): @@ -607,10 +607,10 @@ self.assertRaises(ValueError, float, " 0x3.1 ") self.assertRaises(ValueError, float, " -0x3.p-1 ") if have_unicode: - self.assertEqual(float(unicode(" 3.14 ")), 3.14) - self.assertEqual(float(unicode(b" \u0663.\u0661\u0664 ",'raw-unicode-escape')), 3.14) + self.assertEqual(float(str(" 3.14 ")), 3.14) + self.assertEqual(float(str(b" \u0663.\u0661\u0664 ",'raw-unicode-escape')), 3.14) # Implementation limitation in PyFloat_FromString() - self.assertRaises(ValueError, float, unicode("1"*10000)) + self.assertRaises(ValueError, float, str("1"*10000)) @run_with_locale('LC_NUMERIC', 'fr_FR', 'de_DE') def test_float_with_comma(self): @@ -692,7 +692,7 @@ self.assertEqual(hash(1), hash(1.0)) hash('spam') if have_unicode: - self.assertEqual(hash('spam'), hash(unicode('spam'))) + self.assertEqual(hash('spam'), hash(str('spam'))) hash((0,1,2,3)) def f(): pass self.assertRaises(TypeError, hash, []) @@ -743,7 +743,7 @@ # Different base: self.assertEqual(int("10",16), 16) if have_unicode: - self.assertEqual(int(unicode("10"),16), 16) + self.assertEqual(int(str("10"),16), 16) # Test conversion from strings and various anomalies for s, v in L: for sign in "", "+", "-": @@ -913,7 +913,7 @@ self.assertRaises(TypeError, iter, 42, 42) lists = [("1", "2"), ["1", "2"], "12"] if have_unicode: - lists.append(unicode("12")) + lists.append(str("12")) for l in lists: i = iter(l) self.assertEqual(next(i), '1') @@ -1012,11 +1012,11 @@ self.assertEqual(int(-3.5), -3) self.assertEqual(int("-3"), -3) if have_unicode: - self.assertEqual(int(unicode("-3")), -3) + self.assertEqual(int(str("-3")), -3) # Different base: self.assertEqual(int("10",16), 16) if have_unicode: - self.assertEqual(int(unicode("10"),16), 16) + self.assertEqual(int(str("10"),16), 16) # Check conversions from string (same test set as for int(), and then some) LL = [ ('1' + '0'*20, 10**20), @@ -1025,8 +1025,8 @@ L2 = L[:] if have_unicode: L2 += [ - (unicode('1') + unicode('0')*20, 10**20), - (unicode('1') + unicode('0')*100, 10**100), + (str('1') + str('0')*20, 10**20), + (str('1') + str('0')*100, 10**100), ] for s, v in L2 + LL: for sign in "", "+", "-": @@ -1390,7 +1390,7 @@ self.assertEqual(ord(unichr(sys.maxunicode)), sys.maxunicode) self.assertRaises(TypeError, ord, 42) if have_unicode: - self.assertRaises(TypeError, ord, unicode("12")) + self.assertRaises(TypeError, ord, str("12")) def test_pow(self): self.assertEqual(pow(0,0), 1) @@ -1668,12 +1668,12 @@ def test_unichr(self): if have_unicode: - self.assertEqual(unichr(32), unicode(' ')) - self.assertEqual(unichr(65), unicode('A')) - self.assertEqual(unichr(97), unicode('a')) + self.assertEqual(unichr(32), str(' ')) + self.assertEqual(unichr(65), str('A')) + self.assertEqual(unichr(97), str('a')) self.assertEqual( unichr(sys.maxunicode), - unicode(('\\U%08x' % (sys.maxunicode)).encode("ascii"), 'unicode-escape') + str(('\\U%08x' % (sys.maxunicode)).encode("ascii"), 'unicode-escape') ) self.assertRaises(ValueError, unichr, sys.maxunicode+1) self.assertRaises(TypeError, unichr) @@ -1767,14 +1767,14 @@ s = 'abracadabra' types = [list, tuple] if have_unicode: - types.insert(0, unicode) + types.insert(0, str) for T in types: self.assertEqual(sorted(s), sorted(T(s))) s = ''.join(dict.fromkeys(s).keys()) # unique letters only types = [set, frozenset, list, tuple, dict.fromkeys] if have_unicode: - types.insert(0, unicode) + types.insert(0, str) for T in types: self.assertEqual(sorted(s), sorted(T(s))) Modified: python/branches/py3k-struni/Lib/test/test_bytes.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_bytes.py (original) +++ python/branches/py3k-struni/Lib/test/test_bytes.py Wed May 2 21:09:54 2007 @@ -132,10 +132,10 @@ # But they should never compare equal to Unicode! # Test this for all expected byte orders and Unicode character sizes - self.assertEqual(b"\0a\0b\0c" == u"abc", False) - self.assertEqual(b"\0\0\0a\0\0\0b\0\0\0c" == u"abc", False) - self.assertEqual(b"a\0b\0c\0" == u"abc", False) - self.assertEqual(b"a\0\0\0b\0\0\0c\0\0\0" == u"abc", False) + self.assertEqual(b"\0a\0b\0c" == "abc", False) + self.assertEqual(b"\0\0\0a\0\0\0b\0\0\0c" == "abc", False) + self.assertEqual(b"a\0b\0c\0" == "abc", False) + self.assertEqual(b"a\0\0\0b\0\0\0c\0\0\0" == "abc", False) def test_nohash(self): self.assertRaises(TypeError, hash, bytes()) @@ -323,7 +323,7 @@ self.assertEqual(b, bytes(list(range(8)) + list(range(256)))) def test_encoding(self): - sample = u"Hello world\n\u1234\u5678\u9abc\udef0" + sample = "Hello world\n\u1234\u5678\u9abc\udef0" for enc in ("utf8", "utf16"): b = bytes(sample, enc) self.assertEqual(b, bytes(map(ord, sample.encode(enc)))) @@ -332,11 +332,11 @@ self.assertEqual(b, bytes(sample[:-4])) def test_decode(self): - sample = u"Hello world\n\u1234\u5678\u9abc\def0\def0" + sample = "Hello world\n\u1234\u5678\u9abc\def0\def0" for enc in ("utf8", "utf16"): b = bytes(sample, enc) self.assertEqual(b.decode(enc), sample) - sample = u"Hello world\n\x80\x81\xfe\xff" + sample = "Hello world\n\x80\x81\xfe\xff" b = bytes(sample, "latin1") self.assertRaises(UnicodeDecodeError, b.decode, "utf8") self.assertEqual(b.decode("utf8", "ignore"), "Hello world\n") @@ -366,8 +366,8 @@ self.assertEqual(b1 + b2, bytes("abcdef")) self.assertEqual(b1 + "def", bytes("abcdef")) self.assertEqual("def" + b1, bytes("defabc")) - self.assertRaises(TypeError, lambda: b1 + u"def") - self.assertRaises(TypeError, lambda: u"abc" + b2) + self.assertRaises(TypeError, lambda: b1 + "def") + self.assertRaises(TypeError, lambda: "abc" + b2) def test_repeat(self): b = bytes("abc") @@ -391,7 +391,7 @@ b += "xyz" self.assertEqual(b, b"abcdefxyz") try: - b += u"" + b += "" except TypeError: pass else: @@ -476,10 +476,10 @@ def test_literal(self): tests = [ - (b"Wonderful spam", u"Wonderful spam"), - (br"Wonderful spam too", u"Wonderful spam too"), - (b"\xaa\x00\000\200", u"\xaa\x00\000\200"), - (br"\xaa\x00\000\200", ur"\xaa\x00\000\200"), + (b"Wonderful spam", "Wonderful spam"), + (br"Wonderful spam too", "Wonderful spam too"), + (b"\xaa\x00\000\200", "\xaa\x00\000\200"), + (br"\xaa\x00\000\200", r"\xaa\x00\000\200"), ] for b, s in tests: self.assertEqual(b, bytes(s, 'latin-1')) Modified: python/branches/py3k-struni/Lib/test/test_cfgparser.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_cfgparser.py (original) +++ python/branches/py3k-struni/Lib/test/test_cfgparser.py Wed May 2 21:09:54 2007 @@ -248,12 +248,12 @@ cf.set("sect", "option2", "splat") cf.set("sect", "option2", mystr("splat")) try: - unicode + str except NameError: pass else: - cf.set("sect", "option1", unicode("splat")) - cf.set("sect", "option2", unicode("splat")) + cf.set("sect", "option1", str("splat")) + cf.set("sect", "option2", str("splat")) def test_read_returns_file_list(self): file1 = test_support.findfile("cfgparser.1") Modified: python/branches/py3k-struni/Lib/test/test_charmapcodec.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_charmapcodec.py (original) +++ python/branches/py3k-struni/Lib/test/test_charmapcodec.py Wed May 2 21:09:54 2007 @@ -27,27 +27,27 @@ class CharmapCodecTest(unittest.TestCase): def test_constructorx(self): - self.assertEquals(unicode('abc', codecname), u'abc') - self.assertEquals(unicode('xdef', codecname), u'abcdef') - self.assertEquals(unicode('defx', codecname), u'defabc') - self.assertEquals(unicode('dxf', codecname), u'dabcf') - self.assertEquals(unicode('dxfx', codecname), u'dabcfabc') + self.assertEquals(str('abc', codecname), 'abc') + self.assertEquals(str('xdef', codecname), 'abcdef') + self.assertEquals(str('defx', codecname), 'defabc') + self.assertEquals(str('dxf', codecname), 'dabcf') + self.assertEquals(str('dxfx', codecname), 'dabcfabc') def test_encodex(self): - self.assertEquals(u'abc'.encode(codecname), 'abc') - self.assertEquals(u'xdef'.encode(codecname), 'abcdef') - self.assertEquals(u'defx'.encode(codecname), 'defabc') - self.assertEquals(u'dxf'.encode(codecname), 'dabcf') - self.assertEquals(u'dxfx'.encode(codecname), 'dabcfabc') + self.assertEquals('abc'.encode(codecname), 'abc') + self.assertEquals('xdef'.encode(codecname), 'abcdef') + self.assertEquals('defx'.encode(codecname), 'defabc') + self.assertEquals('dxf'.encode(codecname), 'dabcf') + self.assertEquals('dxfx'.encode(codecname), 'dabcfabc') def test_constructory(self): - self.assertEquals(unicode('ydef', codecname), u'def') - self.assertEquals(unicode('defy', codecname), u'def') - self.assertEquals(unicode('dyf', codecname), u'df') - self.assertEquals(unicode('dyfy', codecname), u'df') + self.assertEquals(str('ydef', codecname), 'def') + self.assertEquals(str('defy', codecname), 'def') + self.assertEquals(str('dyf', codecname), 'df') + self.assertEquals(str('dyfy', codecname), 'df') def test_maptoundefined(self): - self.assertRaises(UnicodeError, unicode, 'abc\001', codecname) + self.assertRaises(UnicodeError, str, 'abc\001', codecname) def test_main(): test.test_support.run_unittest(CharmapCodecTest) Modified: python/branches/py3k-struni/Lib/test/test_codeccallbacks.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codeccallbacks.py (original) +++ python/branches/py3k-struni/Lib/test/test_codeccallbacks.py Wed May 2 21:09:54 2007 @@ -16,18 +16,18 @@ # otherwise we'd get an endless loop if realpos <= exc.start: self.pos = len(exc.object) - return (u"", oldpos) + return ("", oldpos) # A UnicodeEncodeError object with a bad start attribute class BadStartUnicodeEncodeError(UnicodeEncodeError): def __init__(self): - UnicodeEncodeError.__init__(self, "ascii", u"", 0, 1, "bad") + UnicodeEncodeError.__init__(self, "ascii", "", 0, 1, "bad") self.start = [] # A UnicodeEncodeError object with a bad object attribute class BadObjectUnicodeEncodeError(UnicodeEncodeError): def __init__(self): - UnicodeEncodeError.__init__(self, "ascii", u"", 0, 1, "bad") + UnicodeEncodeError.__init__(self, "ascii", "", 0, 1, "bad") self.object = [] # A UnicodeDecodeError object without an end attribute @@ -45,19 +45,19 @@ # A UnicodeTranslateError object without a start attribute class NoStartUnicodeTranslateError(UnicodeTranslateError): def __init__(self): - UnicodeTranslateError.__init__(self, u"", 0, 1, "bad") + UnicodeTranslateError.__init__(self, "", 0, 1, "bad") del self.start # A UnicodeTranslateError object without an end attribute class NoEndUnicodeTranslateError(UnicodeTranslateError): def __init__(self): - UnicodeTranslateError.__init__(self, u"", 0, 1, "bad") + UnicodeTranslateError.__init__(self, "", 0, 1, "bad") del self.end # A UnicodeTranslateError object without an object attribute class NoObjectUnicodeTranslateError(UnicodeTranslateError): def __init__(self): - UnicodeTranslateError.__init__(self, u"", 0, 1, "bad") + UnicodeTranslateError.__init__(self, "", 0, 1, "bad") del self.object class CodecCallbackTest(unittest.TestCase): @@ -66,7 +66,7 @@ # replace unencodable characters which numeric character entities. # For ascii, latin-1 and charmaps this is completely implemented # in C and should be reasonably fast. - s = u"\u30b9\u30d1\u30e2 \xe4nd eggs" + s = "\u30b9\u30d1\u30e2 \xe4nd eggs" self.assertEqual( s.encode("ascii", "xmlcharrefreplace"), "スパモ änd eggs" @@ -86,15 +86,15 @@ l = [] for c in exc.object[exc.start:exc.end]: try: - l.append(u"&%s;" % htmlentitydefs.codepoint2name[ord(c)]) + l.append("&%s;" % htmlentitydefs.codepoint2name[ord(c)]) except KeyError: - l.append(u"&#%d;" % ord(c)) - return (u"".join(l), exc.end) + l.append("&#%d;" % ord(c)) + return ("".join(l), exc.end) codecs.register_error( "test.xmlcharnamereplace", xmlcharnamereplace) - sin = u"\xab\u211c\xbb = \u2329\u1234\u20ac\u232a" + sin = "\xab\u211c\xbb = \u2329\u1234\u20ac\u232a" sout = "«ℜ» = ⟨ሴ€⟩" self.assertEqual(sin.encode("ascii", "test.xmlcharnamereplace"), sout) sout = "\xabℜ\xbb = ⟨ሴ€⟩" @@ -116,13 +116,13 @@ raise TypeError("don't know how to handle %r" % exc) l = [] for c in exc.object[exc.start:exc.end]: - l.append(unicodedata.name(c, u"0x%x" % ord(c))) - return (u"\033[1m%s\033[0m" % u", ".join(l), exc.end) + l.append(unicodedata.name(c, "0x%x" % ord(c))) + return ("\033[1m%s\033[0m" % ", ".join(l), exc.end) codecs.register_error( "test.uninamereplace", uninamereplace) - sin = u"\xac\u1234\u20ac\u8000" + sin = "\xac\u1234\u20ac\u8000" sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" self.assertEqual(sin.encode("ascii", "test.uninamereplace"), sout) @@ -135,7 +135,7 @@ def test_backslashescape(self): # Does the same as the "unicode-escape" encoding, but with different # base encodings. - sin = u"a\xac\u1234\u20ac\u8000" + sin = "a\xac\u1234\u20ac\u8000" if sys.maxunicode > 0xffff: sin += unichr(sys.maxunicode) sout = "a\\xac\\u1234\\u20ac\\u8000" @@ -163,7 +163,7 @@ if not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) if exc.object[exc.start:exc.end].startswith("\xc0\x80"): - return (u"\x00", exc.start+2) # retry after two bytes + return ("\x00", exc.start+2) # retry after two bytes else: raise exc @@ -171,7 +171,7 @@ "test.relaxedutf8", relaxedutf8) sin = "a\x00b\xc0\x80c\xc3\xbc\xc0\x80\xc0\x80" - sout = u"a\x00b\x00c\xfc\x00\x00" + sout = "a\x00b\x00c\xfc\x00\x00" self.assertEqual(sin.decode("utf-8", "test.relaxedutf8"), sout) sin = "\xc0\x80\xc0\x81" self.assertRaises(UnicodeError, sin.decode, "utf-8", "test.relaxedutf8") @@ -182,22 +182,22 @@ # to be able to use e.g. the "replace" handler, the # charmap has to have a mapping for "?". charmap = dict([ (ord(c), 2*c.upper()) for c in "abcdefgh"]) - sin = u"abc" + sin = "abc" sout = "AABBCC" self.assertEquals(codecs.charmap_encode(sin, "strict", charmap)[0], sout) - sin = u"abcA" + sin = "abcA" self.assertRaises(UnicodeError, codecs.charmap_encode, sin, "strict", charmap) charmap[ord("?")] = "XYZ" - sin = u"abcDEF" + sin = "abcDEF" sout = "AABBCCXYZXYZXYZ" self.assertEquals(codecs.charmap_encode(sin, "replace", charmap)[0], sout) - charmap[ord("?")] = u"XYZ" + charmap[ord("?")] = "XYZ" self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) - charmap[ord("?")] = u"XYZ" + charmap[ord("?")] = "XYZ" self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) def test_decodeunicodeinternal(self): @@ -210,23 +210,23 @@ def handler_unicodeinternal(exc): if not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) - return (u"\x01", 1) + return ("\x01", 1) self.assertEqual( "\x00\x00\x00\x00\x00".decode("unicode-internal", "ignore"), - u"\u0000" + "\u0000" ) self.assertEqual( "\x00\x00\x00\x00\x00".decode("unicode-internal", "replace"), - u"\u0000\ufffd" + "\u0000\ufffd" ) codecs.register_error("test.hui", handler_unicodeinternal) self.assertEqual( "\x00\x00\x00\x00\x00".decode("unicode-internal", "test.hui"), - u"\u0000\u0001\u0000" + "\u0000\u0001\u0000" ) def test_callbacks(self): @@ -234,16 +234,16 @@ if not isinstance(exc, UnicodeEncodeError) \ and not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) - l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] - return (u"[%s]" % u"".join(l), exc.end) + l = ["<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] + return ("[%s]" % "".join(l), exc.end) codecs.register_error("test.handler1", handler1) def handler2(exc): if not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) - l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] - return (u"[%s]" % u"".join(l), exc.end+1) # skip one character + l = ["<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] + return ("[%s]" % "".join(l), exc.end+1) # skip one character codecs.register_error("test.handler2", handler2) @@ -251,36 +251,36 @@ self.assertEqual( s.decode("ascii", "test.handler1"), - u"\x00[<129>]\x7f[<128>][<255>]" + "\x00[<129>]\x7f[<128>][<255>]" ) self.assertEqual( s.decode("ascii", "test.handler2"), - u"\x00[<129>][<128>]" + "\x00[<129>][<128>]" ) self.assertEqual( "\\u3042\u3xxx".decode("unicode-escape", "test.handler1"), - u"\u3042[<92><117><51><120>]xx" + "\u3042[<92><117><51><120>]xx" ) self.assertEqual( "\\u3042\u3xx".decode("unicode-escape", "test.handler1"), - u"\u3042[<92><117><51><120><120>]" + "\u3042[<92><117><51><120><120>]" ) self.assertEqual( - codecs.charmap_decode("abc", "test.handler1", {ord("a"): u"z"})[0], - u"z[<98>][<99>]" + codecs.charmap_decode("abc", "test.handler1", {ord("a"): "z"})[0], + "z[<98>][<99>]" ) self.assertEqual( - u"g\xfc\xdfrk".encode("ascii", "test.handler1"), - u"g[<252><223>]rk" + "g\xfc\xdfrk".encode("ascii", "test.handler1"), + "g[<252><223>]rk" ) self.assertEqual( - u"g\xfc\xdf".encode("ascii", "test.handler1"), - u"g[<252><223>]" + "g\xfc\xdf".encode("ascii", "test.handler1"), + "g[<252><223>]" ) def test_longstrings(self): @@ -292,7 +292,7 @@ codecs.register_error("test." + err, codecs.lookup_error(err)) l = 1000 errors += [ "test." + err for err in errors ] - for uni in [ s*l for s in (u"x", u"\u3042", u"a\xe4") ]: + for uni in [ s*l for s in ("x", "\u3042", "a\xe4") ]: for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): for err in errors: try: @@ -307,7 +307,7 @@ # check with one argument too much self.assertRaises(TypeError, exctype, *(args + ["too much"])) # check with one argument of the wrong type - wrongargs = [ "spam", u"eggs", 42, 1.0, None ] + wrongargs = [ "spam", "eggs", 42, 1.0, None ] for i in xrange(len(args)): for wrongarg in wrongargs: if type(wrongarg) is type(args[i]): @@ -328,33 +328,33 @@ def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 2, "ouch"], + ["ascii", "g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 4, "ouch"], + ["ascii", "g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, - ["ascii", u"\xfcx", 0, 1, "ouch"], + ["ascii", "\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, - ["ascii", u"\u0100x", 0, 1, "ouch"], + ["ascii", "\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, - ["ascii", u"\uffffx", 0, 1, "ouch"], + ["ascii", "\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, - ["ascii", u"\U00010000x", 0, 1, "ouch"], + ["ascii", "\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" ) @@ -373,28 +373,28 @@ def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, - [u"g\xfcrk", 1, 2, "ouch"], + ["g\xfcrk", 1, 2, "ouch"], "can't translate character u'\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, - [u"g\u0100rk", 1, 2, "ouch"], + ["g\u0100rk", 1, 2, "ouch"], "can't translate character u'\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, - [u"g\uffffrk", 1, 2, "ouch"], + ["g\uffffrk", 1, 2, "ouch"], "can't translate character u'\\uffff' in position 1: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeTranslateError, - [u"g\U00010000rk", 1, 2, "ouch"], + ["g\U00010000rk", 1, 2, "ouch"], "can't translate character u'\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, - [u"g\xfcrk", 1, 3, "ouch"], + ["g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) @@ -416,7 +416,7 @@ self.assertRaises( UnicodeEncodeError, codecs.strict_errors, - UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch") + UnicodeEncodeError("ascii", "\u3042", 0, 1, "ouch") ) def test_badandgoodignoreexceptions(self): @@ -434,16 +434,16 @@ ) # If the correct exception is passed in, "ignore" returns an empty replacement self.assertEquals( - codecs.ignore_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"", 1) + codecs.ignore_errors(UnicodeEncodeError("ascii", "\u3042", 0, 1, "ouch")), + ("", 1) ) self.assertEquals( codecs.ignore_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), - (u"", 1) + ("", 1) ) self.assertEquals( - codecs.ignore_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), - (u"", 1) + codecs.ignore_errors(UnicodeTranslateError("\u3042", 0, 1, "ouch")), + ("", 1) ) def test_badandgoodreplaceexceptions(self): @@ -471,16 +471,16 @@ ) # With the correct exception, "replace" returns an "?" or u"\ufffd" replacement self.assertEquals( - codecs.replace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"?", 1) + codecs.replace_errors(UnicodeEncodeError("ascii", "\u3042", 0, 1, "ouch")), + ("?", 1) ) self.assertEquals( codecs.replace_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), - (u"\ufffd", 1) + ("\ufffd", 1) ) self.assertEquals( - codecs.replace_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), - (u"\ufffd", 1) + codecs.replace_errors(UnicodeTranslateError("\u3042", 0, 1, "ouch")), + ("\ufffd", 1) ) def test_badandgoodxmlcharrefreplaceexceptions(self): @@ -505,7 +505,7 @@ self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, - UnicodeTranslateError(u"\u3042", 0, 1, "ouch") + UnicodeTranslateError("\u3042", 0, 1, "ouch") ) # Use the correct exception cs = (0, 1, 9, 10, 99, 100, 999, 1000, 9999, 10000, 0x3042) @@ -514,7 +514,7 @@ codecs.xmlcharrefreplace_errors( UnicodeEncodeError("ascii", s, 0, len(s), "ouch") ), - (u"".join(u"&#%d;" % ord(c) for c in s), len(s)) + ("".join("&#%d;" % ord(c) for c in s), len(s)) ) def test_badandgoodbackslashreplaceexceptions(self): @@ -539,41 +539,41 @@ self.assertRaises( TypeError, codecs.backslashreplace_errors, - UnicodeTranslateError(u"\u3042", 0, 1, "ouch") + UnicodeTranslateError("\u3042", 0, 1, "ouch") ) # Use the correct exception self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"\\u3042", 1) + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", "\u3042", 0, 1, "ouch")), + ("\\u3042", 1) ) self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\x00", 0, 1, "ouch")), - (u"\\x00", 1) + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", "\x00", 0, 1, "ouch")), + ("\\x00", 1) ) self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\xff", 0, 1, "ouch")), - (u"\\xff", 1) + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", "\xff", 0, 1, "ouch")), + ("\\xff", 1) ) self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u0100", 0, 1, "ouch")), - (u"\\u0100", 1) + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", "\u0100", 0, 1, "ouch")), + ("\\u0100", 1) ) self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\uffff", 0, 1, "ouch")), - (u"\\uffff", 1) + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", "\uffff", 0, 1, "ouch")), + ("\\uffff", 1) ) if sys.maxunicode>0xffff: self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U00010000", 0, 1, "ouch")), - (u"\\U00010000", 1) + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", "\U00010000", 0, 1, "ouch")), + ("\\U00010000", 1) ) self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U0010ffff", 0, 1, "ouch")), - (u"\\U0010ffff", 1) + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", "\U0010ffff", 0, 1, "ouch")), + ("\\U0010ffff", 1) ) def test_badhandlerresults(self): - results = ( 42, u"foo", (1,2,3), (u"foo", 1, 3), (u"foo", None), (u"foo",), ("foo", 1, 3), ("foo", None), ("foo",) ) + results = ( 42, "foo", (1,2,3), ("foo", 1, 3), ("foo", None), ("foo",), ("foo", 1, 3), ("foo", None), ("foo",) ) encs = ("ascii", "latin-1", "iso-8859-1", "iso-8859-15") for res in results: @@ -581,7 +581,7 @@ for enc in encs: self.assertRaises( TypeError, - u"\u3042".encode, + "\u3042".encode, enc, "test.badhandler" ) @@ -614,14 +614,14 @@ def test_unencodablereplacement(self): def unencrepl(exc): if isinstance(exc, UnicodeEncodeError): - return (u"\u4242", exc.end) + return ("\u4242", exc.end) else: raise TypeError("don't know how to handle %r" % exc) codecs.register_error("test.unencreplhandler", unencrepl) for enc in ("ascii", "iso-8859-1", "iso-8859-15"): self.assertRaises( UnicodeEncodeError, - u"\u4242".encode, + "\u4242".encode, enc, "test.unencreplhandler" ) @@ -650,7 +650,7 @@ v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000) if sys.maxunicode>=100000: v += (100000, 500000, 1000000) - s = u"".join([unichr(x) for x in v]) + s = "".join([unichr(x) for x in v]) codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) for enc in ("ascii", "iso-8859-15"): for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): @@ -673,7 +673,7 @@ self.assertRaises(TypeError, "\\uyyyy".decode, "raw-unicode-escape", "test.baddecodereturn1") def baddecodereturn2(exc): - return (u"?", None) + return ("?", None) codecs.register_error("test.baddecodereturn2", baddecodereturn2) self.assertRaises(TypeError, "\xff".decode, "ascii", "test.baddecodereturn2") @@ -682,11 +682,11 @@ # Valid negative position handler.pos = -1 - self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"0") + self.assertEquals("\xff0".decode("ascii", "test.posreturn"), "0") # Valid negative position handler.pos = -2 - self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"") + self.assertEquals("\xff0".decode("ascii", "test.posreturn"), "") # Negative position out of bounds handler.pos = -3 @@ -694,11 +694,11 @@ # Valid positive position handler.pos = 1 - self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"0") + self.assertEquals("\xff0".decode("ascii", "test.posreturn"), "0") # Largest valid positive position (one beyond end of input) handler.pos = 2 - self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"") + self.assertEquals("\xff0".decode("ascii", "test.posreturn"), "") # Invalid positive position handler.pos = 3 @@ -706,7 +706,7 @@ # Restart at the "0" handler.pos = 6 - self.assertEquals("\\uyyyy0".decode("raw-unicode-escape", "test.posreturn"), u"0") + self.assertEquals("\\uyyyy0".decode("raw-unicode-escape", "test.posreturn"), "0") class D(dict): def __getitem__(self, key): @@ -719,44 +719,44 @@ # enhance coverage of: # Objects/unicodeobject.c::unicode_encode_call_errorhandler() # and callers - self.assertRaises(LookupError, u"\xff".encode, "ascii", "test.unknown") + self.assertRaises(LookupError, "\xff".encode, "ascii", "test.unknown") def badencodereturn1(exc): return 42 codecs.register_error("test.badencodereturn1", badencodereturn1) - self.assertRaises(TypeError, u"\xff".encode, "ascii", "test.badencodereturn1") + self.assertRaises(TypeError, "\xff".encode, "ascii", "test.badencodereturn1") def badencodereturn2(exc): - return (u"?", None) + return ("?", None) codecs.register_error("test.badencodereturn2", badencodereturn2) - self.assertRaises(TypeError, u"\xff".encode, "ascii", "test.badencodereturn2") + self.assertRaises(TypeError, "\xff".encode, "ascii", "test.badencodereturn2") handler = PosReturn() codecs.register_error("test.posreturn", handler.handle) # Valid negative position handler.pos = -1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") + self.assertEquals("\xff0".encode("ascii", "test.posreturn"), "0") # Valid negative position handler.pos = -2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") + self.assertEquals("\xff0".encode("ascii", "test.posreturn"), "") # Negative position out of bounds handler.pos = -3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") + self.assertRaises(IndexError, "\xff0".encode, "ascii", "test.posreturn") # Valid positive position handler.pos = 1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") + self.assertEquals("\xff0".encode("ascii", "test.posreturn"), "0") # Largest valid positive position (one beyond end of input handler.pos = 2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") + self.assertEquals("\xff0".encode("ascii", "test.posreturn"), "") # Invalid positive position handler.pos = 3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") + self.assertRaises(IndexError, "\xff0".encode, "ascii", "test.posreturn") handler.pos = 0 @@ -764,9 +764,9 @@ def __getitem__(self, key): raise ValueError for err in ("strict", "replace", "xmlcharrefreplace", "backslashreplace", "test.posreturn"): - self.assertRaises(UnicodeError, codecs.charmap_encode, u"\xff", err, {0xff: None}) - self.assertRaises(ValueError, codecs.charmap_encode, u"\xff", err, D()) - self.assertRaises(TypeError, codecs.charmap_encode, u"\xff", err, {0xff: 300}) + self.assertRaises(UnicodeError, codecs.charmap_encode, "\xff", err, {0xff: None}) + self.assertRaises(ValueError, codecs.charmap_encode, "\xff", err, D()) + self.assertRaises(TypeError, codecs.charmap_encode, "\xff", err, {0xff: 300}) def test_translatehelper(self): # enhance coverage of: @@ -777,20 +777,20 @@ class D(dict): def __getitem__(self, key): raise ValueError - self.assertRaises(ValueError, u"\xff".translate, D()) - self.assertRaises(TypeError, u"\xff".translate, {0xff: sys.maxunicode+1}) - self.assertRaises(TypeError, u"\xff".translate, {0xff: ()}) + self.assertRaises(ValueError, "\xff".translate, D()) + self.assertRaises(TypeError, "\xff".translate, {0xff: sys.maxunicode+1}) + self.assertRaises(TypeError, "\xff".translate, {0xff: ()}) def test_bug828737(self): charmap = { - ord("&"): u"&", - ord("<"): u"<", - ord(">"): u">", - ord('"'): u""", + ord("&"): "&", + ord("<"): "<", + ord(">"): ">", + ord('"'): """, } for n in (1, 10, 100, 1000): - text = u'abcghi'*n + text = 'abcghi'*n text.translate(charmap) def test_main(): Modified: python/branches/py3k-struni/Lib/test/test_codecencodings_cn.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecencodings_cn.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecencodings_cn.py Wed May 2 21:09:54 2007 @@ -15,9 +15,9 @@ # invalid bytes ("abc\x81\x81\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x81\x81\xc1\xc4", "replace", u"abc\ufffd\u804a"), - ("abc\x81\x81\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"), - ("abc\x81\x81\xc1\xc4", "ignore", u"abc\u804a"), + ("abc\x81\x81\xc1\xc4", "replace", "abc\ufffd\u804a"), + ("abc\x81\x81\xc1\xc4\xc8", "replace", "abc\ufffd\u804a\ufffd"), + ("abc\x81\x81\xc1\xc4", "ignore", "abc\u804a"), ("\xc1\x64", "strict", None), ) @@ -28,11 +28,11 @@ # invalid bytes ("abc\x80\x80\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u804a"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u804a"), + ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u804a"), + ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u804a\ufffd"), + ("abc\x80\x80\xc1\xc4", "ignore", "abc\u804a"), ("\x83\x34\x83\x31", "strict", None), - (u"\u30fb", "strict", None), + ("\u30fb", "strict", None), ) class Test_GB18030(test_multibytecodec_support.TestBase, unittest.TestCase): @@ -42,11 +42,11 @@ # invalid bytes ("abc\x80\x80\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u804a"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u804a"), - ("abc\x84\x39\x84\x39\xc1\xc4", "replace", u"abc\ufffd\u804a"), - (u"\u30fb", "strict", "\x819\xa79"), + ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u804a"), + ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u804a\ufffd"), + ("abc\x80\x80\xc1\xc4", "ignore", "abc\u804a"), + ("abc\x84\x39\x84\x39\xc1\xc4", "replace", "abc\ufffd\u804a"), + ("\u30fb", "strict", "\x819\xa79"), ) has_iso10646 = True Modified: python/branches/py3k-struni/Lib/test/test_codecencodings_hk.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecencodings_hk.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecencodings_hk.py Wed May 2 21:09:54 2007 @@ -15,9 +15,9 @@ # invalid bytes ("abc\x80\x80\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u8b10"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u8b10\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u8b10"), + ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u8b10"), + ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u8b10\ufffd"), + ("abc\x80\x80\xc1\xc4", "ignore", "abc\u8b10"), ) def test_main(): Modified: python/branches/py3k-struni/Lib/test/test_codecencodings_jp.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecencodings_jp.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecencodings_jp.py Wed May 2 21:09:54 2007 @@ -15,12 +15,12 @@ # invalid bytes ("abc\x81\x00\x81\x00\x82\x84", "strict", None), ("abc\xf8", "strict", None), - ("abc\x81\x00\x82\x84", "replace", u"abc\ufffd\uff44"), - ("abc\x81\x00\x82\x84\x88", "replace", u"abc\ufffd\uff44\ufffd"), - ("abc\x81\x00\x82\x84", "ignore", u"abc\uff44"), + ("abc\x81\x00\x82\x84", "replace", "abc\ufffd\uff44"), + ("abc\x81\x00\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), + ("abc\x81\x00\x82\x84", "ignore", "abc\uff44"), # sjis vs cp932 - ("\\\x7e", "replace", u"\\\x7e"), - ("\x81\x5f\x81\x61\x81\x7c", "replace", u"\uff3c\u2225\uff0d"), + ("\\\x7e", "replace", "\\\x7e"), + ("\x81\x5f\x81\x61\x81\x7c", "replace", "\uff3c\u2225\uff0d"), ) class Test_EUC_JISX0213(test_multibytecodec_support.TestBase, @@ -31,25 +31,25 @@ # invalid bytes ("abc\x80\x80\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u7956"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u7956\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u7956"), - ("abc\x8f\x83\x83", "replace", u"abc\ufffd"), + ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), + ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), + ("abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), + ("abc\x8f\x83\x83", "replace", "abc\ufffd"), ("\xc1\x64", "strict", None), - ("\xa1\xc0", "strict", u"\uff3c"), + ("\xa1\xc0", "strict", "\uff3c"), ) xmlcharnametest = ( - u"\xab\u211c\xbb = \u2329\u1234\u232a", + "\xab\u211c\xbb = \u2329\u1234\u232a", "\xa9\xa8ℜ\xa9\xb2 = ⟨ሴ⟩" ) eucjp_commontests = ( ("abc\x80\x80\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u7956"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u7956\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u7956"), - ("abc\x8f\x83\x83", "replace", u"abc\ufffd"), + ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u7956"), + ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u7956\ufffd"), + ("abc\x80\x80\xc1\xc4", "ignore", "abc\u7956"), + ("abc\x8f\x83\x83", "replace", "abc\ufffd"), ("\xc1\x64", "strict", None), ) @@ -58,25 +58,25 @@ encoding = 'euc_jp' tstring = test_multibytecodec_support.load_teststring('euc_jp') codectests = eucjp_commontests + ( - ("\xa1\xc0\\", "strict", u"\uff3c\\"), - (u"\xa5", "strict", "\x5c"), - (u"\u203e", "strict", "\x7e"), + ("\xa1\xc0\\", "strict", "\uff3c\\"), + ("\xa5", "strict", "\x5c"), + ("\u203e", "strict", "\x7e"), ) shiftjis_commonenctests = ( ("abc\x80\x80\x82\x84", "strict", None), ("abc\xf8", "strict", None), - ("abc\x80\x80\x82\x84", "replace", u"abc\ufffd\uff44"), - ("abc\x80\x80\x82\x84\x88", "replace", u"abc\ufffd\uff44\ufffd"), - ("abc\x80\x80\x82\x84def", "ignore", u"abc\uff44def"), + ("abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), + ("abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), + ("abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), ) class Test_SJIS_COMPAT(test_multibytecodec_support.TestBase, unittest.TestCase): encoding = 'shift_jis' tstring = test_multibytecodec_support.load_teststring('shift_jis') codectests = shiftjis_commonenctests + ( - ("\\\x7e", "strict", u"\\\x7e"), - ("\x81\x5f\x81\x61\x81\x7c", "strict", u"\uff3c\u2016\u2212"), + ("\\\x7e", "strict", "\\\x7e"), + ("\x81\x5f\x81\x61\x81\x7c", "strict", "\uff3c\u2016\u2212"), ) class Test_SJISX0213(test_multibytecodec_support.TestBase, unittest.TestCase): @@ -86,15 +86,15 @@ # invalid bytes ("abc\x80\x80\x82\x84", "strict", None), ("abc\xf8", "strict", None), - ("abc\x80\x80\x82\x84", "replace", u"abc\ufffd\uff44"), - ("abc\x80\x80\x82\x84\x88", "replace", u"abc\ufffd\uff44\ufffd"), - ("abc\x80\x80\x82\x84def", "ignore", u"abc\uff44def"), + ("abc\x80\x80\x82\x84", "replace", "abc\ufffd\uff44"), + ("abc\x80\x80\x82\x84\x88", "replace", "abc\ufffd\uff44\ufffd"), + ("abc\x80\x80\x82\x84def", "ignore", "abc\uff44def"), # sjis vs cp932 - ("\\\x7e", "replace", u"\xa5\u203e"), - ("\x81\x5f\x81\x61\x81\x7c", "replace", u"\x5c\u2016\u2212"), + ("\\\x7e", "replace", "\xa5\u203e"), + ("\x81\x5f\x81\x61\x81\x7c", "replace", "\x5c\u2016\u2212"), ) xmlcharnametest = ( - u"\xab\u211c\xbb = \u2329\u1234\u232a", + "\xab\u211c\xbb = \u2329\u1234\u232a", "\x85Gℜ\x85Q = ⟨ሴ⟩" ) Modified: python/branches/py3k-struni/Lib/test/test_codecencodings_kr.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecencodings_kr.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecencodings_kr.py Wed May 2 21:09:54 2007 @@ -15,9 +15,9 @@ # invalid bytes ("abc\x80\x80\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\uc894"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\uc894\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\uc894"), + ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"), + ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"), + ("abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"), ) class Test_EUCKR(test_multibytecodec_support.TestBase, unittest.TestCase): @@ -27,9 +27,9 @@ # invalid bytes ("abc\x80\x80\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\uc894"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\uc894\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\uc894"), + ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\uc894"), + ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\uc894\ufffd"), + ("abc\x80\x80\xc1\xc4", "ignore", "abc\uc894"), ) class Test_JOHAB(test_multibytecodec_support.TestBase, unittest.TestCase): @@ -39,9 +39,9 @@ # invalid bytes ("abc\x80\x80\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\ucd27"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\ucd27\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\ucd27"), + ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ucd27"), + ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ucd27\ufffd"), + ("abc\x80\x80\xc1\xc4", "ignore", "abc\ucd27"), ) def test_main(): Modified: python/branches/py3k-struni/Lib/test/test_codecencodings_tw.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecencodings_tw.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecencodings_tw.py Wed May 2 21:09:54 2007 @@ -15,9 +15,9 @@ # invalid bytes ("abc\x80\x80\xc1\xc4", "strict", None), ("abc\xc8", "strict", None), - ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u8b10"), - ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u8b10\ufffd"), - ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u8b10"), + ("abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u8b10"), + ("abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u8b10\ufffd"), + ("abc\x80\x80\xc1\xc4", "ignore", "abc\u8b10"), ) def test_main(): Modified: python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py Wed May 2 21:09:54 2007 @@ -14,11 +14,11 @@ mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \ 'WINDOWS/CP932.TXT' supmaps = [ - ('\x80', u'\u0080'), - ('\xa0', u'\uf8f0'), - ('\xfd', u'\uf8f1'), - ('\xfe', u'\uf8f2'), - ('\xff', u'\uf8f3'), + ('\x80', '\u0080'), + ('\xa0', '\uf8f0'), + ('\xfd', '\uf8f1'), + ('\xfe', '\uf8f2'), + ('\xff', '\uf8f3'), ] for i in range(0xa1, 0xe0): supmaps.append((chr(i), unichr(i+0xfec0))) @@ -38,12 +38,12 @@ mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE' \ '/EASTASIA/JIS/SHIFTJIS.TXT' pass_enctest = [ - ('\x81_', u'\\'), + ('\x81_', '\\'), ] pass_dectest = [ - ('\\', u'\xa5'), - ('~', u'\u203e'), - ('\x81_', u'\\'), + ('\\', '\xa5'), + ('~', '\u203e'), + ('\x81_', '\\'), ] class TestEUCJISX0213Map(test_multibytecodec_support.TestBase_Mapping, Modified: python/branches/py3k-struni/Lib/test/test_codecmaps_kr.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecmaps_kr.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecmaps_kr.py Wed May 2 21:09:54 2007 @@ -30,8 +30,8 @@ # but, in early 90s that is the only era used johab widely, # the most softwares implements it as REVERSE SOLIDUS. # So, we ignore the standard here. - pass_enctest = [('\\', u'\u20a9')] - pass_dectest = [('\\', u'\u20a9')] + pass_enctest = [('\\', '\u20a9')] + pass_dectest = [('\\', '\u20a9')] def test_main(): test_support.run_unittest(__name__) Modified: python/branches/py3k-struni/Lib/test/test_codecmaps_tw.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecmaps_tw.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecmaps_tw.py Wed May 2 21:09:54 2007 @@ -20,8 +20,8 @@ mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \ 'WINDOWS/CP950.TXT' pass_enctest = [ - ('\xa2\xcc', u'\u5341'), - ('\xa2\xce', u'\u5345'), + ('\xa2\xcc', '\u5341'), + ('\xa2\xce', '\u5345'), ] def test_main(): Modified: python/branches/py3k-struni/Lib/test/test_codecs.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecs.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecs.py Wed May 2 21:09:54 2007 @@ -64,41 +64,41 @@ # entries from partialresults. q = Queue() r = codecs.getreader(self.encoding)(q) - result = u"" + result = "" for (c, partialresult) in zip(input.encode(self.encoding), partialresults): q.write(c) result += r.read() self.assertEqual(result, partialresult) # check that there's nothing left in the buffers - self.assertEqual(r.read(), u"") + self.assertEqual(r.read(), "") self.assertEqual(r.bytebuffer, "") - self.assertEqual(r.charbuffer, u"") + self.assertEqual(r.charbuffer, "") # do the check again, this time using a incremental decoder d = codecs.getincrementaldecoder(self.encoding)() - result = u"" + result = "" for (c, partialresult) in zip(input.encode(self.encoding), partialresults): result += d.decode(c) self.assertEqual(result, partialresult) # check that there's nothing left in the buffers - self.assertEqual(d.decode("", True), u"") + self.assertEqual(d.decode("", True), "") self.assertEqual(d.buffer, "") # Check whether the rest method works properly d.reset() - result = u"" + result = "" for (c, partialresult) in zip(input.encode(self.encoding), partialresults): result += d.decode(c) self.assertEqual(result, partialresult) # check that there's nothing left in the buffers - self.assertEqual(d.decode("", True), u"") + self.assertEqual(d.decode("", True), "") self.assertEqual(d.buffer, "") # check iterdecode() encoded = input.encode(self.encoding) self.assertEqual( input, - u"".join(codecs.iterdecode(encoded, self.encoding)) + "".join(codecs.iterdecode(encoded, self.encoding)) ) def test_readline(self): @@ -116,9 +116,9 @@ lines.append(line) return "|".join(lines) - s = u"foo\nbar\r\nbaz\rspam\u2028eggs" - sexpected = u"foo\n|bar\r\n|baz\r|spam\u2028|eggs" - sexpectednoends = u"foo|bar|baz|spam|eggs" + s = "foo\nbar\r\nbaz\rspam\u2028eggs" + sexpected = "foo\n|bar\r\n|baz\r|spam\u2028|eggs" + sexpectednoends = "foo|bar|baz|spam|eggs" self.assertEqual(readalllines(s, True), sexpected) self.assertEqual(readalllines(s, False), sexpectednoends) self.assertEqual(readalllines(s, True, 10), sexpected) @@ -127,28 +127,28 @@ # Test long lines (multiple calls to read() in readline()) vw = [] vwo = [] - for (i, lineend) in enumerate(u"\n \r\n \r \u2028".split()): - vw.append((i*200)*u"\3042" + lineend) - vwo.append((i*200)*u"\3042") + for (i, lineend) in enumerate("\n \r\n \r \u2028".split()): + vw.append((i*200)*"\3042" + lineend) + vwo.append((i*200)*"\3042") self.assertEqual(readalllines("".join(vw), True), "".join(vw)) self.assertEqual(readalllines("".join(vw), False),"".join(vwo)) # Test lines where the first read might end with \r, so the # reader has to look ahead whether this is a lone \r or a \r\n for size in xrange(80): - for lineend in u"\n \r\n \r \u2028".split(): - s = 10*(size*u"a" + lineend + u"xxx\n") + for lineend in "\n \r\n \r \u2028".split(): + s = 10*(size*"a" + lineend + "xxx\n") reader = getreader(s) for i in xrange(10): self.assertEqual( reader.readline(keepends=True), - size*u"a" + lineend, + size*"a" + lineend, ) reader = getreader(s) for i in xrange(10): self.assertEqual( reader.readline(keepends=False), - size*u"a", + size*"a", ) def test_bug1175396(self): @@ -226,31 +226,31 @@ reader = codecs.getreader(self.encoding)(q) # No lineends - writer.write(u"foo\r") - self.assertEqual(reader.readline(keepends=False), u"foo") - writer.write(u"\nbar\r") - self.assertEqual(reader.readline(keepends=False), u"") - self.assertEqual(reader.readline(keepends=False), u"bar") - writer.write(u"baz") - self.assertEqual(reader.readline(keepends=False), u"baz") - self.assertEqual(reader.readline(keepends=False), u"") + writer.write("foo\r") + self.assertEqual(reader.readline(keepends=False), "foo") + writer.write("\nbar\r") + self.assertEqual(reader.readline(keepends=False), "") + self.assertEqual(reader.readline(keepends=False), "bar") + writer.write("baz") + self.assertEqual(reader.readline(keepends=False), "baz") + self.assertEqual(reader.readline(keepends=False), "") # Lineends - writer.write(u"foo\r") - self.assertEqual(reader.readline(keepends=True), u"foo\r") - writer.write(u"\nbar\r") - self.assertEqual(reader.readline(keepends=True), u"\n") - self.assertEqual(reader.readline(keepends=True), u"bar\r") - writer.write(u"baz") - self.assertEqual(reader.readline(keepends=True), u"baz") - self.assertEqual(reader.readline(keepends=True), u"") - writer.write(u"foo\r\n") - self.assertEqual(reader.readline(keepends=True), u"foo\r\n") + writer.write("foo\r") + self.assertEqual(reader.readline(keepends=True), "foo\r") + writer.write("\nbar\r") + self.assertEqual(reader.readline(keepends=True), "\n") + self.assertEqual(reader.readline(keepends=True), "bar\r") + writer.write("baz") + self.assertEqual(reader.readline(keepends=True), "baz") + self.assertEqual(reader.readline(keepends=True), "") + writer.write("foo\r\n") + self.assertEqual(reader.readline(keepends=True), "foo\r\n") def test_bug1098990_a(self): - s1 = u"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\r\n" - s2 = u"offending line: ladfj askldfj klasdj fskla dfzaskdj fasklfj laskd fjasklfzzzzaa%whereisthis!!!\r\n" - s3 = u"next line.\r\n" + s1 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\r\n" + s2 = "offending line: ladfj askldfj klasdj fskla dfzaskdj fasklfj laskd fjasklfzzzzaa%whereisthis!!!\r\n" + s3 = "next line.\r\n" s = (s1+s2+s3).encode(self.encoding) stream = StringIO.StringIO(s) @@ -258,14 +258,14 @@ self.assertEqual(reader.readline(), s1) self.assertEqual(reader.readline(), s2) self.assertEqual(reader.readline(), s3) - self.assertEqual(reader.readline(), u"") + self.assertEqual(reader.readline(), "") def test_bug1098990_b(self): - s1 = u"aaaaaaaaaaaaaaaaaaaaaaaa\r\n" - s2 = u"bbbbbbbbbbbbbbbbbbbbbbbb\r\n" - s3 = u"stillokay:bbbbxx\r\n" - s4 = u"broken!!!!badbad\r\n" - s5 = u"againokay.\r\n" + s1 = "aaaaaaaaaaaaaaaaaaaaaaaa\r\n" + s2 = "bbbbbbbbbbbbbbbbbbbbbbbb\r\n" + s3 = "stillokay:bbbbxx\r\n" + s4 = "broken!!!!badbad\r\n" + s5 = "againokay.\r\n" s = (s1+s2+s3+s4+s5).encode(self.encoding) stream = StringIO.StringIO(s) @@ -275,7 +275,7 @@ self.assertEqual(reader.readline(), s3) self.assertEqual(reader.readline(), s4) self.assertEqual(reader.readline(), s5) - self.assertEqual(reader.readline(), u"") + self.assertEqual(reader.readline(), "") class UTF16Test(ReadTest): encoding = "utf-16" @@ -288,15 +288,15 @@ # encode some stream s = StringIO.StringIO() f = writer(s) - f.write(u"spam") - f.write(u"spam") + f.write("spam") + f.write("spam") d = s.getvalue() # check whether there is exactly one BOM in it self.assert_(d == self.spamle or d == self.spambe) # try to read it back s = StringIO.StringIO(d) f = reader(s) - self.assertEquals(f.read(), u"spamspam") + self.assertEquals(f.read(), "spamspam") def test_badbom(self): s = StringIO.StringIO("\xff\xff") @@ -309,18 +309,18 @@ def test_partial(self): self.check_partial( - u"\x00\xff\u0100\uffff", + "\x00\xff\u0100\uffff", [ - u"", # first byte of BOM read - u"", # second byte of BOM read => byteorder known - u"", - u"\x00", - u"\x00", - u"\x00\xff", - u"\x00\xff", - u"\x00\xff\u0100", - u"\x00\xff\u0100", - u"\x00\xff\u0100\uffff", + "", # first byte of BOM read + "", # second byte of BOM read => byteorder known + "", + "\x00", + "\x00", + "\x00\xff", + "\x00\xff", + "\x00\xff\u0100", + "\x00\xff\u0100", + "\x00\xff\u0100\uffff", ] ) @@ -330,25 +330,25 @@ def test_decoder_state(self): self.check_state_handling_decode(self.encoding, - u"spamspam", self.spamle) + "spamspam", self.spamle) self.check_state_handling_decode(self.encoding, - u"spamspam", self.spambe) + "spamspam", self.spambe) class UTF16LETest(ReadTest): encoding = "utf-16-le" def test_partial(self): self.check_partial( - u"\x00\xff\u0100\uffff", + "\x00\xff\u0100\uffff", [ - u"", - u"\x00", - u"\x00", - u"\x00\xff", - u"\x00\xff", - u"\x00\xff\u0100", - u"\x00\xff\u0100", - u"\x00\xff\u0100\uffff", + "", + "\x00", + "\x00", + "\x00\xff", + "\x00\xff", + "\x00\xff\u0100", + "\x00\xff\u0100", + "\x00\xff\u0100\uffff", ] ) @@ -361,16 +361,16 @@ def test_partial(self): self.check_partial( - u"\x00\xff\u0100\uffff", + "\x00\xff\u0100\uffff", [ - u"", - u"\x00", - u"\x00", - u"\x00\xff", - u"\x00\xff", - u"\x00\xff\u0100", - u"\x00\xff\u0100", - u"\x00\xff\u0100\uffff", + "", + "\x00", + "\x00", + "\x00\xff", + "\x00\xff", + "\x00\xff\u0100", + "\x00\xff\u0100", + "\x00\xff\u0100\uffff", ] ) @@ -383,24 +383,24 @@ def test_partial(self): self.check_partial( - u"\x00\xff\u07ff\u0800\uffff", + "\x00\xff\u07ff\u0800\uffff", [ - u"\x00", - u"\x00", - u"\x00\xff", - u"\x00\xff", - u"\x00\xff\u07ff", - u"\x00\xff\u07ff", - u"\x00\xff\u07ff", - u"\x00\xff\u07ff\u0800", - u"\x00\xff\u07ff\u0800", - u"\x00\xff\u07ff\u0800", - u"\x00\xff\u07ff\u0800\uffff", + "\x00", + "\x00", + "\x00\xff", + "\x00\xff", + "\x00\xff\u07ff", + "\x00\xff\u07ff", + "\x00\xff\u07ff", + "\x00\xff\u07ff\u0800", + "\x00\xff\u07ff\u0800", + "\x00\xff\u07ff\u0800", + "\x00\xff\u07ff\u0800\uffff", ] ) def test_decoder_state(self): - u = u"\x00\x7f\x80\xff\u0100\u07ff\u0800\uffff\U0010ffff" + u = "\x00\x7f\x80\xff\u0100\u07ff\u0800\uffff\U0010ffff" self.check_state_handling_decode(self.encoding, u, u.encode(self.encoding)) @@ -450,39 +450,39 @@ def test_partial(self): self.check_partial( - u"\ufeff\x00\xff\u07ff\u0800\uffff", + "\ufeff\x00\xff\u07ff\u0800\uffff", [ - u"", - u"", - u"", # First BOM has been read and skipped - u"", - u"", - u"\ufeff", # Second BOM has been read and emitted - u"\ufeff\x00", # "\x00" read and emitted - u"\ufeff\x00", # First byte of encoded u"\xff" read - u"\ufeff\x00\xff", # Second byte of encoded u"\xff" read - u"\ufeff\x00\xff", # First byte of encoded u"\u07ff" read - u"\ufeff\x00\xff\u07ff", # Second byte of encoded u"\u07ff" read - u"\ufeff\x00\xff\u07ff", - u"\ufeff\x00\xff\u07ff", - u"\ufeff\x00\xff\u07ff\u0800", - u"\ufeff\x00\xff\u07ff\u0800", - u"\ufeff\x00\xff\u07ff\u0800", - u"\ufeff\x00\xff\u07ff\u0800\uffff", + "", + "", + "", # First BOM has been read and skipped + "", + "", + "\ufeff", # Second BOM has been read and emitted + "\ufeff\x00", # "\x00" read and emitted + "\ufeff\x00", # First byte of encoded u"\xff" read + "\ufeff\x00\xff", # Second byte of encoded u"\xff" read + "\ufeff\x00\xff", # First byte of encoded u"\u07ff" read + "\ufeff\x00\xff\u07ff", # Second byte of encoded u"\u07ff" read + "\ufeff\x00\xff\u07ff", + "\ufeff\x00\xff\u07ff", + "\ufeff\x00\xff\u07ff\u0800", + "\ufeff\x00\xff\u07ff\u0800", + "\ufeff\x00\xff\u07ff\u0800", + "\ufeff\x00\xff\u07ff\u0800\uffff", ] ) def test_bug1601501(self): # SF bug #1601501: check that the codec works with a buffer - unicode("\xef\xbb\xbf", "utf-8-sig") + str("\xef\xbb\xbf", "utf-8-sig") def test_bom(self): d = codecs.getincrementaldecoder("utf-8-sig")() - s = u"spam" + s = "spam" self.assertEqual(d.decode(s.encode("utf-8-sig")), s) def test_decoder_state(self): - u = u"\x00\x7f\x80\xff\u0100\u07ff\u0800\uffff\U0010ffff" + u = "\x00\x7f\x80\xff\u0100\u07ff\u0800\uffff\U0010ffff" self.check_state_handling_decode(self.encoding, u, u.encode(self.encoding)) @@ -494,7 +494,7 @@ def test_recoding(self): f = StringIO.StringIO() f2 = codecs.EncodedFile(f, "unicode_internal", "utf-8") - f2.write(u"a") + f2.write("a") f2.close() # Python used to crash on this at exit because of a refcount # bug in _codecsmodule.c @@ -502,104 +502,104 @@ # From RFC 3492 punycode_testcases = [ # A Arabic (Egyptian): - (u"\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" - u"\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F", + ("\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" + "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F", "egbpdaj6bu4bxfgehfvwxn"), # B Chinese (simplified): - (u"\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587", + ("\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587", "ihqwcrb4cv8a8dqg056pqjye"), # C Chinese (traditional): - (u"\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587", + ("\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587", "ihqwctvzc91f659drss3x8bo0yb"), # D Czech: Proprostnemluvesky - (u"\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074" - u"\u011B\u006E\u0065\u006D\u006C\u0075\u0076\u00ED\u010D" - u"\u0065\u0073\u006B\u0079", + ("\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074" + "\u011B\u006E\u0065\u006D\u006C\u0075\u0076\u00ED\u010D" + "\u0065\u0073\u006B\u0079", "Proprostnemluvesky-uyb24dma41a"), # E Hebrew: - (u"\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8" - u"\u05DC\u05D0\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2" - u"\u05D1\u05E8\u05D9\u05EA", + ("\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8" + "\u05DC\u05D0\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2" + "\u05D1\u05E8\u05D9\u05EA", "4dbcagdahymbxekheh6e0a7fei0b"), # F Hindi (Devanagari): - (u"\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D" - u"\u0926\u0940\u0915\u094D\u092F\u094B\u0902\u0928\u0939" - u"\u0940\u0902\u092C\u094B\u0932\u0938\u0915\u0924\u0947" - u"\u0939\u0948\u0902", + ("\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D" + "\u0926\u0940\u0915\u094D\u092F\u094B\u0902\u0928\u0939" + "\u0940\u0902\u092C\u094B\u0932\u0938\u0915\u0924\u0947" + "\u0939\u0948\u0902", "i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd"), #(G) Japanese (kanji and hiragana): - (u"\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092" - u"\u8A71\u3057\u3066\u304F\u308C\u306A\u3044\u306E\u304B", + ("\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092" + "\u8A71\u3057\u3066\u304F\u308C\u306A\u3044\u306E\u304B", "n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa"), # (H) Korean (Hangul syllables): - (u"\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774" - u"\uD55C\uAD6D\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74" - u"\uC5BC\uB9C8\uB098\uC88B\uC744\uAE4C", + ("\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774" + "\uD55C\uAD6D\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74" + "\uC5BC\uB9C8\uB098\uC88B\uC744\uAE4C", "989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5j" "psd879ccm6fea98c"), # (I) Russian (Cyrillic): - (u"\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E" - u"\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440" - u"\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A" - u"\u0438", + ("\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E" + "\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440" + "\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A" + "\u0438", "b1abfaaepdrnnbgefbaDotcwatmq2g4l"), # (J) Spanish: PorqunopuedensimplementehablarenEspaol - (u"\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070" - u"\u0075\u0065\u0064\u0065\u006E\u0073\u0069\u006D\u0070" - u"\u006C\u0065\u006D\u0065\u006E\u0074\u0065\u0068\u0061" - u"\u0062\u006C\u0061\u0072\u0065\u006E\u0045\u0073\u0070" - u"\u0061\u00F1\u006F\u006C", + ("\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070" + "\u0075\u0065\u0064\u0065\u006E\u0073\u0069\u006D\u0070" + "\u006C\u0065\u006D\u0065\u006E\u0074\u0065\u0068\u0061" + "\u0062\u006C\u0061\u0072\u0065\u006E\u0045\u0073\u0070" + "\u0061\u00F1\u006F\u006C", "PorqunopuedensimplementehablarenEspaol-fmd56a"), # (K) Vietnamese: # Tisaohkhngthch\ # nitingVit - (u"\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B" - u"\u0068\u00F4\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068" - u"\u1EC9\u006E\u00F3\u0069\u0074\u0069\u1EBF\u006E\u0067" - u"\u0056\u0069\u1EC7\u0074", + ("\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B" + "\u0068\u00F4\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068" + "\u1EC9\u006E\u00F3\u0069\u0074\u0069\u1EBF\u006E\u0067" + "\u0056\u0069\u1EC7\u0074", "TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g"), #(L) 3B - (u"\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F", + ("\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F", "3B-ww4c5e180e575a65lsy2b"), # (M) -with-SUPER-MONKEYS - (u"\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074" - u"\u0068\u002D\u0053\u0055\u0050\u0045\u0052\u002D\u004D" - u"\u004F\u004E\u004B\u0045\u0059\u0053", + ("\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074" + "\u0068\u002D\u0053\u0055\u0050\u0045\u0052\u002D\u004D" + "\u004F\u004E\u004B\u0045\u0059\u0053", "-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n"), # (N) Hello-Another-Way- - (u"\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F" - u"\u0074\u0068\u0065\u0072\u002D\u0057\u0061\u0079\u002D" - u"\u305D\u308C\u305E\u308C\u306E\u5834\u6240", + ("\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F" + "\u0074\u0068\u0065\u0072\u002D\u0057\u0061\u0079\u002D" + "\u305D\u308C\u305E\u308C\u306E\u5834\u6240", "Hello-Another-Way--fc4qua05auwb3674vfr0b"), # (O) 2 - (u"\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032", + ("\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032", "2-u9tlzr9756bt3uc0v"), # (P) MajiKoi5 - (u"\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" - u"\u308B\u0035\u79D2\u524D", + ("\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" + "\u308B\u0035\u79D2\u524D", "MajiKoi5-783gue6qz075azm5e"), # (Q) de - (u"\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", + ("\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0", "de-jg4avhby1noc0d"), # (R) - (u"\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067", + ("\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067", "d9juau41awczczp"), # (S) -> $1.00 <- - (u"\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020" - u"\u003C\u002D", + ("\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020" + "\u003C\u002D", "-> $1.00 <--") ] @@ -627,9 +627,9 @@ # points" above 0x10ffff on UCS-4 builds. if sys.maxunicode > 0xffff: ok = [ - ("\x00\x10\xff\xff", u"\U0010ffff"), - ("\x00\x00\x01\x01", u"\U00000101"), - ("", u""), + ("\x00\x10\xff\xff", "\U0010ffff"), + ("\x00\x00\x01\x01", "\U00000101"), + ("", ""), ] not_ok = [ "\x7f\xff\xff\xff", @@ -664,10 +664,10 @@ if sys.maxunicode > 0xffff: codecs.register_error("UnicodeInternalTest", codecs.ignore_errors) decoder = codecs.getdecoder("unicode_internal") - ab = u"ab".encode("unicode_internal") + ab = "ab".encode("unicode_internal") ignored = decoder("%s\x22\x22\x22\x22%s" % (ab[:4], ab[4:]), "UnicodeInternalTest") - self.assertEquals((u"ab", 12), ignored) + self.assertEquals(("ab", 12), ignored) # From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html nameprep_tests = [ @@ -831,12 +831,12 @@ # Skipped continue # The Unicode strings are given in UTF-8 - orig = unicode(orig, "utf-8") + orig = str(orig, "utf-8") if prepped is None: # Input contains prohibited characters self.assertRaises(UnicodeError, nameprep, orig) else: - prepped = unicode(prepped, "utf-8") + prepped = str(prepped, "utf-8") try: self.assertEquals(nameprep(orig), prepped) except Exception as e: @@ -844,97 +844,97 @@ class IDNACodecTest(unittest.TestCase): def test_builtin_decode(self): - self.assertEquals(unicode("python.org", "idna"), u"python.org") - self.assertEquals(unicode("python.org.", "idna"), u"python.org.") - self.assertEquals(unicode("xn--pythn-mua.org", "idna"), u"pyth\xf6n.org") - self.assertEquals(unicode("xn--pythn-mua.org.", "idna"), u"pyth\xf6n.org.") + self.assertEquals(str("python.org", "idna"), "python.org") + self.assertEquals(str("python.org.", "idna"), "python.org.") + self.assertEquals(str("xn--pythn-mua.org", "idna"), "pyth\xf6n.org") + self.assertEquals(str("xn--pythn-mua.org.", "idna"), "pyth\xf6n.org.") def test_builtin_encode(self): - self.assertEquals(u"python.org".encode("idna"), "python.org") + self.assertEquals("python.org".encode("idna"), "python.org") self.assertEquals("python.org.".encode("idna"), "python.org.") - self.assertEquals(u"pyth\xf6n.org".encode("idna"), "xn--pythn-mua.org") - self.assertEquals(u"pyth\xf6n.org.".encode("idna"), "xn--pythn-mua.org.") + self.assertEquals("pyth\xf6n.org".encode("idna"), "xn--pythn-mua.org") + self.assertEquals("pyth\xf6n.org.".encode("idna"), "xn--pythn-mua.org.") def test_stream(self): import StringIO r = codecs.getreader("idna")(StringIO.StringIO("abc")) r.read(3) - self.assertEquals(r.read(), u"") + self.assertEquals(r.read(), "") def test_incremental_decode(self): self.assertEquals( "".join(codecs.iterdecode("python.org", "idna")), - u"python.org" + "python.org" ) self.assertEquals( "".join(codecs.iterdecode("python.org.", "idna")), - u"python.org." + "python.org." ) self.assertEquals( "".join(codecs.iterdecode("xn--pythn-mua.org.", "idna")), - u"pyth\xf6n.org." + "pyth\xf6n.org." ) self.assertEquals( "".join(codecs.iterdecode("xn--pythn-mua.org.", "idna")), - u"pyth\xf6n.org." + "pyth\xf6n.org." ) decoder = codecs.getincrementaldecoder("idna")() - self.assertEquals(decoder.decode("xn--xam", ), u"") - self.assertEquals(decoder.decode("ple-9ta.o", ), u"\xe4xample.") - self.assertEquals(decoder.decode(u"rg"), u"") - self.assertEquals(decoder.decode(u"", True), u"org") + self.assertEquals(decoder.decode("xn--xam", ), "") + self.assertEquals(decoder.decode("ple-9ta.o", ), "\xe4xample.") + self.assertEquals(decoder.decode("rg"), "") + self.assertEquals(decoder.decode("", True), "org") decoder.reset() - self.assertEquals(decoder.decode("xn--xam", ), u"") - self.assertEquals(decoder.decode("ple-9ta.o", ), u"\xe4xample.") - self.assertEquals(decoder.decode("rg."), u"org.") - self.assertEquals(decoder.decode("", True), u"") + self.assertEquals(decoder.decode("xn--xam", ), "") + self.assertEquals(decoder.decode("ple-9ta.o", ), "\xe4xample.") + self.assertEquals(decoder.decode("rg."), "org.") + self.assertEquals(decoder.decode("", True), "") def test_incremental_encode(self): self.assertEquals( - "".join(codecs.iterencode(u"python.org", "idna")), + "".join(codecs.iterencode("python.org", "idna")), "python.org" ) self.assertEquals( - "".join(codecs.iterencode(u"python.org.", "idna")), + "".join(codecs.iterencode("python.org.", "idna")), "python.org." ) self.assertEquals( - "".join(codecs.iterencode(u"pyth\xf6n.org.", "idna")), + "".join(codecs.iterencode("pyth\xf6n.org.", "idna")), "xn--pythn-mua.org." ) self.assertEquals( - "".join(codecs.iterencode(u"pyth\xf6n.org.", "idna")), + "".join(codecs.iterencode("pyth\xf6n.org.", "idna")), "xn--pythn-mua.org." ) encoder = codecs.getincrementalencoder("idna")() - self.assertEquals(encoder.encode(u"\xe4x"), "") - self.assertEquals(encoder.encode(u"ample.org"), "xn--xample-9ta.") - self.assertEquals(encoder.encode(u"", True), "org") + self.assertEquals(encoder.encode("\xe4x"), "") + self.assertEquals(encoder.encode("ample.org"), "xn--xample-9ta.") + self.assertEquals(encoder.encode("", True), "org") encoder.reset() - self.assertEquals(encoder.encode(u"\xe4x"), "") - self.assertEquals(encoder.encode(u"ample.org."), "xn--xample-9ta.org.") - self.assertEquals(encoder.encode(u"", True), "") + self.assertEquals(encoder.encode("\xe4x"), "") + self.assertEquals(encoder.encode("ample.org."), "xn--xample-9ta.org.") + self.assertEquals(encoder.encode("", True), "") class CodecsModuleTest(unittest.TestCase): def test_decode(self): self.assertEquals(codecs.decode('\xe4\xf6\xfc', 'latin-1'), - u'\xe4\xf6\xfc') + '\xe4\xf6\xfc') self.assertRaises(TypeError, codecs.decode) - self.assertEquals(codecs.decode('abc'), u'abc') + self.assertEquals(codecs.decode('abc'), 'abc') self.assertRaises(UnicodeDecodeError, codecs.decode, '\xff', 'ascii') def test_encode(self): - self.assertEquals(codecs.encode(u'\xe4\xf6\xfc', 'latin-1'), + self.assertEquals(codecs.encode('\xe4\xf6\xfc', 'latin-1'), '\xe4\xf6\xfc') self.assertRaises(TypeError, codecs.encode) self.assertRaises(LookupError, codecs.encode, "foo", "__spam__") - self.assertEquals(codecs.encode(u'abc'), 'abc') - self.assertRaises(UnicodeEncodeError, codecs.encode, u'\xffff', 'ascii') + self.assertEquals(codecs.encode('abc'), 'abc') + self.assertRaises(UnicodeEncodeError, codecs.encode, '\xffff', 'ascii') def test_register(self): self.assertRaises(TypeError, codecs.register) @@ -969,7 +969,7 @@ def test_readlines(self): f = self.reader(self.stream) - self.assertEquals(f.readlines(), [u'\ud55c\n', u'\uae00']) + self.assertEquals(f.readlines(), ['\ud55c\n', '\uae00']) class EncodedFileTest(unittest.TestCase): @@ -1154,7 +1154,7 @@ class BasicUnicodeTest(unittest.TestCase, MixInCheckStateHandling): def test_basics(self): - s = u"abc123" # all codecs should be able to encode these + s = "abc123" # all codecs should be able to encode these for encoding in all_unicode_encodings: name = codecs.lookup(encoding).name if encoding.endswith("_codec"): @@ -1178,7 +1178,7 @@ encodedresult += q.read() q = Queue() reader = codecs.getreader(encoding)(q) - decodedresult = u"" + decodedresult = "" for c in encodedresult: q.write(c) decodedresult += reader.read() @@ -1197,9 +1197,9 @@ encodedresult = "" for c in s: encodedresult += encoder.encode(c) - encodedresult += encoder.encode(u"", True) + encodedresult += encoder.encode("", True) decoder = codecs.getincrementaldecoder(encoding)() - decodedresult = u"" + decodedresult = "" for c in encodedresult: decodedresult += decoder.decode(c) decodedresult += decoder.decode("", True) @@ -1209,21 +1209,21 @@ encodedresult = "" for c in s: encodedresult += cencoder.encode(c) - encodedresult += cencoder.encode(u"", True) + encodedresult += cencoder.encode("", True) cdecoder = _testcapi.codec_incrementaldecoder(encoding) - decodedresult = u"" + decodedresult = "" for c in encodedresult: decodedresult += cdecoder.decode(c) decodedresult += cdecoder.decode("", True) self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) # check iterencode()/iterdecode() - result = u"".join(codecs.iterdecode(codecs.iterencode(s, encoding), encoding)) + result = "".join(codecs.iterdecode(codecs.iterencode(s, encoding), encoding)) self.assertEqual(result, s, "%r != %r (encoding=%r)" % (result, s, encoding)) # check iterencode()/iterdecode() with empty string - result = u"".join(codecs.iterdecode(codecs.iterencode(u"", encoding), encoding)) - self.assertEqual(result, u"") + result = "".join(codecs.iterdecode(codecs.iterencode("", encoding), encoding)) + self.assertEqual(result, "") if encoding not in only_strict_mode: # check incremental decoder/encoder with errors argument @@ -1235,17 +1235,17 @@ else: encodedresult = "".join(encoder.encode(c) for c in s) decoder = codecs.getincrementaldecoder(encoding)("ignore") - decodedresult = u"".join(decoder.decode(c) for c in encodedresult) + decodedresult = "".join(decoder.decode(c) for c in encodedresult) self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) encodedresult = "".join(cencoder.encode(c) for c in s) cdecoder = _testcapi.codec_incrementaldecoder(encoding, "ignore") - decodedresult = u"".join(cdecoder.decode(c) for c in encodedresult) + decodedresult = "".join(cdecoder.decode(c) for c in encodedresult) self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) def test_seek(self): # all codecs should be able to encode these - s = u"%s\n%s\n" % (100*u"abc123", 100*u"def456") + s = "%s\n%s\n" % (100*"abc123", 100*"def456") for encoding in all_unicode_encodings: if encoding == "idna": # FIXME: See SF bug #1163178 continue @@ -1278,7 +1278,7 @@ def test_decoder_state(self): # Check that getstate() and setstate() handle the state properly - u = u"abc123" + u = "abc123" for encoding in all_unicode_encodings: if encoding not in broken_incremental_coders: self.check_state_handling_decode(encoding, u, u.encode(encoding)) @@ -1296,34 +1296,34 @@ class CharmapTest(unittest.TestCase): def test_decode_with_string_map(self): self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "strict", u"abc"), - (u"abc", 3) + codecs.charmap_decode("\x00\x01\x02", "strict", "abc"), + ("abc", 3) ) self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "replace", u"ab"), - (u"ab\ufffd", 3) + codecs.charmap_decode("\x00\x01\x02", "replace", "ab"), + ("ab\ufffd", 3) ) self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "replace", u"ab\ufffe"), - (u"ab\ufffd", 3) + codecs.charmap_decode("\x00\x01\x02", "replace", "ab\ufffe"), + ("ab\ufffd", 3) ) self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "ignore", u"ab"), - (u"ab", 3) + codecs.charmap_decode("\x00\x01\x02", "ignore", "ab"), + ("ab", 3) ) self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "ignore", u"ab\ufffe"), - (u"ab", 3) + codecs.charmap_decode("\x00\x01\x02", "ignore", "ab\ufffe"), + ("ab", 3) ) allbytes = "".join(chr(i) for i in xrange(256)) self.assertEquals( - codecs.charmap_decode(allbytes, "ignore", u""), - (u"", len(allbytes)) + codecs.charmap_decode(allbytes, "ignore", ""), + ("", len(allbytes)) ) class WithStmtTest(unittest.TestCase): @@ -1337,7 +1337,7 @@ info = codecs.lookup("utf-8") with codecs.StreamReaderWriter(f, info.streamreader, info.streamwriter, 'strict') as srw: - self.assertEquals(srw.read(), u"\xfc") + self.assertEquals(srw.read(), "\xfc") def test_main(): Modified: python/branches/py3k-struni/Lib/test/test_compile.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_compile.py (original) +++ python/branches/py3k-struni/Lib/test/test_compile.py Wed May 2 21:09:54 2007 @@ -318,7 +318,7 @@ self.assertNotEqual(id(f1.__code__), id(f2.__code__)) def test_unicode_encoding(self): - code = u"# -*- coding: utf-8 -*-\npass\n" + code = "# -*- coding: utf-8 -*-\npass\n" self.assertRaises(SyntaxError, compile, code, "tmp", "exec") def test_subscripts(self): Modified: python/branches/py3k-struni/Lib/test/test_complex.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_complex.py (original) +++ python/branches/py3k-struni/Lib/test/test_complex.py Wed May 2 21:09:54 2007 @@ -227,7 +227,7 @@ self.assertEqual(complex(" 3.14+J "), 3.14+1j) if test_support.have_unicode: - self.assertEqual(complex(unicode(" 3.14+J ")), 3.14+1j) + self.assertEqual(complex(str(" 3.14+J ")), 3.14+1j) # SF bug 543840: complex(string) accepts strings with \0 # Fixed in 2.3. @@ -251,8 +251,8 @@ self.assertRaises(ValueError, complex, "1+(2j)") self.assertRaises(ValueError, complex, "(1+2j)123") if test_support.have_unicode: - self.assertRaises(ValueError, complex, unicode("1"*500)) - self.assertRaises(ValueError, complex, unicode("x")) + self.assertRaises(ValueError, complex, str("1"*500)) + self.assertRaises(ValueError, complex, str("x")) class EvilExc(Exception): pass Modified: python/branches/py3k-struni/Lib/test/test_contains.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_contains.py (original) +++ python/branches/py3k-struni/Lib/test/test_contains.py Wed May 2 21:09:54 2007 @@ -59,31 +59,31 @@ # Test char in Unicode - check('c' in unicode('abc'), "'c' not in u'abc'") - check('d' not in unicode('abc'), "'d' in u'abc'") + check('c' in str('abc'), "'c' not in u'abc'") + check('d' not in str('abc'), "'d' in u'abc'") - check('' in unicode(''), "'' not in u''") - check(unicode('') in '', "u'' not in ''") - check(unicode('') in unicode(''), "u'' not in u''") - check('' in unicode('abc'), "'' not in u'abc'") - check(unicode('') in 'abc', "u'' not in 'abc'") - check(unicode('') in unicode('abc'), "u'' not in u'abc'") + check('' in str(''), "'' not in u''") + check(str('') in '', "u'' not in ''") + check(str('') in str(''), "u'' not in u''") + check('' in str('abc'), "'' not in u'abc'") + check(str('') in 'abc', "u'' not in 'abc'") + check(str('') in str('abc'), "u'' not in u'abc'") try: - None in unicode('abc') + None in str('abc') check(0, "None in u'abc' did not raise error") except TypeError: pass # Test Unicode char in Unicode - check(unicode('c') in unicode('abc'), "u'c' not in u'abc'") - check(unicode('d') not in unicode('abc'), "u'd' in u'abc'") + check(str('c') in str('abc'), "u'c' not in u'abc'") + check(str('d') not in str('abc'), "u'd' in u'abc'") # Test Unicode char in string - check(unicode('c') in 'abc', "u'c' not in 'abc'") - check(unicode('d') not in 'abc', "u'd' in 'abc'") + check(str('c') in 'abc', "u'c' not in 'abc'") + check(str('d') not in 'abc', "u'd' in 'abc'") # A collection of tests on builtin sequence types a = range(10) Modified: python/branches/py3k-struni/Lib/test/test_cookielib.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_cookielib.py (original) +++ python/branches/py3k-struni/Lib/test/test_cookielib.py Wed May 2 21:09:54 2007 @@ -570,7 +570,7 @@ ("/foo\031/bar", "/foo%19/bar"), ("/\175foo/bar", "/%7Dfoo/bar"), # unicode - (u"/foo/bar\uabcd", "/foo/bar%EA%AF%8D"), # UTF-8 encoded + ("/foo/bar\uabcd", "/foo/bar%EA%AF%8D"), # UTF-8 encoded ] for arg, result in cases: self.assertEquals(escape_path(arg), result) @@ -1540,7 +1540,7 @@ self.assert_(not cookie) # unicode URL doesn't raise exception - cookie = interact_2965(c, u"http://www.acme.com/\xfc") + cookie = interact_2965(c, "http://www.acme.com/\xfc") def test_mozilla(self): # Save / load Mozilla/Netscape cookie file format. Modified: python/branches/py3k-struni/Lib/test/test_copy.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_copy.py (original) +++ python/branches/py3k-struni/Lib/test/test_copy.py Wed May 2 21:09:54 2007 @@ -83,7 +83,7 @@ def f(): pass tests = [None, 42, 2**100, 3.14, True, False, 1j, - "hello", u"hello\u1234", f.__code__, + "hello", "hello\u1234", f.__code__, NewStyle, xrange(10), Classic, max] for x in tests: self.assert_(copy.copy(x) is x, repr(x)) @@ -256,7 +256,7 @@ def f(): pass tests = [None, 42, 2**100, 3.14, True, False, 1j, - "hello", u"hello\u1234", f.__code__, + "hello", "hello\u1234", f.__code__, NewStyle, xrange(10), Classic, max] for x in tests: self.assert_(copy.deepcopy(x) is x, repr(x)) Modified: python/branches/py3k-struni/Lib/test/test_descr.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_descr.py (original) +++ python/branches/py3k-struni/Lib/test/test_descr.py Wed May 2 21:09:54 2007 @@ -264,7 +264,7 @@ del junk # Just make sure these don't blow up! - for arg in 2, 2, 2j, 2e0, [2], "2", u"2", (2,), {2:2}, type, test_dir: + for arg in 2, 2, 2j, 2e0, [2], "2", "2", (2,), {2:2}, type, test_dir: dir(arg) # Test dir on custom classes. Since these have object as a @@ -1100,25 +1100,25 @@ # Test unicode slot names try: - unicode + str except NameError: pass else: # Test a single unicode string is not expanded as a sequence. class C(object): - __slots__ = unicode("abc") + __slots__ = str("abc") c = C() c.abc = 5 vereq(c.abc, 5) # _unicode_to_string used to modify slots in certain circumstances - slots = (unicode("foo"), unicode("bar")) + slots = (str("foo"), str("bar")) class C(object): __slots__ = slots x = C() x.foo = 5 vereq(x.foo, 5) - veris(type(slots[0]), unicode) + veris(type(slots[0]), str) # this used to leak references try: class C(object): @@ -2301,64 +2301,64 @@ verify(s.lower().__class__ is str) vereq(s.lower(), base) - class madunicode(unicode): + class madunicode(str): _rev = None def rev(self): if self._rev is not None: return self._rev L = list(self) L.reverse() - self._rev = self.__class__(u"".join(L)) + self._rev = self.__class__("".join(L)) return self._rev u = madunicode("ABCDEF") - vereq(u, u"ABCDEF") - vereq(u.rev(), madunicode(u"FEDCBA")) - vereq(u.rev().rev(), madunicode(u"ABCDEF")) - base = u"12345" + vereq(u, "ABCDEF") + vereq(u.rev(), madunicode("FEDCBA")) + vereq(u.rev().rev(), madunicode("ABCDEF")) + base = "12345" u = madunicode(base) - vereq(unicode(u), base) - verify(unicode(u).__class__ is unicode) + vereq(str(u), base) + verify(str(u).__class__ is str) vereq(hash(u), hash(base)) vereq({u: 1}[base], 1) vereq({base: 1}[u], 1) - verify(u.strip().__class__ is unicode) + verify(u.strip().__class__ is str) vereq(u.strip(), base) - verify(u.lstrip().__class__ is unicode) + verify(u.lstrip().__class__ is str) vereq(u.lstrip(), base) - verify(u.rstrip().__class__ is unicode) + verify(u.rstrip().__class__ is str) vereq(u.rstrip(), base) - verify(u.replace(u"x", u"x").__class__ is unicode) - vereq(u.replace(u"x", u"x"), base) - verify(u.replace(u"xy", u"xy").__class__ is unicode) - vereq(u.replace(u"xy", u"xy"), base) - verify(u.center(len(u)).__class__ is unicode) + verify(u.replace("x", "x").__class__ is str) + vereq(u.replace("x", "x"), base) + verify(u.replace("xy", "xy").__class__ is str) + vereq(u.replace("xy", "xy"), base) + verify(u.center(len(u)).__class__ is str) vereq(u.center(len(u)), base) - verify(u.ljust(len(u)).__class__ is unicode) + verify(u.ljust(len(u)).__class__ is str) vereq(u.ljust(len(u)), base) - verify(u.rjust(len(u)).__class__ is unicode) + verify(u.rjust(len(u)).__class__ is str) vereq(u.rjust(len(u)), base) - verify(u.lower().__class__ is unicode) + verify(u.lower().__class__ is str) vereq(u.lower(), base) - verify(u.upper().__class__ is unicode) + verify(u.upper().__class__ is str) vereq(u.upper(), base) - verify(u.capitalize().__class__ is unicode) + verify(u.capitalize().__class__ is str) vereq(u.capitalize(), base) - verify(u.title().__class__ is unicode) + verify(u.title().__class__ is str) vereq(u.title(), base) - verify((u + u"").__class__ is unicode) - vereq(u + u"", base) - verify((u"" + u).__class__ is unicode) - vereq(u"" + u, base) - verify((u * 0).__class__ is unicode) - vereq(u * 0, u"") - verify((u * 1).__class__ is unicode) + verify((u + "").__class__ is str) + vereq(u + "", base) + verify(("" + u).__class__ is str) + vereq("" + u, base) + verify((u * 0).__class__ is str) + vereq(u * 0, "") + verify((u * 1).__class__ is str) vereq(u * 1, base) - verify((u * 2).__class__ is unicode) + verify((u * 2).__class__ is str) vereq(u * 2, base + base) - verify(u[:].__class__ is unicode) + verify(u[:].__class__ is str) vereq(u[:], base) - verify(u[0:0].__class__ is unicode) - vereq(u[0:0], u"") + verify(u[0:0].__class__ is str) + vereq(u[0:0], "") class sublist(list): pass @@ -2437,12 +2437,12 @@ vereq(int(x=3), 3) vereq(complex(imag=42, real=666), complex(666, 42)) vereq(str(object=500), '500') - vereq(unicode(string='abc', errors='strict'), u'abc') + vereq(str(string='abc', errors='strict'), 'abc') vereq(tuple(sequence=range(3)), (0, 1, 2)) vereq(list(sequence=(0, 1, 2)), range(3)) # note: as of Python 2.3, dict() no longer has an "items" keyword arg - for constructor in (int, float, int, complex, str, unicode, + for constructor in (int, float, int, complex, str, str, tuple, list, file): try: constructor(bogus_keyword_arg=1) @@ -2719,13 +2719,13 @@ class H(object): __slots__ = ["b", "a"] try: - unicode + str except NameError: class I(object): __slots__ = ["a", "b"] else: class I(object): - __slots__ = [unicode("a"), unicode("b")] + __slots__ = [str("a"), str("b")] class J(object): __slots__ = ["c", "b"] class K(object): @@ -3124,9 +3124,9 @@ # It's not clear that unicode will continue to support the character # buffer interface, and this test will fail if that's taken away. - class MyUni(unicode): + class MyUni(str): pass - base = u'abc' + base = 'abc' m = MyUni(base) vereq(binascii.b2a_hex(m), binascii.b2a_hex(base)) Modified: python/branches/py3k-struni/Lib/test/test_doctest2.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_doctest2.py (original) +++ python/branches/py3k-struni/Lib/test/test_doctest2.py Wed May 2 21:09:54 2007 @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -u"""A module to test whether doctest recognizes some 2.2 features, +"""A module to test whether doctest recognizes some 2.2 features, like static and class methods. >>> print('yup') # 1 @@ -15,7 +15,7 @@ from test import test_support class C(object): - u"""Class C. + """Class C. >>> print(C()) # 2 42 Modified: python/branches/py3k-struni/Lib/test/test_exceptions.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_exceptions.py (original) +++ python/branches/py3k-struni/Lib/test/test_exceptions.py Wed May 2 21:09:54 2007 @@ -251,19 +251,19 @@ 'print_file_and_line' : None, 'msg' : 'msgStr', 'filename' : None, 'lineno' : None, 'offset' : None}), (UnicodeError, (), {'message' : '', 'args' : (),}), - (UnicodeEncodeError, ('ascii', u'a', 0, 1, 'ordinal not in range'), - {'message' : '', 'args' : ('ascii', u'a', 0, 1, + (UnicodeEncodeError, ('ascii', 'a', 0, 1, 'ordinal not in range'), + {'message' : '', 'args' : ('ascii', 'a', 0, 1, 'ordinal not in range'), - 'encoding' : 'ascii', 'object' : u'a', + 'encoding' : 'ascii', 'object' : 'a', 'start' : 0, 'reason' : 'ordinal not in range'}), (UnicodeDecodeError, ('ascii', '\xff', 0, 1, 'ordinal not in range'), {'message' : '', 'args' : ('ascii', '\xff', 0, 1, 'ordinal not in range'), 'encoding' : 'ascii', 'object' : '\xff', 'start' : 0, 'reason' : 'ordinal not in range'}), - (UnicodeTranslateError, (u"\u3042", 0, 1, "ouch"), - {'message' : '', 'args' : (u'\u3042', 0, 1, 'ouch'), - 'object' : u'\u3042', 'reason' : 'ouch', + (UnicodeTranslateError, ("\u3042", 0, 1, "ouch"), + {'message' : '', 'args' : ('\u3042', 0, 1, 'ouch'), + 'object' : '\u3042', 'reason' : 'ouch', 'start' : 0, 'end' : 1}), ] try: @@ -334,9 +334,9 @@ # Make sure both instances and classes have a str and unicode # representation. self.failUnless(str(Exception)) - self.failUnless(unicode(Exception)) + self.failUnless(str(Exception)) + self.failUnless(str(Exception('a'))) self.failUnless(str(Exception('a'))) - self.failUnless(unicode(Exception(u'a'))) def testExceptionCleanup(self): # Make sure "except V as N" exceptions are cleaned up properly Modified: python/branches/py3k-struni/Lib/test/test_file.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_file.py (original) +++ python/branches/py3k-struni/Lib/test/test_file.py Wed May 2 21:09:54 2007 @@ -145,7 +145,7 @@ def testUnicodeOpen(self): # verify repr works for unicode too - f = open(unicode(TESTFN), "w") + f = open(str(TESTFN), "w") self.assert_(repr(f).startswith("", [ - ("starttag", "html", [("foo", u"\u20AC&aa&unsupported;")]) + ("starttag", "html", [("foo", "\u20AC&aa&unsupported;")]) ]) Modified: python/branches/py3k-struni/Lib/test/test_index.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_index.py (original) +++ python/branches/py3k-struni/Lib/test/test_index.py Wed May 2 21:09:54 2007 @@ -161,7 +161,7 @@ seq = "this is a test" class UnicodeTestCase(SeqTestCase): - seq = u"this is a test" + seq = "this is a test" class XRangeTestCase(unittest.TestCase): Modified: python/branches/py3k-struni/Lib/test/test_io.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_io.py (original) +++ python/branches/py3k-struni/Lib/test/test_io.py Wed May 2 21:09:54 2007 @@ -542,13 +542,13 @@ def multi_line_test(self, f, enc): f.seek(0) f.truncate() - sample = u"s\xff\u0fff\uffff" + sample = "s\xff\u0fff\uffff" wlines = [] for size in (0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 62, 63, 64, 65, 1000): chars = [] for i in xrange(size): chars.append(sample[i % len(sample)]) - line = u"".join(chars) + "\n" + line = "".join(chars) + "\n" wlines.append((f.tell(), line)) f.write(line) f.seek(0) @@ -564,19 +564,19 @@ def testTelling(self): f = io.open(test_support.TESTFN, "w+", encoding="utf8") p0 = f.tell() - f.write(u"\xff\n") + f.write("\xff\n") p1 = f.tell() - f.write(u"\xff\n") + f.write("\xff\n") p2 = f.tell() f.seek(0) self.assertEquals(f.tell(), p0) - self.assertEquals(f.readline(), u"\xff\n") + self.assertEquals(f.readline(), "\xff\n") self.assertEquals(f.tell(), p1) - self.assertEquals(f.readline(), u"\xff\n") + self.assertEquals(f.readline(), "\xff\n") self.assertEquals(f.tell(), p2) f.seek(0) for line in f: - self.assertEquals(line, u"\xff\n") + self.assertEquals(line, "\xff\n") self.assertRaises(IOError, f.tell) self.assertEquals(f.tell(), p2) f.close() @@ -584,10 +584,10 @@ def testSeeking(self): chunk_size = io.TextIOWrapper._CHUNK_SIZE prefix_size = chunk_size - 2 - u_prefix = u"a" * prefix_size + u_prefix = "a" * prefix_size prefix = bytes(u_prefix.encode("utf-8")) self.assertEquals(len(u_prefix), len(prefix)) - u_suffix = u"\u8888\n" + u_suffix = "\u8888\n" suffix = bytes(u_suffix.encode("utf-8")) line = prefix + suffix f = io.open(test_support.TESTFN, "wb") @@ -614,7 +614,7 @@ def timingTest(self): timer = time.time enc = "utf8" - line = u"\0\x0f\xff\u0fff\uffff\U000fffff\U0010ffff"*3 + "\n" + line = "\0\x0f\xff\u0fff\uffff\U000fffff\U0010ffff"*3 + "\n" nlines = 10000 nchars = len(line) nbytes = len(line.encode(enc)) Modified: python/branches/py3k-struni/Lib/test/test_isinstance.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_isinstance.py (original) +++ python/branches/py3k-struni/Lib/test/test_isinstance.py Wed May 2 21:09:54 2007 @@ -243,7 +243,7 @@ self.assertEqual(True, issubclass(int, (int, (float, int)))) if test_support.have_unicode: - self.assertEqual(True, issubclass(str, (unicode, (Child, NewChild, basestring)))) + self.assertEqual(True, issubclass(str, (str, (Child, NewChild, basestring)))) def test_subclass_recursion_limit(self): # make sure that issubclass raises RuntimeError before the C stack is Modified: python/branches/py3k-struni/Lib/test/test_iter.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_iter.py (original) +++ python/branches/py3k-struni/Lib/test/test_iter.py Wed May 2 21:09:54 2007 @@ -216,9 +216,9 @@ # Test a Unicode string if have_unicode: def test_iter_unicode(self): - self.check_for_loop(iter(unicode("abcde")), - [unicode("a"), unicode("b"), unicode("c"), - unicode("d"), unicode("e")]) + self.check_for_loop(iter(str("abcde")), + [str("a"), str("b"), str("c"), + str("d"), str("e")]) # Test a directory def test_iter_dict(self): @@ -518,7 +518,7 @@ i = self.i self.i = i+1 if i == 2: - return unicode("fooled you!") + return str("fooled you!") return next(self.it) f = open(TESTFN, "w") @@ -535,7 +535,7 @@ # and pass that on to unicode.join(). try: got = " - ".join(OhPhooey(f)) - self.assertEqual(got, unicode("a\n - b\n - fooled you! - c\n")) + self.assertEqual(got, str("a\n - b\n - fooled you! - c\n")) finally: f.close() try: Modified: python/branches/py3k-struni/Lib/test/test_macfs.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_macfs.py (original) +++ python/branches/py3k-struni/Lib/test/test_macfs.py Wed May 2 21:09:54 2007 @@ -32,7 +32,7 @@ def test_fsref_unicode(self): if sys.getfilesystemencoding(): - testfn_unicode = unicode(test_support.TESTFN) + testfn_unicode = str(test_support.TESTFN) fsr = macfs.FSRef(testfn_unicode) self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) Modified: python/branches/py3k-struni/Lib/test/test_marshal.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_marshal.py (original) +++ python/branches/py3k-struni/Lib/test/test_marshal.py Wed May 2 21:09:54 2007 @@ -106,7 +106,7 @@ class StringTestCase(unittest.TestCase): def test_unicode(self): - for s in [u"", u"Andr? Previn", u"abc", u" "*10000]: + for s in ["", "Andr? Previn", "abc", " "*10000]: new = marshal.loads(marshal.dumps(s)) self.assertEqual(s, new) self.assertEqual(type(s), type(new)) @@ -156,7 +156,7 @@ 'alist': ['.zyx.41'], 'atuple': ('.zyx.41',)*10, 'aboolean': False, - 'aunicode': u"Andr? Previn" + 'aunicode': "Andr? Previn" } def test_dict(self): new = marshal.loads(marshal.dumps(self.d)) Modified: python/branches/py3k-struni/Lib/test/test_minidom.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_minidom.py (original) +++ python/branches/py3k-struni/Lib/test/test_minidom.py Wed May 2 21:09:54 2007 @@ -166,7 +166,7 @@ def testAppendChild(self): dom = parse(tstfile) - dom.documentElement.appendChild(dom.createComment(u"Hello")) + dom.documentElement.appendChild(dom.createComment("Hello")) self.confirm(dom.documentElement.childNodes[-1].nodeName == "#comment") self.confirm(dom.documentElement.childNodes[-1].data == "Hello") dom.unlink() @@ -427,7 +427,7 @@ def testElementReprAndStrUnicode(self): dom = Document() - el = dom.appendChild(dom.createElement(u"abc")) + el = dom.appendChild(dom.createElement("abc")) string1 = repr(el) string2 = str(el) self.confirm(string1 == string2) @@ -436,7 +436,7 @@ def testElementReprAndStrUnicodeNS(self): dom = Document() el = dom.appendChild( - dom.createElementNS(u"http://www.slashdot.org", u"slash:abc")) + dom.createElementNS("http://www.slashdot.org", "slash:abc")) string1 = repr(el) string2 = str(el) self.confirm(string1 == string2) @@ -445,7 +445,7 @@ def testAttributeRepr(self): dom = Document() - el = dom.appendChild(dom.createElement(u"abc")) + el = dom.appendChild(dom.createElement("abc")) node = el.setAttribute("abc", "def") self.confirm(str(node) == repr(node)) dom.unlink() @@ -869,7 +869,7 @@ def testEncodings(self): doc = parseString('') - self.confirm(doc.toxml() == u'\u20ac' + self.confirm(doc.toxml() == '\u20ac' and doc.toxml('utf-8') == '\xe2\x82\xac' and doc.toxml('iso-8859-15') == Modified: python/branches/py3k-struni/Lib/test/test_module.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_module.py (original) +++ python/branches/py3k-struni/Lib/test/test_module.py Wed May 2 21:09:54 2007 @@ -35,15 +35,15 @@ def test_unicode_docstring(self): # Unicode docstring - foo = ModuleType("foo", u"foodoc\u1234") + foo = ModuleType("foo", "foodoc\u1234") self.assertEqual(foo.__name__, "foo") - self.assertEqual(foo.__doc__, u"foodoc\u1234") + self.assertEqual(foo.__doc__, "foodoc\u1234") self.assertEqual(foo.__dict__, - {"__name__": "foo", "__doc__": u"foodoc\u1234"}) + {"__name__": "foo", "__doc__": "foodoc\u1234"}) def test_reinit(self): # Reinitialization should not replace the __dict__ - foo = ModuleType("foo", u"foodoc\u1234") + foo = ModuleType("foo", "foodoc\u1234") foo.bar = 42 d = foo.__dict__ foo.__init__("foo", "foodoc") Modified: python/branches/py3k-struni/Lib/test/test_multibytecodec.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_multibytecodec.py (original) +++ python/branches/py3k-struni/Lib/test/test_multibytecodec.py Wed May 2 21:09:54 2007 @@ -30,9 +30,9 @@ def test_nullcoding(self): for enc in ALL_CJKENCODINGS: - self.assertEqual(''.decode(enc), u'') - self.assertEqual(unicode('', enc), u'') - self.assertEqual(u''.encode(enc), '') + self.assertEqual(''.decode(enc), '') + self.assertEqual(str('', enc), '') + self.assertEqual(''.encode(enc), '') def test_str_decode(self): for enc in ALL_CJKENCODINGS: @@ -40,7 +40,7 @@ def test_errorcallback_longindex(self): dec = codecs.getdecoder('euc-kr') - myreplace = lambda exc: (u'', sys.maxint+1) + myreplace = lambda exc: ('', sys.maxint+1) codecs.register_error('test.cjktest', myreplace) self.assertRaises(IndexError, dec, 'apple\x92ham\x93spam', 'test.cjktest') @@ -58,14 +58,14 @@ def test_stateless(self): # cp949 encoder isn't stateful at all. encoder = codecs.getincrementalencoder('cp949')() - self.assertEqual(encoder.encode(u'\ud30c\uc774\uc36c \ub9c8\uc744'), + self.assertEqual(encoder.encode('\ud30c\uc774\uc36c \ub9c8\uc744'), '\xc6\xc4\xc0\xcc\xbd\xe3 \xb8\xb6\xc0\xbb') self.assertEqual(encoder.reset(), None) - self.assertEqual(encoder.encode(u'\u2606\u223c\u2606', True), + self.assertEqual(encoder.encode('\u2606\u223c\u2606', True), '\xa1\xd9\xa1\xad\xa1\xd9') self.assertEqual(encoder.reset(), None) - self.assertEqual(encoder.encode(u'', True), '') - self.assertEqual(encoder.encode(u'', False), '') + self.assertEqual(encoder.encode('', True), '') + self.assertEqual(encoder.encode('', False), '') self.assertEqual(encoder.reset(), None) def test_stateful(self): @@ -75,29 +75,29 @@ # U+0300 => ABDC encoder = codecs.getincrementalencoder('jisx0213')() - self.assertEqual(encoder.encode(u'\u00e6\u0300'), '\xab\xc4') - self.assertEqual(encoder.encode(u'\u00e6'), '') - self.assertEqual(encoder.encode(u'\u0300'), '\xab\xc4') - self.assertEqual(encoder.encode(u'\u00e6', True), '\xa9\xdc') + self.assertEqual(encoder.encode('\u00e6\u0300'), '\xab\xc4') + self.assertEqual(encoder.encode('\u00e6'), '') + self.assertEqual(encoder.encode('\u0300'), '\xab\xc4') + self.assertEqual(encoder.encode('\u00e6', True), '\xa9\xdc') self.assertEqual(encoder.reset(), None) - self.assertEqual(encoder.encode(u'\u0300'), '\xab\xdc') + self.assertEqual(encoder.encode('\u0300'), '\xab\xdc') - self.assertEqual(encoder.encode(u'\u00e6'), '') + self.assertEqual(encoder.encode('\u00e6'), '') self.assertEqual(encoder.encode('', True), '\xa9\xdc') self.assertEqual(encoder.encode('', True), '') def test_stateful_keep_buffer(self): encoder = codecs.getincrementalencoder('jisx0213')() - self.assertEqual(encoder.encode(u'\u00e6'), '') - self.assertRaises(UnicodeEncodeError, encoder.encode, u'\u0123') - self.assertEqual(encoder.encode(u'\u0300\u00e6'), '\xab\xc4') - self.assertRaises(UnicodeEncodeError, encoder.encode, u'\u0123') + self.assertEqual(encoder.encode('\u00e6'), '') + self.assertRaises(UnicodeEncodeError, encoder.encode, '\u0123') + self.assertEqual(encoder.encode('\u0300\u00e6'), '\xab\xc4') + self.assertRaises(UnicodeEncodeError, encoder.encode, '\u0123') self.assertEqual(encoder.reset(), None) - self.assertEqual(encoder.encode(u'\u0300'), '\xab\xdc') - self.assertEqual(encoder.encode(u'\u00e6'), '') - self.assertRaises(UnicodeEncodeError, encoder.encode, u'\u0123') - self.assertEqual(encoder.encode(u'', True), '\xa9\xdc') + self.assertEqual(encoder.encode('\u0300'), '\xab\xdc') + self.assertEqual(encoder.encode('\u00e6'), '') + self.assertRaises(UnicodeEncodeError, encoder.encode, '\u0123') + self.assertEqual(encoder.encode('', True), '\xa9\xdc') class Test_IncrementalDecoder(unittest.TestCase): @@ -106,52 +106,52 @@ # cp949 decoder is simple with only 1 or 2 bytes sequences. decoder = codecs.getincrementaldecoder('cp949')() self.assertEqual(decoder.decode('\xc6\xc4\xc0\xcc\xbd'), - u'\ud30c\uc774') + '\ud30c\uc774') self.assertEqual(decoder.decode('\xe3 \xb8\xb6\xc0\xbb'), - u'\uc36c \ub9c8\uc744') - self.assertEqual(decoder.decode(''), u'') + '\uc36c \ub9c8\uc744') + self.assertEqual(decoder.decode(''), '') def test_dbcs_keep_buffer(self): decoder = codecs.getincrementaldecoder('cp949')() - self.assertEqual(decoder.decode('\xc6\xc4\xc0'), u'\ud30c') + self.assertEqual(decoder.decode('\xc6\xc4\xc0'), '\ud30c') self.assertRaises(UnicodeDecodeError, decoder.decode, '', True) - self.assertEqual(decoder.decode('\xcc'), u'\uc774') + self.assertEqual(decoder.decode('\xcc'), '\uc774') - self.assertEqual(decoder.decode('\xc6\xc4\xc0'), u'\ud30c') + self.assertEqual(decoder.decode('\xc6\xc4\xc0'), '\ud30c') self.assertRaises(UnicodeDecodeError, decoder.decode, '\xcc\xbd', True) - self.assertEqual(decoder.decode('\xcc'), u'\uc774') + self.assertEqual(decoder.decode('\xcc'), '\uc774') def test_iso2022(self): decoder = codecs.getincrementaldecoder('iso2022-jp')() ESC = '\x1b' - self.assertEqual(decoder.decode(ESC + '('), u'') - self.assertEqual(decoder.decode('B', True), u'') - self.assertEqual(decoder.decode(ESC + '$'), u'') - self.assertEqual(decoder.decode('B@$'), u'\u4e16') - self.assertEqual(decoder.decode('@$@'), u'\u4e16') - self.assertEqual(decoder.decode('$', True), u'\u4e16') + self.assertEqual(decoder.decode(ESC + '('), '') + self.assertEqual(decoder.decode('B', True), '') + self.assertEqual(decoder.decode(ESC + '$'), '') + self.assertEqual(decoder.decode('B@$'), '\u4e16') + self.assertEqual(decoder.decode('@$@'), '\u4e16') + self.assertEqual(decoder.decode('$', True), '\u4e16') self.assertEqual(decoder.reset(), None) - self.assertEqual(decoder.decode('@$'), u'@$') - self.assertEqual(decoder.decode(ESC + '$'), u'') + self.assertEqual(decoder.decode('@$'), '@$') + self.assertEqual(decoder.decode(ESC + '$'), '') self.assertRaises(UnicodeDecodeError, decoder.decode, '', True) - self.assertEqual(decoder.decode('B@$'), u'\u4e16') + self.assertEqual(decoder.decode('B@$'), '\u4e16') class Test_StreamWriter(unittest.TestCase): - if len(u'\U00012345') == 2: # UCS2 + if len('\U00012345') == 2: # UCS2 def test_gb18030(self): s= StringIO.StringIO() c = codecs.getwriter('gb18030')(s) - c.write(u'123') + c.write('123') self.assertEqual(s.getvalue(), '123') - c.write(u'\U00012345') + c.write('\U00012345') self.assertEqual(s.getvalue(), '123\x907\x959') - c.write(u'\U00012345'[0]) + c.write('\U00012345'[0]) self.assertEqual(s.getvalue(), '123\x907\x959') - c.write(u'\U00012345'[1] + u'\U00012345' + u'\uac00\u00ac') + c.write('\U00012345'[1] + '\U00012345' + '\uac00\u00ac') self.assertEqual(s.getvalue(), '123\x907\x959\x907\x959\x907\x959\x827\xcf5\x810\x851') - c.write(u'\U00012345'[0]) + c.write('\U00012345'[0]) self.assertEqual(s.getvalue(), '123\x907\x959\x907\x959\x907\x959\x827\xcf5\x810\x851') self.assertRaises(UnicodeError, c.reset) @@ -161,20 +161,20 @@ def test_utf_8(self): s= StringIO.StringIO() c = codecs.getwriter('utf-8')(s) - c.write(u'123') + c.write('123') self.assertEqual(s.getvalue(), '123') - c.write(u'\U00012345') + c.write('\U00012345') self.assertEqual(s.getvalue(), '123\xf0\x92\x8d\x85') # Python utf-8 codec can't buffer surrogate pairs yet. if 0: - c.write(u'\U00012345'[0]) + c.write('\U00012345'[0]) self.assertEqual(s.getvalue(), '123\xf0\x92\x8d\x85') - c.write(u'\U00012345'[1] + u'\U00012345' + u'\uac00\u00ac') + c.write('\U00012345'[1] + '\U00012345' + '\uac00\u00ac') self.assertEqual(s.getvalue(), '123\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85' '\xea\xb0\x80\xc2\xac') - c.write(u'\U00012345'[0]) + c.write('\U00012345'[0]) self.assertEqual(s.getvalue(), '123\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85' '\xea\xb0\x80\xc2\xac') @@ -182,7 +182,7 @@ self.assertEqual(s.getvalue(), '123\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85' '\xea\xb0\x80\xc2\xac\xed\xa0\x88') - c.write(u'\U00012345'[1]) + c.write('\U00012345'[1]) self.assertEqual(s.getvalue(), '123\xf0\x92\x8d\x85\xf0\x92\x8d\x85\xf0\x92\x8d\x85' '\xea\xb0\x80\xc2\xac\xed\xa0\x88\xed\xbd\x85') @@ -199,13 +199,13 @@ class Test_ISO2022(unittest.TestCase): def test_g2(self): iso2022jp2 = '\x1b(B:hu4:unit\x1b.A\x1bNi de famille' - uni = u':hu4:unit\xe9 de famille' + uni = ':hu4:unit\xe9 de famille' self.assertEqual(iso2022jp2.decode('iso2022-jp-2'), uni) def test_iso2022_jp_g0(self): - self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2')) + self.failIf('\x0e' in '\N{SOFT HYPHEN}'.encode('iso-2022-jp-2')) for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'): - e = u'\u3406'.encode(encoding) + e = '\u3406'.encode(encoding) self.failIf(filter(lambda x: x >= '\x80', e)) def test_bug1572832(self): Modified: python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py (original) +++ python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py Wed May 2 21:09:54 2007 @@ -18,7 +18,7 @@ roundtriptest = 1 # set if roundtrip is possible with unicode has_iso10646 = 0 # set if this encoding contains whole iso10646 map xmlcharnametest = None # string to test xmlcharrefreplace - unmappedunicode = u'\udeee' # a unicode codepoint that is not mapped. + unmappedunicode = '\udeee' # a unicode codepoint that is not mapped. def setUp(self): if self.codec is None: @@ -54,7 +54,7 @@ if self.has_iso10646: return - s = u"\u0b13\u0b23\u0b60 nd eggs" + s = "\u0b13\u0b23\u0b60 nd eggs" self.assertEqual( self.encode(s, "xmlcharrefreplace")[0], "ଓଣୠ nd eggs" @@ -72,17 +72,17 @@ l = [] for c in exc.object[exc.start:exc.end]: if ord(c) in codepoint2name: - l.append(u"&%s;" % codepoint2name[ord(c)]) + l.append("&%s;" % codepoint2name[ord(c)]) else: - l.append(u"&#%d;" % ord(c)) - return (u"".join(l), exc.end) + l.append("&#%d;" % ord(c)) + return ("".join(l), exc.end) codecs.register_error("test.xmlcharnamereplace", xmlcharnamereplace) if self.xmlcharnametest: sin, sout = self.xmlcharnametest else: - sin = u"\xab\u211c\xbb = \u2329\u1234\u232a" + sin = "\xab\u211c\xbb = \u2329\u1234\u232a" sout = "«ℜ» = ⟨ሴ⟩" self.assertEqual(self.encode(sin, "test.xmlcharnamereplace")[0], sout) @@ -98,20 +98,20 @@ def test_callback_long_index(self): def myreplace(exc): - return (u'x', int(exc.end)) + return ('x', int(exc.end)) codecs.register_error("test.cjktest", myreplace) - self.assertEqual(self.encode(u'abcd' + self.unmappedunicode + u'efgh', + self.assertEqual(self.encode('abcd' + self.unmappedunicode + 'efgh', 'test.cjktest'), ('abcdxefgh', 9)) def myreplace(exc): - return (u'x', sys.maxint + 1) + return ('x', sys.maxint + 1) codecs.register_error("test.cjktest", myreplace) self.assertRaises(IndexError, self.encode, self.unmappedunicode, 'test.cjktest') def test_callback_None_index(self): def myreplace(exc): - return (u'x', None) + return ('x', None) codecs.register_error("test.cjktest", myreplace) self.assertRaises(TypeError, self.encode, self.unmappedunicode, 'test.cjktest') @@ -120,25 +120,25 @@ def myreplace(exc): if myreplace.limit > 0: myreplace.limit -= 1 - return (u'REPLACED', 0) + return ('REPLACED', 0) else: - return (u'TERMINAL', exc.end) + return ('TERMINAL', exc.end) myreplace.limit = 3 codecs.register_error("test.cjktest", myreplace) - self.assertEqual(self.encode(u'abcd' + self.unmappedunicode + u'efgh', + self.assertEqual(self.encode('abcd' + self.unmappedunicode + 'efgh', 'test.cjktest'), ('abcdREPLACEDabcdREPLACEDabcdREPLACEDabcdTERMINALefgh', 9)) def test_callback_forward_index(self): def myreplace(exc): - return (u'REPLACED', exc.end + 2) + return ('REPLACED', exc.end + 2) codecs.register_error("test.cjktest", myreplace) - self.assertEqual(self.encode(u'abcd' + self.unmappedunicode + u'efgh', + self.assertEqual(self.encode('abcd' + self.unmappedunicode + 'efgh', 'test.cjktest'), ('abcdREPLACEDgh', 9)) def test_callback_index_outofbound(self): def myreplace(exc): - return (u'TERM', 100) + return ('TERM', 100) codecs.register_error("test.cjktest", myreplace) self.assertRaises(IndexError, self.encode, self.unmappedunicode, 'test.cjktest') @@ -191,7 +191,7 @@ e.reset() def tempreplace(exc): - return (u'called', exc.end) + return ('called', exc.end) codecs.register_error('test.incremental_error_callback', tempreplace) e.errors = 'test.incremental_error_callback' self.assertEqual(e.encode(inv, True), 'called') @@ -243,7 +243,7 @@ self.assertEqual(ostream.getvalue(), self.tstring[0]) -if len(u'\U00012345') == 2: # ucs2 build +if len('\U00012345') == 2: # ucs2 build _unichr = unichr def unichr(v): if v >= 0x10000: @@ -272,7 +272,7 @@ return test_support.open_urlresource(self.mapfileurl) def test_mapping_file(self): - unichrs = lambda s: u''.join(map(unichr, map(eval, s.split('+')))) + unichrs = lambda s: ''.join(map(unichr, map(eval, s.split('+')))) urt_wa = {} for line in self.open_mapping_file(): @@ -311,7 +311,7 @@ if (csetch, unich) not in self.pass_enctest: self.assertEqual(unich.encode(self.encoding), csetch) if (csetch, unich) not in self.pass_dectest: - self.assertEqual(unicode(csetch, self.encoding), unich) + self.assertEqual(str(csetch, self.encoding), unich) def load_teststring(encoding): from test import cjkencodings_test Modified: python/branches/py3k-struni/Lib/test/test_normalization.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_normalization.py (original) +++ python/branches/py3k-struni/Lib/test/test_normalization.py Wed May 2 21:09:54 2007 @@ -28,7 +28,7 @@ for x in data: if x > sys.maxunicode: raise RangeError - return u"".join([unichr(x) for x in data]) + return "".join([unichr(x) for x in data]) class NormalizationTest(unittest.TestCase): def test_main(self): @@ -84,7 +84,7 @@ def test_bug_834676(self): # Check for bug 834676 - normalize('NFC', u'\ud55c\uae00') + normalize('NFC', '\ud55c\uae00') def test_main(): Modified: python/branches/py3k-struni/Lib/test/test_optparse.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_optparse.py (original) +++ python/branches/py3k-struni/Lib/test/test_optparse.py Wed May 2 21:09:54 2007 @@ -1520,8 +1520,8 @@ def test_help_unicode(self): self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE) - self.parser.add_option("-a", action="store_true", help=u"ol\u00E9!") - expect = u"""\ + self.parser.add_option("-a", action="store_true", help="ol\u00E9!") + expect = """\ Options: -h, --help show this help message and exit -a ol\u00E9! @@ -1530,8 +1530,8 @@ def test_help_unicode_description(self): self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE, - description=u"ol\u00E9!") - expect = u"""\ + description="ol\u00E9!") + expect = """\ ol\u00E9! Options: Modified: python/branches/py3k-struni/Lib/test/test_pep263.py ============================================================================== Binary files. No diff available. Modified: python/branches/py3k-struni/Lib/test/test_pep277.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_pep277.py (original) +++ python/branches/py3k-struni/Lib/test/test_pep277.py Wed May 2 21:09:54 2007 @@ -7,14 +7,14 @@ filenames = [ 'abc', - u'ascii', - u'Gr\xfc\xdf-Gott', - u'\u0393\u03b5\u03b9\u03ac-\u03c3\u03b1\u03c2', - u'\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435', - u'\u306b\u307d\u3093', - u'\u05d4\u05e9\u05e7\u05e6\u05e5\u05e1', - u'\u66e8\u66e9\u66eb', - u'\u66e8\u05e9\u3093\u0434\u0393\xdf', + 'ascii', + 'Gr\xfc\xdf-Gott', + '\u0393\u03b5\u03b9\u03ac-\u03c3\u03b1\u03c2', + '\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435', + '\u306b\u307d\u3093', + '\u05d4\u05e9\u05e7\u05e6\u05e5\u05e1', + '\u66e8\u66e9\u66eb', + '\u66e8\u05e9\u3093\u0434\u0393\xdf', ] # Destroy directory dirname and all files under it, to one level. @@ -23,7 +23,7 @@ # an error if we can't remove it. if os.path.exists(dirname): # must pass unicode to os.listdir() so we get back unicode results. - for fname in os.listdir(unicode(dirname)): + for fname in os.listdir(str(dirname)): os.unlink(os.path.join(dirname, fname)) os.rmdir(dirname) @@ -80,7 +80,7 @@ f1 = os.listdir(test_support.TESTFN) # Printing f1 is not appropriate, as specific filenames # returned depend on the local encoding - f2 = os.listdir(unicode(test_support.TESTFN, + f2 = os.listdir(str(test_support.TESTFN, sys.getfilesystemencoding())) f2.sort() print(f2) @@ -91,8 +91,8 @@ os.rename("tmp",name) def test_directory(self): - dirname = os.path.join(test_support.TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') - filename = u'\xdf-\u66e8\u66e9\u66eb' + dirname = os.path.join(test_support.TESTFN,'Gr\xfc\xdf-\u66e8\u66e9\u66eb') + filename = '\xdf-\u66e8\u66e9\u66eb' oldwd = os.getcwd() os.mkdir(dirname) os.chdir(dirname) Modified: python/branches/py3k-struni/Lib/test/test_pep292.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_pep292.py (original) +++ python/branches/py3k-struni/Lib/test/test_pep292.py Wed May 2 21:09:54 2007 @@ -134,8 +134,8 @@ def test_unicode_values(self): s = Template('$who likes $what') - d = dict(who=u't\xffm', what=u'f\xfe\fed') - self.assertEqual(s.substitute(d), u't\xffm likes f\xfe\x0ced') + d = dict(who='t\xffm', what='f\xfe\fed') + self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced') def test_keyword_arguments(self): eq = self.assertEqual Modified: python/branches/py3k-struni/Lib/test/test_pep352.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_pep352.py (original) +++ python/branches/py3k-struni/Lib/test/test_pep352.py Wed May 2 21:09:54 2007 @@ -90,7 +90,7 @@ arg = "spam" exc = Exception(arg) results = ([len(exc.args), 1], [exc.args[0], arg], [exc.message, arg], - [str(exc), str(arg)], [unicode(exc), unicode(arg)], + [str(exc), str(arg)], [str(exc), str(arg)], [repr(exc), exc.__class__.__name__ + repr(exc.args)]) self.interface_test_driver(results) @@ -101,7 +101,7 @@ exc = Exception(*args) results = ([len(exc.args), arg_count], [exc.args, args], [exc.message, ''], [str(exc), str(args)], - [unicode(exc), unicode(args)], + [str(exc), str(args)], [repr(exc), exc.__class__.__name__ + repr(exc.args)]) self.interface_test_driver(results) @@ -109,7 +109,7 @@ # Make sure that with no args that interface is correct exc = Exception() results = ([len(exc.args), 0], [exc.args, tuple()], [exc.message, ''], - [str(exc), ''], [unicode(exc), u''], + [str(exc), ''], [str(exc), ''], [repr(exc), exc.__class__.__name__ + '()']) self.interface_test_driver(results) Modified: python/branches/py3k-struni/Lib/test/test_plistlib.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_plistlib.py (original) +++ python/branches/py3k-struni/Lib/test/test_plistlib.py Wed May 2 21:09:54 2007 @@ -104,7 +104,7 @@ anInt = 728, aDict=dict( anotherString="", - aUnicodeValue=u'M\xe4ssig, Ma\xdf', + aUnicodeValue='M\xe4ssig, Ma\xdf', aTrueValue=True, aFalseValue=False, deeperDict=dict(a=17, b=32.5, c=[1, 2, "text"]), @@ -114,7 +114,7 @@ nestedData = [plistlib.Data("\0\1\2\3" * 10)], aDate = datetime.datetime(2004, 10, 26, 10, 33, 33), ) - pl[u'\xc5benraa'] = "That was a unicode key." + pl['\xc5benraa'] = "That was a unicode key." return pl def test_create(self): Modified: python/branches/py3k-struni/Lib/test/test_pprint.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_pprint.py (original) +++ python/branches/py3k-struni/Lib/test/test_pprint.py Wed May 2 21:09:54 2007 @@ -3,7 +3,7 @@ import unittest try: - uni = unicode + uni = str except NameError: def uni(x): return x Modified: python/branches/py3k-struni/Lib/test/test_pyexpat.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_pyexpat.py (original) +++ python/branches/py3k-struni/Lib/test/test_pyexpat.py Wed May 2 21:09:54 2007 @@ -281,7 +281,7 @@ def check(self, expected, label): self.assertEquals(self.stuff, expected, "%s\nstuff = %r\nexpected = %r" - % (label, self.stuff, map(unicode, expected))) + % (label, self.stuff, map(str, expected))) def CharacterDataHandler(self, text): self.stuff.append(text) Modified: python/branches/py3k-struni/Lib/test/test_re.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_re.py (original) +++ python/branches/py3k-struni/Lib/test/test_re.py Wed May 2 21:09:54 2007 @@ -324,12 +324,12 @@ self.assertEqual(re.search(r"^\Aabc\Z$", "abc", re.M).group(0), "abc") self.assertEqual(re.search(r"^\Aabc\Z$", "\nabc\n", re.M), None) self.assertEqual(re.search(r"\b(b.)\b", - u"abcd abc bcd bx").group(1), "bx") + "abcd abc bcd bx").group(1), "bx") self.assertEqual(re.search(r"\B(b.)\B", - u"abc bcd bc abxd").group(1), "bx") - self.assertEqual(re.search(r"^abc$", u"\nabc\n", re.M).group(0), "abc") - self.assertEqual(re.search(r"^\Aabc\Z$", u"abc", re.M).group(0), "abc") - self.assertEqual(re.search(r"^\Aabc\Z$", u"\nabc\n", re.M), None) + "abc bcd bc abxd").group(1), "bx") + self.assertEqual(re.search(r"^abc$", "\nabc\n", re.M).group(0), "abc") + self.assertEqual(re.search(r"^\Aabc\Z$", "abc", re.M).group(0), "abc") + self.assertEqual(re.search(r"^\Aabc\Z$", "\nabc\n", re.M), None) self.assertEqual(re.search(r"\d\D\w\W\s\S", "1aa! a").group(0), "1aa! a") self.assertEqual(re.search(r"\d\D\w\W\s\S", @@ -339,13 +339,13 @@ def test_ignore_case(self): self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC") - self.assertEqual(re.match("abc", u"ABC", re.I).group(0), "ABC") + self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC") def test_bigcharset(self): - self.assertEqual(re.match(u"([\u2222\u2223])", - u"\u2222").group(1), u"\u2222") - self.assertEqual(re.match(u"([\u2222\u2223])", - u"\u2222", re.UNICODE).group(1), u"\u2222") + self.assertEqual(re.match("([\u2222\u2223])", + "\u2222").group(1), "\u2222") + self.assertEqual(re.match("([\u2222\u2223])", + "\u2222", re.UNICODE).group(1), "\u2222") def test_anyall(self): self.assertEqual(re.match("a.b", "a\nb", re.DOTALL).group(0), @@ -387,7 +387,7 @@ self.assertEqual(_sre.getlower(ord('A'), re.UNICODE), ord('a')) self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC") - self.assertEqual(re.match("abc", u"ABC", re.I).group(0), "ABC") + self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC") def test_not_literal(self): self.assertEqual(re.search("\s([^a])", " b").group(1), "b") @@ -493,7 +493,7 @@ self.assertEqual(re.search('(a|b)*?c', 10000*'ab'+'cd').end(0), 20001) def test_bug_612074(self): - pat=u"["+re.escape(u"\u2039")+u"]" + pat="["+re.escape("\u2039")+"]" self.assertEqual(re.compile(pat) and 1, 1) def test_stack_overflow(self): @@ -561,10 +561,10 @@ def test_bug_764548(self): # bug 764548, re.compile() barfs on str/unicode subclasses try: - unicode + str except NameError: return # no problem if we have no unicode - class my_unicode(unicode): pass + class my_unicode(str): pass pat = re.compile(my_unicode("abc")) self.assertEqual(pat.match("xyz"), None) @@ -575,7 +575,7 @@ def test_bug_926075(self): try: - unicode + str except NameError: return # no problem if we have no unicode self.assert_(re.compile('bug_926075') is not @@ -583,7 +583,7 @@ def test_bug_931848(self): try: - unicode + str except NameError: pass pattern = eval('u"[\u002E\u3002\uFF0E\uFF61]"') @@ -689,7 +689,7 @@ # Try the match on a unicode string, and check that it # still succeeds. try: - result = obj.search(unicode(s, "latin-1")) + result = obj.search(str(s, "latin-1")) if result is None: print('=== Fails on unicode match', t) except NameError: @@ -699,7 +699,7 @@ # Try the match on a unicode pattern, and check that it # still succeeds. - obj=re.compile(unicode(pattern, "latin-1")) + obj=re.compile(str(pattern, "latin-1")) result = obj.search(s) if result is None: print('=== Fails on unicode pattern match', t) Modified: python/branches/py3k-struni/Lib/test/test_set.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_set.py (original) +++ python/branches/py3k-struni/Lib/test/test_set.py Wed May 2 21:09:54 2007 @@ -72,7 +72,7 @@ self.assertEqual(type(u), self.thetype) self.assertRaises(PassThru, self.s.union, check_pass_thru()) self.assertRaises(TypeError, self.s.union, [[]]) - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + for C in set, frozenset, dict.fromkeys, str, str, list, tuple: self.assertEqual(self.thetype('abcba').union(C('cdc')), set('abcd')) self.assertEqual(self.thetype('abcba').union(C('efgfe')), set('abcefg')) self.assertEqual(self.thetype('abcba').union(C('ccb')), set('abc')) @@ -96,7 +96,7 @@ self.assertEqual(self.s, self.thetype(self.word)) self.assertEqual(type(i), self.thetype) self.assertRaises(PassThru, self.s.intersection, check_pass_thru()) - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + for C in set, frozenset, dict.fromkeys, str, str, list, tuple: self.assertEqual(self.thetype('abcba').intersection(C('cdc')), set('cc')) self.assertEqual(self.thetype('abcba').intersection(C('efgfe')), set('')) self.assertEqual(self.thetype('abcba').intersection(C('ccb')), set('bc')) @@ -121,7 +121,7 @@ self.assertEqual(type(i), self.thetype) self.assertRaises(PassThru, self.s.difference, check_pass_thru()) self.assertRaises(TypeError, self.s.difference, [[]]) - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + for C in set, frozenset, dict.fromkeys, str, str, list, tuple: self.assertEqual(self.thetype('abcba').difference(C('cdc')), set('ab')) self.assertEqual(self.thetype('abcba').difference(C('efgfe')), set('abc')) self.assertEqual(self.thetype('abcba').difference(C('ccb')), set('a')) @@ -146,7 +146,7 @@ self.assertEqual(type(i), self.thetype) self.assertRaises(PassThru, self.s.symmetric_difference, check_pass_thru()) self.assertRaises(TypeError, self.s.symmetric_difference, [[]]) - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + for C in set, frozenset, dict.fromkeys, str, str, list, tuple: self.assertEqual(self.thetype('abcba').symmetric_difference(C('cdc')), set('abd')) self.assertEqual(self.thetype('abcba').symmetric_difference(C('efgfe')), set('abcefg')) self.assertEqual(self.thetype('abcba').symmetric_difference(C('ccb')), set('a')) @@ -390,7 +390,7 @@ self.assertRaises(PassThru, self.s.update, check_pass_thru()) self.assertRaises(TypeError, self.s.update, [[]]) for p, q in (('cdc', 'abcd'), ('efgfe', 'abcefg'), ('ccb', 'abc'), ('ef', 'abcef')): - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + for C in set, frozenset, dict.fromkeys, str, str, list, tuple: s = self.thetype('abcba') self.assertEqual(s.update(C(p)), None) self.assertEqual(s, set(q)) @@ -411,7 +411,7 @@ self.assertRaises(PassThru, self.s.intersection_update, check_pass_thru()) self.assertRaises(TypeError, self.s.intersection_update, [[]]) for p, q in (('cdc', 'c'), ('efgfe', ''), ('ccb', 'bc'), ('ef', '')): - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + for C in set, frozenset, dict.fromkeys, str, str, list, tuple: s = self.thetype('abcba') self.assertEqual(s.intersection_update(C(p)), None) self.assertEqual(s, set(q)) @@ -436,7 +436,7 @@ self.assertRaises(TypeError, self.s.difference_update, [[]]) self.assertRaises(TypeError, self.s.symmetric_difference_update, [[]]) for p, q in (('cdc', 'ab'), ('efgfe', 'abc'), ('ccb', 'a'), ('ef', 'abc')): - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + for C in set, frozenset, dict.fromkeys, str, str, list, tuple: s = self.thetype('abcba') self.assertEqual(s.difference_update(C(p)), None) self.assertEqual(s, set(q)) @@ -460,7 +460,7 @@ self.assertRaises(PassThru, self.s.symmetric_difference_update, check_pass_thru()) self.assertRaises(TypeError, self.s.symmetric_difference_update, [[]]) for p, q in (('cdc', 'abd'), ('efgfe', 'abcefg'), ('ccb', 'a'), ('ef', 'abcef')): - for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + for C in set, frozenset, dict.fromkeys, str, str, list, tuple: s = self.thetype('abcba') self.assertEqual(s.symmetric_difference_update(C(p)), None) self.assertEqual(s, set(q)) Modified: python/branches/py3k-struni/Lib/test/test_startfile.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_startfile.py (original) +++ python/branches/py3k-struni/Lib/test/test_startfile.py Wed May 2 21:09:54 2007 @@ -18,7 +18,7 @@ self.assertRaises(OSError, startfile, "nonexisting.vbs") def test_nonexisting_u(self): - self.assertRaises(OSError, startfile, u"nonexisting.vbs") + self.assertRaises(OSError, startfile, "nonexisting.vbs") def test_empty(self): empty = path.join(path.dirname(__file__), "empty.vbs") @@ -27,8 +27,8 @@ def test_empty_u(self): empty = path.join(path.dirname(__file__), "empty.vbs") - startfile(unicode(empty, "mbcs")) - startfile(unicode(empty, "mbcs"), "open") + startfile(str(empty, "mbcs")) + startfile(str(empty, "mbcs"), "open") def test_main(): test_support.run_unittest(TestCase) Modified: python/branches/py3k-struni/Lib/test/test_str.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_str.py (original) +++ python/branches/py3k-struni/Lib/test/test_str.py Wed May 2 21:09:54 2007 @@ -31,7 +31,7 @@ # Make sure __str__() behaves properly class Foo0: def __unicode__(self): - return u"foo" + return "foo" class Foo1: def __str__(self): @@ -43,28 +43,28 @@ class Foo3(object): def __str__(self): - return u"foo" + return "foo" - class Foo4(unicode): + class Foo4(str): def __str__(self): - return u"foo" + return "foo" class Foo5(str): def __str__(self): - return u"foo" + return "foo" class Foo6(str): def __str__(self): return "foos" def __unicode__(self): - return u"foou" + return "foou" - class Foo7(unicode): + class Foo7(str): def __str__(self): return "foos" def __unicode__(self): - return u"foou" + return "foou" class Foo8(str): def __new__(cls, content=""): @@ -88,7 +88,7 @@ self.assertEqual(str(Foo7("bar")), "foos") self.assertEqual(str(Foo8("foo")), "foofoo") self.assertEqual(str(Foo9("foo")), "string") - self.assertEqual(unicode(Foo9("foo")), u"not unicode") + self.assertEqual(str(Foo9("foo")), "not unicode") def test_main(): test_support.run_unittest(StrTest) Modified: python/branches/py3k-struni/Lib/test/test_stringprep.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_stringprep.py (original) +++ python/branches/py3k-struni/Lib/test/test_stringprep.py Wed May 2 21:09:54 2007 @@ -8,66 +8,66 @@ class StringprepTests(unittest.TestCase): def test(self): - self.failUnless(in_table_a1(u"\u0221")) - self.failIf(in_table_a1(u"\u0222")) + self.failUnless(in_table_a1("\u0221")) + self.failIf(in_table_a1("\u0222")) - self.failUnless(in_table_b1(u"\u00ad")) - self.failIf(in_table_b1(u"\u00ae")) + self.failUnless(in_table_b1("\u00ad")) + self.failIf(in_table_b1("\u00ae")) - self.failUnless(map_table_b2(u"\u0041"), u"\u0061") - self.failUnless(map_table_b2(u"\u0061"), u"\u0061") + self.failUnless(map_table_b2("\u0041"), "\u0061") + self.failUnless(map_table_b2("\u0061"), "\u0061") - self.failUnless(map_table_b3(u"\u0041"), u"\u0061") - self.failUnless(map_table_b3(u"\u0061"), u"\u0061") + self.failUnless(map_table_b3("\u0041"), "\u0061") + self.failUnless(map_table_b3("\u0061"), "\u0061") - self.failUnless(in_table_c11(u"\u0020")) - self.failIf(in_table_c11(u"\u0021")) + self.failUnless(in_table_c11("\u0020")) + self.failIf(in_table_c11("\u0021")) - self.failUnless(in_table_c12(u"\u00a0")) - self.failIf(in_table_c12(u"\u00a1")) + self.failUnless(in_table_c12("\u00a0")) + self.failIf(in_table_c12("\u00a1")) - self.failUnless(in_table_c12(u"\u00a0")) - self.failIf(in_table_c12(u"\u00a1")) + self.failUnless(in_table_c12("\u00a0")) + self.failIf(in_table_c12("\u00a1")) - self.failUnless(in_table_c11_c12(u"\u00a0")) - self.failIf(in_table_c11_c12(u"\u00a1")) + self.failUnless(in_table_c11_c12("\u00a0")) + self.failIf(in_table_c11_c12("\u00a1")) - self.failUnless(in_table_c21(u"\u001f")) - self.failIf(in_table_c21(u"\u0020")) + self.failUnless(in_table_c21("\u001f")) + self.failIf(in_table_c21("\u0020")) - self.failUnless(in_table_c22(u"\u009f")) - self.failIf(in_table_c22(u"\u00a0")) + self.failUnless(in_table_c22("\u009f")) + self.failIf(in_table_c22("\u00a0")) - self.failUnless(in_table_c21_c22(u"\u009f")) - self.failIf(in_table_c21_c22(u"\u00a0")) + self.failUnless(in_table_c21_c22("\u009f")) + self.failIf(in_table_c21_c22("\u00a0")) - self.failUnless(in_table_c3(u"\ue000")) - self.failIf(in_table_c3(u"\uf900")) + self.failUnless(in_table_c3("\ue000")) + self.failIf(in_table_c3("\uf900")) - self.failUnless(in_table_c4(u"\uffff")) - self.failIf(in_table_c4(u"\u0000")) + self.failUnless(in_table_c4("\uffff")) + self.failIf(in_table_c4("\u0000")) - self.failUnless(in_table_c5(u"\ud800")) - self.failIf(in_table_c5(u"\ud7ff")) + self.failUnless(in_table_c5("\ud800")) + self.failIf(in_table_c5("\ud7ff")) - self.failUnless(in_table_c6(u"\ufff9")) - self.failIf(in_table_c6(u"\ufffe")) + self.failUnless(in_table_c6("\ufff9")) + self.failIf(in_table_c6("\ufffe")) - self.failUnless(in_table_c7(u"\u2ff0")) - self.failIf(in_table_c7(u"\u2ffc")) + self.failUnless(in_table_c7("\u2ff0")) + self.failIf(in_table_c7("\u2ffc")) - self.failUnless(in_table_c8(u"\u0340")) - self.failIf(in_table_c8(u"\u0342")) + self.failUnless(in_table_c8("\u0340")) + self.failIf(in_table_c8("\u0342")) # C.9 is not in the bmp # self.failUnless(in_table_c9(u"\U000E0001")) # self.failIf(in_table_c8(u"\U000E0002")) - self.failUnless(in_table_d1(u"\u05be")) - self.failIf(in_table_d1(u"\u05bf")) + self.failUnless(in_table_d1("\u05be")) + self.failIf(in_table_d1("\u05bf")) - self.failUnless(in_table_d2(u"\u0041")) - self.failIf(in_table_d2(u"\u0040")) + self.failUnless(in_table_d2("\u0041")) + self.failIf(in_table_d2("\u0040")) # This would generate a hash of all predicates. However, running # it is quite expensive, and only serves to detect changes in the Modified: python/branches/py3k-struni/Lib/test/test_support.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_support.py (original) +++ python/branches/py3k-struni/Lib/test/test_support.py Wed May 2 21:09:54 2007 @@ -131,7 +131,7 @@ return (x > y) - (x < y) try: - unicode + str have_unicode = True except NameError: have_unicode = False @@ -151,13 +151,13 @@ # Assuming sys.getfilesystemencoding()!=sys.getdefaultencoding() # TESTFN_UNICODE is a filename that can be encoded using the # file system encoding, but *not* with the default (ascii) encoding - if isinstance('', unicode): + if isinstance('', str): # python -U # XXX perhaps unicode() should accept Unicode strings? TESTFN_UNICODE = "@test-\xe0\xf2" else: # 2 latin characters. - TESTFN_UNICODE = unicode("@test-\xe0\xf2", "latin-1") + TESTFN_UNICODE = str("@test-\xe0\xf2", "latin-1") TESTFN_ENCODING = sys.getfilesystemencoding() # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be # able to be encoded by *either* the default or filesystem encoding. Modified: python/branches/py3k-struni/Lib/test/test_tarfile.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_tarfile.py (original) +++ python/branches/py3k-struni/Lib/test/test_tarfile.py Wed May 2 21:09:54 2007 @@ -711,7 +711,7 @@ def _test_unicode_filename(self, encoding): tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT) - name = u"\u20ac".encode(encoding) # Euro sign + name = "\u20ac".encode(encoding) # Euro sign tar.encoding = encoding tar.addfile(tarfile.TarInfo(name)) tar.close() @@ -723,7 +723,7 @@ def test_unicode_filename_error(self): # The euro sign filename cannot be translated to iso8859-1 encoding. tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, encoding="utf8") - name = u"\u20ac".encode("utf8") # Euro sign + name = "\u20ac".encode("utf8") # Euro sign tar.addfile(tarfile.TarInfo(name)) tar.close() @@ -732,13 +732,13 @@ def test_pax_headers(self): self._test_pax_headers({"foo": "bar", "uid": 0, "mtime": 1.23}) - self._test_pax_headers({"euro": u"\u20ac".encode("utf8")}) + self._test_pax_headers({"euro": "\u20ac".encode("utf8")}) - self._test_pax_headers({"euro": u"\u20ac"}, - {"euro": u"\u20ac".encode("utf8")}) + self._test_pax_headers({"euro": "\u20ac"}, + {"euro": "\u20ac".encode("utf8")}) - self._test_pax_headers({u"\u20ac": "euro"}, - {u"\u20ac".encode("utf8"): "euro"}) + self._test_pax_headers({"\u20ac": "euro"}, + {"\u20ac".encode("utf8"): "euro"}) def _test_pax_headers(self, pax_headers, cmp_headers=None): if cmp_headers is None: Modified: python/branches/py3k-struni/Lib/test/test_textwrap.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_textwrap.py (original) +++ python/branches/py3k-struni/Lib/test/test_textwrap.py Wed May 2 21:09:54 2007 @@ -341,13 +341,13 @@ # *Very* simple test of wrapping Unicode strings. I'm sure # there's more to it than this, but let's at least make # sure textwrap doesn't crash on Unicode input! - text = u"Hello there, how are you today?" - self.check_wrap(text, 50, [u"Hello there, how are you today?"]) - self.check_wrap(text, 20, [u"Hello there, how are", "you today?"]) + text = "Hello there, how are you today?" + self.check_wrap(text, 50, ["Hello there, how are you today?"]) + self.check_wrap(text, 20, ["Hello there, how are", "you today?"]) olines = self.wrapper.wrap(text) - assert isinstance(olines, list) and isinstance(olines[0], unicode) + assert isinstance(olines, list) and isinstance(olines[0], str) otext = self.wrapper.fill(text) - assert isinstance(otext, unicode) + assert isinstance(otext, str) def test_split(self): # Ensure that the standard _split() method works as advertised Modified: python/branches/py3k-struni/Lib/test/test_timeout.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_timeout.py (original) +++ python/branches/py3k-struni/Lib/test/test_timeout.py Wed May 2 21:09:54 2007 @@ -50,7 +50,7 @@ self.sock.settimeout(0.0) self.sock.settimeout(None) self.assertRaises(TypeError, self.sock.settimeout, "") - self.assertRaises(TypeError, self.sock.settimeout, u"") + self.assertRaises(TypeError, self.sock.settimeout, "") self.assertRaises(TypeError, self.sock.settimeout, ()) self.assertRaises(TypeError, self.sock.settimeout, []) self.assertRaises(TypeError, self.sock.settimeout, {}) Modified: python/branches/py3k-struni/Lib/test/test_types.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_types.py (original) +++ python/branches/py3k-struni/Lib/test/test_types.py Wed May 2 21:09:54 2007 @@ -200,16 +200,16 @@ self.assertEqual(a[-100:100:2], '02468') if have_unicode: - a = unicode('0123456789', 'ascii') + a = str('0123456789', 'ascii') self.assertEqual(a[::], a) - self.assertEqual(a[::2], unicode('02468', 'ascii')) - self.assertEqual(a[1::2], unicode('13579', 'ascii')) - self.assertEqual(a[::-1], unicode('9876543210', 'ascii')) - self.assertEqual(a[::-2], unicode('97531', 'ascii')) - self.assertEqual(a[3::-2], unicode('31', 'ascii')) + self.assertEqual(a[::2], str('02468', 'ascii')) + self.assertEqual(a[1::2], str('13579', 'ascii')) + self.assertEqual(a[::-1], str('9876543210', 'ascii')) + self.assertEqual(a[::-2], str('97531', 'ascii')) + self.assertEqual(a[3::-2], str('31', 'ascii')) self.assertEqual(a[-100:100:], a) self.assertEqual(a[100:-100:-1], a[::-1]) - self.assertEqual(a[-100:100:2], unicode('02468', 'ascii')) + self.assertEqual(a[-100:100:2], str('02468', 'ascii')) def test_type_function(self): Modified: python/branches/py3k-struni/Lib/test/test_ucn.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_ucn.py (original) +++ python/branches/py3k-struni/Lib/test/test_ucn.py Wed May 2 21:09:54 2007 @@ -17,7 +17,7 @@ # Helper that put all \N escapes inside eval'd raw strings, # to make sure this script runs even if the compiler # chokes on \N escapes - res = eval(ur'u"\N{%s}"' % name) + res = eval(r'u"\N{%s}"' % name) self.assertEqual(res, code) return res @@ -51,10 +51,10 @@ "LATIN SMALL LETTER P", "FULL STOP" ] - string = u"The rEd fOx ate the sheep." + string = "The rEd fOx ate the sheep." self.assertEqual( - u"".join([self.checkletter(*args) for args in zip(chars, string)]), + "".join([self.checkletter(*args) for args in zip(chars, string)]), string ) @@ -67,30 +67,30 @@ self.assertEqual(unicodedata.name(code), name) def test_hangul_syllables(self): - self.checkletter("HANGUL SYLLABLE GA", u"\uac00") - self.checkletter("HANGUL SYLLABLE GGWEOSS", u"\uafe8") - self.checkletter("HANGUL SYLLABLE DOLS", u"\ub3d0") - self.checkletter("HANGUL SYLLABLE RYAN", u"\ub7b8") - self.checkletter("HANGUL SYLLABLE MWIK", u"\ubba0") - self.checkletter("HANGUL SYLLABLE BBWAEM", u"\ubf88") - self.checkletter("HANGUL SYLLABLE SSEOL", u"\uc370") - self.checkletter("HANGUL SYLLABLE YI", u"\uc758") - self.checkletter("HANGUL SYLLABLE JJYOSS", u"\ucb40") - self.checkletter("HANGUL SYLLABLE KYEOLS", u"\ucf28") - self.checkletter("HANGUL SYLLABLE PAN", u"\ud310") - self.checkletter("HANGUL SYLLABLE HWEOK", u"\ud6f8") - self.checkletter("HANGUL SYLLABLE HIH", u"\ud7a3") + self.checkletter("HANGUL SYLLABLE GA", "\uac00") + self.checkletter("HANGUL SYLLABLE GGWEOSS", "\uafe8") + self.checkletter("HANGUL SYLLABLE DOLS", "\ub3d0") + self.checkletter("HANGUL SYLLABLE RYAN", "\ub7b8") + self.checkletter("HANGUL SYLLABLE MWIK", "\ubba0") + self.checkletter("HANGUL SYLLABLE BBWAEM", "\ubf88") + self.checkletter("HANGUL SYLLABLE SSEOL", "\uc370") + self.checkletter("HANGUL SYLLABLE YI", "\uc758") + self.checkletter("HANGUL SYLLABLE JJYOSS", "\ucb40") + self.checkletter("HANGUL SYLLABLE KYEOLS", "\ucf28") + self.checkletter("HANGUL SYLLABLE PAN", "\ud310") + self.checkletter("HANGUL SYLLABLE HWEOK", "\ud6f8") + self.checkletter("HANGUL SYLLABLE HIH", "\ud7a3") import unicodedata - self.assertRaises(ValueError, unicodedata.name, u"\ud7a4") + self.assertRaises(ValueError, unicodedata.name, "\ud7a4") def test_cjk_unified_ideographs(self): - self.checkletter("CJK UNIFIED IDEOGRAPH-3400", u"\u3400") - self.checkletter("CJK UNIFIED IDEOGRAPH-4DB5", u"\u4db5") - self.checkletter("CJK UNIFIED IDEOGRAPH-4E00", u"\u4e00") - self.checkletter("CJK UNIFIED IDEOGRAPH-9FA5", u"\u9fa5") - self.checkletter("CJK UNIFIED IDEOGRAPH-20000", u"\U00020000") - self.checkletter("CJK UNIFIED IDEOGRAPH-2A6D6", u"\U0002a6d6") + self.checkletter("CJK UNIFIED IDEOGRAPH-3400", "\u3400") + self.checkletter("CJK UNIFIED IDEOGRAPH-4DB5", "\u4db5") + self.checkletter("CJK UNIFIED IDEOGRAPH-4E00", "\u4e00") + self.checkletter("CJK UNIFIED IDEOGRAPH-9FA5", "\u9fa5") + self.checkletter("CJK UNIFIED IDEOGRAPH-20000", "\U00020000") + self.checkletter("CJK UNIFIED IDEOGRAPH-2A6D6", "\U0002a6d6") def test_bmp_characters(self): import unicodedata @@ -103,38 +103,38 @@ count += 1 def test_misc_symbols(self): - self.checkletter("PILCROW SIGN", u"\u00b6") - self.checkletter("REPLACEMENT CHARACTER", u"\uFFFD") - self.checkletter("HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK", u"\uFF9F") - self.checkletter("FULLWIDTH LATIN SMALL LETTER A", u"\uFF41") + self.checkletter("PILCROW SIGN", "\u00b6") + self.checkletter("REPLACEMENT CHARACTER", "\uFFFD") + self.checkletter("HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK", "\uFF9F") + self.checkletter("FULLWIDTH LATIN SMALL LETTER A", "\uFF41") def test_errors(self): import unicodedata self.assertRaises(TypeError, unicodedata.name) - self.assertRaises(TypeError, unicodedata.name, u'xx') + self.assertRaises(TypeError, unicodedata.name, 'xx') self.assertRaises(TypeError, unicodedata.lookup) - self.assertRaises(KeyError, unicodedata.lookup, u'unknown') + self.assertRaises(KeyError, unicodedata.lookup, 'unknown') def test_strict_eror_handling(self): # bogus character name self.assertRaises( UnicodeError, - unicode, "\\N{blah}", 'unicode-escape', 'strict' + str, "\\N{blah}", 'unicode-escape', 'strict' ) # long bogus character name self.assertRaises( UnicodeError, - unicode, "\\N{%s}" % ("x" * 100000), 'unicode-escape', 'strict' + str, "\\N{%s}" % ("x" * 100000), 'unicode-escape', 'strict' ) # missing closing brace self.assertRaises( UnicodeError, - unicode, "\\N{SPACE", 'unicode-escape', 'strict' + str, "\\N{SPACE", 'unicode-escape', 'strict' ) # missing opening brace self.assertRaises( UnicodeError, - unicode, "\\NSPACE", 'unicode-escape', 'strict' + str, "\\NSPACE", 'unicode-escape', 'strict' ) def test_main(): Modified: python/branches/py3k-struni/Lib/test/test_unicode.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_unicode.py (original) +++ python/branches/py3k-struni/Lib/test/test_unicode.py Wed May 2 21:09:54 2007 @@ -32,7 +32,7 @@ string_tests.MixinStrUnicodeUserStringTest, string_tests.MixinStrUnicodeTest, ): - type2test = unicode + type2test = str def checkequalnofix(self, result, object, methodname, *args): method = getattr(object, methodname) @@ -43,9 +43,9 @@ # if the original is returned make sure that # this doesn't happen with subclasses if realresult is object: - class usub(unicode): + class usub(str): def __repr__(self): - return 'usub(%r)' % unicode.__repr__(self) + return 'usub(%r)' % str.__repr__(self) object = usub(object) method = getattr(object, methodname) realresult = method(*args) @@ -53,8 +53,8 @@ self.assert_(object is not realresult) def test_literals(self): - self.assertEqual(u'\xff', u'\u00ff') - self.assertEqual(u'\uffff', u'\U0000ffff') + self.assertEqual('\xff', '\u00ff') + self.assertEqual('\uffff', '\U0000ffff') self.assertRaises(UnicodeError, eval, 'u\'\\Ufffffffe\'') self.assertRaises(UnicodeError, eval, 'u\'\\Uffffffff\'') self.assertRaises(UnicodeError, eval, 'u\'\\U%08x\'' % 0x110000) @@ -62,19 +62,19 @@ def test_repr(self): if not sys.platform.startswith('java'): # Test basic sanity of repr() - self.assertEqual(repr(u'abc'), "u'abc'") - self.assertEqual(repr(u'ab\\c'), "u'ab\\\\c'") - self.assertEqual(repr(u'ab\\'), "u'ab\\\\'") - self.assertEqual(repr(u'\\c'), "u'\\\\c'") - self.assertEqual(repr(u'\\'), "u'\\\\'") - self.assertEqual(repr(u'\n'), "u'\\n'") - self.assertEqual(repr(u'\r'), "u'\\r'") - self.assertEqual(repr(u'\t'), "u'\\t'") - self.assertEqual(repr(u'\b'), "u'\\x08'") - self.assertEqual(repr(u"'\""), """u'\\'"'""") - self.assertEqual(repr(u"'\""), """u'\\'"'""") - self.assertEqual(repr(u"'"), '''u"'"''') - self.assertEqual(repr(u'"'), """u'"'""") + self.assertEqual(repr('abc'), "u'abc'") + self.assertEqual(repr('ab\\c'), "u'ab\\\\c'") + self.assertEqual(repr('ab\\'), "u'ab\\\\'") + self.assertEqual(repr('\\c'), "u'\\\\c'") + self.assertEqual(repr('\\'), "u'\\\\'") + self.assertEqual(repr('\n'), "u'\\n'") + self.assertEqual(repr('\r'), "u'\\r'") + self.assertEqual(repr('\t'), "u'\\t'") + self.assertEqual(repr('\b'), "u'\\x08'") + self.assertEqual(repr("'\""), """u'\\'"'""") + self.assertEqual(repr("'\""), """u'\\'"'""") + self.assertEqual(repr("'"), '''u"'"''') + self.assertEqual(repr('"'), """u'"'""") latin1repr = ( "u'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r" "\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a" @@ -90,52 +90,52 @@ "\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef" "\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd" "\\xfe\\xff'") - testrepr = repr(u''.join(map(unichr, xrange(256)))) + testrepr = repr(''.join(map(unichr, xrange(256)))) self.assertEqual(testrepr, latin1repr) # Test repr works on wide unicode escapes without overflow. - self.assertEqual(repr(u"\U00010000" * 39 + u"\uffff" * 4096), - repr(u"\U00010000" * 39 + u"\uffff" * 4096)) + self.assertEqual(repr("\U00010000" * 39 + "\uffff" * 4096), + repr("\U00010000" * 39 + "\uffff" * 4096)) def test_iterators(self): # Make sure unicode objects have an __iter__ method - it = u"\u1111\u2222\u3333".__iter__() - self.assertEqual(next(it), u"\u1111") - self.assertEqual(next(it), u"\u2222") - self.assertEqual(next(it), u"\u3333") + it = "\u1111\u2222\u3333".__iter__() + self.assertEqual(next(it), "\u1111") + self.assertEqual(next(it), "\u2222") + self.assertEqual(next(it), "\u3333") self.assertRaises(StopIteration, next, it) def test_count(self): string_tests.CommonTest.test_count(self) # check mixed argument types - self.checkequalnofix(3, 'aaa', 'count', u'a') - self.checkequalnofix(0, 'aaa', 'count', u'b') - self.checkequalnofix(3, u'aaa', 'count', 'a') - self.checkequalnofix(0, u'aaa', 'count', 'b') - self.checkequalnofix(0, u'aaa', 'count', 'b') - self.checkequalnofix(1, u'aaa', 'count', 'a', -1) - self.checkequalnofix(3, u'aaa', 'count', 'a', -10) - self.checkequalnofix(2, u'aaa', 'count', 'a', 0, -1) - self.checkequalnofix(0, u'aaa', 'count', 'a', 0, -10) + self.checkequalnofix(3, 'aaa', 'count', 'a') + self.checkequalnofix(0, 'aaa', 'count', 'b') + self.checkequalnofix(3, 'aaa', 'count', 'a') + self.checkequalnofix(0, 'aaa', 'count', 'b') + self.checkequalnofix(0, 'aaa', 'count', 'b') + self.checkequalnofix(1, 'aaa', 'count', 'a', -1) + self.checkequalnofix(3, 'aaa', 'count', 'a', -10) + self.checkequalnofix(2, 'aaa', 'count', 'a', 0, -1) + self.checkequalnofix(0, 'aaa', 'count', 'a', 0, -10) def test_find(self): - self.checkequalnofix(0, u'abcdefghiabc', 'find', u'abc') - self.checkequalnofix(9, u'abcdefghiabc', 'find', u'abc', 1) - self.checkequalnofix(-1, u'abcdefghiabc', 'find', u'def', 4) + self.checkequalnofix(0, 'abcdefghiabc', 'find', 'abc') + self.checkequalnofix(9, 'abcdefghiabc', 'find', 'abc', 1) + self.checkequalnofix(-1, 'abcdefghiabc', 'find', 'def', 4) - self.assertRaises(TypeError, u'hello'.find) - self.assertRaises(TypeError, u'hello'.find, 42) + self.assertRaises(TypeError, 'hello'.find) + self.assertRaises(TypeError, 'hello'.find, 42) def test_rfind(self): string_tests.CommonTest.test_rfind(self) # check mixed argument types - self.checkequalnofix(9, 'abcdefghiabc', 'rfind', u'abc') - self.checkequalnofix(12, 'abcdefghiabc', 'rfind', u'') - self.checkequalnofix(12, u'abcdefghiabc', 'rfind', '') + self.checkequalnofix(9, 'abcdefghiabc', 'rfind', 'abc') + self.checkequalnofix(12, 'abcdefghiabc', 'rfind', '') + self.checkequalnofix(12, 'abcdefghiabc', 'rfind', '') def test_index(self): string_tests.CommonTest.test_index(self) # check mixed argument types - for (t1, t2) in ((str, unicode), (unicode, str)): + for (t1, t2) in ((str, str), (str, str)): self.checkequalnofix(0, t1('abcdefghiabc'), 'index', t2('')) self.checkequalnofix(3, t1('abcdefghiabc'), 'index', t2('def')) self.checkequalnofix(0, t1('abcdefghiabc'), 'index', t2('abc')) @@ -148,7 +148,7 @@ def test_rindex(self): string_tests.CommonTest.test_rindex(self) # check mixed argument types - for (t1, t2) in ((str, unicode), (unicode, str)): + for (t1, t2) in ((str, str), (str, str)): self.checkequalnofix(12, t1('abcdefghiabc'), 'rindex', t2('')) self.checkequalnofix(3, t1('abcdefghiabc'), 'rindex', t2('def')) self.checkequalnofix(9, t1('abcdefghiabc'), 'rindex', t2('abc')) @@ -161,291 +161,291 @@ self.assertRaises(ValueError, t1('abcdefghi').rindex, t2('ghi'), 0, -1) def test_translate(self): - self.checkequalnofix(u'bbbc', u'abababc', 'translate', {ord('a'):None}) - self.checkequalnofix(u'iiic', u'abababc', 'translate', {ord('a'):None, ord('b'):ord('i')}) - self.checkequalnofix(u'iiix', u'abababc', 'translate', {ord('a'):None, ord('b'):ord('i'), ord('c'):u'x'}) - self.checkequalnofix(u'c', u'abababc', 'translate', {ord('a'):None, ord('b'):u''}) - self.checkequalnofix(u'c', u'abababc', 'translate', {ord('a'):None, ord('b'):u''}) - self.checkequalnofix(u'xyyx', u'xzx', 'translate', {ord('z'):u'yy'}) + self.checkequalnofix('bbbc', 'abababc', 'translate', {ord('a'):None}) + self.checkequalnofix('iiic', 'abababc', 'translate', {ord('a'):None, ord('b'):ord('i')}) + self.checkequalnofix('iiix', 'abababc', 'translate', {ord('a'):None, ord('b'):ord('i'), ord('c'):'x'}) + self.checkequalnofix('c', 'abababc', 'translate', {ord('a'):None, ord('b'):''}) + self.checkequalnofix('c', 'abababc', 'translate', {ord('a'):None, ord('b'):''}) + self.checkequalnofix('xyyx', 'xzx', 'translate', {ord('z'):'yy'}) - self.assertRaises(TypeError, u'hello'.translate) - self.assertRaises(TypeError, u'abababc'.translate, {ord('a'):''}) + self.assertRaises(TypeError, 'hello'.translate) + self.assertRaises(TypeError, 'abababc'.translate, {ord('a'):''}) def test_split(self): string_tests.CommonTest.test_split(self) # Mixed arguments - self.checkequalnofix([u'a', u'b', u'c', u'd'], u'a//b//c//d', 'split', '//') - self.checkequalnofix([u'a', u'b', u'c', u'd'], 'a//b//c//d', 'split', u'//') - self.checkequalnofix([u'endcase ', u''], u'endcase test', 'split', 'test') + self.checkequalnofix(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//') + self.checkequalnofix(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//') + self.checkequalnofix(['endcase ', ''], 'endcase test', 'split', 'test') def test_join(self): string_tests.MixinStrUnicodeUserStringTest.test_join(self) # mixed arguments - self.checkequalnofix(u'a b c d', u' ', 'join', ['a', 'b', u'c', u'd']) - self.checkequalnofix(u'abcd', u'', 'join', (u'a', u'b', u'c', u'd')) - self.checkequalnofix(u'w x y z', u' ', 'join', string_tests.Sequence('wxyz')) - self.checkequalnofix(u'a b c d', ' ', 'join', [u'a', u'b', u'c', u'd']) - self.checkequalnofix(u'a b c d', ' ', 'join', ['a', 'b', u'c', u'd']) - self.checkequalnofix(u'abcd', '', 'join', (u'a', u'b', u'c', u'd')) - self.checkequalnofix(u'w x y z', ' ', 'join', string_tests.Sequence(u'wxyz')) + self.checkequalnofix('a b c d', ' ', 'join', ['a', 'b', 'c', 'd']) + self.checkequalnofix('abcd', '', 'join', ('a', 'b', 'c', 'd')) + self.checkequalnofix('w x y z', ' ', 'join', string_tests.Sequence('wxyz')) + self.checkequalnofix('a b c d', ' ', 'join', ['a', 'b', 'c', 'd']) + self.checkequalnofix('a b c d', ' ', 'join', ['a', 'b', 'c', 'd']) + self.checkequalnofix('abcd', '', 'join', ('a', 'b', 'c', 'd')) + self.checkequalnofix('w x y z', ' ', 'join', string_tests.Sequence('wxyz')) def test_strip(self): string_tests.CommonTest.test_strip(self) - self.assertRaises(UnicodeError, u"hello".strip, "\xff") + self.assertRaises(UnicodeError, "hello".strip, "\xff") def test_replace(self): string_tests.CommonTest.test_replace(self) # method call forwarded from str implementation because of unicode argument - self.checkequalnofix(u'one at two!three!', 'one!two!three!', 'replace', u'!', u'@', 1) - self.assertRaises(TypeError, 'replace'.replace, u"r", 42) + self.checkequalnofix('one at two!three!', 'one!two!three!', 'replace', '!', '@', 1) + self.assertRaises(TypeError, 'replace'.replace, "r", 42) def test_comparison(self): # Comparisons: - self.assertEqual(u'abc', 'abc') - self.assertEqual('abc', u'abc') - self.assertEqual(u'abc', u'abc') - self.assert_(u'abcd' > 'abc') - self.assert_('abcd' > u'abc') - self.assert_(u'abcd' > u'abc') - self.assert_(u'abc' < 'abcd') - self.assert_('abc' < u'abcd') - self.assert_(u'abc' < u'abcd') + self.assertEqual('abc', 'abc') + self.assertEqual('abc', 'abc') + self.assertEqual('abc', 'abc') + self.assert_('abcd' > 'abc') + self.assert_('abcd' > 'abc') + self.assert_('abcd' > 'abc') + self.assert_('abc' < 'abcd') + self.assert_('abc' < 'abcd') + self.assert_('abc' < 'abcd') if 0: # Move these tests to a Unicode collation module test... # Testing UTF-16 code point order comparisons... # No surrogates, no fixup required. - self.assert_(u'\u0061' < u'\u20ac') + self.assert_('\u0061' < '\u20ac') # Non surrogate below surrogate value, no fixup required - self.assert_(u'\u0061' < u'\ud800\udc02') + self.assert_('\u0061' < '\ud800\udc02') # Non surrogate above surrogate value, fixup required def test_lecmp(s, s2): self.assert_(s < s2) def test_fixup(s): - s2 = u'\ud800\udc01' + s2 = '\ud800\udc01' test_lecmp(s, s2) - s2 = u'\ud900\udc01' + s2 = '\ud900\udc01' test_lecmp(s, s2) - s2 = u'\uda00\udc01' + s2 = '\uda00\udc01' test_lecmp(s, s2) - s2 = u'\udb00\udc01' + s2 = '\udb00\udc01' test_lecmp(s, s2) - s2 = u'\ud800\udd01' + s2 = '\ud800\udd01' test_lecmp(s, s2) - s2 = u'\ud900\udd01' + s2 = '\ud900\udd01' test_lecmp(s, s2) - s2 = u'\uda00\udd01' + s2 = '\uda00\udd01' test_lecmp(s, s2) - s2 = u'\udb00\udd01' + s2 = '\udb00\udd01' test_lecmp(s, s2) - s2 = u'\ud800\ude01' + s2 = '\ud800\ude01' test_lecmp(s, s2) - s2 = u'\ud900\ude01' + s2 = '\ud900\ude01' test_lecmp(s, s2) - s2 = u'\uda00\ude01' + s2 = '\uda00\ude01' test_lecmp(s, s2) - s2 = u'\udb00\ude01' + s2 = '\udb00\ude01' test_lecmp(s, s2) - s2 = u'\ud800\udfff' + s2 = '\ud800\udfff' test_lecmp(s, s2) - s2 = u'\ud900\udfff' + s2 = '\ud900\udfff' test_lecmp(s, s2) - s2 = u'\uda00\udfff' + s2 = '\uda00\udfff' test_lecmp(s, s2) - s2 = u'\udb00\udfff' + s2 = '\udb00\udfff' test_lecmp(s, s2) - test_fixup(u'\ue000') - test_fixup(u'\uff61') + test_fixup('\ue000') + test_fixup('\uff61') # Surrogates on both sides, no fixup required - self.assert_(u'\ud800\udc02' < u'\ud84d\udc56') + self.assert_('\ud800\udc02' < '\ud84d\udc56') def test_islower(self): string_tests.MixinStrUnicodeUserStringTest.test_islower(self) - self.checkequalnofix(False, u'\u1FFc', 'islower') + self.checkequalnofix(False, '\u1FFc', 'islower') def test_isupper(self): string_tests.MixinStrUnicodeUserStringTest.test_isupper(self) if not sys.platform.startswith('java'): - self.checkequalnofix(False, u'\u1FFc', 'isupper') + self.checkequalnofix(False, '\u1FFc', 'isupper') def test_istitle(self): string_tests.MixinStrUnicodeUserStringTest.test_title(self) - self.checkequalnofix(True, u'\u1FFc', 'istitle') - self.checkequalnofix(True, u'Greek \u1FFcitlecases ...', 'istitle') + self.checkequalnofix(True, '\u1FFc', 'istitle') + self.checkequalnofix(True, 'Greek \u1FFcitlecases ...', 'istitle') def test_isspace(self): string_tests.MixinStrUnicodeUserStringTest.test_isspace(self) - self.checkequalnofix(True, u'\u2000', 'isspace') - self.checkequalnofix(True, u'\u200a', 'isspace') - self.checkequalnofix(False, u'\u2014', 'isspace') + self.checkequalnofix(True, '\u2000', 'isspace') + self.checkequalnofix(True, '\u200a', 'isspace') + self.checkequalnofix(False, '\u2014', 'isspace') def test_isalpha(self): string_tests.MixinStrUnicodeUserStringTest.test_isalpha(self) - self.checkequalnofix(True, u'\u1FFc', 'isalpha') + self.checkequalnofix(True, '\u1FFc', 'isalpha') def test_isdecimal(self): - self.checkequalnofix(False, u'', 'isdecimal') - self.checkequalnofix(False, u'a', 'isdecimal') - self.checkequalnofix(True, u'0', 'isdecimal') - self.checkequalnofix(False, u'\u2460', 'isdecimal') # CIRCLED DIGIT ONE - self.checkequalnofix(False, u'\xbc', 'isdecimal') # VULGAR FRACTION ONE QUARTER - self.checkequalnofix(True, u'\u0660', 'isdecimal') # ARABIC-INDIC DIGIT ZERO - self.checkequalnofix(True, u'0123456789', 'isdecimal') - self.checkequalnofix(False, u'0123456789a', 'isdecimal') + self.checkequalnofix(False, '', 'isdecimal') + self.checkequalnofix(False, 'a', 'isdecimal') + self.checkequalnofix(True, '0', 'isdecimal') + self.checkequalnofix(False, '\u2460', 'isdecimal') # CIRCLED DIGIT ONE + self.checkequalnofix(False, '\xbc', 'isdecimal') # VULGAR FRACTION ONE QUARTER + self.checkequalnofix(True, '\u0660', 'isdecimal') # ARABIC-INDIC DIGIT ZERO + self.checkequalnofix(True, '0123456789', 'isdecimal') + self.checkequalnofix(False, '0123456789a', 'isdecimal') self.checkraises(TypeError, 'abc', 'isdecimal', 42) def test_isdigit(self): string_tests.MixinStrUnicodeUserStringTest.test_isdigit(self) - self.checkequalnofix(True, u'\u2460', 'isdigit') - self.checkequalnofix(False, u'\xbc', 'isdigit') - self.checkequalnofix(True, u'\u0660', 'isdigit') + self.checkequalnofix(True, '\u2460', 'isdigit') + self.checkequalnofix(False, '\xbc', 'isdigit') + self.checkequalnofix(True, '\u0660', 'isdigit') def test_isnumeric(self): - self.checkequalnofix(False, u'', 'isnumeric') - self.checkequalnofix(False, u'a', 'isnumeric') - self.checkequalnofix(True, u'0', 'isnumeric') - self.checkequalnofix(True, u'\u2460', 'isnumeric') - self.checkequalnofix(True, u'\xbc', 'isnumeric') - self.checkequalnofix(True, u'\u0660', 'isnumeric') - self.checkequalnofix(True, u'0123456789', 'isnumeric') - self.checkequalnofix(False, u'0123456789a', 'isnumeric') + self.checkequalnofix(False, '', 'isnumeric') + self.checkequalnofix(False, 'a', 'isnumeric') + self.checkequalnofix(True, '0', 'isnumeric') + self.checkequalnofix(True, '\u2460', 'isnumeric') + self.checkequalnofix(True, '\xbc', 'isnumeric') + self.checkequalnofix(True, '\u0660', 'isnumeric') + self.checkequalnofix(True, '0123456789', 'isnumeric') + self.checkequalnofix(False, '0123456789a', 'isnumeric') - self.assertRaises(TypeError, u"abc".isnumeric, 42) + self.assertRaises(TypeError, "abc".isnumeric, 42) def test_contains(self): # Testing Unicode contains method - self.assert_('a' in u'abdb') - self.assert_('a' in u'bdab') - self.assert_('a' in u'bdaba') - self.assert_('a' in u'bdba') - self.assert_('a' in u'bdba') - self.assert_(u'a' in u'bdba') - self.assert_(u'a' not in u'bdb') - self.assert_(u'a' not in 'bdb') - self.assert_(u'a' in 'bdba') - self.assert_(u'a' in ('a',1,None)) - self.assert_(u'a' in (1,None,'a')) - self.assert_(u'a' in (1,None,u'a')) + self.assert_('a' in 'abdb') + self.assert_('a' in 'bdab') + self.assert_('a' in 'bdaba') + self.assert_('a' in 'bdba') + self.assert_('a' in 'bdba') + self.assert_('a' in 'bdba') + self.assert_('a' not in 'bdb') + self.assert_('a' not in 'bdb') + self.assert_('a' in 'bdba') self.assert_('a' in ('a',1,None)) self.assert_('a' in (1,None,'a')) - self.assert_('a' in (1,None,u'a')) - self.assert_('a' not in ('x',1,u'y')) + self.assert_('a' in (1,None,'a')) + self.assert_('a' in ('a',1,None)) + self.assert_('a' in (1,None,'a')) + self.assert_('a' in (1,None,'a')) + self.assert_('a' not in ('x',1,'y')) self.assert_('a' not in ('x',1,None)) - self.assert_(u'abcd' not in u'abcxxxx') - self.assert_(u'ab' in u'abcd') - self.assert_('ab' in u'abc') - self.assert_(u'ab' in 'abc') - self.assert_(u'ab' in (1,None,u'ab')) - self.assert_(u'' in u'abc') - self.assert_('' in u'abc') + self.assert_('abcd' not in 'abcxxxx') + self.assert_('ab' in 'abcd') + self.assert_('ab' in 'abc') + self.assert_('ab' in 'abc') + self.assert_('ab' in (1,None,'ab')) + self.assert_('' in 'abc') + self.assert_('' in 'abc') # If the following fails either # the contains operator does not propagate UnicodeErrors or # someone has changed the default encoding - self.assertRaises(UnicodeError, 'g\xe2teau'.__contains__, u'\xe2') + self.assertRaises(UnicodeError, 'g\xe2teau'.__contains__, '\xe2') - self.assert_(u'' in '') - self.assert_('' in u'') - self.assert_(u'' in u'') - self.assert_(u'' in 'abc') - self.assert_('' in u'abc') - self.assert_(u'' in u'abc') - self.assert_(u'\0' not in 'abc') - self.assert_('\0' not in u'abc') - self.assert_(u'\0' not in u'abc') - self.assert_(u'\0' in '\0abc') - self.assert_('\0' in u'\0abc') - self.assert_(u'\0' in u'\0abc') - self.assert_(u'\0' in 'abc\0') - self.assert_('\0' in u'abc\0') - self.assert_(u'\0' in u'abc\0') - self.assert_(u'a' in '\0abc') - self.assert_('a' in u'\0abc') - self.assert_(u'a' in u'\0abc') - self.assert_(u'asdf' in 'asdf') - self.assert_('asdf' in u'asdf') - self.assert_(u'asdf' in u'asdf') - self.assert_(u'asdf' not in 'asd') - self.assert_('asdf' not in u'asd') - self.assert_(u'asdf' not in u'asd') - self.assert_(u'asdf' not in '') - self.assert_('asdf' not in u'') - self.assert_(u'asdf' not in u'') + self.assert_('' in '') + self.assert_('' in '') + self.assert_('' in '') + self.assert_('' in 'abc') + self.assert_('' in 'abc') + self.assert_('' in 'abc') + self.assert_('\0' not in 'abc') + self.assert_('\0' not in 'abc') + self.assert_('\0' not in 'abc') + self.assert_('\0' in '\0abc') + self.assert_('\0' in '\0abc') + self.assert_('\0' in '\0abc') + self.assert_('\0' in 'abc\0') + self.assert_('\0' in 'abc\0') + self.assert_('\0' in 'abc\0') + self.assert_('a' in '\0abc') + self.assert_('a' in '\0abc') + self.assert_('a' in '\0abc') + self.assert_('asdf' in 'asdf') + self.assert_('asdf' in 'asdf') + self.assert_('asdf' in 'asdf') + self.assert_('asdf' not in 'asd') + self.assert_('asdf' not in 'asd') + self.assert_('asdf' not in 'asd') + self.assert_('asdf' not in '') + self.assert_('asdf' not in '') + self.assert_('asdf' not in '') - self.assertRaises(TypeError, u"abc".__contains__) + self.assertRaises(TypeError, "abc".__contains__) def test_formatting(self): string_tests.MixinStrUnicodeUserStringTest.test_formatting(self) # Testing Unicode formatting strings... - self.assertEqual(u"%s, %s" % (u"abc", "abc"), u'abc, abc') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, 2, 3), u'abc, abc, 1, 2.000000, 3.00') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, -2, 3), u'abc, abc, 1, -2.000000, 3.00') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.5), u'abc, abc, -1, -2.000000, 3.50') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.57), u'abc, abc, -1, -2.000000, 3.57') - self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 1003.57), u'abc, abc, -1, -2.000000, 1003.57') + self.assertEqual("%s, %s" % ("abc", "abc"), 'abc, abc') + self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", 1, 2, 3), 'abc, abc, 1, 2.000000, 3.00') + self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", 1, -2, 3), 'abc, abc, 1, -2.000000, 3.00') + self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", -1, -2, 3.5), 'abc, abc, -1, -2.000000, 3.50') + self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", -1, -2, 3.57), 'abc, abc, -1, -2.000000, 3.57') + self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", -1, -2, 1003.57), 'abc, abc, -1, -2.000000, 1003.57') if not sys.platform.startswith('java'): - self.assertEqual(u"%r, %r" % (u"abc", "abc"), u"u'abc', 'abc'") - self.assertEqual(u"%(x)s, %(y)s" % {'x':u"abc", 'y':"def"}, u'abc, def') - self.assertEqual(u"%(x)s, %(\xfc)s" % {'x':u"abc", u'\xfc':"def"}, u'abc, def') + self.assertEqual("%r, %r" % ("abc", "abc"), "u'abc', 'abc'") + self.assertEqual("%(x)s, %(y)s" % {'x':"abc", 'y':"def"}, 'abc, def') + self.assertEqual("%(x)s, %(\xfc)s" % {'x':"abc", '\xfc':"def"}, 'abc, def') - self.assertEqual(u'%c' % 0x1234, u'\u1234') - self.assertRaises(OverflowError, u"%c".__mod__, (sys.maxunicode+1,)) + self.assertEqual('%c' % 0x1234, '\u1234') + self.assertRaises(OverflowError, "%c".__mod__, (sys.maxunicode+1,)) # formatting jobs delegated from the string implementation: - self.assertEqual('...%(foo)s...' % {'foo':u"abc"}, u'...abc...') self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...') - self.assertEqual('...%(foo)s...' % {u'foo':"abc"}, '...abc...') - self.assertEqual('...%(foo)s...' % {u'foo':u"abc"}, u'...abc...') - self.assertEqual('...%(foo)s...' % {u'foo':u"abc",'def':123}, u'...abc...') - self.assertEqual('...%(foo)s...' % {u'foo':u"abc",u'def':123}, u'...abc...') - self.assertEqual('...%s...%s...%s...%s...' % (1,2,3,u"abc"), u'...1...2...3...abc...') - self.assertEqual('...%%...%%s...%s...%s...%s...%s...' % (1,2,3,u"abc"), u'...%...%s...1...2...3...abc...') - self.assertEqual('...%s...' % u"abc", u'...abc...') - self.assertEqual('%*s' % (5,u'abc',), u' abc') - self.assertEqual('%*s' % (-5,u'abc',), u'abc ') - self.assertEqual('%*.*s' % (5,2,u'abc',), u' ab') - self.assertEqual('%*.*s' % (5,3,u'abc',), u' abc') - self.assertEqual('%i %*.*s' % (10, 5,3,u'abc',), u'10 abc') - self.assertEqual('%i%s %*.*s' % (10, 3, 5, 3, u'abc',), u'103 abc') - self.assertEqual('%c' % u'a', u'a') + self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...') + self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...') + self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...') + self.assertEqual('...%(foo)s...' % {'foo':"abc",'def':123}, '...abc...') + self.assertEqual('...%(foo)s...' % {'foo':"abc",'def':123}, '...abc...') + self.assertEqual('...%s...%s...%s...%s...' % (1,2,3,"abc"), '...1...2...3...abc...') + self.assertEqual('...%%...%%s...%s...%s...%s...%s...' % (1,2,3,"abc"), '...%...%s...1...2...3...abc...') + self.assertEqual('...%s...' % "abc", '...abc...') + self.assertEqual('%*s' % (5,'abc',), ' abc') + self.assertEqual('%*s' % (-5,'abc',), 'abc ') + self.assertEqual('%*.*s' % (5,2,'abc',), ' ab') + self.assertEqual('%*.*s' % (5,3,'abc',), ' abc') + self.assertEqual('%i %*.*s' % (10, 5,3,'abc',), '10 abc') + self.assertEqual('%i%s %*.*s' % (10, 3, 5, 3, 'abc',), '103 abc') + self.assertEqual('%c' % 'a', 'a') class Wrapper: def __str__(self): - return u'\u1234' - self.assertEqual('%s' % Wrapper(), u'\u1234') + return '\u1234' + self.assertEqual('%s' % Wrapper(), '\u1234') @test_support.run_with_locale('LC_ALL', 'de_DE', 'fr_FR') def test_format_float(self): # should not format with a comma, but always with C locale - self.assertEqual(u'1.0', u'%.1f' % 1.0) + self.assertEqual('1.0', '%.1f' % 1.0) def test_constructor(self): # unicode(obj) tests (this maps to PyObject_Unicode() at C level) self.assertEqual( - unicode(u'unicode remains unicode'), - u'unicode remains unicode' + str('unicode remains unicode'), + 'unicode remains unicode' ) - class UnicodeSubclass(unicode): + class UnicodeSubclass(str): pass self.assertEqual( - unicode(UnicodeSubclass('unicode subclass becomes unicode')), - u'unicode subclass becomes unicode' + str(UnicodeSubclass('unicode subclass becomes unicode')), + 'unicode subclass becomes unicode' ) self.assertEqual( - unicode('strings are converted to unicode'), - u'strings are converted to unicode' + str('strings are converted to unicode'), + 'strings are converted to unicode' ) class UnicodeCompat: @@ -455,8 +455,8 @@ return self.x self.assertEqual( - unicode(UnicodeCompat('__unicode__ compatible objects are recognized')), - u'__unicode__ compatible objects are recognized') + str(UnicodeCompat('__unicode__ compatible objects are recognized')), + '__unicode__ compatible objects are recognized') class StringCompat: def __init__(self, x): @@ -465,26 +465,26 @@ return self.x self.assertEqual( - unicode(StringCompat('__str__ compatible objects are recognized')), - u'__str__ compatible objects are recognized' + str(StringCompat('__str__ compatible objects are recognized')), + '__str__ compatible objects are recognized' ) # unicode(obj) is compatible to str(): o = StringCompat('unicode(obj) is compatible to str()') - self.assertEqual(unicode(o), u'unicode(obj) is compatible to str()') + self.assertEqual(str(o), 'unicode(obj) is compatible to str()') self.assertEqual(str(o), 'unicode(obj) is compatible to str()') # %-formatting and .__unicode__() - self.assertEqual(u'%s' % - UnicodeCompat(u"u'%s' % obj uses obj.__unicode__()"), - u"u'%s' % obj uses obj.__unicode__()") - self.assertEqual(u'%s' % - UnicodeCompat(u"u'%s' % obj falls back to obj.__str__()"), - u"u'%s' % obj falls back to obj.__str__()") + self.assertEqual('%s' % + UnicodeCompat("u'%s' % obj uses obj.__unicode__()"), + "u'%s' % obj uses obj.__unicode__()") + self.assertEqual('%s' % + UnicodeCompat("u'%s' % obj falls back to obj.__str__()"), + "u'%s' % obj falls back to obj.__str__()") for obj in (123, 123.45, 123): - self.assertEqual(unicode(obj), unicode(str(obj))) + self.assertEqual(str(obj), str(str(obj))) # unicode(obj, encoding, error) tests (this maps to # PyUnicode_FromEncodedObject() at C level) @@ -492,71 +492,71 @@ if not sys.platform.startswith('java'): self.assertRaises( TypeError, - unicode, - u'decoding unicode is not supported', + str, + 'decoding unicode is not supported', 'utf-8', 'strict' ) self.assertEqual( - unicode('strings are decoded to unicode', 'utf-8', 'strict'), - u'strings are decoded to unicode' + str('strings are decoded to unicode', 'utf-8', 'strict'), + 'strings are decoded to unicode' ) if not sys.platform.startswith('java'): self.assertEqual( - unicode( + str( buffer('character buffers are decoded to unicode'), 'utf-8', 'strict' ), - u'character buffers are decoded to unicode' + 'character buffers are decoded to unicode' ) - self.assertRaises(TypeError, unicode, 42, 42, 42) + self.assertRaises(TypeError, str, 42, 42, 42) def test_codecs_utf7(self): utfTests = [ - (u'A\u2262\u0391.', 'A+ImIDkQ.'), # RFC2152 example - (u'Hi Mom -\u263a-!', 'Hi Mom -+Jjo--!'), # RFC2152 example - (u'\u65E5\u672C\u8A9E', '+ZeVnLIqe-'), # RFC2152 example - (u'Item 3 is \u00a31.', 'Item 3 is +AKM-1.'), # RFC2152 example - (u'+', '+-'), - (u'+-', '+--'), - (u'+?', '+-?'), - (u'\?', '+AFw?'), - (u'+?', '+-?'), - (ur'\\?', '+AFwAXA?'), - (ur'\\\?', '+AFwAXABc?'), - (ur'++--', '+-+---') + ('A\u2262\u0391.', 'A+ImIDkQ.'), # RFC2152 example + ('Hi Mom -\u263a-!', 'Hi Mom -+Jjo--!'), # RFC2152 example + ('\u65E5\u672C\u8A9E', '+ZeVnLIqe-'), # RFC2152 example + ('Item 3 is \u00a31.', 'Item 3 is +AKM-1.'), # RFC2152 example + ('+', '+-'), + ('+-', '+--'), + ('+?', '+-?'), + ('\?', '+AFw?'), + ('+?', '+-?'), + (r'\\?', '+AFwAXA?'), + (r'\\\?', '+AFwAXABc?'), + (r'++--', '+-+---') ] for (x, y) in utfTests: self.assertEqual(x.encode('utf-7'), y) # surrogates not supported - self.assertRaises(UnicodeError, unicode, '+3ADYAA-', 'utf-7') + self.assertRaises(UnicodeError, str, '+3ADYAA-', 'utf-7') - self.assertEqual(unicode('+3ADYAA-', 'utf-7', 'replace'), u'\ufffd') + self.assertEqual(str('+3ADYAA-', 'utf-7', 'replace'), '\ufffd') def test_codecs_utf8(self): - self.assertEqual(u''.encode('utf-8'), '') - self.assertEqual(u'\u20ac'.encode('utf-8'), '\xe2\x82\xac') - self.assertEqual(u'\ud800\udc02'.encode('utf-8'), '\xf0\x90\x80\x82') - self.assertEqual(u'\ud84d\udc56'.encode('utf-8'), '\xf0\xa3\x91\x96') - self.assertEqual(u'\ud800'.encode('utf-8'), '\xed\xa0\x80') - self.assertEqual(u'\udc00'.encode('utf-8'), '\xed\xb0\x80') + self.assertEqual(''.encode('utf-8'), '') + self.assertEqual('\u20ac'.encode('utf-8'), '\xe2\x82\xac') + self.assertEqual('\ud800\udc02'.encode('utf-8'), '\xf0\x90\x80\x82') + self.assertEqual('\ud84d\udc56'.encode('utf-8'), '\xf0\xa3\x91\x96') + self.assertEqual('\ud800'.encode('utf-8'), '\xed\xa0\x80') + self.assertEqual('\udc00'.encode('utf-8'), '\xed\xb0\x80') self.assertEqual( - (u'\ud800\udc02'*1000).encode('utf-8'), + ('\ud800\udc02'*1000).encode('utf-8'), '\xf0\x90\x80\x82'*1000 ) self.assertEqual( - u'\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f' - u'\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00' - u'\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c' - u'\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067' - u'\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das' - u' Nunstuck git und'.encode('utf-8'), + '\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f' + '\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00' + '\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c' + '\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067' + '\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das' + ' Nunstuck git und'.encode('utf-8'), '\xe6\xad\xa3\xe7\xa2\xba\xe3\x81\xab\xe8\xa8\x80\xe3\x81' '\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3\xe3\x81\xaf\xe3' '\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe' @@ -570,9 +570,9 @@ ) # UTF-8 specific decoding tests - self.assertEqual(unicode('\xf0\xa3\x91\x96', 'utf-8'), u'\U00023456' ) - self.assertEqual(unicode('\xf0\x90\x80\x82', 'utf-8'), u'\U00010002' ) - self.assertEqual(unicode('\xe2\x82\xac', 'utf-8'), u'\u20ac' ) + self.assertEqual(str('\xf0\xa3\x91\x96', 'utf-8'), '\U00023456' ) + self.assertEqual(str('\xf0\x90\x80\x82', 'utf-8'), '\U00010002' ) + self.assertEqual(str('\xe2\x82\xac', 'utf-8'), '\u20ac' ) # Other possible utf-8 test cases: # * strict decoding testing for all of the @@ -580,55 +580,55 @@ def test_codecs_idna(self): # Test whether trailing dot is preserved - self.assertEqual(u"www.python.org.".encode("idna"), "www.python.org.") + self.assertEqual("www.python.org.".encode("idna"), "www.python.org.") def test_codecs_errors(self): # Error handling (encoding) - self.assertRaises(UnicodeError, u'Andr\202 x'.encode, 'ascii') - self.assertRaises(UnicodeError, u'Andr\202 x'.encode, 'ascii','strict') - self.assertEqual(u'Andr\202 x'.encode('ascii','ignore'), "Andr x") - self.assertEqual(u'Andr\202 x'.encode('ascii','replace'), "Andr? x") + self.assertRaises(UnicodeError, 'Andr\202 x'.encode, 'ascii') + self.assertRaises(UnicodeError, 'Andr\202 x'.encode, 'ascii','strict') + self.assertEqual('Andr\202 x'.encode('ascii','ignore'), "Andr x") + self.assertEqual('Andr\202 x'.encode('ascii','replace'), "Andr? x") # Error handling (decoding) - self.assertRaises(UnicodeError, unicode, 'Andr\202 x', 'ascii') - self.assertRaises(UnicodeError, unicode, 'Andr\202 x', 'ascii','strict') - self.assertEqual(unicode('Andr\202 x','ascii','ignore'), u"Andr x") - self.assertEqual(unicode('Andr\202 x','ascii','replace'), u'Andr\uFFFD x') + self.assertRaises(UnicodeError, str, 'Andr\202 x', 'ascii') + self.assertRaises(UnicodeError, str, 'Andr\202 x', 'ascii','strict') + self.assertEqual(str('Andr\202 x','ascii','ignore'), "Andr x") + self.assertEqual(str('Andr\202 x','ascii','replace'), 'Andr\uFFFD x') # Error handling (unknown character names) - self.assertEqual("\\N{foo}xx".decode("unicode-escape", "ignore"), u"xx") + self.assertEqual("\\N{foo}xx".decode("unicode-escape", "ignore"), "xx") # Error handling (truncated escape sequence) self.assertRaises(UnicodeError, "\\".decode, "unicode-escape") self.assertRaises(TypeError, "hello".decode, "test.unicode1") - self.assertRaises(TypeError, unicode, "hello", "test.unicode2") - self.assertRaises(TypeError, u"hello".encode, "test.unicode1") - self.assertRaises(TypeError, u"hello".encode, "test.unicode2") + self.assertRaises(TypeError, str, "hello", "test.unicode2") + self.assertRaises(TypeError, "hello".encode, "test.unicode1") + self.assertRaises(TypeError, "hello".encode, "test.unicode2") # executes PyUnicode_Encode() import imp self.assertRaises( ImportError, imp.find_module, "non-existing module", - [u"non-existing dir"] + ["non-existing dir"] ) # Error handling (wrong arguments) - self.assertRaises(TypeError, u"hello".encode, 42, 42, 42) + self.assertRaises(TypeError, "hello".encode, 42, 42, 42) # Error handling (PyUnicode_EncodeDecimal()) - self.assertRaises(UnicodeError, int, u"\u0200") + self.assertRaises(UnicodeError, int, "\u0200") def test_codecs(self): # Encoding - self.assertEqual(u'hello'.encode('ascii'), 'hello') - self.assertEqual(u'hello'.encode('utf-7'), 'hello') - self.assertEqual(u'hello'.encode('utf-8'), 'hello') - self.assertEqual(u'hello'.encode('utf8'), 'hello') - self.assertEqual(u'hello'.encode('utf-16-le'), 'h\000e\000l\000l\000o\000') - self.assertEqual(u'hello'.encode('utf-16-be'), '\000h\000e\000l\000l\000o') - self.assertEqual(u'hello'.encode('latin-1'), 'hello') + self.assertEqual('hello'.encode('ascii'), 'hello') + self.assertEqual('hello'.encode('utf-7'), 'hello') + self.assertEqual('hello'.encode('utf-8'), 'hello') + self.assertEqual('hello'.encode('utf8'), 'hello') + self.assertEqual('hello'.encode('utf-16-le'), 'h\000e\000l\000l\000o\000') + self.assertEqual('hello'.encode('utf-16-be'), '\000h\000e\000l\000l\000o') + self.assertEqual('hello'.encode('latin-1'), 'hello') # Roundtrip safety for BMP (just the first 1024 chars) for c in xrange(1024): @@ -636,34 +636,34 @@ for encoding in ('utf-7', 'utf-8', 'utf-16', 'utf-16-le', 'utf-16-be', 'raw_unicode_escape', 'unicode_escape', 'unicode_internal'): - self.assertEqual(unicode(u.encode(encoding),encoding), u) + self.assertEqual(str(u.encode(encoding),encoding), u) # Roundtrip safety for BMP (just the first 256 chars) for c in xrange(256): u = unichr(c) for encoding in ('latin-1',): - self.assertEqual(unicode(u.encode(encoding),encoding), u) + self.assertEqual(str(u.encode(encoding),encoding), u) # Roundtrip safety for BMP (just the first 128 chars) for c in xrange(128): u = unichr(c) for encoding in ('ascii',): - self.assertEqual(unicode(u.encode(encoding),encoding), u) + self.assertEqual(str(u.encode(encoding),encoding), u) # Roundtrip safety for non-BMP (just a few chars) - u = u'\U00010001\U00020002\U00030003\U00040004\U00050005' + u = '\U00010001\U00020002\U00030003\U00040004\U00050005' for encoding in ('utf-8', 'utf-16', 'utf-16-le', 'utf-16-be', #'raw_unicode_escape', 'unicode_escape', 'unicode_internal'): - self.assertEqual(unicode(u.encode(encoding),encoding), u) + self.assertEqual(str(u.encode(encoding),encoding), u) # UTF-8 must be roundtrip safe for all UCS-2 code points # This excludes surrogates: in the full range, there would be # a surrogate pair (\udbff\udc00), which gets converted back # to a non-BMP character (\U0010fc00) - u = u''.join(map(unichr, range(0,0xd800)+range(0xe000,0x10000))) + u = ''.join(map(unichr, range(0,0xd800)+range(0xe000,0x10000))) for encoding in ('utf-8',): - self.assertEqual(unicode(u.encode(encoding),encoding), u) + self.assertEqual(str(u.encode(encoding),encoding), u) def test_codecs_charmap(self): # 0-127 @@ -692,7 +692,7 @@ #'cp875' ): - self.assertEqual(unicode(s, encoding).encode(encoding), s) + self.assertEqual(str(s, encoding).encode(encoding), s) # 128-255 s = ''.join(map(chr, xrange(128, 256))) @@ -717,14 +717,14 @@ #'cp1006', 'cp875', 'iso8859_8', ): - self.assertEqual(unicode(s, encoding).encode(encoding), s) + self.assertEqual(str(s, encoding).encode(encoding), s) def test_concatenation(self): - self.assertEqual((u"abc" u"def"), u"abcdef") - self.assertEqual(("abc" u"def"), u"abcdef") - self.assertEqual((u"abc" "def"), u"abcdef") - self.assertEqual((u"abc" u"def" "ghi"), u"abcdefghi") - self.assertEqual(("abc" "def" u"ghi"), u"abcdefghi") + self.assertEqual(("abc" "def"), "abcdef") + self.assertEqual(("abc" "def"), "abcdef") + self.assertEqual(("abc" "def"), "abcdef") + self.assertEqual(("abc" "def" "ghi"), "abcdefghi") + self.assertEqual(("abc" "def" "ghi"), "abcdefghi") def test_printing(self): class BitBucket: @@ -732,20 +732,20 @@ pass out = BitBucket() - print(u'abc', file=out) - print(u'abc', u'def', file=out) - print(u'abc', 'def', file=out) - print('abc', u'def', file=out) - print(u'abc\n', file=out) - print(u'abc\n', end=' ', file=out) - print(u'abc\n', end=' ', file=out) - print(u'def\n', file=out) - print(u'def\n', file=out) + print('abc', file=out) + print('abc', 'def', file=out) + print('abc', 'def', file=out) + print('abc', 'def', file=out) + print('abc\n', file=out) + print('abc\n', end=' ', file=out) + print('abc\n', end=' ', file=out) + print('def\n', file=out) + print('def\n', file=out) def test_ucs4(self): if sys.maxunicode == 0xFFFF: return - x = u'\U00100000' + x = '\U00100000' y = x.encode("raw-unicode-escape").decode("raw-unicode-escape") self.assertEqual(x, y) @@ -757,11 +757,11 @@ class Foo1: def __unicode__(self): - return u"foo" + return "foo" class Foo2(object): def __unicode__(self): - return u"foo" + return "foo" class Foo3(object): def __unicode__(self): @@ -771,7 +771,7 @@ def __unicode__(self): return "foo" - class Foo5(unicode): + class Foo5(str): def __unicode__(self): return "foo" @@ -780,37 +780,37 @@ return "foos" def __unicode__(self): - return u"foou" + return "foou" - class Foo7(unicode): + class Foo7(str): def __str__(self): return "foos" def __unicode__(self): - return u"foou" + return "foou" - class Foo8(unicode): + class Foo8(str): def __new__(cls, content=""): - return unicode.__new__(cls, 2*content) + return str.__new__(cls, 2*content) def __unicode__(self): return self - class Foo9(unicode): + class Foo9(str): def __str__(self): return "string" def __unicode__(self): return "not unicode" - self.assertEqual(unicode(Foo0()), u"foo") - self.assertEqual(unicode(Foo1()), u"foo") - self.assertEqual(unicode(Foo2()), u"foo") - self.assertEqual(unicode(Foo3()), u"foo") - self.assertEqual(unicode(Foo4("bar")), u"foo") - self.assertEqual(unicode(Foo5("bar")), u"foo") - self.assertEqual(unicode(Foo6("bar")), u"foou") - self.assertEqual(unicode(Foo7("bar")), u"foou") - self.assertEqual(unicode(Foo8("foo")), u"foofoo") + self.assertEqual(str(Foo0()), "foo") + self.assertEqual(str(Foo1()), "foo") + self.assertEqual(str(Foo2()), "foo") + self.assertEqual(str(Foo3()), "foo") + self.assertEqual(str(Foo4("bar")), "foo") + self.assertEqual(str(Foo5("bar")), "foo") + self.assertEqual(str(Foo6("bar")), "foou") + self.assertEqual(str(Foo7("bar")), "foou") + self.assertEqual(str(Foo8("foo")), "foofoo") self.assertEqual(str(Foo9("foo")), "string") - self.assertEqual(unicode(Foo9("foo")), u"not unicode") + self.assertEqual(str(Foo9("foo")), "not unicode") def test_unicode_repr(self): class s1: @@ -819,7 +819,7 @@ class s2: def __repr__(self): - return u'\\n' + return '\\n' self.assertEqual(repr(s1()), '\\n') self.assertEqual(repr(s2()), '\\n') Modified: python/branches/py3k-struni/Lib/test/test_unicode_file.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_unicode_file.py (original) +++ python/branches/py3k-struni/Lib/test/test_unicode_file.py Wed May 2 21:09:54 2007 @@ -20,7 +20,7 @@ # encoding instead. import sys try: - TESTFN_UNICODE = unicode("@test-\xe0\xf2", sys.getfilesystemencoding()) + TESTFN_UNICODE = str("@test-\xe0\xf2", sys.getfilesystemencoding()) TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) if '?' in TESTFN_ENCODED: # MBCS will not report the error properly Modified: python/branches/py3k-struni/Lib/test/test_unicodedata.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_unicodedata.py (original) +++ python/branches/py3k-struni/Lib/test/test_unicodedata.py Wed May 2 21:09:54 2007 @@ -24,26 +24,26 @@ char = unichr(i) data = [ # Predicates (single char) - u"01"[char.isalnum()], - u"01"[char.isalpha()], - u"01"[char.isdecimal()], - u"01"[char.isdigit()], - u"01"[char.islower()], - u"01"[char.isnumeric()], - u"01"[char.isspace()], - u"01"[char.istitle()], - u"01"[char.isupper()], + "01"[char.isalnum()], + "01"[char.isalpha()], + "01"[char.isdecimal()], + "01"[char.isdigit()], + "01"[char.islower()], + "01"[char.isnumeric()], + "01"[char.isspace()], + "01"[char.istitle()], + "01"[char.isupper()], # Predicates (multiple chars) - u"01"[(char + u'abc').isalnum()], - u"01"[(char + u'abc').isalpha()], - u"01"[(char + u'123').isdecimal()], - u"01"[(char + u'123').isdigit()], - u"01"[(char + u'abc').islower()], - u"01"[(char + u'123').isnumeric()], - u"01"[(char + u' \t').isspace()], - u"01"[(char + u'abc').istitle()], - u"01"[(char + u'ABC').isupper()], + "01"[(char + 'abc').isalnum()], + "01"[(char + 'abc').isalpha()], + "01"[(char + '123').isdecimal()], + "01"[(char + '123').isdigit()], + "01"[(char + 'abc').islower()], + "01"[(char + '123').isnumeric()], + "01"[(char + ' \t').isspace()], + "01"[(char + 'abc').istitle()], + "01"[(char + 'ABC').isupper()], # Mappings (single char) char.lower(), @@ -51,13 +51,13 @@ char.title(), # Mappings (multiple chars) - (char + u'abc').lower(), - (char + u'ABC').upper(), - (char + u'abc').title(), - (char + u'ABC').title(), + (char + 'abc').lower(), + (char + 'ABC').upper(), + (char + 'abc').title(), + (char + 'ABC').title(), ] - h.update(u''.join(data).encode(encoding)) + h.update(''.join(data).encode(encoding)) result = h.hexdigest() self.assertEqual(result, self.expectedchecksum) @@ -99,92 +99,92 @@ self.assertEqual(result, self.expectedchecksum) def test_digit(self): - self.assertEqual(self.db.digit(u'A', None), None) - self.assertEqual(self.db.digit(u'9'), 9) - self.assertEqual(self.db.digit(u'\u215b', None), None) - self.assertEqual(self.db.digit(u'\u2468'), 9) + self.assertEqual(self.db.digit('A', None), None) + self.assertEqual(self.db.digit('9'), 9) + self.assertEqual(self.db.digit('\u215b', None), None) + self.assertEqual(self.db.digit('\u2468'), 9) self.assertRaises(TypeError, self.db.digit) - self.assertRaises(TypeError, self.db.digit, u'xx') - self.assertRaises(ValueError, self.db.digit, u'x') + self.assertRaises(TypeError, self.db.digit, 'xx') + self.assertRaises(ValueError, self.db.digit, 'x') def test_numeric(self): - self.assertEqual(self.db.numeric(u'A',None), None) - self.assertEqual(self.db.numeric(u'9'), 9) - self.assertEqual(self.db.numeric(u'\u215b'), 0.125) - self.assertEqual(self.db.numeric(u'\u2468'), 9.0) + self.assertEqual(self.db.numeric('A',None), None) + self.assertEqual(self.db.numeric('9'), 9) + self.assertEqual(self.db.numeric('\u215b'), 0.125) + self.assertEqual(self.db.numeric('\u2468'), 9.0) self.assertRaises(TypeError, self.db.numeric) - self.assertRaises(TypeError, self.db.numeric, u'xx') - self.assertRaises(ValueError, self.db.numeric, u'x') + self.assertRaises(TypeError, self.db.numeric, 'xx') + self.assertRaises(ValueError, self.db.numeric, 'x') def test_decimal(self): - self.assertEqual(self.db.decimal(u'A',None), None) - self.assertEqual(self.db.decimal(u'9'), 9) - self.assertEqual(self.db.decimal(u'\u215b', None), None) - self.assertEqual(self.db.decimal(u'\u2468', None), None) + self.assertEqual(self.db.decimal('A',None), None) + self.assertEqual(self.db.decimal('9'), 9) + self.assertEqual(self.db.decimal('\u215b', None), None) + self.assertEqual(self.db.decimal('\u2468', None), None) self.assertRaises(TypeError, self.db.decimal) - self.assertRaises(TypeError, self.db.decimal, u'xx') - self.assertRaises(ValueError, self.db.decimal, u'x') + self.assertRaises(TypeError, self.db.decimal, 'xx') + self.assertRaises(ValueError, self.db.decimal, 'x') def test_category(self): - self.assertEqual(self.db.category(u'\uFFFE'), 'Cn') - self.assertEqual(self.db.category(u'a'), 'Ll') - self.assertEqual(self.db.category(u'A'), 'Lu') + self.assertEqual(self.db.category('\uFFFE'), 'Cn') + self.assertEqual(self.db.category('a'), 'Ll') + self.assertEqual(self.db.category('A'), 'Lu') self.assertRaises(TypeError, self.db.category) - self.assertRaises(TypeError, self.db.category, u'xx') + self.assertRaises(TypeError, self.db.category, 'xx') def test_bidirectional(self): - self.assertEqual(self.db.bidirectional(u'\uFFFE'), '') - self.assertEqual(self.db.bidirectional(u' '), 'WS') - self.assertEqual(self.db.bidirectional(u'A'), 'L') + self.assertEqual(self.db.bidirectional('\uFFFE'), '') + self.assertEqual(self.db.bidirectional(' '), 'WS') + self.assertEqual(self.db.bidirectional('A'), 'L') self.assertRaises(TypeError, self.db.bidirectional) - self.assertRaises(TypeError, self.db.bidirectional, u'xx') + self.assertRaises(TypeError, self.db.bidirectional, 'xx') def test_decomposition(self): - self.assertEqual(self.db.decomposition(u'\uFFFE'),'') - self.assertEqual(self.db.decomposition(u'\u00bc'), ' 0031 2044 0034') + self.assertEqual(self.db.decomposition('\uFFFE'),'') + self.assertEqual(self.db.decomposition('\u00bc'), ' 0031 2044 0034') self.assertRaises(TypeError, self.db.decomposition) - self.assertRaises(TypeError, self.db.decomposition, u'xx') + self.assertRaises(TypeError, self.db.decomposition, 'xx') def test_mirrored(self): - self.assertEqual(self.db.mirrored(u'\uFFFE'), 0) - self.assertEqual(self.db.mirrored(u'a'), 0) - self.assertEqual(self.db.mirrored(u'\u2201'), 1) + self.assertEqual(self.db.mirrored('\uFFFE'), 0) + self.assertEqual(self.db.mirrored('a'), 0) + self.assertEqual(self.db.mirrored('\u2201'), 1) self.assertRaises(TypeError, self.db.mirrored) - self.assertRaises(TypeError, self.db.mirrored, u'xx') + self.assertRaises(TypeError, self.db.mirrored, 'xx') def test_combining(self): - self.assertEqual(self.db.combining(u'\uFFFE'), 0) - self.assertEqual(self.db.combining(u'a'), 0) - self.assertEqual(self.db.combining(u'\u20e1'), 230) + self.assertEqual(self.db.combining('\uFFFE'), 0) + self.assertEqual(self.db.combining('a'), 0) + self.assertEqual(self.db.combining('\u20e1'), 230) self.assertRaises(TypeError, self.db.combining) - self.assertRaises(TypeError, self.db.combining, u'xx') + self.assertRaises(TypeError, self.db.combining, 'xx') def test_normalize(self): self.assertRaises(TypeError, self.db.normalize) - self.assertRaises(ValueError, self.db.normalize, 'unknown', u'xx') - self.assertEqual(self.db.normalize('NFKC', u''), u'') + self.assertRaises(ValueError, self.db.normalize, 'unknown', 'xx') + self.assertEqual(self.db.normalize('NFKC', ''), '') # The rest can be found in test_normalization.py # which requires an external file. def test_east_asian_width(self): eaw = self.db.east_asian_width self.assertRaises(TypeError, eaw, 'a') - self.assertRaises(TypeError, eaw, u'') - self.assertRaises(TypeError, eaw, u'ra') - self.assertEqual(eaw(u'\x1e'), 'N') - self.assertEqual(eaw(u'\x20'), 'Na') - self.assertEqual(eaw(u'\uC894'), 'W') - self.assertEqual(eaw(u'\uFF66'), 'H') - self.assertEqual(eaw(u'\uFF1F'), 'F') - self.assertEqual(eaw(u'\u2010'), 'A') + self.assertRaises(TypeError, eaw, '') + self.assertRaises(TypeError, eaw, 'ra') + self.assertEqual(eaw('\x1e'), 'N') + self.assertEqual(eaw('\x20'), 'Na') + self.assertEqual(eaw('\uC894'), 'W') + self.assertEqual(eaw('\uFF66'), 'H') + self.assertEqual(eaw('\uFF1F'), 'F') + self.assertEqual(eaw('\u2010'), 'A') class UnicodeMiscTest(UnicodeDatabaseTest): Modified: python/branches/py3k-struni/Lib/test/test_urllib.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_urllib.py (original) +++ python/branches/py3k-struni/Lib/test/test_urllib.py Wed May 2 21:09:54 2007 @@ -425,8 +425,8 @@ "using unquote_plus(): %s != %s" % (expect, result)) def test_unquote_with_unicode(self): - r = urllib.unquote(u'br%C3%BCckner_sapporo_20050930.doc') - self.assertEqual(r, u'br\xc3\xbcckner_sapporo_20050930.doc') + r = urllib.unquote('br%C3%BCckner_sapporo_20050930.doc') + self.assertEqual(r, 'br\xc3\xbcckner_sapporo_20050930.doc') class urlencode_Tests(unittest.TestCase): """Tests for urlencode()""" Modified: python/branches/py3k-struni/Lib/test/test_winreg.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_winreg.py (original) +++ python/branches/py3k-struni/Lib/test/test_winreg.py Wed May 2 21:09:54 2007 @@ -19,10 +19,10 @@ ] if have_unicode: test_data+=[ - (unicode("Unicode Val"), unicode("A Unicode value"), REG_SZ,), - ("UnicodeExpand", unicode("The path is %path%"), REG_EXPAND_SZ), - ("Multi-unicode", [unicode("Lots"), unicode("of"), unicode("unicode"), unicode("values")], REG_MULTI_SZ), - ("Multi-mixed", [unicode("Unicode"), unicode("and"), "string", "values"],REG_MULTI_SZ), + (str("Unicode Val"), str("A Unicode value"), REG_SZ,), + ("UnicodeExpand", str("The path is %path%"), REG_EXPAND_SZ), + ("Multi-unicode", [str("Lots"), str("of"), str("unicode"), str("values")], REG_MULTI_SZ), + ("Multi-mixed", [str("Unicode"), str("and"), "string", "values"],REG_MULTI_SZ), ] def WriteTestData(root_key): Modified: python/branches/py3k-struni/Lib/test/test_xmlrpc.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_xmlrpc.py (original) +++ python/branches/py3k-struni/Lib/test/test_xmlrpc.py Wed May 2 21:09:54 2007 @@ -5,7 +5,7 @@ from test import test_support try: - unicode + str except NameError: have_unicode = False else: @@ -18,8 +18,8 @@ 'anotherlist': ['.zyx.41'], 'abase64': xmlrpclib.Binary("my dog has fleas"), 'boolean': xmlrpclib.False, - 'unicode': u'\u4000\u6000\u8000', - u'ukey\u4000': 'regular value', + 'unicode': '\u4000\u6000\u8000', + 'ukey\u4000': 'regular value', 'datetime1': xmlrpclib.DateTime('20050210T11:41:23'), 'datetime2': xmlrpclib.DateTime( (2005, 02, 10, 11, 41, 23, 0, 1, -1)), @@ -147,11 +147,11 @@ items = list(d.items()) if have_unicode: - self.assertEquals(s, u"abc \x95") - self.assert_(isinstance(s, unicode)) - self.assertEquals(items, [(u"def \x96", u"ghi \x97")]) - self.assert_(isinstance(items[0][0], unicode)) - self.assert_(isinstance(items[0][1], unicode)) + self.assertEquals(s, "abc \x95") + self.assert_(isinstance(s, str)) + self.assertEquals(items, [("def \x96", "ghi \x97")]) + self.assert_(isinstance(items[0][0], str)) + self.assert_(isinstance(items[0][1], str)) else: self.assertEquals(s, "abc \xc2\x95") self.assertEquals(items, [("def \xc2\x96", "ghi \xc2\x97")]) Modified: python/branches/py3k-struni/Lib/test/testcodec.py ============================================================================== --- python/branches/py3k-struni/Lib/test/testcodec.py (original) +++ python/branches/py3k-struni/Lib/test/testcodec.py Wed May 2 21:09:54 2007 @@ -35,10 +35,10 @@ decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ - 0x78: u"abc", # 1-n decoding mapping + 0x78: "abc", # 1-n decoding mapping "abc": 0x0078,# 1-n encoding mapping 0x01: None, # decoding mapping to - 0x79: u"", # decoding mapping to + 0x79: "", # decoding mapping to }) ### Encoding Map Modified: python/branches/py3k-struni/Lib/textwrap.py ============================================================================== --- python/branches/py3k-struni/Lib/textwrap.py (original) +++ python/branches/py3k-struni/Lib/textwrap.py Wed May 2 21:09:54 2007 @@ -70,7 +70,7 @@ whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace)) unicode_whitespace_trans = {} - uspace = ord(u' ') + uspace = ord(' ') for x in map(ord, _whitespace): unicode_whitespace_trans[x] = uspace @@ -127,7 +127,7 @@ if self.replace_whitespace: if isinstance(text, str): text = text.translate(self.whitespace_trans) - elif isinstance(text, unicode): + elif isinstance(text, str): text = text.translate(self.unicode_whitespace_trans) return text Modified: python/branches/py3k-struni/Lib/types.py ============================================================================== --- python/branches/py3k-struni/Lib/types.py (original) +++ python/branches/py3k-struni/Lib/types.py Wed May 2 21:09:54 2007 @@ -28,7 +28,7 @@ # types.StringTypes", you should use "isinstance(x, basestring)". But # we keep around for compatibility with Python 2.2. try: - UnicodeType = unicode + UnicodeType = str StringTypes = (StringType, UnicodeType) except NameError: StringTypes = (StringType,) Modified: python/branches/py3k-struni/Lib/urllib.py ============================================================================== --- python/branches/py3k-struni/Lib/urllib.py (original) +++ python/branches/py3k-struni/Lib/urllib.py Wed May 2 21:09:54 2007 @@ -984,13 +984,13 @@ # quote('abc def') -> 'abc%20def') try: - unicode + str except NameError: def _is_unicode(x): return 0 else: def _is_unicode(x): - return isinstance(x, unicode) + return isinstance(x, str) def toBytes(url): """toBytes(u"URL") --> 'URL'.""" Modified: python/branches/py3k-struni/Lib/xml/dom/minicompat.py ============================================================================== --- python/branches/py3k-struni/Lib/xml/dom/minicompat.py (original) +++ python/branches/py3k-struni/Lib/xml/dom/minicompat.py Wed May 2 21:09:54 2007 @@ -41,11 +41,11 @@ import xml.dom try: - unicode + str except NameError: StringTypes = type(''), else: - StringTypes = type(''), type(unicode('')) + StringTypes = type(''), type(str('')) class NodeList(list): Modified: python/branches/py3k-struni/Lib/xmlrpclib.py ============================================================================== --- python/branches/py3k-struni/Lib/xmlrpclib.py (original) +++ python/branches/py3k-struni/Lib/xmlrpclib.py Wed May 2 21:09:54 2007 @@ -144,9 +144,9 @@ # Internal stuff try: - unicode + str except NameError: - unicode = None # unicode support not available + str = None # unicode support not available try: import datetime @@ -160,8 +160,8 @@ def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search): # decode non-ascii string (if possible) - if unicode and encoding and is8bit(data): - data = unicode(data, encoding) + if str and encoding and is8bit(data): + data = str(data, encoding) return data def escape(s): @@ -169,7 +169,7 @@ s = s.replace("<", "<") return s.replace(">", ">",) -if unicode: +if str: def _stringify(string): # convert to 7-bit ascii if possible try: @@ -632,7 +632,7 @@ write("\n") dispatch[StringType] = dump_string - if unicode: + if str: def dump_unicode(self, value, write, escape=escape): value = value.encode(self.encoding) write("") @@ -664,7 +664,7 @@ for k, v in value.items(): write("\n") if type(k) is not StringType: - if unicode and type(k) is UnicodeType: + if str and type(k) is UnicodeType: k = k.encode(self.encoding) else: raise TypeError, "dictionary key must be string" From buildbot at python.org Wed May 2 21:18:48 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 May 2007 19:18:48 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20070502191849.0CA121E4010@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.5/builds/97 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: kristjan.jonsson Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_timeout make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed May 2 21:23:38 2007 From: python-checkins at python.org (armin.rigo) Date: Wed, 2 May 2007 21:23:38 +0200 (CEST) Subject: [Python-checkins] r55080 - in python/trunk: Lib/test/crashers/dangerous_subclassing.py Lib/test/crashers/modify_dict_attr.py Lib/test/test_descr.py Misc/NEWS Objects/typeobject.c Message-ID: <20070502192338.47DFF1E4005@bag.python.org> Author: armin.rigo Date: Wed May 2 21:23:31 2007 New Revision: 55080 Removed: python/trunk/Lib/test/crashers/dangerous_subclassing.py python/trunk/Lib/test/crashers/modify_dict_attr.py Modified: python/trunk/Lib/test/test_descr.py python/trunk/Misc/NEWS python/trunk/Objects/typeobject.c Log: Fix for #1303614 and #1174712: - __dict__ descriptor abuse for subclasses of built-in types - subclassing from both ModuleType and another built-in types Thanks zseil for the patch. Deleted: /python/trunk/Lib/test/crashers/dangerous_subclassing.py ============================================================================== --- /python/trunk/Lib/test/crashers/dangerous_subclassing.py Wed May 2 21:23:31 2007 +++ (empty file) @@ -1,12 +0,0 @@ - -# http://python.org/sf/1174712 - -import types - -class X(types.ModuleType, str): - """Such a subclassing is incorrectly allowed -- - see the SF bug report for explanations""" - -if __name__ == '__main__': - X('name') # segfault: ModuleType.__init__() reads - # the dict at the wrong offset Deleted: /python/trunk/Lib/test/crashers/modify_dict_attr.py ============================================================================== --- /python/trunk/Lib/test/crashers/modify_dict_attr.py Wed May 2 21:23:31 2007 +++ (empty file) @@ -1,20 +0,0 @@ - -# http://python.org/sf/1303614 - -class Y(object): - pass - -class type_with_modifiable_dict(type, Y): - pass - -class MyClass(object): - """This class has its __dict__ attribute indirectly - exposed via the __dict__ getter/setter of Y. - """ - __metaclass__ = type_with_modifiable_dict - - -if __name__ == '__main__': - dictattr = Y.__dict__['__dict__'] - dictattr.__delete__(MyClass) # if we set tp_dict to NULL, - print MyClass # doing anything with MyClass segfaults Modified: python/trunk/Lib/test/test_descr.py ============================================================================== --- python/trunk/Lib/test/test_descr.py (original) +++ python/trunk/Lib/test/test_descr.py Wed May 2 21:23:31 2007 @@ -3,6 +3,7 @@ from test.test_support import verify, vereq, verbose, TestFailed, TESTFN, get_original_stdout from copy import deepcopy import warnings +import types warnings.filterwarnings("ignore", r'complex divmod\(\), // and % are deprecated$', @@ -861,6 +862,16 @@ ("getattr", "foo"), ("delattr", "foo")]) + # http://python.org/sf/1174712 + try: + class Module(types.ModuleType, str): + pass + except TypeError: + pass + else: + raise TestFailed("inheriting from ModuleType and str at the " + "same time should fail") + def multi(): if verbose: print "Testing multiple inheritance..." class C(object): @@ -2907,8 +2918,73 @@ cant(a, []) cant(a, 1) del a.__dict__ # Deleting __dict__ is allowed - # Classes don't allow __dict__ assignment - cant(C, {}) + + class Base(object): + pass + def verify_dict_readonly(x): + """ + x has to be an instance of a class inheriting from Base. + """ + cant(x, {}) + try: + del x.__dict__ + except (AttributeError, TypeError): + pass + else: + raise TestFailed, "shouldn't allow del %r.__dict__" % x + dict_descr = Base.__dict__["__dict__"] + try: + dict_descr.__set__(x, {}) + except (AttributeError, TypeError): + pass + else: + raise TestFailed, "dict_descr allowed access to %r's dict" % x + + # Classes don't allow __dict__ assignment and have readonly dicts + class Meta1(type, Base): + pass + class Meta2(Base, type): + pass + class D(object): + __metaclass__ = Meta1 + class E(object): + __metaclass__ = Meta2 + for cls in C, D, E: + verify_dict_readonly(cls) + class_dict = cls.__dict__ + try: + class_dict["spam"] = "eggs" + except TypeError: + pass + else: + raise TestFailed, "%r's __dict__ can be modified" % cls + + # Modules also disallow __dict__ assignment + class Module1(types.ModuleType, Base): + pass + class Module2(Base, types.ModuleType): + pass + for ModuleType in Module1, Module2: + mod = ModuleType("spam") + verify_dict_readonly(mod) + mod.__dict__["spam"] = "eggs" + + # Exception's __dict__ can be replaced, but not deleted + class Exception1(Exception, Base): + pass + class Exception2(Base, Exception): + pass + for ExceptionType in Exception, Exception1, Exception2: + e = ExceptionType() + e.__dict__ = {"a": 1} + vereq(e.a, 1) + try: + del e.__dict__ + except (TypeError, AttributeError): + pass + else: + raise TestFaied, "%r's __dict__ can be deleted" % e + def pickles(): if verbose: Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed May 2 21:23:31 2007 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Bug #1303614: don't expose object's __dict__ when the dict is + inherited from a builtin base. + - When __slots__ are set to a unicode string, make it work the same as setting a plain string, ie don't expand to single letter identifiers. @@ -199,13 +202,6 @@ - Bug #1664966: Fix crash in exec if Unicode filename can't be decoded. -- Add new requirements for metaclasses. 1) If type or a subclass of type - occurs in __bases__, it must occur before any non-type bases, e.g. - before regular classes. 2) If you assign to __bases__, you may not - change the metaclass. Many more illegal assignments to __bases__ - are now checked and raise TypeErrors. This changed fixed at least - one known crash. - Library ------- Modified: python/trunk/Objects/typeobject.c ============================================================================== --- python/trunk/Objects/typeobject.c (original) +++ python/trunk/Objects/typeobject.c Wed May 2 21:23:31 2007 @@ -1423,10 +1423,12 @@ type->tp_itemsize != base->tp_itemsize; } if (type->tp_weaklistoffset && base->tp_weaklistoffset == 0 && - type->tp_weaklistoffset + sizeof(PyObject *) == t_size) + type->tp_weaklistoffset + sizeof(PyObject *) == t_size && + type->tp_flags & Py_TPFLAGS_HEAPTYPE) t_size -= sizeof(PyObject *); if (type->tp_dictoffset && base->tp_dictoffset == 0 && - type->tp_dictoffset + sizeof(PyObject *) == t_size) + type->tp_dictoffset + sizeof(PyObject *) == t_size && + type->tp_flags & Py_TPFLAGS_HEAPTYPE) t_size -= sizeof(PyObject *); return t_size != b_size; @@ -1452,12 +1454,73 @@ static int update_slot(PyTypeObject *, PyObject *); static void fixup_slot_dispatchers(PyTypeObject *); +/* + * Helpers for __dict__ descriptor. We don't want to expose the dicts + * inherited from various builtin types. The builtin base usually provides + * its own __dict__ descriptor, so we use that when we can. + */ +static PyTypeObject * +get_builtin_base_with_dict(PyTypeObject *type) +{ + while (type->tp_base != NULL) { + if (type->tp_dictoffset != 0 && + !(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) + return type; + type = type->tp_base; + } + return NULL; +} + +static PyObject * +get_dict_descriptor(PyTypeObject *type) +{ + static PyObject *dict_str; + PyObject *descr; + + if (dict_str == NULL) { + dict_str = PyString_InternFromString("__dict__"); + if (dict_str == NULL) + return NULL; + } + descr = _PyType_Lookup(type, dict_str); + if (descr == NULL || !PyDescr_IsData(descr)) + return NULL; + + return descr; +} + +static void +raise_dict_descr_error(PyObject *obj) +{ + PyErr_Format(PyExc_TypeError, + "this __dict__ descriptor does not support " + "'%.200s' objects", obj->ob_type->tp_name); +} + static PyObject * subtype_dict(PyObject *obj, void *context) { - PyObject **dictptr = _PyObject_GetDictPtr(obj); + PyObject **dictptr; PyObject *dict; + PyTypeObject *base; + + base = get_builtin_base_with_dict(obj->ob_type); + if (base != NULL) { + descrgetfunc func; + PyObject *descr = get_dict_descriptor(base); + if (descr == NULL) { + raise_dict_descr_error(obj); + return NULL; + } + func = descr->ob_type->tp_descr_get; + if (func == NULL) { + raise_dict_descr_error(obj); + return NULL; + } + return func(descr, obj, (PyObject *)(obj->ob_type)); + } + dictptr = _PyObject_GetDictPtr(obj); if (dictptr == NULL) { PyErr_SetString(PyExc_AttributeError, "This object has no __dict__"); @@ -1473,9 +1536,27 @@ static int subtype_setdict(PyObject *obj, PyObject *value, void *context) { - PyObject **dictptr = _PyObject_GetDictPtr(obj); + PyObject **dictptr; PyObject *dict; + PyTypeObject *base; + + base = get_builtin_base_with_dict(obj->ob_type); + if (base != NULL) { + descrsetfunc func; + PyObject *descr = get_dict_descriptor(base); + if (descr == NULL) { + raise_dict_descr_error(obj); + return -1; + } + func = descr->ob_type->tp_descr_set; + if (func == NULL) { + raise_dict_descr_error(obj); + return -1; + } + return func(descr, obj, value); + } + dictptr = _PyObject_GetDictPtr(obj); if (dictptr == NULL) { PyErr_SetString(PyExc_AttributeError, "This object has no __dict__"); From buildbot at python.org Wed May 2 21:28:43 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 May 2007 19:28:43 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD trunk Message-ID: <20070502192843.C7C7C1E4005@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%2520trunk/builds/1665 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: armin.rigo BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Wed May 2 21:41:21 2007 From: python-checkins at python.org (thomas.heller) Date: Wed, 2 May 2007 21:41:21 +0200 (CEST) Subject: [Python-checkins] r55081 - python/branches/release25-maint/Modules/_ctypes python/branches/release25-maint/Modules/_ctypes/cfield.c Message-ID: <20070502194121.C37AD1E4005@bag.python.org> Author: thomas.heller Date: Wed May 2 21:41:16 2007 New Revision: 55081 Modified: python/branches/release25-maint/Modules/_ctypes/ (props changed) python/branches/release25-maint/Modules/_ctypes/cfield.c Log: Merged revisions 55027 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk/Modules/_ctypes ........ r55027 | thomas.heller | 2007-04-30 18:04:57 +0200 (Mo, 30 Apr 2007) | 8 lines When accessing the .value attribute of a c_wchar_p instance, and the instance does not point to a valid wchar_t zero-terminated string, raise a ValueError. c_char_p does this already. The ValueError message now contains the correct pointer address. Will backport to release25-maint. ........ Modified: python/branches/release25-maint/Modules/_ctypes/cfield.c ============================================================================== --- python/branches/release25-maint/Modules/_ctypes/cfield.c (original) +++ python/branches/release25-maint/Modules/_ctypes/cfield.c Wed May 2 21:41:16 2007 @@ -1333,7 +1333,7 @@ if (IsBadStringPtrA(*(char **)ptr, -1)) { PyErr_Format(PyExc_ValueError, "invalid string pointer %p", - ptr); + *(char **)ptr); return NULL; } #endif @@ -1414,9 +1414,17 @@ { wchar_t *p; p = *(wchar_t **)ptr; - if (p) + if (p) { +#if defined(MS_WIN32) && !defined(_WIN32_WCE) + if (IsBadStringPtrW(*(wchar_t **)ptr, -1)) { + PyErr_Format(PyExc_ValueError, + "invalid string pointer %p", + *(wchar_t **)ptr); + return NULL; + } +#endif return PyUnicode_FromWideChar(p, wcslen(p)); - else { + } else { Py_INCREF(Py_None); return Py_None; } From python-checkins at python.org Wed May 2 22:02:34 2007 From: python-checkins at python.org (georg.brandl) Date: Wed, 2 May 2007 22:02:34 +0200 (CEST) Subject: [Python-checkins] r55083 - python/trunk/Python/ast.c Message-ID: <20070502200234.4EC0E1E4005@bag.python.org> Author: georg.brandl Date: Wed May 2 22:02:29 2007 New Revision: 55083 Modified: python/trunk/Python/ast.c Log: Actually raise an exception before calling ast_error_finish. Triggers an assertion otherwise. Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Wed May 2 22:02:29 2007 @@ -274,6 +274,8 @@ return Interactive(stmts, arena); } default: + PyErr_Format(PyExc_SystemError, + "invalid node %d for PyAST_FromNode", TYPE(n)); goto error; } error: From buildbot at python.org Wed May 2 22:06:42 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 May 2007 20:06:42 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070502200642.DDD2F1E401E@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/1979 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: armin.rigo Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver sincerely, -The Buildbot From python-checkins at python.org Wed May 2 23:24:16 2007 From: python-checkins at python.org (georg.brandl) Date: Wed, 2 May 2007 23:24:16 +0200 (CEST) Subject: [Python-checkins] r55084 - peps/trunk/pep-3132.txt Message-ID: <20070502212416.2DFF01E4006@bag.python.org> Author: georg.brandl Date: Wed May 2 23:24:11 2007 New Revision: 55084 Modified: peps/trunk/pep-3132.txt Log: Update PEP and refer to patch. Modified: peps/trunk/pep-3132.txt ============================================================================== --- peps/trunk/pep-3132.txt (original) +++ peps/trunk/pep-3132.txt Wed May 2 23:24:11 2007 @@ -44,49 +44,109 @@ For more complex unpacking patterns, the new syntax looks even cleaner, and the clumsy index handling is not necessary anymore. +Also, if the right-hand value is not a list, but an iterable, it +has to be converted to a list before being able to do slicing; to +avoid creating this temporary list, one has to resort to :: + + it = iter(seq) + first = it.next() + rest = list(it) + Specification ============= A tuple (or list) on the left side of a simple assignment (unpacking is not defined for augmented assignment) may contain at most one -expression prepended with a single asterisk. For the rest of this -section, the other expressions in the list are called "mandatory". - -Note that this also refers to tuples in implicit assignment context, -such as in a ``for`` statement. - -This designates a subexpression that will be assigned a list of all -items from the iterable being unpacked that are not assigned to any -of the mandatory expressions, or an empty list if there are no such -items. +expression prepended with a single asterisk (which is henceforth +called a "starred" expression, while the other expressions in the +list are called "mandatory"). This designates a subexpression that +will be assigned a list of all items from the iterable being unpacked +that are not assigned to any of the mandatory expressions, or an +empty list if there are no such items. + +For example, if ``seq`` is a slicable sequence, all the following +assignments are equivalent if ``seq`` has at least three elements:: + + a, b, c = seq[0], seq[1:-1], seq[-1] + a, *b, c = seq + [a, *b, c] = seq It is an error (as it is currently) if the iterable doesn't contain enough items to assign to all the mandatory expressions. +It is also an error to use the starred expression as a lone +assignment target, as in :: + + *a = range(5) + +This, however, is valid syntax:: + + *a, = range(5) + +Note that this proposal also applies to tuples in implicit assignment +context, such as in a ``for`` statement:: + + for (a, *b) in [(1, 2, 3), (4, 5, 6, 7)]: + print(b) + +would print out :: + + [2, 3] + [5, 6, 7] + Implementation ============== -The proposed implementation strategy is: +Grammar change +-------------- + +This feature requires a new grammar rule:: + + star_expr: ['*'] expr + +In these two rules, ``expr`` is changed to ``star_expr``:: + + comparison: star_expr (comp_op star_expr)* + exprlist: star_expr (',' star_expr)* [','] + +Changes to the Compiler +----------------------- + +A new ASDL expression type ``Starred`` is added which represents a +starred expression. Note that the starred expression element +introduced here is universal and could later be used for other +purposes in non-assignment context, such as the ``yield *iterable`` +proposal. + +The compiler is changed to recognize all cases where a starred +expression is invalid and flag them with syntax errors. + +A new bytecode instruction, ``UNPACK_EX``, is added, whose argument +has the number of mandatory targets before the starred target in the +lower 8 bits and the number of mandatory targets after the starred +target in the upper 8 bits. For unpacking sequences without starred +expressions, the old ``UNPACK_ITERABLE`` opcode is kept. + +Changes to the Bytecode Interpreter +----------------------------------- + +The function ``unpack_iterable()`` in ceval.c is changed to handle +the extended unpacking, via an ``argcntafter`` parameter. In the +``UNPACK_EX`` case, the function will do the following: + +* collect all items for mandatory targets before the starred one +* collect all remaining items from the iterable in a list +* pop items for mandatory targets after the starred one from the list +* push the single items and the resized list on the stack + +Shortcuts for unpacking iterables of known types, such as lists or +tuples, can be added. + -- add a new grammar rule, ``star_test``, which consists of ``'*' - test`` and is used in test lists -- add a new ASDL type ``Starred`` to represent a starred expression -- catch all cases where starred expressions are not allowed in the AST - and symtable generation stage -- add a new opcode, ``UNPACK_EX``, which will only be used if a - list/tuple to be assigned to contains a starred expression -- change ``unpack_iterable()`` in ceval.c to handle the extended - unpacking case - -Note that the starred expression element introduced here is universal -and could be used for other purposes in non-assignment context, such -as the ``yield *iterable`` proposal. - -The author has written a draft implementation, but there are some open -issues which will be resolved in case this PEP is looked upon -benevolently. +The current implementation can be found at the SourceForge Patch +tracker [SFPATCH]_. It now includes a minimal test case. Open Issues @@ -98,7 +158,7 @@ References ========== -None yet. +.. [SFPATCH] http://python.org/sf/1711529 Copyright From python-checkins at python.org Wed May 2 23:45:37 2007 From: python-checkins at python.org (georg.brandl) Date: Wed, 2 May 2007 23:45:37 +0200 (CEST) Subject: [Python-checkins] r55085 - peps/trunk/pep-3132.txt Message-ID: <20070502214537.A88541E4016@bag.python.org> Author: georg.brandl Date: Wed May 2 23:45:29 2007 New Revision: 55085 Modified: peps/trunk/pep-3132.txt Log: Little addition. Modified: peps/trunk/pep-3132.txt ============================================================================== --- peps/trunk/pep-3132.txt (original) +++ peps/trunk/pep-3132.txt Wed May 2 23:45:29 2007 @@ -87,7 +87,7 @@ Note that this proposal also applies to tuples in implicit assignment context, such as in a ``for`` statement:: - for (a, *b) in [(1, 2, 3), (4, 5, 6, 7)]: + for a, *b in [(1, 2, 3), (4, 5, 6, 7)]: print(b) would print out :: @@ -95,6 +95,10 @@ [2, 3] [5, 6, 7] +Starred expressions are only allowed as assignment targets, using them +anywhere else (except for star-args in function calls, of course) is an +error. + Implementation ============== From buildbot at python.org Wed May 2 23:57:02 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 May 2007 21:57:02 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20070502215702.C545F1E4005@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/618 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: armin.rigo Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_timeout make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu May 3 00:09:47 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 May 2007 22:09:47 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20070502220947.D7CA21E4016@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/191 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: armin.rigo Build had warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Thu May 3 00:30:25 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 3 May 2007 00:30:25 +0200 (CEST) Subject: [Python-checkins] r55086 - python/branches/bcannon-objcap/BRANCH_NOTES python/branches/bcannon-objcap/secure_python.c Message-ID: <20070502223025.E20CA1E4019@bag.python.org> Author: brett.cannon Date: Thu May 3 00:30:22 2007 New Revision: 55086 Modified: python/branches/bcannon-objcap/BRANCH_NOTES python/branches/bcannon-objcap/secure_python.c Log: Remove 'open' and 'execfile'. Unfortunately this breaks the importation of Python source code as importlib no longer can access 'open' through the built-in namespace. Need to decide best way to save reference to the 'open' (either just global variable or something more like an attribute on the right class?). Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Thu May 3 00:30:22 2007 @@ -12,7 +12,7 @@ ====== Status ====== -* Remove dangerous built-ins. +* Decide how to squirrel away and access 'open'. * Turn on whitelisting. * Write tests. Modified: python/branches/bcannon-objcap/secure_python.c ============================================================================== --- python/branches/bcannon-objcap/secure_python.c (original) +++ python/branches/bcannon-objcap/secure_python.c Thu May 3 00:30:22 2007 @@ -102,6 +102,10 @@ PyDict_Clear(PyDict_GetItemString(interp->sysdict, "path_importer_cache")); + /* Remove dangerous built-ins. */ + PyDict_DelItemString(interp->builtins, "execfile"); + PyDict_DelItemString(interp->builtins, "open"); + /* Use interpreter. */ return_val = Py_Main(argc, argv); /* Tear down interpreter. */ From python-checkins at python.org Thu May 3 08:47:19 2007 From: python-checkins at python.org (neal.norwitz) Date: Thu, 3 May 2007 08:47:19 +0200 (CEST) Subject: [Python-checkins] r55087 - python/trunk/Python/ast.c Message-ID: <20070503064719.8C2101E4005@bag.python.org> Author: neal.norwitz Date: Thu May 3 08:47:18 2007 New Revision: 55087 Modified: python/trunk/Python/ast.c Log: Handle a couple of uncaught errors. This should be backported Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Thu May 3 08:47:18 2007 @@ -244,6 +244,8 @@ goto error; asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset, arena)); + if (!asdl_seq_GET(stmts, 0)) + goto error; return Interactive(stmts, arena); } else { @@ -675,6 +677,8 @@ if (NCH(ch) != 1) { /* We have complex arguments, setup for unpacking. */ asdl_seq_SET(args, k++, compiler_complex_args(c, ch)); + if (!asdl_seq_GET(args, k-1)) + goto error; } else { /* def foo((x)): setup for checking NAME below. */ /* Loop because there can be many parens and tuple From python-checkins at python.org Thu May 3 09:00:06 2007 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 3 May 2007 09:00:06 +0200 (CEST) Subject: [Python-checkins] r55088 - peps/trunk/pep-3121.txt Message-ID: <20070503070006.B87D81E4010@bag.python.org> Author: martin.v.loewis Date: Thu May 3 09:00:04 2007 New Revision: 55088 Modified: peps/trunk/pep-3121.txt Log: Retitle, clarifying that the PEP talks about extension modules. Modified: peps/trunk/pep-3121.txt ============================================================================== --- peps/trunk/pep-3121.txt (original) +++ peps/trunk/pep-3121.txt Thu May 3 09:00:04 2007 @@ -1,5 +1,5 @@ PEP: 3121 -Title: Module Initialization and finalization +Title: Extension Module Initialization and Finalization Version: $Revision$ Last-Modified: $Date$ Author: Martin v. L?wis @@ -13,11 +13,11 @@ Abstract ======== -Module initialization currently has a few deficiencies. There is no -cleanup for modules, the entry point name might give naming conflicts, -the entry functions don't follow the usual calling convention, and -multiple interpreters are not supported well. This PEP addresses these -issues. +Extension module initialization currently has a few deficiencies. +There is no cleanup for modules, the entry point name might give +naming conflicts, the entry functions don't follow the usual calling +convention, and multiple interpreters are not supported well. This PEP +addresses these issues. Problems ======== From python-checkins at python.org Thu May 3 09:01:16 2007 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 3 May 2007 09:01:16 +0200 (CEST) Subject: [Python-checkins] r55089 - peps/trunk/pep-3121.txt Message-ID: <20070503070116.05B601E4005@bag.python.org> Author: martin.v.loewis Date: Thu May 3 09:01:14 2007 New Revision: 55089 Modified: peps/trunk/pep-3121.txt Log: C module -> extension module. Modified: peps/trunk/pep-3121.txt ============================================================================== --- peps/trunk/pep-3121.txt (original) +++ peps/trunk/pep-3121.txt Thu May 3 09:01:14 2007 @@ -25,13 +25,13 @@ Module Finalization ------------------- -Currently, C modules are initialized usually once and then "live" -forever. The only exception is when Py_Finalize() is called: then -the initialization routine is invoked a second time. This is bad +Currently, extension modules are initialized usually once and then +"live" forever. The only exception is when Py_Finalize() is called: +then the initialization routine is invoked a second time. This is bad from a resource management point of view: memory and other resources -might get allocated each time initialization is called, but there -is no way to reclaim them. As a result, there is currently no -way to completely release all resources Python has allocated. +might get allocated each time initialization is called, but there is +no way to reclaim them. As a result, there is currently no way to +completely release all resources Python has allocated. Entry point name conflicts -------------------------- From python-checkins at python.org Thu May 3 09:21:03 2007 From: python-checkins at python.org (neal.norwitz) Date: Thu, 3 May 2007 09:21:03 +0200 (CEST) Subject: [Python-checkins] r55090 - python/trunk/Objects/floatobject.c Message-ID: <20070503072103.19D231E4005@bag.python.org> Author: neal.norwitz Date: Thu May 3 09:20:57 2007 New Revision: 55090 Modified: python/trunk/Objects/floatobject.c Log: Remove dead code. This code couldn't be reached because earlier in the function there is another check for z != Py_None. Modified: python/trunk/Objects/floatobject.c ============================================================================== --- python/trunk/Objects/floatobject.c (original) +++ python/trunk/Objects/floatobject.c Thu May 3 09:20:57 2007 @@ -764,18 +764,7 @@ /* Sort out special cases here instead of relying on pow() */ if (iw == 0) { /* v**0 is 1, even 0**0 */ - PyFPE_START_PROTECT("pow", return NULL) - if ((PyObject *)z != Py_None) { - double iz; - CONVERT_TO_DOUBLE(z, iz); - ix = fmod(1.0, iz); - if (ix != 0 && iz < 0) - ix += iz; - } - else - ix = 1.0; - PyFPE_END_PROTECT(ix) - return PyFloat_FromDouble(ix); + return PyFloat_FromDouble(1.0); } if (iv == 0.0) { /* 0**w is error if w<0, else 1 */ if (iw < 0.0) { From python-checkins at python.org Thu May 3 14:02:09 2007 From: python-checkins at python.org (thomas.heller) Date: Thu, 3 May 2007 14:02:09 +0200 (CEST) Subject: [Python-checkins] r55092 - python/trunk/PCbuild8/_ctypes/_ctypes.vcproj Message-ID: <20070503120209.DBC5D1E4019@bag.python.org> Author: thomas.heller Date: Thu May 3 14:02:08 2007 New Revision: 55092 Modified: python/trunk/PCbuild8/_ctypes/_ctypes.vcproj Log: Fix building _ctypes.pyd for x64 / Windows. Modified: python/trunk/PCbuild8/_ctypes/_ctypes.vcproj ============================================================================== --- python/trunk/PCbuild8/_ctypes/_ctypes.vcproj (original) +++ python/trunk/PCbuild8/_ctypes/_ctypes.vcproj Thu May 3 14:02:08 2007 @@ -16,6 +16,9 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Author: thomas.heller Date: Thu May 3 14:05:20 2007 New Revision: 55093 Modified: python/trunk/Modules/_ctypes/callbacks.c Log: Don't truncate pointers to integers (on win64 platform). Modified: python/trunk/Modules/_ctypes/callbacks.c ============================================================================== --- python/trunk/Modules/_ctypes/callbacks.c (original) +++ python/trunk/Modules/_ctypes/callbacks.c Thu May 3 14:05:20 2007 @@ -383,8 +383,27 @@ return E_FAIL; } - result = PyObject_CallFunction(func, - "iii", rclsid, riid, ppv); + { + PyObject *py_rclsid = PyLong_FromVoidPtr(rclsid); + PyObject *py_riid = PyLong_FromVoidPtr(riid); + PyObject *py_ppv = PyLong_FromVoidPtr(ppv); + if (!py_rclsid || !py_riid || !py_ppv) { + Py_XDECREF(py_rclsid); + Py_XDECREF(py_riid); + Py_XDECREF(py_ppv); + Py_DECREF(func); + PyErr_WriteUnraisable(context ? context : Py_None); + return E_FAIL; + } + result = PyObject_CallFunctionObjArgs(func, + py_rclsid, + py_riid, + py_ppv, + NULL); + Py_DECREF(py_rclsid); + Py_DECREF(py_riid); + Py_DECREF(py_ppv); + } Py_DECREF(func); if (!result) { PyErr_WriteUnraisable(context ? context : Py_None); From python-checkins at python.org Thu May 3 17:13:57 2007 From: python-checkins at python.org (walter.doerwald) Date: Thu, 3 May 2007 17:13:57 +0200 (CEST) Subject: [Python-checkins] r55094 - python/trunk/Doc/api/concrete.tex Message-ID: <20070503151357.1F8291E401E@bag.python.org> Author: walter.doerwald Date: Thu May 3 17:13:55 2007 New Revision: 55094 Modified: python/trunk/Doc/api/concrete.tex Log: Clarify the behaviour of PyUnicode_DecodeUTF16(): A BOM is only skipped in native order mode, and only if it's the first two bytes. Modified: python/trunk/Doc/api/concrete.tex ============================================================================== --- python/trunk/Doc/api/concrete.tex (original) +++ python/trunk/Doc/api/concrete.tex Thu May 3 17:13:55 2007 @@ -1178,10 +1178,10 @@ *byteorder == 1: big endian \end{verbatim} - and then switches according to all byte order marks (BOM) it finds - in the input data. BOMs are not copied into the resulting Unicode - string. After completion, \var{*byteorder} is set to the current - byte order at the end of input data. + and then switches if the first two bytes of the input data are a byte order + mark (BOM) and the specified byte order is native order. This BOM is not + copied into the resulting Unicode string. After completion, \var{*byteorder} + is set to the current byte order at the. If \var{byteorder} is \NULL{}, the codec starts in native order mode. From python-checkins at python.org Thu May 3 17:16:21 2007 From: python-checkins at python.org (walter.doerwald) Date: Thu, 3 May 2007 17:16:21 +0200 (CEST) Subject: [Python-checkins] r55095 - python/branches/release25-maint/Doc/api/concrete.tex Message-ID: <20070503151621.87B371E4016@bag.python.org> Author: walter.doerwald Date: Thu May 3 17:16:16 2007 New Revision: 55095 Modified: python/branches/release25-maint/Doc/api/concrete.tex Log: Backport checkin: Clarify the behaviour of PyUnicode_DecodeUTF16(): A BOM is only skipped in native order mode, and only if it's the first two bytes. Modified: python/branches/release25-maint/Doc/api/concrete.tex ============================================================================== --- python/branches/release25-maint/Doc/api/concrete.tex (original) +++ python/branches/release25-maint/Doc/api/concrete.tex Thu May 3 17:16:16 2007 @@ -1173,10 +1173,10 @@ *byteorder == 1: big endian \end{verbatim} - and then switches according to all byte order marks (BOM) it finds - in the input data. BOMs are not copied into the resulting Unicode - string. After completion, \var{*byteorder} is set to the current - byte order at the end of input data. + and then switches if the first two bytes of the input data are a byte order + mark (BOM) and the specified byte order is native order. This BOM is not + copied into the resulting Unicode string. After completion, \var{*byteorder} + is set to the current byte order at the. If \var{byteorder} is \NULL{}, the codec starts in native order mode. From python-checkins at python.org Thu May 3 17:31:12 2007 From: python-checkins at python.org (david.goodger) Date: Thu, 3 May 2007 17:31:12 +0200 (CEST) Subject: [Python-checkins] r55096 - peps/trunk/pep-0000.txt Message-ID: <20070503153112.E529C1E4005@bag.python.org> Author: david.goodger Date: Thu May 3 17:31:10 2007 New Revision: 55096 Modified: peps/trunk/pep-0000.txt Log: updated title per r55088 Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Thu May 3 17:31:10 2007 @@ -117,7 +117,7 @@ S 3118 Revising the buffer protocol Oliphant, Banks S 3119 Introducing Abstract Base Classes GvR, Talin S 3120 Using UTF-8 as the default source encoding von L?wis - S 3121 Module Initialization and finalization von L?wis + S 3121 Extension Module Initialization & Finalization von L?wis S 3123 Making PyObject_HEAD conform to standard C von L?wis S 3124 Overloading, Generic Functions, Interfaces Eby S 3125 Remove Backslash Continuation Jewett @@ -490,7 +490,7 @@ S 3118 Revising the buffer protocol Oliphant, Banks S 3119 Introducing Abstract Base Classes GvR, Talin S 3120 Using UTF-8 as the default source encoding von L?wis - S 3121 Module Initialization and finalization von L?wis + S 3121 Extension Module Initialization & Finalization von L?wis SR 3122 Delineation of the main module Cannon S 3123 Making PyObject_HEAD conform to standard C von L?wis S 3124 Overloading, Generic Functions, Interfaces Eby From python-checkins at python.org Thu May 3 19:18:41 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 3 May 2007 19:18:41 +0200 (CEST) Subject: [Python-checkins] r55097 - in python/branches/py3k-struni: Lib/HTMLParser.py Lib/encodings/punycode.py Lib/sre_parse.py Lib/test/test_builtin.py Lib/test/test_codeccallbacks.py Lib/test/test_codecmaps_jp.py Lib/test/test_descr.py Lib/test/test_multibytecodec.py Lib/test/test_multibytecodec_support.py Lib/test/test_normalization.py Lib/test/test_ucn.py Lib/test/test_unicode.py Lib/test/test_unicodedata.py Lib/urllib.py Objects/stringobject.c Objects/unicodeobject.c Python/bltinmodule.c Message-ID: <20070503171841.7CD441E4005@bag.python.org> Author: guido.van.rossum Date: Thu May 3 19:18:26 2007 New Revision: 55097 Modified: python/branches/py3k-struni/Lib/HTMLParser.py python/branches/py3k-struni/Lib/encodings/punycode.py python/branches/py3k-struni/Lib/sre_parse.py python/branches/py3k-struni/Lib/test/test_builtin.py python/branches/py3k-struni/Lib/test/test_codeccallbacks.py python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py python/branches/py3k-struni/Lib/test/test_descr.py python/branches/py3k-struni/Lib/test/test_multibytecodec.py python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py python/branches/py3k-struni/Lib/test/test_normalization.py python/branches/py3k-struni/Lib/test/test_ucn.py python/branches/py3k-struni/Lib/test/test_unicode.py python/branches/py3k-struni/Lib/test/test_unicodedata.py python/branches/py3k-struni/Lib/urllib.py python/branches/py3k-struni/Objects/stringobject.c python/branches/py3k-struni/Objects/unicodeobject.c python/branches/py3k-struni/Python/bltinmodule.c Log: Rename 'unicode' to 'str' in its tp_name field. Rename 'str' to 'str8'. Change all occurrences of unichr to chr. Modified: python/branches/py3k-struni/Lib/HTMLParser.py ============================================================================== --- python/branches/py3k-struni/Lib/HTMLParser.py (original) +++ python/branches/py3k-struni/Lib/HTMLParser.py Thu May 3 19:18:26 2007 @@ -370,7 +370,7 @@ c = int(s[1:], 16) else: c = int(s) - return unichr(c) + return chr(c) else: # Cannot use name2codepoint directly, because HTMLParser supports apos, # which is not part of HTML 4 @@ -378,7 +378,7 @@ if HTMLParser.entitydefs is None: entitydefs = HTMLParser.entitydefs = {'apos':"'"} for k, v in htmlentitydefs.name2codepoint.items(): - entitydefs[k] = unichr(v) + entitydefs[k] = chr(v) try: return self.entitydefs[s] except KeyError: Modified: python/branches/py3k-struni/Lib/encodings/punycode.py ============================================================================== --- python/branches/py3k-struni/Lib/encodings/punycode.py (original) +++ python/branches/py3k-struni/Lib/encodings/punycode.py Thu May 3 19:18:26 2007 @@ -176,7 +176,7 @@ raise UnicodeError, ("Invalid character U+%x" % char) char = ord('?') pos = pos % (len(base) + 1) - base = base[:pos] + unichr(char) + base[pos:] + base = base[:pos] + chr(char) + base[pos:] bias = adapt(delta, (extpos == 0), len(base)) extpos = newpos return base Modified: python/branches/py3k-struni/Lib/sre_parse.py ============================================================================== --- python/branches/py3k-struni/Lib/sre_parse.py (original) +++ python/branches/py3k-struni/Lib/sre_parse.py Thu May 3 19:18:26 2007 @@ -712,7 +712,7 @@ if type(sep) is type(""): makechar = chr else: - makechar = unichr + makechar = chr while 1: this = sget() if this is None: Modified: python/branches/py3k-struni/Lib/test/test_builtin.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_builtin.py (original) +++ python/branches/py3k-struni/Lib/test/test_builtin.py Thu May 3 19:18:26 2007 @@ -90,7 +90,7 @@ (str(''), ValueError), (str(' '), ValueError), (str(' \t\t '), ValueError), - (unichr(0x200), ValueError), + (chr(0x200), ValueError), ] class TestFailingBool: @@ -221,7 +221,7 @@ mode='eval', source='0', filename='tmp') if have_unicode: compile(str(b'print(u"\xc3\xa5")\n', 'utf8'), '', 'exec') - self.assertRaises(TypeError, compile, unichr(0), 'f', 'exec') + self.assertRaises(TypeError, compile, chr(0), 'f', 'exec') self.assertRaises(ValueError, compile, str('a = 1'), 'f', 'bad') @@ -557,7 +557,7 @@ class shiftunicode(str): def __getitem__(self, index): - return unichr(ord(str.__getitem__(self, index))+1) + return chr(ord(str.__getitem__(self, index))+1) self.assertEqual( filter(lambda x: x>=str("3"), shiftunicode("1234")), str("345") @@ -676,7 +676,7 @@ self.assertRaises(TypeError, getattr, sys, 1, "foo") self.assertRaises(TypeError, getattr) if have_unicode: - self.assertRaises(UnicodeError, getattr, sys, unichr(sys.maxunicode)) + self.assertRaises(UnicodeError, getattr, sys, chr(sys.maxunicode)) def test_hasattr(self): import sys @@ -684,7 +684,7 @@ self.assertRaises(TypeError, hasattr, sys, 1) self.assertRaises(TypeError, hasattr) if have_unicode: - self.assertRaises(UnicodeError, hasattr, sys, unichr(sys.maxunicode)) + self.assertRaises(UnicodeError, hasattr, sys, chr(sys.maxunicode)) def test_hash(self): hash(None) @@ -789,7 +789,7 @@ self.assert_(isinstance(x, int)) if have_unicode: - x = int(unichr(0x661) * 600) + x = int(chr(0x661) * 600) self.assert_(isinstance(x, int)) self.assertRaises(TypeError, int, 1, 12) @@ -1387,7 +1387,7 @@ self.assertEqual(ord('A'), 65) self.assertEqual(ord('a'), 97) if have_unicode: - self.assertEqual(ord(unichr(sys.maxunicode)), sys.maxunicode) + self.assertEqual(ord(chr(sys.maxunicode)), sys.maxunicode) self.assertRaises(TypeError, ord, 42) if have_unicode: self.assertRaises(TypeError, ord, str("12")) @@ -1668,15 +1668,15 @@ def test_unichr(self): if have_unicode: - self.assertEqual(unichr(32), str(' ')) - self.assertEqual(unichr(65), str('A')) - self.assertEqual(unichr(97), str('a')) + self.assertEqual(chr(32), str(' ')) + self.assertEqual(chr(65), str('A')) + self.assertEqual(chr(97), str('a')) self.assertEqual( - unichr(sys.maxunicode), + chr(sys.maxunicode), str(('\\U%08x' % (sys.maxunicode)).encode("ascii"), 'unicode-escape') ) - self.assertRaises(ValueError, unichr, sys.maxunicode+1) - self.assertRaises(TypeError, unichr) + self.assertRaises(ValueError, chr, sys.maxunicode+1) + self.assertRaises(TypeError, chr) # We don't want self in vars(), so these are static methods Modified: python/branches/py3k-struni/Lib/test/test_codeccallbacks.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codeccallbacks.py (original) +++ python/branches/py3k-struni/Lib/test/test_codeccallbacks.py Thu May 3 19:18:26 2007 @@ -137,7 +137,7 @@ # base encodings. sin = "a\xac\u1234\u20ac\u8000" if sys.maxunicode > 0xffff: - sin += unichr(sys.maxunicode) + sin += chr(sys.maxunicode) sout = "a\\xac\\u1234\\u20ac\\u8000" if sys.maxunicode > 0xffff: sout += "\\U%08x" % sys.maxunicode @@ -509,7 +509,7 @@ ) # Use the correct exception cs = (0, 1, 9, 10, 99, 100, 999, 1000, 9999, 10000, 0x3042) - s = "".join(unichr(c) for c in cs) + s = "".join(chr(c) for c in cs) self.assertEquals( codecs.xmlcharrefreplace_errors( UnicodeEncodeError("ascii", s, 0, len(s), "ouch") @@ -650,7 +650,7 @@ v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000) if sys.maxunicode>=100000: v += (100000, 500000, 1000000) - s = "".join([unichr(x) for x in v]) + s = "".join([chr(x) for x in v]) codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) for enc in ("ascii", "iso-8859-15"): for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): Modified: python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py Thu May 3 19:18:26 2007 @@ -21,7 +21,7 @@ ('\xff', '\uf8f3'), ] for i in range(0xa1, 0xe0): - supmaps.append((chr(i), unichr(i+0xfec0))) + supmaps.append((chr(i), chr(i+0xfec0))) class TestEUCJPCOMPATMap(test_multibytecodec_support.TestBase_Mapping, Modified: python/branches/py3k-struni/Lib/test/test_descr.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_descr.py (original) +++ python/branches/py3k-struni/Lib/test/test_descr.py Thu May 3 19:18:26 2007 @@ -1122,7 +1122,7 @@ # this used to leak references try: class C(object): - __slots__ = [unichr(128)] + __slots__ = [chr(128)] except (TypeError, UnicodeEncodeError): pass else: Modified: python/branches/py3k-struni/Lib/test/test_multibytecodec.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_multibytecodec.py (original) +++ python/branches/py3k-struni/Lib/test/test_multibytecodec.py Thu May 3 19:18:26 2007 @@ -210,9 +210,9 @@ def test_bug1572832(self): if sys.maxunicode >= 0x10000: - myunichr = unichr + myunichr = chr else: - myunichr = lambda x: unichr(0xD7C0+(x>>10)) + unichr(0xDC00+(x&0x3FF)) + myunichr = lambda x: chr(0xD7C0+(x>>10)) + chr(0xDC00+(x&0x3FF)) for x in xrange(0x10000, 0x110000): # Any ISO 2022 codec will cause the segfault Modified: python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py (original) +++ python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py Thu May 3 19:18:26 2007 @@ -244,8 +244,8 @@ self.assertEqual(ostream.getvalue(), self.tstring[0]) if len('\U00012345') == 2: # ucs2 build - _unichr = unichr - def unichr(v): + _unichr = chr + def chr(v): if v >= 0x10000: return _unichr(0xd800 + ((v - 0x10000) >> 10)) + \ _unichr(0xdc00 + ((v - 0x10000) & 0x3ff)) @@ -272,7 +272,7 @@ return test_support.open_urlresource(self.mapfileurl) def test_mapping_file(self): - unichrs = lambda s: ''.join(map(unichr, map(eval, s.split('+')))) + unichrs = lambda s: ''.join(map(chr, map(eval, s.split('+')))) urt_wa = {} for line in self.open_mapping_file(): Modified: python/branches/py3k-struni/Lib/test/test_normalization.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_normalization.py (original) +++ python/branches/py3k-struni/Lib/test/test_normalization.py Thu May 3 19:18:26 2007 @@ -28,7 +28,7 @@ for x in data: if x > sys.maxunicode: raise RangeError - return "".join([unichr(x) for x in data]) + return "".join([chr(x) for x in data]) class NormalizationTest(unittest.TestCase): def test_main(self): @@ -77,7 +77,7 @@ # Perform tests for all other data for c in range(sys.maxunicode+1): - X = unichr(c) + X = chr(c) if X in part1_data: continue self.failUnless(X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c) Modified: python/branches/py3k-struni/Lib/test/test_ucn.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_ucn.py (original) +++ python/branches/py3k-struni/Lib/test/test_ucn.py Thu May 3 19:18:26 2007 @@ -96,7 +96,7 @@ import unicodedata count = 0 for code in xrange(0x10000): - char = unichr(code) + char = chr(code) name = unicodedata.name(char, None) if name is not None: self.assertEqual(unicodedata.lookup(name), char) Modified: python/branches/py3k-struni/Lib/test/test_unicode.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_unicode.py (original) +++ python/branches/py3k-struni/Lib/test/test_unicode.py Thu May 3 19:18:26 2007 @@ -90,7 +90,7 @@ "\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef" "\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd" "\\xfe\\xff'") - testrepr = repr(''.join(map(unichr, xrange(256)))) + testrepr = repr(''.join(map(chr, xrange(256)))) self.assertEqual(testrepr, latin1repr) # Test repr works on wide unicode escapes without overflow. self.assertEqual(repr("\U00010000" * 39 + "\uffff" * 4096), @@ -632,7 +632,7 @@ # Roundtrip safety for BMP (just the first 1024 chars) for c in xrange(1024): - u = unichr(c) + u = chr(c) for encoding in ('utf-7', 'utf-8', 'utf-16', 'utf-16-le', 'utf-16-be', 'raw_unicode_escape', 'unicode_escape', 'unicode_internal'): @@ -640,13 +640,13 @@ # Roundtrip safety for BMP (just the first 256 chars) for c in xrange(256): - u = unichr(c) + u = chr(c) for encoding in ('latin-1',): self.assertEqual(str(u.encode(encoding),encoding), u) # Roundtrip safety for BMP (just the first 128 chars) for c in xrange(128): - u = unichr(c) + u = chr(c) for encoding in ('ascii',): self.assertEqual(str(u.encode(encoding),encoding), u) @@ -661,7 +661,7 @@ # This excludes surrogates: in the full range, there would be # a surrogate pair (\udbff\udc00), which gets converted back # to a non-BMP character (\U0010fc00) - u = ''.join(map(unichr, range(0,0xd800)+range(0xe000,0x10000))) + u = ''.join(map(chr, range(0,0xd800)+range(0xe000,0x10000))) for encoding in ('utf-8',): self.assertEqual(str(u.encode(encoding),encoding), u) Modified: python/branches/py3k-struni/Lib/test/test_unicodedata.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_unicodedata.py (original) +++ python/branches/py3k-struni/Lib/test/test_unicodedata.py Thu May 3 19:18:26 2007 @@ -21,7 +21,7 @@ def test_method_checksum(self): h = hashlib.sha1() for i in range(65536): - char = unichr(i) + char = chr(i) data = [ # Predicates (single char) "01"[char.isalnum()], @@ -82,7 +82,7 @@ h = hashlib.sha1() for i in range(0x10000): - char = unichr(i) + char = chr(i) data = [ # Properties str(self.db.digit(char, -1)), @@ -194,7 +194,7 @@ # its numeric value should be the same. count = 0 for i in xrange(0x10000): - c = unichr(i) + c = chr(i) dec = self.db.decimal(c, -1) if dec != -1: self.assertEqual(dec, self.db.numeric(c)) @@ -207,7 +207,7 @@ # its numeric value should be the same. count = 0 for i in xrange(0x10000): - c = unichr(i) + c = chr(i) dec = self.db.digit(c, -1) if dec != -1: self.assertEqual(dec, self.db.numeric(c)) Modified: python/branches/py3k-struni/Lib/urllib.py ============================================================================== --- python/branches/py3k-struni/Lib/urllib.py (original) +++ python/branches/py3k-struni/Lib/urllib.py Thu May 3 19:18:26 2007 @@ -1158,7 +1158,7 @@ except KeyError: res[i] = '%' + item except UnicodeDecodeError: - res[i] = unichr(int(item[:2], 16)) + item[2:] + res[i] = chr(int(item[:2], 16)) + item[2:] return "".join(res) def unquote_plus(s): Modified: python/branches/py3k-struni/Objects/stringobject.c ============================================================================== --- python/branches/py3k-struni/Objects/stringobject.c (original) +++ python/branches/py3k-struni/Objects/stringobject.c Thu May 3 19:18:26 2007 @@ -4009,7 +4009,7 @@ PyTypeObject PyString_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, - "str", + "str8", sizeof(PyStringObject), sizeof(char), string_dealloc, /* tp_dealloc */ Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Thu May 3 19:18:26 2007 @@ -7954,7 +7954,7 @@ PyTypeObject PyUnicode_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ - "unicode", /* tp_name */ + "str", /* tp_name */ sizeof(PyUnicodeObject), /* tp_size */ 0, /* tp_itemsize */ /* Slots */ Modified: python/branches/py3k-struni/Python/bltinmodule.c ============================================================================== --- python/branches/py3k-struni/Python/bltinmodule.c (original) +++ python/branches/py3k-struni/Python/bltinmodule.c Thu May 3 19:18:26 2007 @@ -380,28 +380,6 @@ "function is None, return the items that are true. If sequence is a tuple\n" "or string, return the same type, else return a list."); -static PyObject * -builtin_chr(PyObject *self, PyObject *args) -{ - long x; - char s[1]; - - if (!PyArg_ParseTuple(args, "l:chr", &x)) - return NULL; - if (x < 0 || x >= 256) { - PyErr_SetString(PyExc_ValueError, - "chr() arg not in range(256)"); - return NULL; - } - s[0] = (char)x; - return PyString_FromStringAndSize(s, 1); -} - -PyDoc_STRVAR(chr_doc, -"chr(i) -> character\n\ -\n\ -Return a string of one character with ordinal i; 0 <= i < 256."); - #ifdef Py_USING_UNICODE static PyObject * @@ -416,7 +394,7 @@ } PyDoc_STRVAR(unichr_doc, -"unichr(i) -> Unicode character\n\ +"chr(i) -> Unicode character\n\ \n\ Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."); #endif @@ -2270,7 +2248,7 @@ {"all", builtin_all, METH_O, all_doc}, {"any", builtin_any, METH_O, any_doc}, {"callable", builtin_callable, METH_O, callable_doc}, - {"chr", builtin_unichr, METH_VARARGS, chr_doc}, + {"chr", builtin_unichr, METH_VARARGS, unichr_doc}, {"cmp", builtin_cmp, METH_VARARGS, cmp_doc}, {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, @@ -2376,6 +2354,7 @@ SETBUILTIN("slice", &PySlice_Type); SETBUILTIN("staticmethod", &PyStaticMethod_Type); SETBUILTIN("str", &PyUnicode_Type); + SETBUILTIN("str8", &PyString_Type); SETBUILTIN("super", &PySuper_Type); SETBUILTIN("tuple", &PyTuple_Type); SETBUILTIN("type", &PyType_Type); From python-checkins at python.org Thu May 3 19:18:53 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 3 May 2007 19:18:53 +0200 (CEST) Subject: [Python-checkins] r55098 - sandbox/trunk/2to3/fixes/fix_unicode.py Message-ID: <20070503171853.4F27B1E4006@bag.python.org> Author: guido.van.rossum Date: Thu May 3 19:18:52 2007 New Revision: 55098 Modified: sandbox/trunk/2to3/fixes/fix_unicode.py Log: The unicode fixer now also translates unichr() to chr(). Modified: sandbox/trunk/2to3/fixes/fix_unicode.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_unicode.py (original) +++ sandbox/trunk/2to3/fixes/fix_unicode.py Thu May 3 19:18:52 2007 @@ -1,4 +1,4 @@ -"""Fixer that changes unicode to str and u"..." into "...". +"""Fixer that changes unicode to str, unichr to chr, and u"..." into "...". """ @@ -9,7 +9,7 @@ class FixUnicode(basefix.BaseFix): - PATTERN = "STRING | NAME<'unicode'>" + PATTERN = "STRING | NAME<'unicode' | 'unichr'>" def transform(self, node): if node.type == token.NAME: @@ -17,6 +17,10 @@ new = node.clone() new.value = "str" return new + if node.value == "unichr": + new = node.clone() + new.value = "chr" + return new # XXX Warn when __unicode__ found? elif node.type == token.STRING: if re.match(r"[uU][rR]?[\'\"]", node.value): From python-checkins at python.org Thu May 3 19:22:58 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 3 May 2007 19:22:58 +0200 (CEST) Subject: [Python-checkins] r55099 - python/branches/py3k-struni/Python/bltinmodule.c Message-ID: <20070503172258.DFC3D1E4006@bag.python.org> Author: guido.van.rossum Date: Thu May 3 19:22:56 2007 New Revision: 55099 Modified: python/branches/py3k-struni/Python/bltinmodule.c Log: Kill unichr() itself. Modified: python/branches/py3k-struni/Python/bltinmodule.c ============================================================================== --- python/branches/py3k-struni/Python/bltinmodule.c (original) +++ python/branches/py3k-struni/Python/bltinmodule.c Thu May 3 19:22:56 2007 @@ -2286,9 +2286,6 @@ {"setattr", builtin_setattr, METH_VARARGS, setattr_doc}, {"sorted", (PyCFunction)builtin_sorted, METH_VARARGS | METH_KEYWORDS, sorted_doc}, {"sum", builtin_sum, METH_VARARGS, sum_doc}, -#ifdef Py_USING_UNICODE - {"unichr", builtin_unichr, METH_VARARGS, unichr_doc}, -#endif {"vars", builtin_vars, METH_VARARGS, vars_doc}, {"zip", builtin_zip, METH_VARARGS, zip_doc}, {NULL, NULL}, From python-checkins at python.org Thu May 3 19:49:46 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 3 May 2007 19:49:46 +0200 (CEST) Subject: [Python-checkins] r55100 - in python/branches/py3k-struni: Include/longobject.h Include/object.h Include/pyerrors.h Include/unicodeobject.h Modules/_codecsmodule.c Modules/_elementtree.c Modules/_localemodule.c Modules/_sre.c Modules/_testcapimodule.c Modules/_tkinter.c Modules/arraymodule.c Modules/cPickle.c Modules/posixmodule.c Modules/pyexpat.c Objects/abstract.c Objects/complexobject.c Objects/exceptions.c Objects/fileobject.c Objects/floatobject.c Objects/intobject.c Objects/longobject.c Objects/object.c Objects/stringobject.c Objects/typeobject.c PC/pyconfig.h Parser/tokenizer.c Python/ast.c Python/bltinmodule.c Python/codecs.c Python/getargs.c Python/import.c Python/marshal.c Python/modsupport.c Python/pythonrun.c Python/sysmodule.c RISCOS/pyconfig.h Message-ID: <20070503174946.D611D1E4020@bag.python.org> Author: guido.van.rossum Date: Thu May 3 19:49:24 2007 New Revision: 55100 Modified: python/branches/py3k-struni/Include/longobject.h python/branches/py3k-struni/Include/object.h python/branches/py3k-struni/Include/pyerrors.h python/branches/py3k-struni/Include/unicodeobject.h python/branches/py3k-struni/Modules/_codecsmodule.c python/branches/py3k-struni/Modules/_elementtree.c python/branches/py3k-struni/Modules/_localemodule.c python/branches/py3k-struni/Modules/_sre.c python/branches/py3k-struni/Modules/_testcapimodule.c python/branches/py3k-struni/Modules/_tkinter.c python/branches/py3k-struni/Modules/arraymodule.c python/branches/py3k-struni/Modules/cPickle.c python/branches/py3k-struni/Modules/posixmodule.c python/branches/py3k-struni/Modules/pyexpat.c python/branches/py3k-struni/Objects/abstract.c python/branches/py3k-struni/Objects/complexobject.c python/branches/py3k-struni/Objects/exceptions.c python/branches/py3k-struni/Objects/fileobject.c python/branches/py3k-struni/Objects/floatobject.c python/branches/py3k-struni/Objects/intobject.c python/branches/py3k-struni/Objects/longobject.c python/branches/py3k-struni/Objects/object.c python/branches/py3k-struni/Objects/stringobject.c python/branches/py3k-struni/Objects/typeobject.c python/branches/py3k-struni/PC/pyconfig.h python/branches/py3k-struni/Parser/tokenizer.c python/branches/py3k-struni/Python/ast.c python/branches/py3k-struni/Python/bltinmodule.c python/branches/py3k-struni/Python/codecs.c python/branches/py3k-struni/Python/getargs.c python/branches/py3k-struni/Python/import.c python/branches/py3k-struni/Python/marshal.c python/branches/py3k-struni/Python/modsupport.c python/branches/py3k-struni/Python/pythonrun.c python/branches/py3k-struni/Python/sysmodule.c python/branches/py3k-struni/RISCOS/pyconfig.h Log: Get rid of all #ifdef Py_USING_UNICODE (it is always present now). (With the help of unifdef from freshmeat.) Modified: python/branches/py3k-struni/Include/longobject.h ============================================================================== --- python/branches/py3k-struni/Include/longobject.h (original) +++ python/branches/py3k-struni/Include/longobject.h Thu May 3 19:49:24 2007 @@ -51,9 +51,7 @@ #endif /* HAVE_LONG_LONG */ PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int); -#ifdef Py_USING_UNICODE PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int); -#endif /* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0. v must not be NULL, and must be a normalized long. Modified: python/branches/py3k-struni/Include/object.h ============================================================================== --- python/branches/py3k-struni/Include/object.h (original) +++ python/branches/py3k-struni/Include/object.h Thu May 3 19:49:24 2007 @@ -374,9 +374,7 @@ PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *); PyAPI_FUNC(PyObject *) _PyObject_Str(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); -#ifdef Py_USING_UNICODE PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *); -#endif PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); Modified: python/branches/py3k-struni/Include/pyerrors.h ============================================================================== --- python/branches/py3k-struni/Include/pyerrors.h (original) +++ python/branches/py3k-struni/Include/pyerrors.h Thu May 3 19:49:24 2007 @@ -26,7 +26,6 @@ PyObject *print_file_and_line; } PySyntaxErrorObject; -#ifdef Py_USING_UNICODE typedef struct { PyObject_HEAD PyObject *dict; @@ -38,7 +37,6 @@ PyObject *end; PyObject *reason; } PyUnicodeErrorObject; -#endif typedef struct { PyObject_HEAD @@ -235,7 +233,6 @@ PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int); PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int); -#ifdef Py_USING_UNICODE /* The following functions are used to create and modify unicode exceptions from C */ @@ -297,7 +294,6 @@ PyObject *, const char *); PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( PyObject *, const char *); -#endif /* These APIs aren't really part of the error implementation, but Modified: python/branches/py3k-struni/Include/unicodeobject.h ============================================================================== --- python/branches/py3k-struni/Include/unicodeobject.h (original) +++ python/branches/py3k-struni/Include/unicodeobject.h Thu May 3 19:49:24 2007 @@ -58,13 +58,6 @@ /* --- Internal Unicode Format -------------------------------------------- */ -#ifndef Py_USING_UNICODE - -#define PyUnicode_Check(op) 0 -#define PyUnicode_CheckExact(op) 0 - -#else - /* FIXME: MvL's new implementation assumes that Py_UNICODE_SIZE is properly set, but the default rules below doesn't set it. I'll sort this out some other day -- fredrik at pythonware.com */ @@ -1262,5 +1255,4 @@ #ifdef __cplusplus } #endif -#endif /* Py_USING_UNICODE */ #endif /* !Py_UNICODEOBJECT_H */ Modified: python/branches/py3k-struni/Modules/_codecsmodule.c ============================================================================== --- python/branches/py3k-struni/Modules/_codecsmodule.c (original) +++ python/branches/py3k-struni/Modules/_codecsmodule.c Thu May 3 19:49:24 2007 @@ -93,15 +93,8 @@ if (!PyArg_ParseTuple(args, "O|ss:encode", &v, &encoding, &errors)) return NULL; -#ifdef Py_USING_UNICODE if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); -#else - if (encoding == NULL) { - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - return NULL; - } -#endif /* Encode via the codec registry */ return PyCodec_Encode(v, encoding, errors); @@ -127,15 +120,8 @@ if (!PyArg_ParseTuple(args, "O|ss:decode", &v, &encoding, &errors)) return NULL; -#ifdef Py_USING_UNICODE if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); -#else - if (encoding == NULL) { - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - return NULL; - } -#endif /* Decode via the codec registry */ return PyCodec_Decode(v, encoding, errors); @@ -198,7 +184,6 @@ return codec_tuple(str, PyString_Size(str)); } -#ifdef Py_USING_UNICODE /* --- Decoder ------------------------------------------------------------ */ static PyObject * @@ -833,7 +818,6 @@ } #endif /* MS_WINDOWS */ -#endif /* Py_USING_UNICODE */ /* --- Error handler registry --------------------------------------------- */ @@ -888,7 +872,6 @@ decode__doc__}, {"escape_encode", escape_encode, METH_VARARGS}, {"escape_decode", escape_decode, METH_VARARGS}, -#ifdef Py_USING_UNICODE {"utf_8_encode", utf_8_encode, METH_VARARGS}, {"utf_8_decode", utf_8_decode, METH_VARARGS}, {"utf_7_encode", utf_7_encode, METH_VARARGS}, @@ -919,7 +902,6 @@ {"mbcs_encode", mbcs_encode, METH_VARARGS}, {"mbcs_decode", mbcs_decode, METH_VARARGS}, #endif -#endif /* Py_USING_UNICODE */ {"register_error", register_error, METH_VARARGS, register_error__doc__}, {"lookup_error", lookup_error, METH_VARARGS, Modified: python/branches/py3k-struni/Modules/_elementtree.c ============================================================================== --- python/branches/py3k-struni/Modules/_elementtree.c (original) +++ python/branches/py3k-struni/Modules/_elementtree.c Thu May 3 19:49:24 2007 @@ -93,27 +93,6 @@ #define LOCAL(type) static type #endif -/* compatibility macros */ -#if (PY_VERSION_HEX < 0x02050000) -typedef int Py_ssize_t; -#define lenfunc inquiry -#endif - -#if (PY_VERSION_HEX < 0x02040000) -#define PyDict_CheckExact PyDict_Check -#if (PY_VERSION_HEX < 0x02020000) -#define PyList_CheckExact PyList_Check -#define PyString_CheckExact PyString_Check -#if (PY_VERSION_HEX >= 0x01060000) -#define Py_USING_UNICODE /* always enabled for 2.0 and 2.1 */ -#endif -#endif -#endif - -#if !defined(Py_RETURN_NONE) -#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None -#endif - /* macros used to store 'join' flags in string object pointers. note that all use of text and tail as object pointers must be wrapped in JOIN_OBJ. see comments in the ElementObject definition for more @@ -724,7 +703,6 @@ #define PATHCHAR(ch) (ch == '/' || ch == '*' || ch == '[' || ch == '@') -#if defined(Py_USING_UNICODE) if (PyUnicode_Check(tag)) { Py_UNICODE *p = PyUnicode_AS_UNICODE(tag); for (i = 0; i < PyUnicode_GET_SIZE(tag); i++) { @@ -737,7 +715,6 @@ } return 0; } -#endif if (PyString_Check(tag)) { char *p = PyString_AS_STRING(tag); for (i = 0; i < PyString_GET_SIZE(tag); i++) { @@ -1860,7 +1837,6 @@ /* helpers */ -#if defined(Py_USING_UNICODE) LOCAL(int) checkstring(const char* string, int size) { @@ -1873,7 +1849,6 @@ return 0; } -#endif LOCAL(PyObject*) makestring(const char* string, int size) @@ -1881,10 +1856,8 @@ /* convert a UTF-8 string to either a 7-bit ascii string or a Unicode string */ -#if defined(Py_USING_UNICODE) if (checkstring(string, size)) return PyUnicode_DecodeUTF8(string, size, "strict"); -#endif return PyString_FromStringAndSize(string, size); } @@ -1934,7 +1907,6 @@ } /* decode universal name */ -#if defined(Py_USING_UNICODE) /* inline makestring, to avoid duplicating the source string if it's not an utf-8 string */ p = PyString_AS_STRING(tag); @@ -1946,7 +1918,6 @@ return NULL; } } else -#endif value = tag; /* use tag as is */ /* add to names dictionary */ @@ -2163,7 +2134,6 @@ } } -#if defined(Py_USING_UNICODE) static int expat_unknown_encoding_handler(XMLParserObject *self, const XML_Char *name, XML_Encoding *info) @@ -2200,7 +2170,6 @@ return XML_STATUS_OK; } -#endif /* -------------------------------------------------------------------- */ /* constructor and destructor */ @@ -2306,12 +2275,10 @@ self->parser, (XML_ProcessingInstructionHandler) expat_pi_handler ); -#if defined(Py_USING_UNICODE) EXPAT(SetUnknownEncodingHandler)( self->parser, (XML_UnknownEncodingHandler) expat_unknown_encoding_handler, NULL ); -#endif ALLOC(sizeof(XMLParserObject), "create expatparser"); Modified: python/branches/py3k-struni/Modules/_localemodule.c ============================================================================== --- python/branches/py3k-struni/Modules/_localemodule.c (original) +++ python/branches/py3k-struni/Modules/_localemodule.c Thu May 3 19:49:24 2007 @@ -270,7 +270,7 @@ static PyObject* PyLocale_strcoll(PyObject* self, PyObject* args) { -#if !defined(HAVE_WCSCOLL) || !defined(Py_USING_UNICODE) +#if !defined(HAVE_WCSCOLL) char *s1,*s2; if (!PyArg_ParseTuple(args, "ss:strcoll", &s1, &s2)) Modified: python/branches/py3k-struni/Modules/_sre.c ============================================================================== --- python/branches/py3k-struni/Modules/_sre.c (original) +++ python/branches/py3k-struni/Modules/_sre.c Thu May 3 19:49:24 2007 @@ -58,12 +58,8 @@ /* defining this one enables tracing */ #undef VERBOSE -#if PY_VERSION_HEX >= 0x01060000 -#if PY_VERSION_HEX < 0x02020000 || defined(Py_USING_UNICODE) /* defining this enables unicode support (default under 1.6a1 and later) */ #define HAVE_UNICODE -#endif -#endif /* -------------------------------------------------------------------- */ /* optional features */ Modified: python/branches/py3k-struni/Modules/_testcapimodule.c ============================================================================== --- python/branches/py3k-struni/Modules/_testcapimodule.c (original) +++ python/branches/py3k-struni/Modules/_testcapimodule.c Thu May 3 19:49:24 2007 @@ -456,7 +456,6 @@ return Py_None; } -#ifdef Py_USING_UNICODE /* Test the u and u# codes for PyArg_ParseTuple. May leak memory in case of an error. @@ -518,7 +517,6 @@ return PyCodec_IncrementalDecoder(encoding, errors); } -#endif /* Simple test of _PyLong_NumBits and _PyLong_Sign. */ static PyObject * @@ -863,9 +861,7 @@ {"codec_incrementaldecoder", (PyCFunction)codec_incrementaldecoder, METH_VARARGS}, #endif -#ifdef Py_USING_UNICODE {"test_u_code", (PyCFunction)test_u_code, METH_NOARGS}, -#endif #ifdef WITH_THREAD {"_test_thread_state", test_thread_state, METH_VARARGS}, #endif Modified: python/branches/py3k-struni/Modules/_tkinter.c ============================================================================== --- python/branches/py3k-struni/Modules/_tkinter.c (original) +++ python/branches/py3k-struni/Modules/_tkinter.c Thu May 3 19:49:24 2007 @@ -337,7 +337,6 @@ { if (PyString_Check(value)) return PyString_AsString(value); -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(value)) { PyObject *v = PyUnicode_AsUTF8String(value); if (v == NULL) @@ -349,7 +348,6 @@ Py_DECREF(v); return PyString_AsString(v); } -#endif else { PyObject *v = PyObject_Str(value); if (v == NULL) @@ -775,7 +773,6 @@ for (i = 0; i < len; i++) if (s[i] & 0x80) break; -#ifdef Py_USING_UNICODE if (i == len) /* It is an ASCII string. */ self->string = PyString_FromStringAndSize(s, len); @@ -786,9 +783,6 @@ self->string = PyString_FromStringAndSize(s, len); } } -#else - self->string = PyString_FromStringAndSize(s, len); -#endif if (!self->string) return NULL; } @@ -796,7 +790,6 @@ return self->string; } -#ifdef Py_USING_UNICODE PyDoc_STRVAR(PyTclObject_unicode__doc__, "convert argument to unicode"); static PyObject * @@ -812,7 +805,6 @@ s = Tcl_GetStringFromObj(self->value, &len); return PyUnicode_DecodeUTF8(s, len, "strict"); } -#endif static PyObject * PyTclObject_repr(PyTclObject *self) @@ -851,10 +843,8 @@ }; static PyMethodDef PyTclObject_methods[] = { -#ifdef Py_USING_UNICODE {"__unicode__", (PyCFunction)PyTclObject_unicode, METH_NOARGS, PyTclObject_unicode__doc__}, -#endif {0} }; @@ -929,7 +919,6 @@ ckfree(FREECAST argv); return result; } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(value)) { Py_UNICODE *inbuf = PyUnicode_AS_UNICODE(value); Py_ssize_t size = PyUnicode_GET_SIZE(value); @@ -962,7 +951,6 @@ #endif } -#endif else if(PyTclObject_Check(value)) { Tcl_Obj *v = ((PyTclObject*)value)->value; Tcl_IncrRefCount(v); @@ -987,7 +975,6 @@ if (value->typePtr == NULL) { /* If the result contains any bytes with the top bit set, it's UTF-8 and we should decode it to Unicode */ -#ifdef Py_USING_UNICODE int i; char *s = value->bytes; int len = value->length; @@ -1006,9 +993,6 @@ result = PyString_FromStringAndSize(s, len); } } -#else - result = PyString_FromStringAndSize(value->bytes, value->length); -#endif return result; } @@ -1066,7 +1050,6 @@ } if (value->typePtr == app->StringType) { -#ifdef Py_USING_UNICODE #if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX==3 PyObject *result; int size; @@ -1086,12 +1069,6 @@ return PyUnicode_FromUnicode(Tcl_GetUnicode(value), Tcl_GetCharLength(value)); #endif -#else - int size; - char *c; - c = Tcl_GetStringFromObj(value, &size); - return PyString_FromStringAndSize(c, size); -#endif } return newPyTclObject(value); @@ -1194,7 +1171,6 @@ /* If the result contains any bytes with the top bit set, it's UTF-8 and we should decode it to Unicode */ -#ifdef Py_USING_UNICODE while (*p != '\0') { if (*p & 0x80) break; @@ -1212,10 +1188,6 @@ res = PyString_FromStringAndSize(s, (int)(p-s)); } } -#else - p = strchr(p, '\0'); - res = PyString_FromStringAndSize(s, (int)(p-s)); -#endif } return res; } Modified: python/branches/py3k-struni/Modules/arraymodule.c ============================================================================== --- python/branches/py3k-struni/Modules/arraymodule.c (original) +++ python/branches/py3k-struni/Modules/arraymodule.c Thu May 3 19:49:24 2007 @@ -170,7 +170,6 @@ return 0; } -#ifdef Py_USING_UNICODE static PyObject * u_getitem(arrayobject *ap, Py_ssize_t i) { @@ -194,7 +193,6 @@ ((Py_UNICODE *)ap->ob_item)[i] = p[0]; return 0; } -#endif static PyObject * h_getitem(arrayobject *ap, Py_ssize_t i) @@ -394,9 +392,7 @@ {'c', sizeof(char), c_getitem, c_setitem}, {'b', sizeof(char), b_getitem, b_setitem}, {'B', sizeof(char), BB_getitem, BB_setitem}, -#ifdef Py_USING_UNICODE {'u', sizeof(Py_UNICODE), u_getitem, u_setitem}, -#endif {'h', sizeof(short), h_getitem, h_setitem}, {'H', sizeof(short), HH_getitem, HH_setitem}, {'i', sizeof(int), i_getitem, i_setitem}, @@ -1430,7 +1426,6 @@ -#ifdef Py_USING_UNICODE static PyObject * array_fromunicode(arrayobject *self, PyObject *args) { @@ -1491,7 +1486,6 @@ array.tostring().decode() to obtain a unicode string from\n\ an array of some other type."); -#endif /* Py_USING_UNICODE */ static PyObject * @@ -1536,10 +1530,8 @@ fromlist_doc}, {"fromstring", (PyCFunction)array_fromstring, METH_VARARGS, fromstring_doc}, -#ifdef Py_USING_UNICODE {"fromunicode", (PyCFunction)array_fromunicode, METH_VARARGS, fromunicode_doc}, -#endif {"index", (PyCFunction)array_index, METH_O, index_doc}, {"insert", (PyCFunction)array_insert, METH_VARARGS, @@ -1562,10 +1554,8 @@ tolist_doc}, {"tostring", (PyCFunction)array_tostring, METH_NOARGS, tostring_doc}, -#ifdef Py_USING_UNICODE {"tounicode", (PyCFunction)array_tounicode, METH_NOARGS, tounicode_doc}, -#endif {"write", (PyCFunction)array_tofile, METH_O, tofile_doc}, {NULL, NULL} /* sentinel */ @@ -1587,10 +1577,8 @@ if (typecode == 'c') v = array_tostring(a, NULL); -#ifdef Py_USING_UNICODE else if (typecode == 'u') v = array_tounicode(a, NULL); -#endif else v = array_tolist(a, NULL); t = PyObject_Repr(v); @@ -1899,7 +1887,6 @@ return NULL; } Py_DECREF(v); -#ifdef Py_USING_UNICODE } else if (initial != NULL && PyUnicode_Check(initial)) { Py_ssize_t n = PyUnicode_GET_DATA_SIZE(initial); if (n > 0) { @@ -1916,7 +1903,6 @@ memcpy(item, PyUnicode_AS_DATA(initial), n); self->allocated = self->ob_size; } -#endif } if (it != NULL) { if (array_iter_extend((arrayobject *)a, it) == -1) { Modified: python/branches/py3k-struni/Modules/cPickle.c ============================================================================== --- python/branches/py3k-struni/Modules/cPickle.c (original) +++ python/branches/py3k-struni/Modules/cPickle.c Thu May 3 19:49:24 2007 @@ -1256,7 +1256,6 @@ } -#ifdef Py_USING_UNICODE /* A copy of PyUnicode_EncodeRawUnicodeEscape() that also translates backslash and newline characters to \uXXXX escapes. */ static PyObject * @@ -1373,7 +1372,6 @@ Py_XDECREF(repr); return -1; } -#endif /* A helper for save_tuple. Push the len elements in tuple t on the stack. */ static int @@ -2225,13 +2223,11 @@ goto finally; } -#ifdef Py_USING_UNICODE case 'u': if ((type == &PyUnicode_Type) && (PyString_GET_SIZE(args) < 2)) { res = save_unicode(self, args, 0); goto finally; } -#endif } if (args->ob_refcnt > 1) { @@ -2255,14 +2251,12 @@ } break; -#ifdef Py_USING_UNICODE case 'u': if (type == &PyUnicode_Type) { res = save_unicode(self, args, 1); goto finally; } break; -#endif case 't': if (type == &PyTuple_Type) { @@ -3326,7 +3320,6 @@ } -#ifdef Py_USING_UNICODE static int load_unicode(Unpicklerobject *self) { @@ -3346,10 +3339,8 @@ finally: return res; } -#endif -#ifdef Py_USING_UNICODE static int load_binunicode(Unpicklerobject *self) { @@ -3370,7 +3361,6 @@ PDATA_PUSH(self->stack, unicode, -1); return 0; } -#endif static int @@ -4347,7 +4337,6 @@ break; continue; -#ifdef Py_USING_UNICODE case UNICODE: if (load_unicode(self) < 0) break; @@ -4357,7 +4346,6 @@ if (load_binunicode(self) < 0) break; continue; -#endif case EMPTY_TUPLE: if (load_counted_tuple(self, 0) < 0) @@ -4737,7 +4725,6 @@ break; continue; -#ifdef Py_USING_UNICODE case UNICODE: if (load_unicode(self) < 0) break; @@ -4747,7 +4734,6 @@ if (load_binunicode(self) < 0) break; continue; -#endif case EMPTY_TUPLE: if (load_counted_tuple(self, 0) < 0) Modified: python/branches/py3k-struni/Modules/posixmodule.c ============================================================================== --- python/branches/py3k-struni/Modules/posixmodule.c (original) +++ python/branches/py3k-struni/Modules/posixmodule.c Thu May 3 19:49:24 2007 @@ -44,10 +44,6 @@ disguised Unix interface). Refer to the library manual and\n\ corresponding Unix manual entries for more information on calls."); -#ifndef Py_USING_UNICODE -/* This is used in signatures of functions. */ -#define Py_UNICODE void -#endif #if defined(PYOS_OS2) #define INCL_DOS @@ -1895,7 +1891,6 @@ return PyString_FromString(buf); } -#ifdef Py_USING_UNICODE PyDoc_STRVAR(posix_getcwdu__doc__, "getcwdu() -> path\n\n\ Return a unicode string representing the current working directory."); @@ -1949,7 +1944,6 @@ return PyUnicode_Decode(buf, strlen(buf), Py_FileSystemDefaultEncoding,"strict"); } #endif -#endif #ifdef HAVE_LINK @@ -2242,7 +2236,6 @@ d = NULL; break; } -#ifdef Py_USING_UNICODE if (arg_is_unicode) { PyObject *w; @@ -2259,7 +2252,6 @@ PyErr_Clear(); } } -#endif if (PyList_Append(d, v) != 0) { Py_DECREF(v); Py_DECREF(d); @@ -5764,14 +5756,11 @@ char buf[MAXPATHLEN]; char *path; int n; -#ifdef Py_USING_UNICODE int arg_is_unicode = 0; -#endif if (!PyArg_ParseTuple(args, "et:readlink", Py_FileSystemDefaultEncoding, &path)) return NULL; -#ifdef Py_USING_UNICODE v = PySequence_GetItem(args, 0); if (v == NULL) return NULL; @@ -5779,7 +5768,6 @@ arg_is_unicode = 1; } Py_DECREF(v); -#endif Py_BEGIN_ALLOW_THREADS n = readlink(path, buf, (int) sizeof buf); @@ -5788,7 +5776,6 @@ return posix_error_with_filename(path); v = PyString_FromStringAndSize(buf, n); -#ifdef Py_USING_UNICODE if (arg_is_unicode) { PyObject *w; @@ -5805,7 +5792,6 @@ PyErr_Clear(); } } -#endif return v; } #endif /* HAVE_READLINK */ @@ -8184,10 +8170,8 @@ #endif #ifdef HAVE_GETCWD {"getcwd", posix_getcwd, METH_NOARGS, posix_getcwd__doc__}, -#ifdef Py_USING_UNICODE {"getcwdu", posix_getcwdu, METH_NOARGS, posix_getcwdu__doc__}, #endif -#endif #ifdef HAVE_LINK {"link", posix_link, METH_VARARGS, posix_link__doc__}, #endif /* HAVE_LINK */ Modified: python/branches/py3k-struni/Modules/pyexpat.c ============================================================================== --- python/branches/py3k-struni/Modules/pyexpat.c (original) +++ python/branches/py3k-struni/Modules/pyexpat.c Thu May 3 19:49:24 2007 @@ -22,12 +22,7 @@ #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) #endif -#if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 2) -/* In Python 2.0 and 2.1, disabling Unicode was not possible. */ -#define Py_USING_UNICODE -#else #define FIX_TRACE -#endif enum HandlerTypes { StartElement, @@ -161,7 +156,6 @@ } -#ifdef Py_USING_UNICODE /* Convert a string of XML_Chars into a Unicode string. Returns None if str is a null pointer. */ @@ -190,7 +184,6 @@ } return PyUnicode_DecodeUTF8((const char *)str, len, "strict"); } -#endif /* Convert a string of XML_Chars into an 8-bit Python string. Returns None if str is a null pointer. */ @@ -418,13 +411,9 @@ return res; } -#ifndef Py_USING_UNICODE -#define STRING_CONV_FUNC conv_string_to_utf8 -#else /* Python 2.0 and later versions, when built with Unicode support */ #define STRING_CONV_FUNC (self->returns_unicode \ ? conv_string_to_unicode : conv_string_to_utf8) -#endif static PyObject* string_intern(xmlparseobject *self, const char* str) @@ -460,13 +449,9 @@ args = PyTuple_New(1); if (args == NULL) return -1; -#ifdef Py_USING_UNICODE temp = (self->returns_unicode ? conv_string_len_to_unicode(buffer, len) : conv_string_len_to_utf8(buffer, len)); -#else - temp = conv_string_len_to_utf8(buffer, len); -#endif if (temp == NULL) { Py_DECREF(args); flag_error(self); @@ -674,24 +659,6 @@ string_intern(self, systemId), string_intern(self, publicId), string_intern(self, notationName))) -#ifndef Py_USING_UNICODE -VOID_HANDLER(EntityDecl, - (void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName), - ("NiNNNNN", - string_intern(self, entityName), is_parameter_entity, - conv_string_len_to_utf8(value, value_length), - string_intern(self, base), string_intern(self, systemId), - string_intern(self, publicId), - string_intern(self, notationName))) -#else VOID_HANDLER(EntityDecl, (void *userData, const XML_Char *entityName, @@ -710,7 +677,6 @@ string_intern(self, base), string_intern(self, systemId), string_intern(self, publicId), string_intern(self, notationName))) -#endif VOID_HANDLER(XmlDecl, (void *userData, @@ -761,14 +727,10 @@ if (flush_character_buffer(self) < 0) goto finally; -#ifdef Py_USING_UNICODE modelobj = conv_content_model(model, (self->returns_unicode ? conv_string_to_unicode : conv_string_to_utf8)); -#else - modelobj = conv_content_model(model, conv_string_to_utf8); -#endif if (modelobj == NULL) { flag_error(self); goto finally; @@ -856,15 +818,6 @@ (void *userData), ("()")) -#ifndef Py_USING_UNICODE -VOID_HANDLER(Default, - (void *userData, const XML_Char *s, int len), - ("(N)", conv_string_len_to_utf8(s,len))) - -VOID_HANDLER(DefaultHandlerExpand, - (void *userData, const XML_Char *s, int len), - ("(N)", conv_string_len_to_utf8(s,len))) -#else VOID_HANDLER(Default, (void *userData, const XML_Char *s, int len), ("(N)", (self->returns_unicode @@ -876,7 +829,6 @@ ("(N)", (self->returns_unicode ? conv_string_len_to_unicode(s,len) : conv_string_len_to_utf8(s,len)))) -#endif INT_HANDLER(NotStandalone, (void *userData), @@ -1268,7 +1220,6 @@ /* ---------- */ -#ifdef Py_USING_UNICODE /* pyexpat international encoding support. Make it as simple as possible. @@ -1319,7 +1270,6 @@ return result; } -#endif static PyObject * newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern) @@ -1336,11 +1286,7 @@ if (self == NULL) return NULL; -#ifdef Py_USING_UNICODE self->returns_unicode = 1; -#else - self->returns_unicode = 0; -#endif self->buffer = NULL; self->buffer_size = CHARACTER_DATA_BUFFER_SIZE; @@ -1370,10 +1316,8 @@ return NULL; } XML_SetUserData(self->itself, (void *)self); -#ifdef Py_USING_UNICODE XML_SetUnknownEncodingHandler(self->itself, (XML_UnknownEncodingHandler) PyUnknownEncodingHandler, NULL); -#endif for (i = 0; handler_info[i].name != NULL; i++) /* do nothing */; @@ -1631,13 +1575,7 @@ } if (strcmp(name, "returns_unicode") == 0) { if (PyObject_IsTrue(v)) { -#ifndef Py_USING_UNICODE - PyErr_SetString(PyExc_ValueError, - "Unicode support not available"); - return -1; -#else self->returns_unicode = 1; -#endif } else self->returns_unicode = 0; @@ -1886,9 +1824,7 @@ Py_BuildValue("(iii)", info.major, info.minor, info.micro)); } -#ifdef Py_USING_UNICODE init_template_buffer(); -#endif /* XXX When Expat supports some way of figuring out how it was compiled, this should check and set native_encoding appropriately. Modified: python/branches/py3k-struni/Objects/abstract.c ============================================================================== --- python/branches/py3k-struni/Objects/abstract.c (original) +++ python/branches/py3k-struni/Objects/abstract.c Thu May 3 19:49:24 2007 @@ -931,13 +931,11 @@ */ return long_from_string(PyString_AS_STRING(o), PyString_GET_SIZE(o)); -#ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) /* The above check is done in PyLong_FromUnicode(). */ return PyLong_FromUnicode(PyUnicode_AS_UNICODE(o), PyUnicode_GET_SIZE(o), 10); -#endif if (!PyObject_AsCharBuffer(o, &buffer, &buffer_len)) return long_from_string(buffer, buffer_len); Modified: python/branches/py3k-struni/Objects/complexobject.c ============================================================================== --- python/branches/py3k-struni/Objects/complexobject.c (original) +++ python/branches/py3k-struni/Objects/complexobject.c Thu May 3 19:49:24 2007 @@ -696,16 +696,13 @@ int sw_error=0; int sign; char buffer[256]; /* For errors */ -#ifdef Py_USING_UNICODE char s_buffer[256]; -#endif Py_ssize_t len; if (PyString_Check(v)) { s = PyString_AS_STRING(v); len = PyString_GET_SIZE(v); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { if (PyUnicode_GET_SIZE(v) >= (Py_ssize_t)sizeof(s_buffer)) { PyErr_SetString(PyExc_ValueError, @@ -720,7 +717,6 @@ s = s_buffer; len = strlen(s); } -#endif else if (PyObject_AsCharBuffer(v, &s, &len)) { PyErr_SetString(PyExc_TypeError, "complex() arg is not a string"); Modified: python/branches/py3k-struni/Objects/exceptions.c ============================================================================== --- python/branches/py3k-struni/Objects/exceptions.c (original) +++ python/branches/py3k-struni/Objects/exceptions.c Thu May 3 19:49:24 2007 @@ -1183,7 +1183,6 @@ SimpleExtendsException(PyExc_ValueError, UnicodeError, "Unicode related error."); -#ifdef Py_USING_UNICODE static int get_int(PyObject *attr, Py_ssize_t *value, const char *name) { @@ -1788,7 +1787,6 @@ return PyObject_CallFunction(PyExc_UnicodeTranslateError, "u#nns", object, length, start, end, reason); } -#endif /* @@ -1989,11 +1987,9 @@ PRE_INIT(KeyError) PRE_INIT(ValueError) PRE_INIT(UnicodeError) -#ifdef Py_USING_UNICODE PRE_INIT(UnicodeEncodeError) PRE_INIT(UnicodeDecodeError) PRE_INIT(UnicodeTranslateError) -#endif PRE_INIT(AssertionError) PRE_INIT(ArithmeticError) PRE_INIT(FloatingPointError) @@ -2051,11 +2047,9 @@ POST_INIT(KeyError) POST_INIT(ValueError) POST_INIT(UnicodeError) -#ifdef Py_USING_UNICODE POST_INIT(UnicodeEncodeError) POST_INIT(UnicodeDecodeError) POST_INIT(UnicodeTranslateError) -#endif POST_INIT(AssertionError) POST_INIT(ArithmeticError) POST_INIT(FloatingPointError) Modified: python/branches/py3k-struni/Objects/fileobject.c ============================================================================== --- python/branches/py3k-struni/Objects/fileobject.c (original) +++ python/branches/py3k-struni/Objects/fileobject.c Thu May 3 19:49:24 2007 @@ -412,7 +412,6 @@ file_repr(PyFileObject *f) { if (PyUnicode_Check(f->f_name)) { -#ifdef Py_USING_UNICODE PyObject *ret = NULL; PyObject *name = PyUnicode_AsUnicodeEscapeString(f->f_name); const char *name_str = name ? PyString_AsString(name) : "?"; @@ -423,7 +422,6 @@ f); Py_XDECREF(name); return ret; -#endif } else { return PyString_FromFormat("<%s file '%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", @@ -1337,7 +1335,6 @@ } } } -#ifdef Py_USING_UNICODE if (n < 0 && result != NULL && PyUnicode_Check(result)) { Py_UNICODE *s = PyUnicode_AS_UNICODE(result); Py_ssize_t len = PyUnicode_GET_SIZE(result); @@ -1358,7 +1355,6 @@ } } } -#endif return result; } @@ -2124,15 +2120,12 @@ } else if (PyFile_Check(f)) { FILE *fp = PyFile_AsFile(f); -#ifdef Py_USING_UNICODE PyObject *enc = ((PyFileObject*)f)->f_encoding; int result; -#endif if (fp == NULL) { err_closed(); return -1; } -#ifdef Py_USING_UNICODE if ((flags & Py_PRINT_RAW) && PyUnicode_Check(v) && enc != Py_None) { char *cenc = PyString_AS_STRING(enc); @@ -2146,9 +2139,6 @@ result = PyObject_Print(value, fp, flags); Py_DECREF(value); return result; -#else - return PyObject_Print(v, fp, flags); -#endif } writer = PyObject_GetAttrString(f, "write"); if (writer == NULL) Modified: python/branches/py3k-struni/Objects/floatobject.c ============================================================================== --- python/branches/py3k-struni/Objects/floatobject.c (original) +++ python/branches/py3k-struni/Objects/floatobject.c Thu May 3 19:49:24 2007 @@ -68,16 +68,13 @@ const char *s, *last, *end; double x; char buffer[256]; /* for errors */ -#ifdef Py_USING_UNICODE char s_buffer[256]; /* for objects convertible to a char buffer */ -#endif Py_ssize_t len; if (PyString_Check(v)) { s = PyString_AS_STRING(v); len = PyString_GET_SIZE(v); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { if (PyUnicode_GET_SIZE(v) >= (Py_ssize_t)sizeof(s_buffer)) { PyErr_SetString(PyExc_ValueError, @@ -92,7 +89,6 @@ s = s_buffer; len = strlen(s); } -#endif else if (PyObject_AsCharBuffer(v, &s, &len)) { PyErr_SetString(PyExc_TypeError, "float() argument must be a string or a number"); Modified: python/branches/py3k-struni/Objects/intobject.c ============================================================================== --- python/branches/py3k-struni/Objects/intobject.c (original) +++ python/branches/py3k-struni/Objects/intobject.c Thu May 3 19:49:24 2007 @@ -387,7 +387,6 @@ return PyInt_FromLong(x); } -#ifdef Py_USING_UNICODE PyObject * PyInt_FromUnicode(Py_UNICODE *s, Py_ssize_t length, int base) { @@ -405,7 +404,6 @@ PyMem_FREE(buffer); return result; } -#endif /* Methods */ @@ -986,12 +984,10 @@ } return PyInt_FromString(string, NULL, base); } -#ifdef Py_USING_UNICODE if (PyUnicode_Check(x)) return PyInt_FromUnicode(PyUnicode_AS_UNICODE(x), PyUnicode_GET_SIZE(x), base); -#endif PyErr_SetString(PyExc_TypeError, "int() can't convert non-string with explicit base"); return NULL; Modified: python/branches/py3k-struni/Objects/longobject.c ============================================================================== --- python/branches/py3k-struni/Objects/longobject.c (original) +++ python/branches/py3k-struni/Objects/longobject.c Thu May 3 19:49:24 2007 @@ -1939,7 +1939,6 @@ return NULL; } -#ifdef Py_USING_UNICODE PyObject * PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base) { @@ -1957,7 +1956,6 @@ PyMem_FREE(buffer); return result; } -#endif /* forward */ static PyLongObject *x_divrem @@ -3538,12 +3536,10 @@ } return PyLong_FromString(PyString_AS_STRING(x), NULL, base); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(x)) return PyLong_FromUnicode(PyUnicode_AS_UNICODE(x), PyUnicode_GET_SIZE(x), base); -#endif else { PyErr_SetString(PyExc_TypeError, "int() can't convert non-string with explicit base"); Modified: python/branches/py3k-struni/Objects/object.c ============================================================================== --- python/branches/py3k-struni/Objects/object.c (original) +++ python/branches/py3k-struni/Objects/object.c Thu May 3 19:49:24 2007 @@ -361,7 +361,6 @@ res = (*v->ob_type->tp_repr)(v); if (res == NULL) return NULL; -#ifdef Py_USING_UNICODE if (PyUnicode_Check(res)) { PyObject* str; str = PyUnicode_AsEncodedString(res, NULL, NULL); @@ -371,7 +370,6 @@ else return NULL; } -#endif if (!PyString_Check(res)) { PyErr_Format(PyExc_TypeError, "__repr__ returned non-string (type %.200s)", @@ -394,12 +392,10 @@ Py_INCREF(v); return v; } -#ifdef Py_USING_UNICODE if (PyUnicode_CheckExact(v)) { Py_INCREF(v); return v; } -#endif if (v->ob_type->tp_str == NULL) return PyObject_Repr(v); @@ -407,9 +403,7 @@ if (res == NULL) return NULL; type_ok = PyString_Check(res); -#ifdef Py_USING_UNICODE type_ok = type_ok || PyUnicode_Check(res); -#endif if (!type_ok) { PyErr_Format(PyExc_TypeError, "__str__ returned non-string (type %.200s)", @@ -426,7 +420,6 @@ PyObject *res = _PyObject_Str(v); if (res == NULL) return NULL; -#ifdef Py_USING_UNICODE if (PyUnicode_Check(res)) { PyObject* str; str = PyUnicode_AsEncodedString(res, NULL, NULL); @@ -436,12 +429,10 @@ else return NULL; } -#endif assert(PyString_Check(res)); return res; } -#ifdef Py_USING_UNICODE PyObject * PyObject_Unicode(PyObject *v) { @@ -502,7 +493,6 @@ } return res; } -#endif /* The new comparison philosophy is: we completely separate three-way @@ -895,7 +885,6 @@ PyTypeObject *tp = v->ob_type; if (!PyString_Check(name)) { -#ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_getattro slots expect a string object as name and we wouldn't want to break those. */ @@ -905,7 +894,6 @@ return NULL; } else -#endif { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", @@ -942,7 +930,6 @@ int err; if (!PyString_Check(name)){ -#ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name and we wouldn't want to break those. */ @@ -952,7 +939,6 @@ return -1; } else -#endif { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", @@ -1039,7 +1025,6 @@ PyObject **dictptr; if (!PyString_Check(name)){ -#ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name and we wouldn't want to break those. */ @@ -1049,7 +1034,6 @@ return NULL; } else -#endif { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", @@ -1157,7 +1141,6 @@ int res = -1; if (!PyString_Check(name)){ -#ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name and we wouldn't want to break those. */ @@ -1167,7 +1150,6 @@ return -1; } else -#endif { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", Modified: python/branches/py3k-struni/Objects/stringobject.c ============================================================================== --- python/branches/py3k-struni/Objects/stringobject.c (original) +++ python/branches/py3k-struni/Objects/stringobject.c Thu May 3 19:49:24 2007 @@ -379,12 +379,7 @@ } if (encoding == NULL) { -#ifdef Py_USING_UNICODE encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif } /* Decode via the codec registry */ @@ -408,7 +403,6 @@ if (v == NULL) goto onError; -#ifdef Py_USING_UNICODE /* Convert Unicode to a string using the default encoding */ if (PyUnicode_Check(v)) { PyObject *temp = v; @@ -417,7 +411,6 @@ if (v == NULL) goto onError; } -#endif if (!PyString_Check(v)) { PyErr_Format(PyExc_TypeError, "decoder did not return a string object (type=%.400s)", @@ -459,12 +452,7 @@ } if (encoding == NULL) { -#ifdef Py_USING_UNICODE encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif } /* Encode via the codec registry */ @@ -488,7 +476,6 @@ if (v == NULL) goto onError; -#ifdef Py_USING_UNICODE /* Convert Unicode to a string using the default encoding */ if (PyUnicode_Check(v)) { PyObject *temp = v; @@ -497,7 +484,6 @@ if (v == NULL) goto onError; } -#endif if (!PyString_Check(v)) { PyErr_Format(PyExc_TypeError, "encoder did not return a string object (type=%.400s)", @@ -560,7 +546,6 @@ while (s < end) { if (*s != '\\') { non_esc: -#ifdef Py_USING_UNICODE if (recode_encoding && (*s & 0x80)) { PyObject *u, *w; char *r; @@ -589,9 +574,6 @@ } else { *p++ = *s++; } -#else - *p++ = *s++; -#endif continue; } s++; @@ -663,17 +645,6 @@ errors); goto failed; } -#ifndef Py_USING_UNICODE - case 'u': - case 'U': - case 'N': - if (unicode) { - PyErr_SetString(PyExc_ValueError, - "Unicode escapes not legal " - "when Unicode disabled"); - goto failed; - } -#endif default: *p++ = '\\'; s--; @@ -739,17 +710,15 @@ } if (!PyString_Check(obj)) { -#ifdef Py_USING_UNICODE if (PyUnicode_Check(obj)) { obj = _PyUnicode_AsDefaultEncodedString(obj, NULL); if (obj == NULL) return -1; } else -#endif { PyErr_Format(PyExc_TypeError, - "expected string or Unicode object, " + "expected str object, " "%.200s found", obj->ob_type->tp_name); return -1; } @@ -944,10 +913,8 @@ register Py_ssize_t size; register PyStringObject *op; if (!PyString_Check(bb)) { -#ifdef Py_USING_UNICODE if (PyUnicode_Check(bb)) return PyUnicode_Concat((PyObject *)a, bb); -#endif if (PyBytes_Check(bb)) return PyBytes_Concat((PyObject *)a, bb); PyErr_Format(PyExc_TypeError, @@ -1068,10 +1035,8 @@ string_contains(PyObject *str_obj, PyObject *sub_obj) { if (!PyString_CheckExact(sub_obj)) { -#ifdef Py_USING_UNICODE if (PyUnicode_Check(sub_obj)) return PyUnicode_Contains(str_obj, sub_obj); -#endif if (!PyString_Check(sub_obj)) { PyErr_Format(PyExc_TypeError, "'in ' requires string as left operand, " @@ -1477,10 +1442,8 @@ sub = PyString_AS_STRING(subobj); n = PyString_GET_SIZE(subobj); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) return PyUnicode_Split((PyObject *)self, subobj, maxsplit); -#endif else if (PyObject_AsCharBuffer(subobj, &sub, &n)) return NULL; @@ -1543,10 +1506,8 @@ sep = PyString_AS_STRING(sep_obj); sep_len = PyString_GET_SIZE(sep_obj); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(sep_obj)) return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) return NULL; @@ -1574,10 +1535,8 @@ sep = PyString_AS_STRING(sep_obj); sep_len = PyString_GET_SIZE(sep_obj); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(sep_obj)) return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) return NULL; @@ -1684,10 +1643,8 @@ sub = PyString_AS_STRING(subobj); n = PyString_GET_SIZE(subobj); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) return PyUnicode_RSplit((PyObject *)self, subobj, maxsplit); -#endif else if (PyObject_AsCharBuffer(subobj, &sub, &n)) return NULL; @@ -1774,7 +1731,6 @@ const size_t old_sz = sz; item = PySequence_Fast_GET_ITEM(seq, i); if (!PyString_Check(item)){ -#ifdef Py_USING_UNICODE if (PyUnicode_Check(item)) { /* Defer to Unicode join. * CAUTION: There's no gurantee that the @@ -1786,7 +1742,6 @@ Py_DECREF(seq); return result; } -#endif PyErr_Format(PyExc_TypeError, "sequence item %zd: expected string," " %.80s found", @@ -1868,11 +1823,9 @@ sub = PyString_AS_STRING(subobj); sub_len = PyString_GET_SIZE(subobj); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) return PyUnicode_Find( (PyObject *)self, subobj, start, end, dir); -#endif else if (PyObject_AsCharBuffer(subobj, &sub, &sub_len)) /* XXX - the "expected a character buffer object" is pretty confusing for a non-expert. remap to something else ? */ @@ -2041,7 +1994,6 @@ if (sep != NULL && sep != Py_None) { if (PyString_Check(sep)) return do_xstrip(self, striptype, sep); -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(sep)) { PyObject *uniself = PyUnicode_FromObject((PyObject *)self); PyObject *res; @@ -2052,13 +2004,8 @@ Py_DECREF(uniself); return res; } -#endif PyErr_Format(PyExc_TypeError, -#ifdef Py_USING_UNICODE - "%s arg must be None, str or unicode", -#else "%s arg must be None or str", -#endif STRIPNAME(striptype)); return NULL; } @@ -2068,7 +2015,7 @@ PyDoc_STRVAR(strip__doc__, -"S.strip([chars]) -> string or unicode\n\ +"S.strip([chars]) -> str\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ @@ -2086,7 +2033,7 @@ PyDoc_STRVAR(lstrip__doc__, -"S.lstrip([chars]) -> string or unicode\n\ +"S.lstrip([chars]) -> str\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ If chars is given and not None, remove characters in chars instead.\n\ @@ -2103,7 +2050,7 @@ PyDoc_STRVAR(rstrip__doc__, -"S.rstrip([chars]) -> string or unicode\n\ +"S.rstrip([chars]) -> str\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ If chars is given and not None, remove characters in chars instead.\n\ @@ -2281,7 +2228,6 @@ sub = PyString_AS_STRING(sub_obj); sub_len = PyString_GET_SIZE(sub_obj); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(sub_obj)) { Py_ssize_t count; count = PyUnicode_Count((PyObject *)self, sub_obj, start, end); @@ -2290,7 +2236,6 @@ else return PyInt_FromSsize_t(count); } -#endif else if (PyObject_AsCharBuffer(sub_obj, &sub, &sub_len)) return NULL; @@ -2367,7 +2312,6 @@ table = NULL; tablen = 256; } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(tableobj)) { /* Unicode .translate() does not support the deletechars parameter; instead a mapping to None will cause characters @@ -2379,7 +2323,6 @@ } return PyUnicode_Translate((PyObject *)self, tableobj, NULL); } -#endif else if (PyObject_AsCharBuffer(tableobj, &table, &tablen)) return NULL; @@ -2394,13 +2337,11 @@ del_table = PyString_AS_STRING(delobj); dellen = PyString_GET_SIZE(delobj); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(delobj)) { PyErr_SetString(PyExc_TypeError, "deletions are implemented differently for unicode"); return NULL; } -#endif else if (PyObject_AsCharBuffer(delobj, &del_table, &dellen)) return NULL; } @@ -3069,11 +3010,9 @@ from_s = PyString_AS_STRING(from); from_len = PyString_GET_SIZE(from); } -#ifdef Py_USING_UNICODE if (PyUnicode_Check(from)) return PyUnicode_Replace((PyObject *)self, from, to, count); -#endif else if (PyObject_AsCharBuffer(from, &from_s, &from_len)) return NULL; @@ -3081,11 +3020,9 @@ to_s = PyString_AS_STRING(to); to_len = PyString_GET_SIZE(to); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(to)) return PyUnicode_Replace((PyObject *)self, from, to, count); -#endif else if (PyObject_AsCharBuffer(to, &to_s, &to_len)) return NULL; @@ -3113,11 +3050,9 @@ sub = PyString_AS_STRING(substr); slen = PyString_GET_SIZE(substr); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(substr)) return PyUnicode_Tailmatch((PyObject *)self, substr, start, end, direction); -#endif else if (PyObject_AsCharBuffer(substr, &sub, &slen)) return -1; str = PyString_AS_STRING(self); @@ -4009,7 +3944,7 @@ PyTypeObject PyString_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, - "str8", + "str", sizeof(PyStringObject), sizeof(char), string_dealloc, /* tp_dealloc */ @@ -4458,9 +4393,7 @@ Py_ssize_t reslen, rescnt, fmtcnt; int args_owned = 0; PyObject *result, *orig_args; -#ifdef Py_USING_UNICODE PyObject *v, *w; -#endif PyObject *dict = NULL; if (format == NULL || !PyString_Check(format) || args == NULL) { PyErr_BadInternalCall(); @@ -4512,10 +4445,8 @@ Py_ssize_t len; char formatbuf[FORMATBUFLEN]; /* For format{float,int,char}() */ -#ifdef Py_USING_UNICODE char *fmt_start = fmt; Py_ssize_t argidx_start = argidx; -#endif fmt++; if (*fmt == '(') { @@ -4669,22 +4600,18 @@ len = 1; break; case 's': -#ifdef Py_USING_UNICODE if (PyUnicode_Check(v)) { fmt = fmt_start; argidx = argidx_start; goto unicode; } -#endif temp = _PyObject_Str(v); -#ifdef Py_USING_UNICODE if (temp != NULL && PyUnicode_Check(temp)) { Py_DECREF(temp); fmt = fmt_start; argidx = argidx_start; goto unicode; } -#endif /* Fall through */ case 'r': if (c == 'r') @@ -4749,13 +4676,11 @@ fill = '0'; break; case 'c': -#ifdef Py_USING_UNICODE if (PyUnicode_Check(v)) { fmt = fmt_start; argidx = argidx_start; goto unicode; } -#endif pbuf = formatbuf; len = formatchar(pbuf, sizeof(formatbuf), v); if (len < 0) @@ -4864,7 +4789,6 @@ _PyString_Resize(&result, reslen - rescnt); return result; -#ifdef Py_USING_UNICODE unicode: if (args_owned) { Py_DECREF(args); @@ -4909,7 +4833,6 @@ Py_DECREF(v); Py_DECREF(args); return w; -#endif /* Py_USING_UNICODE */ error: Py_DECREF(result); Modified: python/branches/py3k-struni/Objects/typeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/typeobject.c (original) +++ python/branches/py3k-struni/Objects/typeobject.c Thu May 3 19:49:24 2007 @@ -1505,7 +1505,6 @@ return 1; } -#ifdef Py_USING_UNICODE /* Replace Unicode objects in slots. */ static PyObject * @@ -1539,7 +1538,6 @@ } return slots; } -#endif /* Forward */ static int @@ -1713,7 +1711,6 @@ return NULL; } -#ifdef Py_USING_UNICODE tmp = _unicode_to_string(slots, nslots); if (tmp == NULL) goto bad_slots; @@ -1721,7 +1718,6 @@ Py_DECREF(slots); slots = tmp; } -#endif /* Check for valid slot names and two special cases */ for (i = 0; i < nslots; i++) { PyObject *tmp = PyTuple_GET_ITEM(slots, i); Modified: python/branches/py3k-struni/PC/pyconfig.h ============================================================================== --- python/branches/py3k-struni/PC/pyconfig.h (original) +++ python/branches/py3k-struni/PC/pyconfig.h Thu May 3 19:49:24 2007 @@ -475,9 +475,6 @@ /* Define if you want to use the GNU readline library */ /* #define WITH_READLINE 1 */ -/* Define if you want to have a Unicode type. */ -#define Py_USING_UNICODE - /* Define as the integral type used for Unicode representation. */ #define PY_UNICODE_TYPE unsigned short Modified: python/branches/py3k-struni/Parser/tokenizer.c ============================================================================== --- python/branches/py3k-struni/Parser/tokenizer.c (original) +++ python/branches/py3k-struni/Parser/tokenizer.c Thu May 3 19:49:24 2007 @@ -272,7 +272,6 @@ strcmp(cs, "iso-8859-1") == 0) { tok->encoding = cs; } else { -#ifdef Py_USING_UNICODE r = set_readline(tok, cs); if (r) { tok->encoding = cs; @@ -280,13 +279,6 @@ } else PyMem_FREE(cs); -#else - /* Without Unicode support, we cannot - process the coding spec. Since there - won't be any Unicode literals, that - won't matter. */ - PyMem_FREE(cs); -#endif } } else { /* then, compare cs with BOM */ r = (strcmp(tok->encoding, cs) == 0); @@ -363,11 +355,6 @@ static char * fp_readl(char *s, int size, struct tok_state *tok) { -#ifndef Py_USING_UNICODE - /* In a non-Unicode built, this should never be called. */ - Py_FatalError("fp_readl should not be called in this build."); - return NULL; /* Keep compiler happy (not reachable) */ -#else PyObject* utf8 = NULL; PyObject* buf = tok->decoding_buffer; char *str; @@ -407,7 +394,6 @@ Py_DECREF(utf8); if (utf8len == 0) return NULL; /* EOF */ return s; -#endif } /* Set the readline function for TOK to a StreamReader's @@ -564,7 +550,6 @@ /* Return a UTF-8 encoding Python string object from the C byte string STR, which is encoded with ENC. */ -#ifdef Py_USING_UNICODE static PyObject * translate_into_utf8(const char* str, const char* enc) { PyObject *utf8; @@ -575,7 +560,6 @@ Py_DECREF(buf); return utf8; } -#endif /* Decode a byte string STR for use as the buffer of TOK. Look for encoding declarations inside STR, and record them @@ -593,14 +577,12 @@ return error_ret(tok); str = tok->str; /* string after BOM if any */ assert(str); -#ifdef Py_USING_UNICODE if (tok->enc != NULL) { utf8 = translate_into_utf8(str, tok->enc); if (utf8 == NULL) return error_ret(tok); str = PyString_AsString(utf8); } -#endif for (s = str;; s++) { if (*s == '\0') break; else if (*s == '\n') { @@ -611,7 +593,6 @@ tok->enc = NULL; if (!check_coding_spec(str, s - str, tok, buf_setreadl)) return error_ret(tok); -#ifdef Py_USING_UNICODE if (tok->enc != NULL) { assert(utf8 == NULL); utf8 = translate_into_utf8(str, tok->enc); @@ -622,7 +603,6 @@ } str = PyString_AsString(utf8); } -#endif assert(tok->decoding_buffer == NULL); tok->decoding_buffer = utf8; /* CAUTION */ return str; @@ -687,7 +667,7 @@ PyMem_FREE(tok); } -#if !defined(PGEN) && defined(Py_USING_UNICODE) +#if !defined(PGEN) static int tok_stdin_decode(struct tok_state *tok, char **inp) { @@ -786,7 +766,7 @@ PyMem_FREE(newtok); tok->done = E_EOF; } -#if !defined(PGEN) && defined(Py_USING_UNICODE) +#if !defined(PGEN) else if (tok_stdin_decode(tok, &newtok) != 0) PyMem_FREE(newtok); #endif Modified: python/branches/py3k-struni/Python/ast.c ============================================================================== --- python/branches/py3k-struni/Python/ast.c (original) +++ python/branches/py3k-struni/Python/ast.c Thu May 3 19:49:24 2007 @@ -3050,10 +3050,6 @@ static PyObject * decode_utf8(const char **sPtr, const char *end, char* encoding) { -#ifndef Py_USING_UNICODE - Py_FatalError("decode_utf8 should not be called in this build."); - return NULL; -#else PyObject *u, *v; char *s, *t; t = s = (char *)*sPtr; @@ -3066,7 +3062,6 @@ v = PyUnicode_AsEncodedString(u, encoding, NULL); Py_DECREF(u); return v; -#endif } static PyObject * @@ -3186,11 +3181,9 @@ return NULL; } } -#ifdef Py_USING_UNICODE if (!*bytesmode) { return decode_unicode(s, len, rawmode, encoding); } -#endif if (*bytesmode) { /* Disallow non-ascii characters (but not escapes) */ const char *c; @@ -3207,19 +3200,12 @@ strcmp(encoding, "iso-8859-1") != 0); if (rawmode || strchr(s, '\\') == NULL) { if (need_encoding) { -#ifndef Py_USING_UNICODE - /* This should not happen - we never see any other - encoding. */ - Py_FatalError( - "cannot deal with encodings in this build."); -#else PyObject *v, *u = PyUnicode_DecodeUTF8(s, len, NULL); if (u == NULL) return NULL; v = PyUnicode_AsEncodedString(u, encoding, NULL); Py_DECREF(u); return v; -#endif } else { return PyString_FromStringAndSize(s, len); } @@ -3258,7 +3244,6 @@ if (v == NULL) goto onError; } -#ifdef Py_USING_UNICODE else { PyObject *temp = PyUnicode_Concat(v, s); Py_DECREF(s); @@ -3267,7 +3252,6 @@ if (v == NULL) goto onError; } -#endif } } return v; Modified: python/branches/py3k-struni/Python/bltinmodule.c ============================================================================== --- python/branches/py3k-struni/Python/bltinmodule.c (original) +++ python/branches/py3k-struni/Python/bltinmodule.c Thu May 3 19:49:24 2007 @@ -25,9 +25,7 @@ /* Forward */ static PyObject *filterstring(PyObject *, PyObject *); -#ifdef Py_USING_UNICODE static PyObject *filterunicode(PyObject *, PyObject *); -#endif static PyObject *filtertuple (PyObject *, PyObject *); static PyObject * @@ -272,10 +270,8 @@ /* Strings and tuples return a result of the same type. */ if (PyString_Check(seq)) return filterstring(func, seq); -#ifdef Py_USING_UNICODE if (PyUnicode_Check(seq)) return filterunicode(func, seq); -#endif if (PyTuple_Check(seq)) return filtertuple(func, seq); @@ -381,7 +377,6 @@ "or string, return the same type, else return a list."); -#ifdef Py_USING_UNICODE static PyObject * builtin_unichr(PyObject *self, PyObject *args) { @@ -397,7 +392,6 @@ "chr(i) -> Unicode character\n\ \n\ Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."); -#endif static PyObject * @@ -440,7 +434,6 @@ cf.cf_flags = supplied_flags; -#ifdef Py_USING_UNICODE if (PyUnicode_Check(cmd)) { tmp = PyUnicode_AsUTF8String(cmd); if (tmp == NULL) @@ -448,7 +441,6 @@ cmd = tmp; cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } -#endif if (PyObject_AsReadBuffer(cmd, (const void **)&str, &length)) return NULL; if ((size_t)length != strlen(str)) { @@ -600,7 +592,6 @@ } cf.cf_flags = 0; -#ifdef Py_USING_UNICODE if (PyUnicode_Check(cmd)) { tmp = PyUnicode_AsUTF8String(cmd); if (tmp == NULL) @@ -608,7 +599,6 @@ cmd = tmp; cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } -#endif if (PyString_AsStringAndSize(cmd, &str, NULL)) { Py_XDECREF(tmp); return NULL; @@ -708,7 +698,6 @@ char *str; PyCompilerFlags cf; cf.cf_flags = 0; -#ifdef Py_USING_UNICODE if (PyUnicode_Check(prog)) { tmp = PyUnicode_AsUTF8String(prog); if (tmp == NULL) @@ -716,7 +705,6 @@ prog = tmp; cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } -#endif if (PyString_AsStringAndSize(prog, &str, NULL)) return NULL; if (PyEval_MergeCompilerFlags(&cf)) @@ -850,13 +838,11 @@ if (!PyArg_UnpackTuple(args, "getattr", 2, 3, &v, &name, &dflt)) return NULL; -#ifdef Py_USING_UNICODE if (PyUnicode_Check(name)) { name = _PyUnicode_AsDefaultEncodedString(name, NULL); if (name == NULL) return NULL; } -#endif if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, @@ -906,13 +892,11 @@ if (!PyArg_UnpackTuple(args, "hasattr", 2, 2, &v, &name)) return NULL; -#ifdef Py_USING_UNICODE if (PyUnicode_Check(name)) { name = _PyUnicode_AsDefaultEncodedString(name, NULL); if (name == NULL) return NULL; } -#endif if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, @@ -1471,7 +1455,6 @@ ord = (long)((unsigned char)*PyString_AS_STRING(obj)); return PyInt_FromLong(ord); } -#ifdef Py_USING_UNICODE } else if (PyUnicode_Check(obj)) { size = PyUnicode_GET_SIZE(obj); @@ -1479,7 +1462,6 @@ ord = (long)*PyUnicode_AS_UNICODE(obj); return PyInt_FromLong(ord); } -#endif } else if (PyBytes_Check(obj)) { /* XXX Hopefully this is temporary */ @@ -2356,9 +2338,7 @@ SETBUILTIN("tuple", &PyTuple_Type); SETBUILTIN("type", &PyType_Type); SETBUILTIN("xrange", &PyRange_Type); -#ifdef Py_USING_UNICODE SETBUILTIN("unicode", &PyUnicode_Type); -#endif debug = PyBool_FromLong(Py_OptimizeFlag == 0); if (PyDict_SetItemString(dict, "__debug__", debug) < 0) { Py_XDECREF(debug); @@ -2536,7 +2516,6 @@ return NULL; } -#ifdef Py_USING_UNICODE /* Helper for filter(): filter a Unicode object through a function */ static PyObject * @@ -2630,4 +2609,3 @@ Py_DECREF(result); return NULL; } -#endif Modified: python/branches/py3k-struni/Python/codecs.c ============================================================================== --- python/branches/py3k-struni/Python/codecs.c (original) +++ python/branches/py3k-struni/Python/codecs.c Thu May 3 19:49:24 2007 @@ -468,7 +468,6 @@ } -#ifdef Py_USING_UNICODE PyObject *PyCodec_IgnoreErrors(PyObject *exc) { Py_ssize_t end; @@ -729,7 +728,6 @@ return NULL; } } -#endif static PyObject *strict_errors(PyObject *self, PyObject *exc) { @@ -737,7 +735,6 @@ } -#ifdef Py_USING_UNICODE static PyObject *ignore_errors(PyObject *self, PyObject *exc) { return PyCodec_IgnoreErrors(exc); @@ -760,7 +757,6 @@ { return PyCodec_BackslashReplaceErrors(exc); } -#endif static int _PyCodecRegistry_Init(void) { @@ -777,7 +773,6 @@ METH_O } }, -#ifdef Py_USING_UNICODE { "ignore", { @@ -810,7 +805,6 @@ METH_O } } -#endif }; PyInterpreterState *interp = PyThreadState_GET()->interp; Modified: python/branches/py3k-struni/Python/getargs.c ============================================================================== --- python/branches/py3k-struni/Python/getargs.c (original) +++ python/branches/py3k-struni/Python/getargs.c Thu May 3 19:49:24 2007 @@ -547,9 +547,7 @@ const char *format = *p_format; char c = *format++; -#ifdef Py_USING_UNICODE PyObject *uarg; -#endif switch (c) { @@ -780,7 +778,6 @@ *p = PyString_AS_STRING(arg); STORE_SIZE(PyString_GET_SIZE(arg)); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) @@ -789,7 +786,6 @@ *p = PyString_AS_STRING(uarg); STORE_SIZE(PyString_GET_SIZE(uarg)); } -#endif else { /* any buffer-like object */ char *buf; Py_ssize_t count = convertbuffer(arg, p, &buf); @@ -803,7 +799,6 @@ if (PyString_Check(arg)) *p = PyString_AS_STRING(arg); -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) @@ -811,7 +806,6 @@ arg, msgbuf, bufsize); *p = PyString_AS_STRING(uarg); } -#endif else return converterr("string", arg, msgbuf, bufsize); if ((Py_ssize_t)strlen(*p) != PyString_Size(arg)) @@ -834,7 +828,6 @@ *p = PyString_AS_STRING(arg); STORE_SIZE(PyString_GET_SIZE(arg)); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) @@ -843,7 +836,6 @@ *p = PyString_AS_STRING(uarg); STORE_SIZE(PyString_GET_SIZE(uarg)); } -#endif else { /* any buffer-like object */ char *buf; Py_ssize_t count = convertbuffer(arg, p, &buf); @@ -859,7 +851,6 @@ *p = 0; else if (PyString_Check(arg)) *p = PyString_AS_STRING(arg); -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) @@ -867,7 +858,6 @@ arg, msgbuf, bufsize); *p = PyString_AS_STRING(uarg); } -#endif else return converterr("string or None", arg, msgbuf, bufsize); @@ -897,10 +887,8 @@ /* Get 'e' parameter: the encoding name */ encoding = (const char *)va_arg(*p_va, const char *); -#ifdef Py_USING_UNICODE if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); -#endif /* Get output buffer parameter: 's' (recode all objects via Unicode) or @@ -926,7 +914,6 @@ Py_INCREF(s); } else { -#ifdef Py_USING_UNICODE PyObject *u; /* Convert object to Unicode */ @@ -950,9 +937,6 @@ "(encoder failed to return a string)", arg, msgbuf, bufsize); } -#else - return converterr("string", arg, msgbuf, bufsize); -#endif } size = PyString_GET_SIZE(s); @@ -1054,7 +1038,6 @@ break; } -#ifdef Py_USING_UNICODE case 'u': {/* raw unicode buffer (Py_UNICODE *) */ if (*format == '#') { /* any buffer-like object */ void **p = (void **)va_arg(*p_va, char **); @@ -1077,7 +1060,6 @@ } break; } -#endif case 'S': { /* string object */ PyObject **p = va_arg(*p_va, PyObject **); @@ -1088,7 +1070,6 @@ break; } -#ifdef Py_USING_UNICODE case 'U': { /* Unicode object */ PyObject **p = va_arg(*p_va, PyObject **); if (PyUnicode_Check(arg)) @@ -1097,7 +1078,6 @@ return converterr("unicode", arg, msgbuf, bufsize); break; } -#endif case 'O': { /* object */ PyTypeObject *type; @@ -1611,9 +1591,7 @@ case 's': /* string */ case 'z': /* string or None */ -#ifdef Py_USING_UNICODE case 'u': /* unicode string */ -#endif case 't': /* buffer, read-only */ case 'w': /* buffer, read-write */ { @@ -1631,9 +1609,7 @@ /* object codes */ case 'S': /* string object */ -#ifdef Py_USING_UNICODE case 'U': /* unicode string object */ -#endif { (void) va_arg(*p_va, PyObject **); break; Modified: python/branches/py3k-struni/Python/import.c ============================================================================== --- python/branches/py3k-struni/Python/import.c (original) +++ python/branches/py3k-struni/Python/import.c Thu May 3 19:49:24 2007 @@ -1256,7 +1256,6 @@ PyObject *v = PyList_GetItem(path, i); if (!v) return NULL; -#ifdef Py_USING_UNICODE if (PyUnicode_Check(v)) { copy = PyUnicode_Encode(PyUnicode_AS_UNICODE(v), PyUnicode_GET_SIZE(v), Py_FileSystemDefaultEncoding, NULL); @@ -1265,7 +1264,6 @@ v = copy; } else -#endif if (!PyString_Check(v)) continue; len = PyString_GET_SIZE(v); Modified: python/branches/py3k-struni/Python/marshal.c ============================================================================== --- python/branches/py3k-struni/Python/marshal.c (original) +++ python/branches/py3k-struni/Python/marshal.c Thu May 3 19:49:24 2007 @@ -254,7 +254,6 @@ w_long((long)n, p); w_string(PyString_AS_STRING(v), (int)n, p); } -#ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { PyObject *utf8; utf8 = PyUnicode_AsUTF8String(v); @@ -274,7 +273,6 @@ w_string(PyString_AS_STRING(utf8), (int)n, p); Py_DECREF(utf8); } -#endif else if (PyTuple_Check(v)) { w_byte(TYPE_TUPLE, p); n = PyTuple_Size(v); @@ -678,7 +676,6 @@ Py_INCREF(v); return v; -#ifdef Py_USING_UNICODE case TYPE_UNICODE: { char *buffer; @@ -701,7 +698,6 @@ PyMem_DEL(buffer); return v; } -#endif case TYPE_TUPLE: n = r_long(p); Modified: python/branches/py3k-struni/Python/modsupport.c ============================================================================== --- python/branches/py3k-struni/Python/modsupport.c (original) +++ python/branches/py3k-struni/Python/modsupport.c Thu May 3 19:49:24 2007 @@ -240,7 +240,6 @@ return v; } -#ifdef Py_USING_UNICODE static int _ustrlen(Py_UNICODE *u) { @@ -249,7 +248,6 @@ while (*v != 0) { i++; v++; } return i; } -#endif static PyObject * do_mktuple(const char **p_format, va_list *p_va, int endchar, int n, int flags) @@ -349,7 +347,6 @@ case 'K': return PyLong_FromUnsignedLongLong((PY_LONG_LONG)va_arg(*p_va, unsigned PY_LONG_LONG)); #endif -#ifdef Py_USING_UNICODE case 'u': { PyObject *v; @@ -375,7 +372,6 @@ } return v; } -#endif case 'f': case 'd': return PyFloat_FromDouble( Modified: python/branches/py3k-struni/Python/pythonrun.c ============================================================================== --- python/branches/py3k-struni/Python/pythonrun.c (original) +++ python/branches/py3k-struni/Python/pythonrun.c Thu May 3 19:49:24 2007 @@ -152,7 +152,7 @@ PyThreadState *tstate; PyObject *bimod, *sysmod; char *p; -#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) +#if defined(HAVE_LANGINFO_H) && defined(CODESET) char *codeset; char *saved_locale; PyObject *sys_stream, *sys_isatty; @@ -199,10 +199,8 @@ if (interp->modules_reloading == NULL) Py_FatalError("Py_Initialize: can't make modules_reloading dictionary"); -#ifdef Py_USING_UNICODE /* Init Unicode implementation; relies on the codec registry */ _PyUnicode_Init(); -#endif bimod = _PyBuiltin_Init(); if (bimod == NULL) @@ -250,7 +248,7 @@ if (!warnings_module) PyErr_Clear(); -#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) +#if defined(HAVE_LANGINFO_H) && defined(CODESET) /* On Unix, set the file system encoding according to the user's preference, if the CODESET names a well-known Python codec, and Py_FileSystemDefaultEncoding isn't @@ -468,10 +466,8 @@ PyLong_Fini(); PyFloat_Fini(); -#ifdef Py_USING_UNICODE /* Cleanup Unicode implementation */ _PyUnicode_Fini(); -#endif /* XXX Still allocated: - various static ad-hoc pointers to interned strings Modified: python/branches/py3k-struni/Python/sysmodule.c ============================================================================== --- python/branches/py3k-struni/Python/sysmodule.c (original) +++ python/branches/py3k-struni/Python/sysmodule.c Thu May 3 19:49:24 2007 @@ -210,7 +210,6 @@ exit status will be one (i.e., failure)." ); -#ifdef Py_USING_UNICODE static PyObject * sys_getdefaultencoding(PyObject *self) @@ -259,7 +258,6 @@ operating system filenames." ); -#endif static PyObject * @@ -763,10 +761,8 @@ {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc}, {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc}, {"exit", sys_exit, METH_VARARGS, exit_doc}, -#ifdef Py_USING_UNICODE {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, METH_NOARGS, getdefaultencoding_doc}, -#endif #ifdef HAVE_DLOPEN {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, getdlopenflags_doc}, @@ -777,10 +773,8 @@ #ifdef DYNAMIC_EXECUTION_PROFILE {"getdxp", _Py_GetDXProfile, METH_VARARGS}, #endif -#ifdef Py_USING_UNICODE {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, METH_NOARGS, getfilesystemencoding_doc}, -#endif #ifdef Py_TRACE_REFS {"getobjects", _Py_GetObjects, METH_VARARGS}, #endif @@ -799,10 +793,8 @@ #ifdef USE_MALLOPT {"mdebug", sys_mdebug, METH_VARARGS}, #endif -#ifdef Py_USING_UNICODE {"setdefaultencoding", sys_setdefaultencoding, METH_VARARGS, setdefaultencoding_doc}, -#endif {"setcheckinterval", sys_setcheckinterval, METH_VARARGS, setcheckinterval_doc}, {"getcheckinterval", sys_getcheckinterval, METH_NOARGS, @@ -1184,10 +1176,8 @@ PyString_FromString(Py_GetExecPrefix())); SET_SYS_FROM_STRING("maxint", PyInt_FromLong(PyInt_GetMax())); -#ifdef Py_USING_UNICODE SET_SYS_FROM_STRING("maxunicode", PyInt_FromLong(PyUnicode_GetMax())); -#endif SET_SYS_FROM_STRING("builtin_module_names", list_builtin_module_names()); { Modified: python/branches/py3k-struni/RISCOS/pyconfig.h ============================================================================== --- python/branches/py3k-struni/RISCOS/pyconfig.h (original) +++ python/branches/py3k-struni/RISCOS/pyconfig.h Thu May 3 19:49:24 2007 @@ -168,9 +168,6 @@ /* This must be defined on some systems to enable large file support */ #undef _LARGEFILE_SOURCE -/* Define if you want to have a Unicode type. */ -#define Py_USING_UNICODE 1 - /* Define as the integral type used for Unicode representation. */ #define PY_UNICODE_TYPE unsigned short From python-checkins at python.org Thu May 3 22:04:57 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Thu, 3 May 2007 22:04:57 +0200 (CEST) Subject: [Python-checkins] r55101 - in python/trunk/PCbuild8: make_versioninfo/make_versioninfo.vcproj pcbuild.sln pyproject.vsprops python/python.vcproj pythoncore/pythoncore.vcproj pythonw/pythonw.vcproj Message-ID: <20070503200457.D05181E4005@bag.python.org> Author: kristjan.jonsson Date: Thu May 3 22:04:53 2007 New Revision: 55101 Modified: python/trunk/PCbuild8/make_versioninfo/make_versioninfo.vcproj python/trunk/PCbuild8/pcbuild.sln python/trunk/PCbuild8/pyproject.vsprops python/trunk/PCbuild8/python/python.vcproj python/trunk/PCbuild8/pythoncore/pythoncore.vcproj python/trunk/PCbuild8/pythonw/pythonw.vcproj Log: Fix pcbuild8 after recent overhaul: Added the version resource to python26.dll. Adjust stacksize to 2Mb and made large address aware for 32 bits, and set stacksize to 3Mb for 64 bits. Todo: Set .dll optimized load addresses, and side-by-side packaging of the python26.dll. Modified: python/trunk/PCbuild8/make_versioninfo/make_versioninfo.vcproj ============================================================================== --- python/trunk/PCbuild8/make_versioninfo/make_versioninfo.vcproj (original) +++ python/trunk/PCbuild8/make_versioninfo/make_versioninfo.vcproj Thu May 3 22:04:53 2007 @@ -90,7 +90,7 @@ Modified: python/trunk/PCbuild8/pcbuild.sln ============================================================================== --- python/trunk/PCbuild8/pcbuild.sln (original) +++ python/trunk/PCbuild8/pcbuild.sln Thu May 3 22:04:53 2007 @@ -2,8 +2,8 @@ # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore\pythoncore.vcproj", "{987306EC-6BAD-4440-B4FB-A699A1EE6A28}" ProjectSection(ProjectDependencies) = postProject - {87AB87DB-B665-4621-A67B-878C15B93FF0} = {87AB87DB-B665-4621-A67B-878C15B93FF0} {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} = {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} + {87AB87DB-B665-4621-A67B-878C15B93FF0} = {87AB87DB-B665-4621-A67B-878C15B93FF0} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo\make_versioninfo.vcproj", "{2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}" @@ -16,9 +16,6 @@ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test\_ctypes_test.vcproj", "{F548A318-960A-4B37-9CD6-86B1B0E33CC8}" - ProjectSection(ProjectDependencies) = postProject - {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED} = {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree\_elementtree.vcproj", "{CB025148-F0A1-4B32-A669-19EE0534136D}" ProjectSection(ProjectDependencies) = postProject Modified: python/trunk/PCbuild8/pyproject.vsprops ============================================================================== --- python/trunk/PCbuild8/pyproject.vsprops (original) +++ python/trunk/PCbuild8/pyproject.vsprops Thu May 3 22:04:53 2007 @@ -15,6 +15,10 @@ Name="VCLinkerTool" AdditionalLibraryDirectories="$(OutDir)" /> + + + Author: kristjan.jonsson Date: Thu May 3 22:09:56 2007 New Revision: 55102 Modified: python/trunk/Lib/test/string_tests.py python/trunk/Lib/test/test_format.py python/trunk/Lib/test/test_index.py python/trunk/Lib/test/test_itertools.py python/trunk/Lib/test/test_unittest.py Log: Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform. Modified: python/trunk/Lib/test/string_tests.py ============================================================================== --- python/trunk/Lib/test/string_tests.py (original) +++ python/trunk/Lib/test/string_tests.py Thu May 3 22:09:56 2007 @@ -2,7 +2,7 @@ Common tests shared by test_str, test_unicode, test_userstring and test_string. """ -import unittest, string, sys +import unittest, string, sys, struct from test import test_support from UserList import UserList @@ -671,7 +671,7 @@ def test_replace_overflow(self): # Check for overflow checking on 32 bit machines - if sys.maxint != 2147483647: + if sys.maxint != 2147483647 or struct.calcsize("P") > 4: return A2_16 = "A" * (2**16) self.checkraises(OverflowError, A2_16, "replace", "", A2_16) Modified: python/trunk/Lib/test/test_format.py ============================================================================== --- python/trunk/Lib/test/test_format.py (original) +++ python/trunk/Lib/test/test_format.py Thu May 3 22:09:56 2007 @@ -1,5 +1,7 @@ from test.test_support import verbose, have_unicode, TestFailed import sys +from test.test_support import MAX_Py_ssize_t +maxsize = MAX_Py_ssize_t # test string formatting operator (I am not sure if this is being tested # elsewhere but, surely, some of the given cases are *not* tested because @@ -238,11 +240,11 @@ test_exc('%o', Foobar(), TypeError, "expected string or Unicode object, long found") -if sys.maxint == 2**31-1: +if maxsize == 2**31-1: # crashes 2.2.1 and earlier: try: - "%*d"%(sys.maxint, -127) + "%*d"%(maxsize, -127) except MemoryError: pass else: - raise TestFailed, '"%*d"%(sys.maxint, -127) should fail' + raise TestFailed, '"%*d"%(maxsize, -127) should fail' Modified: python/trunk/Lib/test/test_index.py ============================================================================== --- python/trunk/Lib/test/test_index.py (original) +++ python/trunk/Lib/test/test_index.py Thu May 3 22:09:56 2007 @@ -1,7 +1,10 @@ import unittest from test import test_support import operator +import sys from sys import maxint +maxsize = test_support.MAX_Py_ssize_t +minsize = -maxsize-1 class oldstyle: def __index__(self): @@ -185,7 +188,7 @@ def _getitem_helper(self, base): class GetItem(base): def __len__(self): - return maxint + return maxint #cannot return long here def __getitem__(self, key): return key def __getslice__(self, i, j): @@ -193,8 +196,8 @@ x = GetItem() self.assertEqual(x[self.pos], self.pos) self.assertEqual(x[self.neg], self.neg) - self.assertEqual(x[self.neg:self.pos], (-1, maxint)) - self.assertEqual(x[self.neg:self.pos:1].indices(maxint), (0, maxint, 1)) + self.assertEqual(x[self.neg:self.pos], (maxint+minsize, maxsize)) + self.assertEqual(x[self.neg:self.pos:1].indices(maxsize), (0, maxsize, 1)) def test_getitem(self): self._getitem_helper(object) Modified: python/trunk/Lib/test/test_itertools.py ============================================================================== --- python/trunk/Lib/test/test_itertools.py (original) +++ python/trunk/Lib/test/test_itertools.py Thu May 3 22:09:56 2007 @@ -5,6 +5,8 @@ import sys import operator import random +maxsize = test_support.MAX_Py_ssize_t +minsize = -maxsize-1 def onearg(x): 'Test function of one argument' @@ -52,7 +54,7 @@ self.assertEqual(take(2, zip('abc',count(3))), [('a', 3), ('b', 4)]) self.assertRaises(TypeError, count, 2, 3) self.assertRaises(TypeError, count, 'a') - self.assertRaises(OverflowError, list, islice(count(sys.maxint-5), 10)) + self.assertRaises(OverflowError, list, islice(count(maxsize-5), 10)) c = count(3) self.assertEqual(repr(c), 'count(3)') c.next() @@ -330,7 +332,7 @@ self.assertRaises(ValueError, islice, xrange(10), 1, 'a') self.assertRaises(ValueError, islice, xrange(10), 'a', 1, 1) self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1) - self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1) + self.assertEqual(len(list(islice(count(), 1, 10, maxsize))), 1) def test_takewhile(self): data = [1, 3, 5, 20, 2, 4, 6, 8] Modified: python/trunk/Lib/test/test_unittest.py ============================================================================== --- python/trunk/Lib/test/test_unittest.py (original) +++ python/trunk/Lib/test/test_unittest.py Thu May 3 22:09:56 2007 @@ -540,7 +540,8 @@ # audioop should now be loaded, thanks to loadTestsFromName() self.failUnless(module_name in sys.modules) finally: - del sys.modules[module_name] + if module_name in sys.modules: + del sys.modules[module_name] ################################################################ ### Tests for TestLoader.loadTestsFromName() @@ -936,7 +937,8 @@ # audioop should now be loaded, thanks to loadTestsFromName() self.failUnless(module_name in sys.modules) finally: - del sys.modules[module_name] + if module_name in sys.modules: + del sys.modules[module_name] ################################################################ ### /Tests for TestLoader.loadTestsFromNames() From nnorwitz at gmail.com Thu May 3 22:14:27 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 3 May 2007 16:14:27 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20070503201427.GA2740@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another WARNING: failed to listen on port 9907, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [9008 refs] test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test test_smtplib failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_smtplib.py", line 59, in testTimeoutNone smtp = smtplib.SMTP("localhost", 9091, timeout=None) File "/tmp/python-test/local/lib/python2.6/smtplib.py", line 248, in __init__ (code, msg) = self.connect(host, port) File "/tmp/python-test/local/lib/python2.6/smtplib.py", line 304, in connect self.sock = self._get_socket(host, port, self.timeout) File "/tmp/python-test/local/lib/python2.6/smtplib.py", line 282, in _get_socket return socket.create_connection((port, host), timeout) File "/tmp/python-test/local/lib/python2.6/socket.py", line 443, in create_connection raise error, msg error: (111, 'Connection refused') test_socket test_socket_ssl test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_smtplib 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [482270 refs] From python-checkins at python.org Thu May 3 22:27:12 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Thu, 3 May 2007 22:27:12 +0200 (CEST) Subject: [Python-checkins] r55103 - in python/trunk: Modules/itertoolsmodule.c Modules/posixmodule.c Objects/intobject.c Objects/longobject.c PC/config.c PC/pyconfig.h Python/thread_nt.h Message-ID: <20070503202712.69E601E4005@bag.python.org> Author: kristjan.jonsson Date: Thu May 3 22:27:03 2007 New Revision: 55103 Modified: python/trunk/Modules/itertoolsmodule.c python/trunk/Modules/posixmodule.c python/trunk/Objects/intobject.c python/trunk/Objects/longobject.c python/trunk/PC/config.c python/trunk/PC/pyconfig.h python/trunk/Python/thread_nt.h Log: Fix problems in x64 build that were discovered by the testsuite: - Reenable modules on x64 that had been disabled aeons ago for Itanium. - Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above. - Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms. - Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn?t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform. - Itertools module used wrong constant to check for overflow in count() - PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member. - PyLong_FromSsize_t() incorrectly specified that the operand were unsigned. With these changes, the x64 passes the testsuite, for those modules present. Modified: python/trunk/Modules/itertoolsmodule.c ============================================================================== --- python/trunk/Modules/itertoolsmodule.c (original) +++ python/trunk/Modules/itertoolsmodule.c Thu May 3 22:27:03 2007 @@ -2073,9 +2073,9 @@ static PyObject * count_next(countobject *lz) { - if (lz->cnt == LONG_MAX) { + if (lz->cnt == PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, - "cannot count beyond LONG_MAX"); + "cannot count beyond PY_SSIZE_T_MAX"); return NULL; } return PyInt_FromSsize_t(lz->cnt++); Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Thu May 3 22:27:03 2007 @@ -263,7 +263,6 @@ #include #endif #include "osdefs.h" -#define _WIN32_WINNT 0x0400 /* Needed for CryptoAPI on some systems */ #include #include /* for ShellExecute() */ #define popen _popen Modified: python/trunk/Objects/intobject.c ============================================================================== --- python/trunk/Objects/intobject.c (original) +++ python/trunk/Objects/intobject.c Thu May 3 22:27:03 2007 @@ -215,6 +215,10 @@ if (nb->nb_long != 0) { io = (PyIntObject*) (*nb->nb_long) (op); + if (io == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + io = (PyIntObject*) (*nb->nb_int) (op); + } } else { io = (PyIntObject*) (*nb->nb_int) (op); } Modified: python/trunk/Objects/longobject.c ============================================================================== --- python/trunk/Objects/longobject.c (original) +++ python/trunk/Objects/longobject.c Thu May 3 22:27:03 2007 @@ -893,7 +893,7 @@ int one = 1; return _PyLong_FromByteArray( (unsigned char *)&bytes, - SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 0); + SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 1); } /* Create a new long int object from a C size_t. */ Modified: python/trunk/PC/config.c ============================================================================== --- python/trunk/PC/config.c (original) +++ python/trunk/PC/config.c Thu May 3 22:27:03 2007 @@ -6,21 +6,21 @@ #include "Python.h" extern void initarray(void); -#ifndef MS_WIN64 +#ifndef MS_WINI64 extern void initaudioop(void); #endif extern void initbinascii(void); extern void initcmath(void); extern void initerrno(void); extern void initgc(void); -#ifndef MS_WIN64 +#ifndef MS_WINI64 extern void initimageop(void); #endif extern void initmath(void); extern void init_md5(void); extern void initnt(void); extern void initoperator(void); -#ifndef MS_WIN64 +#ifndef MS_WINI64 extern void initrgbimg(void); #endif extern void initsignal(void); @@ -80,7 +80,7 @@ {"array", initarray}, {"_ast", init_ast}, #ifdef MS_WINDOWS -#ifndef MS_WIN64 +#ifndef MS_WINI64 {"audioop", initaudioop}, #endif #endif @@ -88,14 +88,14 @@ {"cmath", initcmath}, {"errno", initerrno}, {"gc", initgc}, -#ifndef MS_WIN64 +#ifndef MS_WINI64 {"imageop", initimageop}, #endif {"math", initmath}, {"_md5", init_md5}, {"nt", initnt}, /* Use the NT os functions, not posix */ {"operator", initoperator}, -#ifndef MS_WIN64 +#ifndef MS_WINI64 {"rgbimg", initrgbimg}, #endif {"signal", initsignal}, Modified: python/trunk/PC/pyconfig.h ============================================================================== --- python/trunk/PC/pyconfig.h (original) +++ python/trunk/PC/pyconfig.h Thu May 3 22:27:03 2007 @@ -128,6 +128,8 @@ defined on Win32 *and* Win64. Win32 only code must therefore be guarded as follows: #if defined(MS_WIN32) && !defined(MS_WIN64) + Some modules are disabled on Itanium processors, therefore we + have MS_WINI64 set for those targets, otherwise MS_WINX64 */ #ifdef _WIN64 #define MS_WIN64 @@ -135,17 +137,28 @@ /* set the COMPILER */ #ifdef MS_WIN64 -#ifdef _M_IX86 -#define COMPILER _Py_PASTE_VERSION("64 bit (Intel)") -#elif defined(_M_IA64) +#if defined(_M_IA64) #define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)") -#elif defined(_M_AMD64) -#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)") +#define MS_WINI64 +#elif defined(_M_X64) +#define COMPILER _Py_PASTE_VERSION("64 bit (x64)") +#define MS_WINX64 #else #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") #endif #endif /* MS_WIN64 */ +/* set the version macros for the windows headers */ +#ifdef MS_WINX64 +/* 64 bit only runs on XP or greater */ +#define _WIN32_WINNT 0x0501 +#define WINVER 0x0501 +#else +/* NT 4.0 or greater required otherwise */ +#define _WIN32_WINNT 0x0400 +#define WINVER 0x0400 +#endif + /* _W64 is not defined for VC6 or eVC4 */ #ifndef _W64 #define _W64 Modified: python/trunk/Python/thread_nt.h ============================================================================== --- python/trunk/Python/thread_nt.h (original) +++ python/trunk/Python/thread_nt.h Thu May 3 22:27:03 2007 @@ -15,72 +15,16 @@ HANDLE hevent ; } NRMUTEX, *PNRMUTEX ; -typedef PVOID WINAPI interlocked_cmp_xchg_t(PVOID *dest, PVOID exc, PVOID comperand) ; - -/* Sorry mate, but we haven't got InterlockedCompareExchange in Win95! */ -static PVOID WINAPI -interlocked_cmp_xchg(PVOID *dest, PVOID exc, PVOID comperand) -{ - static LONG spinlock = 0 ; - PVOID result ; - DWORD dwSleep = 0; - - /* Acqire spinlock (yielding control to other threads if cant aquire for the moment) */ - while(InterlockedExchange(&spinlock, 1)) - { - // Using Sleep(0) can cause a priority inversion. - // Sleep(0) only yields the processor if there's - // another thread of the same priority that's - // ready to run. If a high-priority thread is - // trying to acquire the lock, which is held by - // a low-priority thread, then the low-priority - // thread may never get scheduled and hence never - // free the lock. NT attempts to avoid priority - // inversions by temporarily boosting the priority - // of low-priority runnable threads, but the problem - // can still occur if there's a medium-priority - // thread that's always runnable. If Sleep(1) is used, - // then the thread unconditionally yields the CPU. We - // only do this for the second and subsequent even - // iterations, since a millisecond is a long time to wait - // if the thread can be scheduled in again sooner - // (~100,000 instructions). - // Avoid priority inversion: 0, 1, 0, 1,... - Sleep(dwSleep); - dwSleep = !dwSleep; - } - result = *dest ; - if (result == comperand) - *dest = exc ; - /* Release spinlock */ - spinlock = 0 ; - return result ; -} ; - -static interlocked_cmp_xchg_t *ixchg; BOOL InitializeNonRecursiveMutex(PNRMUTEX mutex) { - if (!ixchg) - { - /* Sorely, Win95 has no InterlockedCompareExchange API (Win98 has), so we have to use emulation */ - HANDLE kernel = GetModuleHandle("kernel32.dll") ; - if (!kernel || (ixchg = (interlocked_cmp_xchg_t *)GetProcAddress(kernel, "InterlockedCompareExchange")) == NULL) - ixchg = interlocked_cmp_xchg ; - } - mutex->owned = -1 ; /* No threads have entered NonRecursiveMutex */ mutex->thread_id = 0 ; mutex->hevent = CreateEvent(NULL, FALSE, FALSE, NULL) ; return mutex->hevent != NULL ; /* TRUE if the mutex is created */ } -#ifdef InterlockedCompareExchange -#undef InterlockedCompareExchange -#endif -#define InterlockedCompareExchange(dest,exchange,comperand) (ixchg((dest), (exchange), (comperand))) - VOID DeleteNonRecursiveMutex(PNRMUTEX mutex) { @@ -98,7 +42,7 @@ /* InterlockedIncrement(&mutex->owned) == 0 means that no thread currently owns the mutex */ if (!wait) { - if (InterlockedCompareExchange((PVOID *)&mutex->owned, (PVOID)0, (PVOID)-1) != (PVOID)-1) + if (InterlockedCompareExchange(&mutex->owned, 0, -1) != -1) return WAIT_TIMEOUT ; ret = WAIT_OBJECT_0 ; } @@ -196,7 +140,10 @@ if (obj.done == NULL) return -1; - rv = _beginthread(bootstrap, _pythread_stacksize, &obj); + rv = _beginthread(bootstrap, + Py_SAFE_DOWNCAST(_pythread_stacksize, + Py_ssize_t, int), + &obj); if (rv == (Py_uintptr_t)-1) { /* I've seen errno == EAGAIN here, which means "there are * too many threads". From python-checkins at python.org Thu May 3 22:49:31 2007 From: python-checkins at python.org (walter.doerwald) Date: Thu, 3 May 2007 22:49:31 +0200 (CEST) Subject: [Python-checkins] r55104 - python/branches/py3k-struni/Objects/stringobject.c Message-ID: <20070503204931.6AE4D1E4021@bag.python.org> Author: walter.doerwald Date: Thu May 3 22:49:27 2007 New Revision: 55104 Modified: python/branches/py3k-struni/Objects/stringobject.c Log: Fix type name (str has been renamed to str8). Modified: python/branches/py3k-struni/Objects/stringobject.c ============================================================================== --- python/branches/py3k-struni/Objects/stringobject.c (original) +++ python/branches/py3k-struni/Objects/stringobject.c Thu May 3 22:49:27 2007 @@ -3944,7 +3944,7 @@ PyTypeObject PyString_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, - "str", + "str8", sizeof(PyStringObject), sizeof(char), string_dealloc, /* tp_dealloc */ From python-checkins at python.org Thu May 3 23:05:56 2007 From: python-checkins at python.org (walter.doerwald) Date: Thu, 3 May 2007 23:05:56 +0200 (CEST) Subject: [Python-checkins] r55105 - in python/branches/py3k-struni/Lib: ctypes/__init__.py ctypes/test/test_as_parameter.py ctypes/test/test_functions.py decimal.py doctest.py msilib/__init__.py plat-mac/EasyDialogs.py plat-mac/plistlib.py random.py subprocess.py test/test_array.py test/test_long.py test/test_struct.py test/test_unicode.py Message-ID: <20070503210556.7DBBF1E4005@bag.python.org> Author: walter.doerwald Date: Thu May 3 23:05:51 2007 New Revision: 55105 Modified: python/branches/py3k-struni/Lib/ctypes/__init__.py python/branches/py3k-struni/Lib/ctypes/test/test_as_parameter.py python/branches/py3k-struni/Lib/ctypes/test/test_functions.py python/branches/py3k-struni/Lib/decimal.py python/branches/py3k-struni/Lib/doctest.py python/branches/py3k-struni/Lib/msilib/__init__.py python/branches/py3k-struni/Lib/plat-mac/EasyDialogs.py python/branches/py3k-struni/Lib/plat-mac/plistlib.py python/branches/py3k-struni/Lib/random.py python/branches/py3k-struni/Lib/subprocess.py python/branches/py3k-struni/Lib/test/test_array.py python/branches/py3k-struni/Lib/test/test_long.py python/branches/py3k-struni/Lib/test/test_struct.py python/branches/py3k-struni/Lib/test/test_unicode.py Log: Fix various spots where int/long and str/unicode unification lead to type checks like isinstance(foo, (str, str)) or isinstance(foo, (int, int)). Modified: python/branches/py3k-struni/Lib/ctypes/__init__.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/__init__.py (original) +++ python/branches/py3k-struni/Lib/ctypes/__init__.py Thu May 3 23:05:51 2007 @@ -59,14 +59,14 @@ create_string_buffer(anInteger) -> character array create_string_buffer(aString, anInteger) -> character array """ - if isinstance(init, (str, str)): + if isinstance(init, str): if size is None: size = len(init)+1 buftype = c_char * size buf = buftype() buf.value = init return buf - elif isinstance(init, (int, int)): + elif isinstance(init, int): buftype = c_char * init buf = buftype() return buf @@ -281,14 +281,14 @@ create_unicode_buffer(anInteger) -> character array create_unicode_buffer(aString, anInteger) -> character array """ - if isinstance(init, (str, str)): + if isinstance(init, str): if size is None: size = len(init)+1 buftype = c_wchar * size buf = buftype() buf.value = init return buf - elif isinstance(init, (int, int)): + elif isinstance(init, int): buftype = c_wchar * init buf = buftype() return buf @@ -359,7 +359,7 @@ def __getitem__(self, name_or_ordinal): func = self._FuncPtr((name_or_ordinal, self)) - if not isinstance(name_or_ordinal, (int, int)): + if not isinstance(name_or_ordinal, int): func.__name__ = name_or_ordinal return func Modified: python/branches/py3k-struni/Lib/ctypes/test/test_as_parameter.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_as_parameter.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_as_parameter.py Thu May 3 23:05:51 2007 @@ -133,7 +133,7 @@ f.argtypes = [c_longlong, MyCallback] def callback(value): - self.failUnless(isinstance(value, (int, int))) + self.failUnless(isinstance(value, int)) return value & 0x7FFFFFFF cb = MyCallback(callback) Modified: python/branches/py3k-struni/Lib/ctypes/test/test_functions.py ============================================================================== --- python/branches/py3k-struni/Lib/ctypes/test/test_functions.py (original) +++ python/branches/py3k-struni/Lib/ctypes/test/test_functions.py Thu May 3 23:05:51 2007 @@ -293,7 +293,7 @@ f.argtypes = [c_longlong, MyCallback] def callback(value): - self.failUnless(isinstance(value, (int, int))) + self.failUnless(isinstance(value, int)) return value & 0x7FFFFFFF cb = MyCallback(callback) Modified: python/branches/py3k-struni/Lib/decimal.py ============================================================================== --- python/branches/py3k-struni/Lib/decimal.py (original) +++ python/branches/py3k-struni/Lib/decimal.py Thu May 3 23:05:51 2007 @@ -741,32 +741,32 @@ return 1 def __eq__(self, other): - if not isinstance(other, (Decimal, int, int)): + if not isinstance(other, (Decimal, int)): return NotImplemented return self.__cmp__(other) == 0 def __ne__(self, other): - if not isinstance(other, (Decimal, int, int)): + if not isinstance(other, (Decimal, int)): return NotImplemented return self.__cmp__(other) != 0 def __lt__(self, other): - if not isinstance(other, (Decimal, int, int)): + if not isinstance(other, (Decimal, int)): return NotImplemented return self.__cmp__(other) < 0 def __le__(self, other): - if not isinstance(other, (Decimal, int, int)): + if not isinstance(other, (Decimal, int)): return NotImplemented return self.__cmp__(other) <= 0 def __gt__(self, other): - if not isinstance(other, (Decimal, int, int)): + if not isinstance(other, (Decimal, int)): return NotImplemented return self.__cmp__(other) > 0 def __ge__(self, other): - if not isinstance(other, (Decimal, int, int)): + if not isinstance(other, (Decimal, int)): return NotImplemented return self.__cmp__(other) >= 0 @@ -2993,7 +2993,7 @@ """ if isinstance(other, Decimal): return other - if isinstance(other, (int, int)): + if isinstance(other, int): return Decimal(other) return NotImplemented Modified: python/branches/py3k-struni/Lib/doctest.py ============================================================================== --- python/branches/py3k-struni/Lib/doctest.py (original) +++ python/branches/py3k-struni/Lib/doctest.py Thu May 3 23:05:51 2007 @@ -196,7 +196,7 @@ """ if inspect.ismodule(module): return module - elif isinstance(module, (str, str)): + elif isinstance(module, str): return __import__(module, globals(), locals(), ["*"]) elif module is None: return sys.modules[sys._getframe(depth).f_globals['__name__']] Modified: python/branches/py3k-struni/Lib/msilib/__init__.py ============================================================================== --- python/branches/py3k-struni/Lib/msilib/__init__.py (original) +++ python/branches/py3k-struni/Lib/msilib/__init__.py Thu May 3 23:05:51 2007 @@ -99,7 +99,7 @@ assert len(value) == count, value for i in range(count): field = value[i] - if isinstance(field, (int, int)): + if isinstance(field, int): r.SetInteger(i+1,field) elif isinstance(field, basestring): r.SetString(i+1,field) Modified: python/branches/py3k-struni/Lib/plat-mac/EasyDialogs.py ============================================================================== --- python/branches/py3k-struni/Lib/plat-mac/EasyDialogs.py (original) +++ python/branches/py3k-struni/Lib/plat-mac/EasyDialogs.py Thu May 3 23:05:51 2007 @@ -713,7 +713,7 @@ raise TypeError, "Cannot pass wanted=FSRef to AskFileForSave" if issubclass(tpwanted, Carbon.File.FSSpec): return tpwanted(rr.selection[0]) - if issubclass(tpwanted, (str, str)): + if issubclass(tpwanted, str): if sys.platform == 'mac': fullpath = rr.selection[0].as_pathname() else: Modified: python/branches/py3k-struni/Lib/plat-mac/plistlib.py ============================================================================== --- python/branches/py3k-struni/Lib/plat-mac/plistlib.py (original) +++ python/branches/py3k-struni/Lib/plat-mac/plistlib.py Thu May 3 23:05:51 2007 @@ -70,7 +70,7 @@ usually is a dictionary). """ didOpen = 0 - if isinstance(pathOrFile, (str, str)): + if isinstance(pathOrFile, str): pathOrFile = open(pathOrFile) didOpen = 1 p = PlistParser() @@ -85,7 +85,7 @@ file name or a (writable) file object. """ didOpen = 0 - if isinstance(pathOrFile, (str, str)): + if isinstance(pathOrFile, str): pathOrFile = open(pathOrFile, "w") didOpen = 1 writer = PlistWriter(pathOrFile) @@ -231,7 +231,7 @@ DumbXMLWriter.__init__(self, file, indentLevel, indent) def writeValue(self, value): - if isinstance(value, (str, str)): + if isinstance(value, str): self.simpleElement("string", value) elif isinstance(value, bool): # must switch for bool before int, as bool is a @@ -270,7 +270,7 @@ self.beginElement("dict") items = sorted(d.items()) for key, value in items: - if not isinstance(key, (str, str)): + if not isinstance(key, str): raise TypeError("keys must be strings") self.simpleElement("key", key) self.writeValue(value) Modified: python/branches/py3k-struni/Lib/random.py ============================================================================== --- python/branches/py3k-struni/Lib/random.py (original) +++ python/branches/py3k-struni/Lib/random.py Thu May 3 23:05:51 2007 @@ -631,7 +631,7 @@ import time a = int(time.time() * 256) # use fractional seconds - if not isinstance(a, (int, int)): + if not isinstance(a, int): a = hash(a) a, x = divmod(a, 30268) Modified: python/branches/py3k-struni/Lib/subprocess.py ============================================================================== --- python/branches/py3k-struni/Lib/subprocess.py (original) +++ python/branches/py3k-struni/Lib/subprocess.py Thu May 3 23:05:51 2007 @@ -541,7 +541,7 @@ _cleanup() self._child_created = False - if not isinstance(bufsize, (int, int)): + if not isinstance(bufsize, int): raise TypeError("bufsize must be an integer") if mswindows: Modified: python/branches/py3k-struni/Lib/test/test_array.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_array.py (original) +++ python/branches/py3k-struni/Lib/test/test_array.py Thu May 3 23:05:51 2007 @@ -65,7 +65,7 @@ bi = a.buffer_info() self.assert_(isinstance(bi, tuple)) self.assertEqual(len(bi), 2) - self.assert_(isinstance(bi[0], (int, int))) + self.assert_(isinstance(bi[0], int)) self.assert_(isinstance(bi[1], int)) self.assertEqual(bi[1], len(a)) Modified: python/branches/py3k-struni/Lib/test/test_long.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_long.py (original) +++ python/branches/py3k-struni/Lib/test/test_long.py Thu May 3 23:05:51 2007 @@ -426,7 +426,7 @@ # represents all Python ints, longs and floats exactly). class Rat: def __init__(self, value): - if isinstance(value, (int, int)): + if isinstance(value, int): self.n = value self.d = 1 elif isinstance(value, float): Modified: python/branches/py3k-struni/Lib/test/test_struct.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_struct.py (original) +++ python/branches/py3k-struni/Lib/test/test_struct.py Thu May 3 23:05:51 2007 @@ -492,12 +492,11 @@ def test_1229380(): import sys for endian in ('', '>', '<'): - for cls in (int, int): - for fmt in ('B', 'H', 'I', 'L'): - deprecated_err(struct.pack, endian + fmt, cls(-1)) + for fmt in ('B', 'H', 'I', 'L'): + deprecated_err(struct.pack, endian + fmt, -1) - deprecated_err(struct.pack, endian + 'B', cls(300)) - deprecated_err(struct.pack, endian + 'H', cls(70000)) + deprecated_err(struct.pack, endian + 'B', 300) + deprecated_err(struct.pack, endian + 'H', 70000) deprecated_err(struct.pack, endian + 'I', sys.maxint * 4) deprecated_err(struct.pack, endian + 'L', sys.maxint * 4) Modified: python/branches/py3k-struni/Lib/test/test_unicode.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_unicode.py (original) +++ python/branches/py3k-struni/Lib/test/test_unicode.py Thu May 3 23:05:51 2007 @@ -134,31 +134,27 @@ def test_index(self): string_tests.CommonTest.test_index(self) - # check mixed argument types - for (t1, t2) in ((str, str), (str, str)): - self.checkequalnofix(0, t1('abcdefghiabc'), 'index', t2('')) - self.checkequalnofix(3, t1('abcdefghiabc'), 'index', t2('def')) - self.checkequalnofix(0, t1('abcdefghiabc'), 'index', t2('abc')) - self.checkequalnofix(9, t1('abcdefghiabc'), 'index', t2('abc'), 1) - self.assertRaises(ValueError, t1('abcdefghiabc').index, t2('hib')) - self.assertRaises(ValueError, t1('abcdefghiab').index, t2('abc'), 1) - self.assertRaises(ValueError, t1('abcdefghi').index, t2('ghi'), 8) - self.assertRaises(ValueError, t1('abcdefghi').index, t2('ghi'), -1) + self.checkequalnofix(0, 'abcdefghiabc', 'index', '') + self.checkequalnofix(3, 'abcdefghiabc', 'index', 'def') + self.checkequalnofix(0, 'abcdefghiabc', 'index', 'abc') + self.checkequalnofix(9, 'abcdefghiabc', 'index', 'abc', 1) + self.assertRaises(ValueError, 'abcdefghiabc'.index, 'hib') + self.assertRaises(ValueError, 'abcdefghiab'.index, 'abc', 1) + self.assertRaises(ValueError, 'abcdefghi'.index, 'ghi', 8) + self.assertRaises(ValueError, 'abcdefghi'.index, 'ghi', -1) def test_rindex(self): string_tests.CommonTest.test_rindex(self) - # check mixed argument types - for (t1, t2) in ((str, str), (str, str)): - self.checkequalnofix(12, t1('abcdefghiabc'), 'rindex', t2('')) - self.checkequalnofix(3, t1('abcdefghiabc'), 'rindex', t2('def')) - self.checkequalnofix(9, t1('abcdefghiabc'), 'rindex', t2('abc')) - self.checkequalnofix(0, t1('abcdefghiabc'), 'rindex', t2('abc'), 0, -1) - - self.assertRaises(ValueError, t1('abcdefghiabc').rindex, t2('hib')) - self.assertRaises(ValueError, t1('defghiabc').rindex, t2('def'), 1) - self.assertRaises(ValueError, t1('defghiabc').rindex, t2('abc'), 0, -1) - self.assertRaises(ValueError, t1('abcdefghi').rindex, t2('ghi'), 0, 8) - self.assertRaises(ValueError, t1('abcdefghi').rindex, t2('ghi'), 0, -1) + self.checkequalnofix(12, 'abcdefghiabc', 'rindex', '') + self.checkequalnofix(3, 'abcdefghiabc', 'rindex', 'def') + self.checkequalnofix(9, 'abcdefghiabc', 'rindex', 'abc') + self.checkequalnofix(0, 'abcdefghiabc', 'rindex', 'abc', 0, -1) + + self.assertRaises(ValueError, 'abcdefghiabc'.rindex, 'hib') + self.assertRaises(ValueError, 'defghiabc'.rindex, 'def', 1) + self.assertRaises(ValueError, 'defghiabc'.rindex, 'abc', 0, -1) + self.assertRaises(ValueError, 'abcdefghi'.rindex, 'ghi', 0, 8) + self.assertRaises(ValueError, 'abcdefghi'.rindex, 'ghi', 0, -1) def test_translate(self): self.checkequalnofix('bbbc', 'abababc', 'translate', {ord('a'):None}) From python-checkins at python.org Thu May 3 23:11:44 2007 From: python-checkins at python.org (walter.doerwald) Date: Thu, 3 May 2007 23:11:44 +0200 (CEST) Subject: [Python-checkins] r55106 - python/branches/py3k-struni/Lib/test/test_support.py Message-ID: <20070503211144.5AF2D1E4005@bag.python.org> Author: walter.doerwald Date: Thu May 3 23:11:35 2007 New Revision: 55106 Modified: python/branches/py3k-struni/Lib/test/test_support.py Log: Temporary fix: Module names are still 8bit strings. This change allows test_support.run_unittest(__name__) to work again. However the proper fix would be module names that are real unicode strings. Modified: python/branches/py3k-struni/Lib/test/test_support.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_support.py (original) +++ python/branches/py3k-struni/Lib/test/test_support.py Thu May 3 23:11:35 2007 @@ -534,7 +534,7 @@ valid_types = (unittest.TestSuite, unittest.TestCase) suite = unittest.TestSuite() for cls in classes: - if isinstance(cls, str): + if isinstance(cls, (str, str8)): if cls in sys.modules: suite.addTest(unittest.findTestCases(sys.modules[cls])) else: From martin at v.loewis.de Thu May 3 23:17:31 2007 From: martin at v.loewis.de (=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=) Date: Thu, 03 May 2007 23:17:31 +0200 Subject: [Python-checkins] r55103 - in python/trunk: Modules/itertoolsmodule.c Modules/posixmodule.c Objects/intobject.c Objects/longobject.c PC/config.c PC/pyconfig.h Python/thread_nt.h In-Reply-To: <20070503202712.69E601E4005@bag.python.org> References: <20070503202712.69E601E4005@bag.python.org> Message-ID: <463A516B.8070209@v.loewis.de> > -#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)") > +#define COMPILER _Py_PASTE_VERSION("64 bit (x64)") Please undo that change. The architecture's name is AMD64, not x64. Regards, Martin From jeremy.kloth at 4suite.org Thu May 3 23:35:40 2007 From: jeremy.kloth at 4suite.org (Jeremy Kloth) Date: Thu, 3 May 2007 15:35:40 -0600 Subject: [Python-checkins] =?iso-8859-1?q?r55103_-_in_python/trunk=3A=09Mo?= =?iso-8859-1?q?dules/itertoolsmodule=2Ec_Modules/posixmodule=2Ec=09Object?= =?iso-8859-1?q?s/intobject=2Ec_Objects/longobject=2Ec_PC/config=2Ec_PC/py?= =?iso-8859-1?q?config=2Eh_Python/thread=5Fnt=2Eh?= In-Reply-To: <463A516B.8070209@v.loewis.de> References: <20070503202712.69E601E4005@bag.python.org> <463A516B.8070209@v.loewis.de> Message-ID: <200705031535.40850.jeremy.kloth@4suite.org> On Thursday 03 May 2007 3:17:31 pm Martin v. L?wis wrote: > > -#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)") > > +#define COMPILER _Py_PASTE_VERSION("64 bit (x64)") > > Please undo that change. The architecture's name is AMD64, not x64. Not to start a flame war, but 64-bit extensions on Intel are referred to as "Intel 64" (formerly EM64T). So to call it "AMD64" would be incorrect as well. The most neutral name would be "x86-64". For reference see: http://en.wikipedia.org/wiki/X86-64 -- Jeremy Kloth http://4suite.org/ From martin at v.loewis.de Fri May 4 00:04:20 2007 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Fri, 04 May 2007 00:04:20 +0200 Subject: [Python-checkins] r55103 - in python/trunk: Modules/itertoolsmodule.c Modules/posixmodule.c Objects/intobject.c Objects/longobject.c PC/config.c PC/pyconfig.h Python/thread_nt.h In-Reply-To: <200705031535.40850.jeremy.kloth@4suite.org> References: <20070503202712.69E601E4005@bag.python.org> <463A516B.8070209@v.loewis.de> <200705031535.40850.jeremy.kloth@4suite.org> Message-ID: <463A5C64.1020708@v.loewis.de> >>> -#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)") >>> +#define COMPILER _Py_PASTE_VERSION("64 bit (x64)") >> Please undo that change. The architecture's name is AMD64, not x64. > > Not to start a flame war, but 64-bit extensions on Intel are referred to > as "Intel 64" (formerly EM64T). So to call it "AMD64" would be incorrect as > well. The most neutral name would be "x86-64". But the most neutral name would be wrong. AMD has invented the technology, so AMD gets to name it. AMD wants us to call it AMD64, so we should obey. I feel quite strongly that Intel's marketing droids have no right to change history. They may manage to subjugate Microsoft's marketing (to call the product "x64", even though inside, they use AMD64 in many places still), but I would prefer if we could resist. Plus, it's a compatibility issue. People may rely on that string, so their code will break. Regards, Martin From kristjan at ccpgames.com Fri May 4 01:23:56 2007 From: kristjan at ccpgames.com (=?iso-8859-1?Q?Kristj=E1n_Valur_J=F3nsson?=) Date: Thu, 3 May 2007 23:23:56 +0000 Subject: [Python-checkins] r55103 - in python/trunk: Modules/itertoolsmodule.c Modules/posixmodule.c Objects/intobject.c Objects/longobject.c PC/config.c PC/pyconfig.h Python/thread_nt.h In-Reply-To: <463A5C64.1020708@v.loewis.de> References: <20070503202712.69E601E4005@bag.python.org> <463A516B.8070209@v.loewis.de> <200705031535.40850.jeremy.kloth@4suite.org> <463A5C64.1020708@v.loewis.de> Message-ID: <4E9372E6B2234D4F859320D896059A9508CD57DBEF@exchis.ccp.ad.local> > -----Original Message----- > From: "Martin v. L?wis" [mailto:martin at v.loewis.de] > But the most neutral name would be wrong. AMD has invented the > technology, so AMD gets to name it. AMD wants us to call it AMD64, > so we should obey. I feel quite strongly that Intel's marketing > droids have no right to change history. They may manage to subjugate > Microsoft's marketing (to call the product "x64", even though > inside, they use AMD64 in many places still), but I would prefer if we > could resist. > > Plus, it's a compatibility issue. People may rely on that string, > so their code will break. Ah, but Microsoft invented the compiler so they get to name the preprocessor macro.. Anyway, I don't care much one way or the other and am happy that this seems to be the biggest beef you have about my three checkins :) I'll fix that particular bit. The significant change was the removal of the _M_X86 define, which is never true for 64 bit builds. On a different issue, What is your opinion on Itanium? Is it here to stay? I never installed any I64 compilers and didn't add that target to the VC8 build dir. Do you think I ought to? Kristjan From python-checkins at python.org Fri May 4 02:25:09 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Fri, 4 May 2007 02:25:09 +0200 (CEST) Subject: [Python-checkins] r55107 - python/trunk/PC/pyconfig.h Message-ID: <20070504002509.936EB1E4005@bag.python.org> Author: kristjan.jonsson Date: Fri May 4 02:25:08 2007 New Revision: 55107 Modified: python/trunk/PC/pyconfig.h Log: Revert compiler comment to AMD64 for x64/AMD64 builds. Modified: python/trunk/PC/pyconfig.h ============================================================================== --- python/trunk/PC/pyconfig.h (original) +++ python/trunk/PC/pyconfig.h Fri May 4 02:25:08 2007 @@ -141,7 +141,7 @@ #define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)") #define MS_WINI64 #elif defined(_M_X64) -#define COMPILER _Py_PASTE_VERSION("64 bit (x64)") +#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)") #define MS_WINX64 #else #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") From python-checkins at python.org Fri May 4 02:41:50 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 02:41:50 +0200 (CEST) Subject: [Python-checkins] r55108 - in python/branches/py3k-struni: Lib/test/test_builtin.py Objects/bytesobject.c Objects/moduleobject.c Objects/object.c Objects/stringobject.c Objects/unicodeobject.c Parser/tokenizer.c Python/ast.c Python/bltinmodule.c Python/getargs.c Python/import.c Python/marshal.c Message-ID: <20070504004150.368A51E4005@bag.python.org> Author: guido.van.rossum Date: Fri May 4 02:41:39 2007 New Revision: 55108 Modified: python/branches/py3k-struni/Lib/test/test_builtin.py python/branches/py3k-struni/Objects/bytesobject.c python/branches/py3k-struni/Objects/moduleobject.c python/branches/py3k-struni/Objects/object.c python/branches/py3k-struni/Objects/stringobject.c python/branches/py3k-struni/Objects/unicodeobject.c python/branches/py3k-struni/Parser/tokenizer.c python/branches/py3k-struni/Python/ast.c python/branches/py3k-struni/Python/bltinmodule.c python/branches/py3k-struni/Python/getargs.c python/branches/py3k-struni/Python/import.c python/branches/py3k-struni/Python/marshal.c Log: More coding by random modification. Encoding now return bytes instead of str8. eval(), exec(), compile() now accept unicode or bytes. Modified: python/branches/py3k-struni/Lib/test/test_builtin.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_builtin.py (original) +++ python/branches/py3k-struni/Lib/test/test_builtin.py Fri May 4 02:41:39 2007 @@ -208,8 +208,8 @@ def test_compile(self): compile('print(1)\n', '', 'exec') - bom = '\xef\xbb\xbf' - compile((bom + 'print(1)\n').encode("latin-1"), '', 'exec') +## bom = b'\xef\xbb\xbf' +## compile(bom + b'print(1)\n', '', 'exec') compile(source='pass', filename='?', mode='exec') compile(dont_inherit=0, filename='tmp', source='0', mode='eval') compile('pass', '?', dont_inherit=1, mode='exec') @@ -220,7 +220,7 @@ self.assertRaises(TypeError, compile, 'pass', '?', 'exec', mode='eval', source='0', filename='tmp') if have_unicode: - compile(str(b'print(u"\xc3\xa5")\n', 'utf8'), '', 'exec') + compile('print(u"\xe5")\n', '', 'exec') self.assertRaises(TypeError, compile, chr(0), 'f', 'exec') self.assertRaises(ValueError, compile, str('a = 1'), 'f', 'bad') @@ -338,10 +338,9 @@ self.assertEqual(eval(str('a'), globals, locals), 1) self.assertEqual(eval(str('b'), globals, locals), 200) self.assertEqual(eval(str('c'), globals, locals), 300) - bom = '\xef\xbb\xbf' - self.assertEqual(eval((bom + 'a').encode("latin-1"), globals, locals), 1) - self.assertEqual(eval(str(b'u"\xc3\xa5"', 'utf8'), globals), - str(b'\xc3\xa5', 'utf8')) +## bom = b'\xef\xbb\xbf' +## self.assertEqual(eval(bom + b'a', globals, locals), 1) + self.assertEqual(eval('u"\xe5"', globals), u"\xe5") self.assertRaises(TypeError, eval) self.assertRaises(TypeError, eval, ()) @@ -675,16 +674,14 @@ self.assertRaises(TypeError, getattr, sys, 1) self.assertRaises(TypeError, getattr, sys, 1, "foo") self.assertRaises(TypeError, getattr) - if have_unicode: - self.assertRaises(UnicodeError, getattr, sys, chr(sys.maxunicode)) + self.assertRaises(AttributeError, getattr, sys, chr(sys.maxunicode)) def test_hasattr(self): import sys self.assert_(hasattr(sys, 'stdout')) self.assertRaises(TypeError, hasattr, sys, 1) self.assertRaises(TypeError, hasattr) - if have_unicode: - self.assertRaises(UnicodeError, hasattr, sys, chr(sys.maxunicode)) + self.assertEqual(False, hasattr(sys, chr(sys.maxunicode))) def test_hash(self): hash(None) Modified: python/branches/py3k-struni/Objects/bytesobject.c ============================================================================== --- python/branches/py3k-struni/Objects/bytesobject.c (original) +++ python/branches/py3k-struni/Objects/bytesobject.c Fri May 4 02:41:39 2007 @@ -79,6 +79,7 @@ PyBytes_FromStringAndSize(const char *bytes, Py_ssize_t size) { PyBytesObject *new; + int alloc; assert(size >= 0); @@ -86,18 +87,23 @@ if (new == NULL) return NULL; - if (size == 0) + if (size == 0) { new->ob_bytes = NULL; + alloc = 0; + } else { - new->ob_bytes = PyMem_Malloc(size); + alloc = size + 1; + new->ob_bytes = PyMem_Malloc(alloc); if (new->ob_bytes == NULL) { Py_DECREF(new); return NULL; } if (bytes != NULL) memcpy(new->ob_bytes, bytes, size); + new->ob_bytes[size] = '\0'; /* Trailing null byte */ } - new->ob_size = new->ob_alloc = size; + new->ob_size = size; + new->ob_alloc = alloc; return (PyObject *)new; } @@ -134,7 +140,7 @@ /* Major downsize; resize down to exact size */ alloc = size; } - else if (size <= alloc) { + else if (size < alloc) { /* Within allocated size; quick exit */ ((PyBytesObject *)self)->ob_size = size; return 0; @@ -147,6 +153,8 @@ /* Major upsize; resize up to exact size */ alloc = size; } + if (alloc <= size) + alloc = size + 1; sval = PyMem_Realloc(((PyBytesObject *)self)->ob_bytes, alloc); if (sval == NULL) { @@ -158,6 +166,8 @@ ((PyBytesObject *)self)->ob_size = size; ((PyBytesObject *)self)->ob_alloc = alloc; + ((PyBytesObject *)self)->ob_bytes[size] = '\0'; /* Trailing null byte */ + return 0; } @@ -221,7 +231,7 @@ size = mysize + osize; if (size < 0) return PyErr_NoMemory(); - if (size <= self->ob_alloc) + if (size < self->ob_alloc) self->ob_size = size; else if (PyBytes_Resize((PyObject *)self, size) < 0) return NULL; @@ -243,7 +253,7 @@ size = mysize * count; if (count != 0 && size / count != mysize) return PyErr_NoMemory(); - result = (PyBytesObject *)PyBytes_FromStringAndSize(NULL, size); + result = (PyBytesObject *)PyBytes_FromStringAndSize(NULL, size); if (result != NULL && size != 0) { if (mysize == 1) memset(result->ob_bytes, self->ob_bytes[0], size); @@ -268,7 +278,7 @@ size = mysize * count; if (count != 0 && size / count != mysize) return PyErr_NoMemory(); - if (size <= self->ob_alloc) + if (size < self->ob_alloc) self->ob_size = size; else if (PyBytes_Resize((PyObject *)self, size) < 0) return NULL; @@ -703,7 +713,7 @@ } bytes = PyString_AS_STRING(encoded); size = PyString_GET_SIZE(encoded); - if (size <= self->ob_alloc) + if (size < self->ob_alloc) self->ob_size = size; else if (PyBytes_Resize((PyObject *)self, size) < 0) { Py_DECREF(encoded); Modified: python/branches/py3k-struni/Objects/moduleobject.c ============================================================================== --- python/branches/py3k-struni/Objects/moduleobject.c (original) +++ python/branches/py3k-struni/Objects/moduleobject.c Fri May 4 02:41:39 2007 @@ -72,8 +72,11 @@ PyErr_SetString(PyExc_SystemError, "nameless module"); return NULL; } - if (PyUnicode_Check(nameobj)) - nameobj = _PyUnicode_AsDefaultEncodedString(nameobj, "replace"); + if (PyUnicode_Check(nameobj)) { + nameobj = _PyUnicode_AsDefaultEncodedString(nameobj, NULL); + if (nameobj == NULL) + return NULL; + } return PyString_AsString(nameobj); } Modified: python/branches/py3k-struni/Objects/object.c ============================================================================== --- python/branches/py3k-struni/Objects/object.c (original) +++ python/branches/py3k-struni/Objects/object.c Fri May 4 02:41:39 2007 @@ -422,7 +422,8 @@ return NULL; if (PyUnicode_Check(res)) { PyObject* str; - str = PyUnicode_AsEncodedString(res, NULL, NULL); + str = _PyUnicode_AsDefaultEncodedString(res, NULL); + Py_XINCREF(str); Py_DECREF(res); if (str) res = str; @@ -929,12 +930,12 @@ PyTypeObject *tp = v->ob_type; int err; - if (!PyString_Check(name)){ + if (!PyString_Check(name)) { /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name and we wouldn't want to break those. */ if (PyUnicode_Check(name)) { - name = PyUnicode_AsEncodedString(name, NULL, NULL); + name = _PyUnicode_AsDefaultEncodedString(name, NULL); if (name == NULL) return -1; } @@ -946,8 +947,7 @@ return -1; } } - else - Py_INCREF(name); + Py_INCREF(name); PyString_InternInPlace(&name); if (tp->tp_setattro != NULL) { @@ -961,6 +961,7 @@ return err; } Py_DECREF(name); + assert(name->ob_refcnt >= 1); if (tp->tp_getattr == NULL && tp->tp_getattro == NULL) PyErr_Format(PyExc_TypeError, "'%.100s' object has no attributes " Modified: python/branches/py3k-struni/Objects/stringobject.c ============================================================================== --- python/branches/py3k-struni/Objects/stringobject.c (original) +++ python/branches/py3k-struni/Objects/stringobject.c Fri May 4 02:41:39 2007 @@ -3181,9 +3181,9 @@ v = PyString_AsEncodedObject((PyObject *)self, encoding, errors); if (v == NULL) goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_Format(PyExc_TypeError, - "encoder did not return a string/unicode object " + "[str8] encoder did not return a bytes object " "(type=%.400s)", v->ob_type->tp_name); Py_DECREF(v); Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Fri May 4 02:41:39 2007 @@ -104,13 +104,9 @@ static PyUnicodeObject *unicode_latin1[256]; /* Default encoding to use and assume when NULL is passed as encoding - parameter; it is initialized by _PyUnicode_Init(). - - Always use the PyUnicode_SetDefaultEncoding() and - PyUnicode_GetDefaultEncoding() APIs to access this global. - -*/ -static char unicode_default_encoding[100]; + parameter; it is fixed to "utf-8". Always use the + PyUnicode_GetDefaultEncoding() API to access this global. */ +static const char unicode_default_encoding[] = "utf-8"; Py_UNICODE PyUnicode_GetMax(void) @@ -711,10 +707,19 @@ v = PyCodec_Encode(unicode, encoding, errors); if (v == NULL) goto onError; - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { + if (PyString_Check(v)) { + /* Old codec, turn it into bytes */ + PyObject *b = PyBytes_FromObject(v); + Py_DECREF(v); + return b; + } PyErr_Format(PyExc_TypeError, - "encoder did not return a string object (type=%.400s)", - v->ob_type->tp_name); + "encoder did not return a bytes object " + "(type=%.400s, encoding=%.20s, errors=%.20s)", + v->ob_type->tp_name, + encoding ? encoding : "NULL", + errors ? errors : "NULL"); Py_DECREF(v); goto onError; } @@ -728,12 +733,28 @@ const char *errors) { PyObject *v = ((PyUnicodeObject *)unicode)->defenc; - + PyObject *b; if (v) return v; - v = PyUnicode_AsEncodedString(unicode, NULL, errors); - if (v && errors == NULL) + if (errors != NULL) + Py_FatalError("non-NULL encoding in _PyUnicode_AsDefaultEncodedString"); + if (errors == NULL) { + b = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode), + PyUnicode_GET_SIZE(unicode), + NULL); + } + else { + b = PyUnicode_AsEncodedString(unicode, NULL, errors); + } + if (!b) + return NULL; + v = PyString_FromStringAndSize(PyBytes_AsString(b), + PyBytes_Size(b)); + Py_DECREF(b); + if (!errors) { + Py_XINCREF(v); ((PyUnicodeObject *)unicode)->defenc = v; + } return v; } @@ -768,21 +789,13 @@ int PyUnicode_SetDefaultEncoding(const char *encoding) { - PyObject *v; - - /* Make sure the encoding is valid. As side effect, this also - loads the encoding into the codec registry cache. */ - v = _PyCodec_Lookup(encoding); - if (v == NULL) - goto onError; - Py_DECREF(v); - strncpy(unicode_default_encoding, - encoding, - sizeof(unicode_default_encoding)); + if (strcmp(encoding, unicode_default_encoding) != 0) { + PyErr_Format(PyExc_ValueError, + "Can only set default encoding to %s", + unicode_default_encoding); + return -1; + } return 0; - - onError: - return -1; } /* error handling callback helper: @@ -1429,10 +1442,10 @@ nallocated = size * 4; if (nallocated / 4 != size) /* overflow! */ return PyErr_NoMemory(); - v = PyString_FromStringAndSize(NULL, nallocated); + v = PyBytes_FromStringAndSize(NULL, nallocated); if (v == NULL) return NULL; - p = PyString_AS_STRING(v); + p = PyBytes_AS_STRING(v); } for (i = 0; i < size;) { @@ -1480,13 +1493,13 @@ /* This was stack allocated. */ nneeded = p - stackbuf; assert(nneeded <= nallocated); - v = PyString_FromStringAndSize(stackbuf, nneeded); + v = PyBytes_FromStringAndSize(stackbuf, nneeded); } else { /* Cut back to size actually needed. */ - nneeded = p - PyString_AS_STRING(v); + nneeded = p - PyBytes_AS_STRING(v); assert(nneeded <= nallocated); - _PyString_Resize(&v, nneeded); + PyBytes_Resize(v, nneeded); } return v; @@ -2588,12 +2601,12 @@ /* allocate enough for a simple encoding without replacements, if we need more, we'll resize */ - res = PyString_FromStringAndSize(NULL, size); + res = PyBytes_FromStringAndSize(NULL, size); if (res == NULL) goto onError; if (size == 0) return res; - str = PyString_AS_STRING(res); + str = PyBytes_AS_STRING(res); ressize = size; while (p ressize) { if (requiredsize<2*ressize) requiredsize = 2*ressize; - if (_PyString_Resize(&res, requiredsize)) + if (PyBytes_Resize(res, requiredsize)) goto onError; - str = PyString_AS_STRING(res) + respos; + str = PyBytes_AS_STRING(res) + respos; ressize = requiredsize; } /* generate replacement (temporarily (mis)uses p) */ @@ -2690,17 +2703,17 @@ /* need more space? (at least enough for what we have+the replacement+the rest of the string, so we won't have to check space for encodable characters) */ - respos = str-PyString_AS_STRING(res); + respos = str - PyBytes_AS_STRING(res); repsize = PyUnicode_GET_SIZE(repunicode); requiredsize = respos+repsize+(endp-collend); if (requiredsize > ressize) { if (requiredsize<2*ressize) requiredsize = 2*ressize; - if (_PyString_Resize(&res, requiredsize)) { + if (PyBytes_Resize(res, requiredsize)) { Py_DECREF(repunicode); goto onError; } - str = PyString_AS_STRING(res) + respos; + str = PyBytes_AS_STRING(res) + respos; ressize = requiredsize; } /* check if there is anything unencodable in the replacement @@ -2721,10 +2734,10 @@ } } /* Resize if we allocated to much */ - respos = str-PyString_AS_STRING(res); + respos = str - PyBytes_AS_STRING(res); if (respos 0) { - char *s = PyString_AS_STRING(*repr) + n; + char *s = PyBytes_AS_STRING(*repr) + n; if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)) { PyErr_SetFromWindowsErrWithFilename(0, NULL); return -1; @@ -5630,9 +5643,9 @@ v = PyUnicode_AsEncodedObject((PyObject *)self, encoding, errors); if (v == NULL) goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_Format(PyExc_TypeError, - "encoder did not return a string/unicode object " + "encoder did not return a bytes object " "(type=%.400s)", v->ob_type->tp_name); Py_DECREF(v); @@ -6797,9 +6810,11 @@ } static -PyObject *unicode_str(PyUnicodeObject *self) +PyObject *unicode_str(PyObject *self) { - return PyUnicode_AsEncodedString((PyObject *)self, NULL, NULL); + PyObject *res = _PyUnicode_AsDefaultEncodedString(self, NULL); + Py_XINCREF(res); + return res; } PyDoc_STRVAR(swapcase__doc__, @@ -8021,7 +8036,6 @@ if (!unicode_empty) return; - strcpy(unicode_default_encoding, "ascii"); for (i = 0; i < 256; i++) unicode_latin1[i] = NULL; if (PyType_Ready(&PyUnicode_Type) < 0) Modified: python/branches/py3k-struni/Parser/tokenizer.c ============================================================================== --- python/branches/py3k-struni/Parser/tokenizer.c (original) +++ python/branches/py3k-struni/Parser/tokenizer.c Fri May 4 02:41:39 2007 @@ -696,9 +696,9 @@ if (utf8 == NULL) goto error_clear; - assert(PyString_Check(utf8)); - converted = new_string(PyString_AS_STRING(utf8), - PyString_GET_SIZE(utf8)); + assert(PyBytes_Check(utf8)); + converted = new_string(PyBytes_AS_STRING(utf8), + PyBytes_GET_SIZE(utf8)); Py_DECREF(utf8); if (converted == NULL) goto error_nomem; Modified: python/branches/py3k-struni/Python/ast.c ============================================================================== --- python/branches/py3k-struni/Python/ast.c (original) +++ python/branches/py3k-struni/Python/ast.c Fri May 4 02:41:39 2007 @@ -3101,8 +3101,9 @@ Py_DECREF(u); return NULL; } - r = PyString_AsString(w); - rn = PyString_Size(w); + assert(PyBytes_Check(w)); + r = PyBytes_AsString(w); + rn = PyBytes_Size(w); assert(rn % 2 == 0); for (i = 0; i < rn; i += 2) { sprintf(p, "\\u%02x%02x", Modified: python/branches/py3k-struni/Python/bltinmodule.c ============================================================================== --- python/branches/py3k-struni/Python/bltinmodule.c (original) +++ python/branches/py3k-struni/Python/bltinmodule.c Fri May 4 02:41:39 2007 @@ -412,6 +412,36 @@ \n\ Return negative if xy."); + +static char * +source_as_string(PyObject *cmd) +{ + char *str; + Py_ssize_t size; + + if (!PyObject_CheckReadBuffer(cmd) && + !PyUnicode_Check(cmd)) { + PyErr_SetString(PyExc_TypeError, + "eval()/exec() arg 1 must be a string, bytes or code object"); + return NULL; + } + + if (PyUnicode_Check(cmd)) { + cmd = _PyUnicode_AsDefaultEncodedString(cmd, NULL); + if (cmd == NULL) + return NULL; + } + if (PyObject_AsReadBuffer(cmd, (const void **)&str, &size) < 0) { + return NULL; + } + if (strlen(str) != size) { + PyErr_SetString(PyExc_TypeError, + "source code string cannot contain null bytes"); + return NULL; + } + return str; +} + static PyObject * builtin_compile(PyObject *self, PyObject *args, PyObject *kwds) { @@ -422,8 +452,7 @@ int dont_inherit = 0; int supplied_flags = 0; PyCompilerFlags cf; - PyObject *result = NULL, *cmd, *tmp = NULL; - Py_ssize_t length; + PyObject *cmd; static char *kwlist[] = {"source", "filename", "mode", "flags", "dont_inherit", NULL}; @@ -432,22 +461,11 @@ &supplied_flags, &dont_inherit)) return NULL; - cf.cf_flags = supplied_flags; + cf.cf_flags = supplied_flags | PyCF_SOURCE_IS_UTF8; - if (PyUnicode_Check(cmd)) { - tmp = PyUnicode_AsUTF8String(cmd); - if (tmp == NULL) - return NULL; - cmd = tmp; - cf.cf_flags |= PyCF_SOURCE_IS_UTF8; - } - if (PyObject_AsReadBuffer(cmd, (const void **)&str, &length)) + str = source_as_string(cmd); + if (str == NULL) return NULL; - if ((size_t)length != strlen(str)) { - PyErr_SetString(PyExc_TypeError, - "compile() expected string without null bytes"); - goto cleanup; - } if (strcmp(startstr, "exec") == 0) start = Py_file_input; @@ -458,7 +476,7 @@ else { PyErr_SetString(PyExc_ValueError, "compile() arg 3 must be 'exec' or 'eval' or 'single'"); - goto cleanup; + return NULL; } if (supplied_flags & @@ -466,17 +484,14 @@ { PyErr_SetString(PyExc_ValueError, "compile(): unrecognised flags"); - goto cleanup; + return NULL; } /* XXX Warn if (supplied_flags & PyCF_MASK_OBSOLETE) != 0? */ if (!dont_inherit) { PyEval_MergeCompilerFlags(&cf); } - result = Py_CompileStringFlags(str, filename, start, &cf); -cleanup: - Py_XDECREF(tmp); - return result; + return Py_CompileStringFlags(str, filename, start, &cf); } PyDoc_STRVAR(compile_doc, @@ -584,28 +599,14 @@ return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); } - if (!PyString_Check(cmd) && - !PyUnicode_Check(cmd)) { - PyErr_SetString(PyExc_TypeError, - "eval() arg 1 must be a string or code object"); + str = source_as_string(cmd); + if (str == NULL) return NULL; - } - cf.cf_flags = 0; - if (PyUnicode_Check(cmd)) { - tmp = PyUnicode_AsUTF8String(cmd); - if (tmp == NULL) - return NULL; - cmd = tmp; - cf.cf_flags |= PyCF_SOURCE_IS_UTF8; - } - if (PyString_AsStringAndSize(cmd, &str, NULL)) { - Py_XDECREF(tmp); - return NULL; - } while (*str == ' ' || *str == '\t') str++; + cf.cf_flags = PyCF_SOURCE_IS_UTF8; (void)PyEval_MergeCompilerFlags(&cf); result = PyRun_StringFlags(str, Py_eval_input, globals, locals, &cf); Py_XDECREF(tmp); @@ -694,25 +695,16 @@ locals); } else { - PyObject *tmp = NULL; - char *str; + char *str = source_as_string(prog); PyCompilerFlags cf; - cf.cf_flags = 0; - if (PyUnicode_Check(prog)) { - tmp = PyUnicode_AsUTF8String(prog); - if (tmp == NULL) - return NULL; - prog = tmp; - cf.cf_flags |= PyCF_SOURCE_IS_UTF8; - } - if (PyString_AsStringAndSize(prog, &str, NULL)) + if (str == NULL) return NULL; + cf.cf_flags = PyCF_SOURCE_IS_UTF8; if (PyEval_MergeCompilerFlags(&cf)) v = PyRun_StringFlags(str, Py_file_input, globals, locals, &cf); else v = PyRun_String(str, Py_file_input, globals, locals); - Py_XDECREF(tmp); } if (v == NULL) return NULL; Modified: python/branches/py3k-struni/Python/getargs.c ============================================================================== --- python/branches/py3k-struni/Python/getargs.c (original) +++ python/branches/py3k-struni/Python/getargs.c Fri May 4 02:41:39 2007 @@ -883,7 +883,9 @@ char **buffer; const char *encoding; PyObject *s; - int size, recode_strings; + int recode_strings; + Py_ssize_t size; + char *ptr; /* Get 'e' parameter: the encoding name */ encoding = (const char *)va_arg(*p_va, const char *); @@ -912,6 +914,8 @@ if (!recode_strings && PyString_Check(arg)) { s = arg; Py_INCREF(s); + size = PyString_GET_SIZE(s); + ptr = PyString_AS_STRING(s); } else { PyObject *u; @@ -931,14 +935,15 @@ if (s == NULL) return converterr("(encoding failed)", arg, msgbuf, bufsize); - if (!PyString_Check(s)) { + if (!PyBytes_Check(s)) { Py_DECREF(s); return converterr( - "(encoder failed to return a string)", + "(encoder failed to return bytes)", arg, msgbuf, bufsize); } + size = PyBytes_GET_SIZE(s); + ptr = PyBytes_AS_STRING(s); } - size = PyString_GET_SIZE(s); /* Write output; output is guaranteed to be 0-terminated */ if (*format == '#') { @@ -994,9 +999,7 @@ arg, msgbuf, bufsize); } } - memcpy(*buffer, - PyString_AS_STRING(s), - size + 1); + memcpy(*buffer, ptr, size+1); STORE_SIZE(size); } else { /* Using a 0-terminated buffer: @@ -1012,8 +1015,7 @@ PyMem_Free()ing it after usage */ - if ((Py_ssize_t)strlen(PyString_AS_STRING(s)) - != size) { + if ((Py_ssize_t)strlen(ptr) != size) { Py_DECREF(s); return converterr( "(encoded string without NULL bytes)", @@ -1030,9 +1032,7 @@ return converterr("(cleanup problem)", arg, msgbuf, bufsize); } - memcpy(*buffer, - PyString_AS_STRING(s), - size + 1); + memcpy(*buffer, ptr, size+1); } Py_DECREF(s); break; Modified: python/branches/py3k-struni/Python/import.c ============================================================================== --- python/branches/py3k-struni/Python/import.c (original) +++ python/branches/py3k-struni/Python/import.c Fri May 4 02:41:39 2007 @@ -1254,6 +1254,9 @@ for (i = 0; i < npath; i++) { PyObject *copy = NULL; PyObject *v = PyList_GetItem(path, i); + PyObject *origv = v; + char *base; + Py_ssize_t size; if (!v) return NULL; if (PyUnicode_Check(v)) { @@ -1263,15 +1266,24 @@ return NULL; v = copy; } - else - if (!PyString_Check(v)) + if (PyString_Check(v)) { + base = PyString_AS_STRING(v); + size = PyString_GET_SIZE(v); + } + else if (PyBytes_Check(v)) { + base = PyBytes_AS_STRING(v); + size = PyBytes_GET_SIZE(v); + } + else { + Py_XDECREF(copy); continue; - len = PyString_GET_SIZE(v); + } + len = size; if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen) { Py_XDECREF(copy); continue; /* Too long */ } - strcpy(buf, PyString_AS_STRING(v)); + strcpy(buf, base); if (strlen(buf) != len) { Py_XDECREF(copy); continue; /* v contains '\0' */ @@ -1282,7 +1294,7 @@ PyObject *importer; importer = get_path_importer(path_importer_cache, - path_hooks, v); + path_hooks, origv); if (importer == NULL) { Py_XDECREF(copy); return NULL; Modified: python/branches/py3k-struni/Python/marshal.c ============================================================================== --- python/branches/py3k-struni/Python/marshal.c (original) +++ python/branches/py3k-struni/Python/marshal.c Fri May 4 02:41:39 2007 @@ -263,14 +263,14 @@ return; } w_byte(TYPE_UNICODE, p); - n = PyString_GET_SIZE(utf8); + n = PyBytes_GET_SIZE(utf8); if (n > INT_MAX) { p->depth--; p->error = 1; return; } w_long((long)n, p); - w_string(PyString_AS_STRING(utf8), (int)n, p); + w_string(PyBytes_AS_STRING(utf8), (int)n, p); Py_DECREF(utf8); } else if (PyTuple_Check(v)) { @@ -1031,7 +1031,7 @@ if (wf.ptr - base > PY_SSIZE_T_MAX) { Py_DECREF(wf.str); PyErr_SetString(PyExc_OverflowError, - "too much marshall data for a string"); + "too much marshal data for a string"); return NULL; } _PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); From guido at python.org Fri May 4 02:44:25 2007 From: guido at python.org (Guido van Rossum) Date: Thu, 3 May 2007 17:44:25 -0700 Subject: [Python-checkins] r55106 - python/branches/py3k-struni/Lib/test/test_support.py In-Reply-To: <20070503211144.5AF2D1E4005@bag.python.org> References: <20070503211144.5AF2D1E4005@bag.python.org> Message-ID: I think this and similar places should use basestring. On 5/3/07, walter.doerwald wrote: > Author: walter.doerwald > Date: Thu May 3 23:11:35 2007 > New Revision: 55106 > > Modified: > python/branches/py3k-struni/Lib/test/test_support.py > Log: > Temporary fix: Module names are still 8bit strings. This > change allows test_support.run_unittest(__name__) to work > again. However the proper fix would be module names that > are real unicode strings. > > > Modified: python/branches/py3k-struni/Lib/test/test_support.py > ============================================================================== > --- python/branches/py3k-struni/Lib/test/test_support.py (original) > +++ python/branches/py3k-struni/Lib/test/test_support.py Thu May 3 23:11:35 2007 > @@ -534,7 +534,7 @@ > valid_types = (unittest.TestSuite, unittest.TestCase) > suite = unittest.TestSuite() > for cls in classes: > - if isinstance(cls, str): > + if isinstance(cls, (str, str8)): > if cls in sys.modules: > suite.addTest(unittest.findTestCases(sys.modules[cls])) > else: > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From python-checkins at python.org Fri May 4 06:17:49 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 06:17:49 +0200 (CEST) Subject: [Python-checkins] r55109 - in python/branches/py3k-struni: Objects/unicodeobject.c Python/getargs.c Message-ID: <20070504041749.C9BD11E400B@bag.python.org> Author: guido.van.rossum Date: Fri May 4 06:17:33 2007 New Revision: 55109 Modified: python/branches/py3k-struni/Objects/unicodeobject.c python/branches/py3k-struni/Python/getargs.c Log: Compare and hash unicode objects like their UTF-8 representations. Accept Unicode characters < 256 for 'c' format. Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Fri May 4 06:17:33 2007 @@ -5406,33 +5406,23 @@ int PyUnicode_Compare(PyObject *left, PyObject *right) { - PyUnicodeObject *u = NULL, *v = NULL; - int result; - - /* Coerce the two arguments */ - u = (PyUnicodeObject *)PyUnicode_FromObject(left); - if (u == NULL) - goto onError; - v = (PyUnicodeObject *)PyUnicode_FromObject(right); - if (v == NULL) - goto onError; - - /* Shortcut for empty or interned objects */ - if (v == u) { - Py_DECREF(u); - Py_DECREF(v); - return 0; - } - - result = unicode_compare(u, v); - - Py_DECREF(u); - Py_DECREF(v); - return result; - -onError: - Py_XDECREF(u); - Py_XDECREF(v); + if (PyUnicode_Check(left) && PyUnicode_Check(right)) + return unicode_compare((PyUnicodeObject *)left, + (PyUnicodeObject *)right); + if ((PyString_Check(left) && PyUnicode_Check(right)) || + (PyUnicode_Check(left) && PyString_Check(right))) { + if (PyUnicode_Check(left)) + left = _PyUnicode_AsDefaultEncodedString(left, NULL); + if (PyUnicode_Check(right)) + right = _PyUnicode_AsDefaultEncodedString(right, NULL); + assert(PyString_Check(left)); + assert(PyString_Check(right)); + return PyObject_Compare(left, right); + } + PyErr_Format(PyExc_TypeError, + "Can't compare %.100s and %.100s", + left->ob_type->tp_name, + right->ob_type->tp_name); return -1; } @@ -5802,30 +5792,12 @@ } static long -unicode_hash(PyUnicodeObject *self) +unicode_hash(PyObject *self) { - /* Since Unicode objects compare equal to their ASCII string - counterparts, they should use the individual character values - as basis for their hash value. This is needed to assure that - strings and Unicode objects behave in the same way as - dictionary keys. */ - - register Py_ssize_t len; - register Py_UNICODE *p; - register long x; - - if (self->hash != -1) - return self->hash; - len = PyUnicode_GET_SIZE(self); - p = PyUnicode_AS_UNICODE(self); - x = *p << 7; - while (--len >= 0) - x = (1000003*x) ^ *p++; - x ^= PyUnicode_GET_SIZE(self); - if (x == -1) - x = -2; - self->hash = x; - return x; + /* Since Unicode objects compare equal to their UTF-8 string + counterparts, we hash the UTF-8 string. */ + PyObject *v = _PyUnicode_AsDefaultEncodedString(self, NULL); + return PyObject_Hash(v); } PyDoc_STRVAR(index__doc__, Modified: python/branches/py3k-struni/Python/getargs.c ============================================================================== --- python/branches/py3k-struni/Python/getargs.c (original) +++ python/branches/py3k-struni/Python/getargs.c Fri May 4 06:17:33 2007 @@ -764,8 +764,12 @@ char *p = va_arg(*p_va, char *); if (PyString_Check(arg) && PyString_Size(arg) == 1) *p = PyString_AS_STRING(arg)[0]; + else if (PyUnicode_Check(arg) && + PyUnicode_GET_SIZE(arg) == 1 && + PyUnicode_AS_UNICODE(arg)[0] < 256) + *p = PyUnicode_AS_UNICODE(arg)[0]; else - return converterr("char", arg, msgbuf, bufsize); + return converterr("char < 256", arg, msgbuf, bufsize); break; } From python-checkins at python.org Fri May 4 06:27:23 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 06:27:23 +0200 (CEST) Subject: [Python-checkins] r55110 - python/branches/py3k-struni/Objects/bytesobject.c Message-ID: <20070504042723.780311E4006@bag.python.org> Author: guido.van.rossum Date: Fri May 4 06:27:16 2007 New Revision: 55110 Modified: python/branches/py3k-struni/Objects/bytesobject.c Log: Add trailing null bytes to a few more places. Modified: python/branches/py3k-struni/Objects/bytesobject.c ============================================================================== --- python/branches/py3k-struni/Objects/bytesobject.c (original) +++ python/branches/py3k-struni/Objects/bytesobject.c Fri May 4 06:27:16 2007 @@ -138,11 +138,12 @@ if (size < alloc / 2) { /* Major downsize; resize down to exact size */ - alloc = size; + alloc = size + 1; } else if (size < alloc) { /* Within allocated size; quick exit */ ((PyBytesObject *)self)->ob_size = size; + ((PyBytesObject *)self)->ob_bytes[size] = '\0'; /* Trailing null byte */ return 0; } else if (size <= alloc * 1.125) { @@ -151,10 +152,8 @@ } else { /* Major upsize; resize up to exact size */ - alloc = size; - } - if (alloc <= size) alloc = size + 1; + } sval = PyMem_Realloc(((PyBytesObject *)self)->ob_bytes, alloc); if (sval == NULL) { @@ -165,7 +164,6 @@ ((PyBytesObject *)self)->ob_bytes = sval; ((PyBytesObject *)self)->ob_size = size; ((PyBytesObject *)self)->ob_alloc = alloc; - ((PyBytesObject *)self)->ob_bytes[size] = '\0'; /* Trailing null byte */ return 0; @@ -231,8 +229,10 @@ size = mysize + osize; if (size < 0) return PyErr_NoMemory(); - if (size < self->ob_alloc) + if (size < self->ob_alloc) { self->ob_size = size; + self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */ + } else if (PyBytes_Resize((PyObject *)self, size) < 0) return NULL; memcpy(self->ob_bytes + mysize, optr, osize); @@ -278,8 +278,10 @@ size = mysize * count; if (count != 0 && size / count != mysize) return PyErr_NoMemory(); - if (size < self->ob_alloc) + if (size < self->ob_alloc) { self->ob_size = size; + self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */ + } else if (PyBytes_Resize((PyObject *)self, size) < 0) return NULL; @@ -713,8 +715,10 @@ } bytes = PyString_AS_STRING(encoded); size = PyString_GET_SIZE(encoded); - if (size < self->ob_alloc) + if (size < self->ob_alloc) { self->ob_size = size; + self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */ + } else if (PyBytes_Resize((PyObject *)self, size) < 0) { Py_DECREF(encoded); return -1; From martin at v.loewis.de Fri May 4 06:57:07 2007 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Fri, 04 May 2007 06:57:07 +0200 Subject: [Python-checkins] r55103 - in python/trunk: Modules/itertoolsmodule.c Modules/posixmodule.c Objects/intobject.c Objects/longobject.c PC/config.c PC/pyconfig.h Python/thread_nt.h In-Reply-To: <4E9372E6B2234D4F859320D896059A9508CD57DBEF@exchis.ccp.ad.local> References: <20070503202712.69E601E4005@bag.python.org> <463A516B.8070209@v.loewis.de> <200705031535.40850.jeremy.kloth@4suite.org> <463A5C64.1020708@v.loewis.de> <4E9372E6B2234D4F859320D896059A9508CD57DBEF@exchis.ccp.ad.local> Message-ID: <463ABD23.1070304@v.loewis.de> > On a different issue, What is your opinion on Itanium? Is it here to > stay? I never installed any I64 compilers and didn't add that target > to the VC8 build dir. Do you think I ought to? No; I would like to stop producing Itanium binaries in 2.6. This hasn't seen much discussion, yet, however, users interested in seeing such support would have to contribute patches themselves. Regards, Martin From python-checkins at python.org Fri May 4 07:00:07 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 07:00:07 +0200 (CEST) Subject: [Python-checkins] r55111 - in python/branches/py3k-struni: Lib/test/test_bytes.py Objects/bytesobject.c Objects/unicodeobject.c Message-ID: <20070504050007.1D8431E4011@bag.python.org> Author: guido.van.rossum Date: Fri May 4 07:00:04 2007 New Revision: 55111 Modified: python/branches/py3k-struni/Lib/test/test_bytes.py python/branches/py3k-struni/Objects/bytesobject.c python/branches/py3k-struni/Objects/unicodeobject.c Log: Make all of test_bytes pass (except pickling, which is too badly busted). Modified: python/branches/py3k-struni/Lib/test/test_bytes.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_bytes.py (original) +++ python/branches/py3k-struni/Lib/test/test_bytes.py Fri May 4 07:00:04 2007 @@ -102,35 +102,35 @@ self.failIf(b3 <= b2) def test_compare_to_str(self): - self.assertEqual(b"abc" == "abc", True) - self.assertEqual(b"ab" != "abc", True) - self.assertEqual(b"ab" <= "abc", True) - self.assertEqual(b"ab" < "abc", True) - self.assertEqual(b"abc" >= "ab", True) - self.assertEqual(b"abc" > "ab", True) - - self.assertEqual(b"abc" != "abc", False) - self.assertEqual(b"ab" == "abc", False) - self.assertEqual(b"ab" > "abc", False) - self.assertEqual(b"ab" >= "abc", False) - self.assertEqual(b"abc" < "ab", False) - self.assertEqual(b"abc" <= "ab", False) - - self.assertEqual("abc" == b"abc", True) - self.assertEqual("ab" != b"abc", True) - self.assertEqual("ab" <= b"abc", True) - self.assertEqual("ab" < b"abc", True) - self.assertEqual("abc" >= b"ab", True) - self.assertEqual("abc" > b"ab", True) - - self.assertEqual("abc" != b"abc", False) - self.assertEqual("ab" == b"abc", False) - self.assertEqual("ab" > b"abc", False) - self.assertEqual("ab" >= b"abc", False) - self.assertEqual("abc" < b"ab", False) - self.assertEqual("abc" <= b"ab", False) + self.assertEqual(b"abc" == str8("abc"), True) + self.assertEqual(b"ab" != str8("abc"), True) + self.assertEqual(b"ab" <= str8("abc"), True) + self.assertEqual(b"ab" < str8("abc"), True) + self.assertEqual(b"abc" >= str8("ab"), True) + self.assertEqual(b"abc" > str8("ab"), True) + + self.assertEqual(b"abc" != str8("abc"), False) + self.assertEqual(b"ab" == str8("abc"), False) + self.assertEqual(b"ab" > str8("abc"), False) + self.assertEqual(b"ab" >= str8("abc"), False) + self.assertEqual(b"abc" < str8("ab"), False) + self.assertEqual(b"abc" <= str8("ab"), False) + + self.assertEqual(str8("abc") == b"abc", True) + self.assertEqual(str8("ab") != b"abc", True) + self.assertEqual(str8("ab") <= b"abc", True) + self.assertEqual(str8("ab") < b"abc", True) + self.assertEqual(str8("abc") >= b"ab", True) + self.assertEqual(str8("abc") > b"ab", True) + + self.assertEqual(str8("abc") != b"abc", False) + self.assertEqual(str8("ab") == b"abc", False) + self.assertEqual(str8("ab") > b"abc", False) + self.assertEqual(str8("ab") >= b"abc", False) + self.assertEqual(str8("abc") < b"ab", False) + self.assertEqual(str8("abc") <= b"ab", False) - # But they should never compare equal to Unicode! + # Bytes should never compare equal to Unicode! # Test this for all expected byte orders and Unicode character sizes self.assertEqual(b"\0a\0b\0c" == "abc", False) self.assertEqual(b"\0\0\0a\0\0\0b\0\0\0c" == "abc", False) @@ -326,7 +326,7 @@ sample = "Hello world\n\u1234\u5678\u9abc\udef0" for enc in ("utf8", "utf16"): b = bytes(sample, enc) - self.assertEqual(b, bytes(map(ord, sample.encode(enc)))) + self.assertEqual(b, bytes(sample.encode(enc))) self.assertRaises(UnicodeEncodeError, bytes, sample, "latin1") b = bytes(sample, "latin1", "ignore") self.assertEqual(b, bytes(sample[:-4])) @@ -342,7 +342,7 @@ self.assertEqual(b.decode("utf8", "ignore"), "Hello world\n") def test_from_buffer(self): - sample = "Hello world\n\x80\x81\xfe\xff" + sample = str8("Hello world\n\x80\x81\xfe\xff") buf = buffer(sample) b = bytes(buf) self.assertEqual(b, bytes(map(ord, sample))) @@ -364,8 +364,8 @@ b1 = bytes("abc") b2 = bytes("def") self.assertEqual(b1 + b2, bytes("abcdef")) - self.assertEqual(b1 + "def", bytes("abcdef")) - self.assertEqual("def" + b1, bytes("defabc")) + self.assertEqual(b1 + str8("def"), bytes("abcdef")) + self.assertEqual(str8("def") + b1, bytes("defabc")) self.assertRaises(TypeError, lambda: b1 + "def") self.assertRaises(TypeError, lambda: "abc" + b2) @@ -388,7 +388,7 @@ self.assertEqual(b, bytes("abcdef")) self.assertEqual(b, b1) self.failUnless(b is b1) - b += "xyz" + b += str8("xyz") self.assertEqual(b, b"abcdefxyz") try: b += "" @@ -456,8 +456,8 @@ b = bytes([0x1a, 0x2b, 0x30]) self.assertEquals(bytes.fromhex('1a2B30'), b) self.assertEquals(bytes.fromhex(' 1A 2B 30 '), b) - self.assertEquals(bytes.fromhex(buffer('')), bytes()) - self.assertEquals(bytes.fromhex(buffer('0000')), bytes([0, 0])) + self.assertEquals(bytes.fromhex(buffer(b'')), bytes()) + self.assertEquals(bytes.fromhex(buffer(b'0000')), bytes([0, 0])) self.assertRaises(ValueError, bytes.fromhex, 'a') self.assertRaises(ValueError, bytes.fromhex, 'rt') self.assertRaises(ValueError, bytes.fromhex, '1a b cd') @@ -717,5 +717,5 @@ if __name__ == "__main__": - test_main() - ##unittest.main() + ##test_main() + unittest.main() Modified: python/branches/py3k-struni/Objects/bytesobject.c ============================================================================== --- python/branches/py3k-struni/Objects/bytesobject.c (original) +++ python/branches/py3k-struni/Objects/bytesobject.c Fri May 4 07:00:04 2007 @@ -218,6 +218,7 @@ Py_ssize_t mysize; Py_ssize_t size; + /* XXX What if other == self? */ osize = _getbuffer(other, &optr); if (osize < 0) { PyErr_Format(PyExc_TypeError, @@ -698,34 +699,25 @@ if (PyUnicode_Check(arg)) { /* Encode via the codec registry */ - PyObject *encoded; - char *bytes; - Py_ssize_t size; + PyObject *encoded, *new; if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); encoded = PyCodec_Encode(arg, encoding, errors); if (encoded == NULL) return -1; - if (!PyString_Check(encoded)) { + if (!PyBytes_Check(encoded) && !PyString_Check(encoded)) { PyErr_Format(PyExc_TypeError, - "encoder did not return a string object (type=%.400s)", + "encoder did not return a str8 or bytes object (type=%.400s)", encoded->ob_type->tp_name); Py_DECREF(encoded); return -1; } - bytes = PyString_AS_STRING(encoded); - size = PyString_GET_SIZE(encoded); - if (size < self->ob_alloc) { - self->ob_size = size; - self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */ - } - else if (PyBytes_Resize((PyObject *)self, size) < 0) { - Py_DECREF(encoded); - return -1; - } - memcpy(self->ob_bytes, bytes, size); - Py_DECREF(encoded); - return 0; + new = bytes_iconcat(self, encoded); + Py_DECREF(encoded); + if (new == NULL) + return -1; + Py_DECREF(new); + return 0; } /* If it's not unicode, there can't be encoding or errors */ @@ -2689,7 +2681,7 @@ return NULL; buf = PyBytes_AS_STRING(newbytes); - for (i = j = 0; ; i += 2) { + for (i = j = 0; i < len; i += 2) { /* skip over spaces in the input */ while (Py_CHARMASK(hex[i]) == ' ') i++; Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Fri May 4 07:00:04 2007 @@ -5634,6 +5634,12 @@ if (v == NULL) goto onError; if (!PyBytes_Check(v)) { + if (PyString_Check(v)) { + /* Old codec, turn it into bytes */ + PyObject *b = PyBytes_FromObject(v); + Py_DECREF(v); + return b; + } PyErr_Format(PyExc_TypeError, "encoder did not return a bytes object " "(type=%.400s)", From python-checkins at python.org Fri May 4 07:04:40 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 07:04:40 +0200 (CEST) Subject: [Python-checkins] r55112 - python/branches/py3k-struni/Lib/test/test_types.py Message-ID: <20070504050440.310581E4018@bag.python.org> Author: guido.van.rossum Date: Fri May 4 07:04:37 2007 New Revision: 55112 Modified: python/branches/py3k-struni/Lib/test/test_types.py Log: Make test_types.py pass. Modified: python/branches/py3k-struni/Lib/test/test_types.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_types.py (original) +++ python/branches/py3k-struni/Lib/test/test_types.py Fri May 4 07:04:37 2007 @@ -200,16 +200,16 @@ self.assertEqual(a[-100:100:2], '02468') if have_unicode: - a = str('0123456789', 'ascii') + a = str(b'0123456789', 'ascii') self.assertEqual(a[::], a) - self.assertEqual(a[::2], str('02468', 'ascii')) - self.assertEqual(a[1::2], str('13579', 'ascii')) - self.assertEqual(a[::-1], str('9876543210', 'ascii')) - self.assertEqual(a[::-2], str('97531', 'ascii')) - self.assertEqual(a[3::-2], str('31', 'ascii')) + self.assertEqual(a[::2], str(b'02468', 'ascii')) + self.assertEqual(a[1::2], str(b'13579', 'ascii')) + self.assertEqual(a[::-1], str(b'9876543210', 'ascii')) + self.assertEqual(a[::-2], str(b'97531', 'ascii')) + self.assertEqual(a[3::-2], str(b'31', 'ascii')) self.assertEqual(a[-100:100:], a) self.assertEqual(a[100:-100:-1], a[::-1]) - self.assertEqual(a[-100:100:2], str('02468', 'ascii')) + self.assertEqual(a[-100:100:2], str(b'02468', 'ascii')) def test_type_function(self): @@ -220,7 +220,7 @@ self.assertRaises(ValueError, buffer, 'asdf', -1) self.assertRaises(TypeError, buffer, None) - a = buffer('asdf') + a = buffer(b'asdf') hash(a) b = a * 5 if a == b: @@ -229,7 +229,7 @@ self.fail('repeated buffer has wrong content') if str(a * 0) != '': self.fail('repeated buffer zero times has wrong content') - if str(a + buffer('def')) != 'asdfdef': + if str(a + buffer(b'def')) != 'asdfdef': self.fail('concatenation of buffers yields wrong content') if str(buffer(a)) != 'asdf': self.fail('composing buffers failed') @@ -239,14 +239,14 @@ self.fail('specifying buffer size failed') if str(buffer(a, 1, 2)) != 'sd': self.fail('specifying buffer offset and size failed') - self.assertRaises(ValueError, buffer, buffer('asdf', 1), -1) - if str(buffer(buffer('asdf', 0, 2), 0)) != 'as': + self.assertRaises(ValueError, buffer, buffer(b'asdf', 1), -1) + if str(buffer(buffer(b'asdf', 0, 2), 0)) != 'as': self.fail('composing length-specified buffer failed') - if str(buffer(buffer('asdf', 0, 2), 0, 5000)) != 'as': + if str(buffer(buffer(b'asdf', 0, 2), 0, 5000)) != 'as': self.fail('composing length-specified buffer failed') - if str(buffer(buffer('asdf', 0, 2), 0, -1)) != 'as': + if str(buffer(buffer(b'asdf', 0, 2), 0, -1)) != 'as': self.fail('composing length-specified buffer failed') - if str(buffer(buffer('asdf', 0, 2), 1, 2)) != 's': + if str(buffer(buffer(b'asdf', 0, 2), 1, 2)) != 's': self.fail('composing length-specified buffer failed') try: a[1] = 'g' From python-checkins at python.org Fri May 4 07:06:46 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 07:06:46 +0200 (CEST) Subject: [Python-checkins] r55113 - python/branches/py3k-struni/Lib/test/test_exceptions.py Message-ID: <20070504050646.4CB101E4006@bag.python.org> Author: guido.van.rossum Date: Fri May 4 07:06:43 2007 New Revision: 55113 Modified: python/branches/py3k-struni/Lib/test/test_exceptions.py Log: test_exceptions.py passes, except for pickling of course. Modified: python/branches/py3k-struni/Lib/test/test_exceptions.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_exceptions.py (original) +++ python/branches/py3k-struni/Lib/test/test_exceptions.py Fri May 4 07:06:43 2007 @@ -98,7 +98,7 @@ except TypeError: pass self.raise_catch(ValueError, "ValueError") - self.assertRaises(ValueError, chr, 10000) + self.assertRaises(ValueError, chr, 1000000) self.raise_catch(ZeroDivisionError, "ZeroDivisionError") try: x = 1/0 From python-checkins at python.org Fri May 4 07:14:31 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 07:14:31 +0200 (CEST) Subject: [Python-checkins] r55114 - python/branches/py3k-struni/Objects/object.c Message-ID: <20070504051431.9C6391E4013@bag.python.org> Author: guido.van.rossum Date: Fri May 4 07:14:29 2007 New Revision: 55114 Modified: python/branches/py3k-struni/Objects/object.c Log: It's ok for __repr__ to return unicode. Modified: python/branches/py3k-struni/Objects/object.c ============================================================================== --- python/branches/py3k-struni/Objects/object.c (original) +++ python/branches/py3k-struni/Objects/object.c Fri May 4 07:14:29 2007 @@ -361,15 +361,8 @@ res = (*v->ob_type->tp_repr)(v); if (res == NULL) return NULL; - if (PyUnicode_Check(res)) { - PyObject* str; - str = PyUnicode_AsEncodedString(res, NULL, NULL); - Py_DECREF(res); - if (str) - res = str; - else - return NULL; - } + if (PyUnicode_Check(res)) + return res; if (!PyString_Check(res)) { PyErr_Format(PyExc_TypeError, "__repr__ returned non-string (type %.200s)", From anthony at interlink.com.au Fri May 4 07:24:58 2007 From: anthony at interlink.com.au (Anthony Baxter) Date: Fri, 4 May 2007 15:24:58 +1000 Subject: [Python-checkins] r55103 - in python/trunk: Modules/itertoolsmodule.c Modules/posixmodule.c Objects/intobject.c Objects/longobject.c PC/config.c PC/pyconfig.h Python/thread_nt.h In-Reply-To: <463ABD23.1070304@v.loewis.de> References: <20070503202712.69E601E4005@bag.python.org> <4E9372E6B2234D4F859320D896059A9508CD57DBEF@exchis.ccp.ad.local> <463ABD23.1070304@v.loewis.de> Message-ID: <200705041524.59134.anthony@interlink.com.au> On Friday 04 May 2007, Martin v. L?wis wrote: > > On a different issue, What is your opinion on Itanium? Is it > > here to stay? I never installed any I64 compilers and didn't > > add that target to the VC8 build dir. Do you think I ought to? > > No; I would like to stop producing Itanium binaries in 2.6. This > hasn't seen much discussion, yet, however, users interested in > seeing such support would have to contribute patches themselves. There's numbers for different releases here: http://www.python.org/webstats/usage_200705.html#TOPURLS I'm mystified at the 3k+ downloads per day for 2.5.msi instead of 2.5.1.msi, or the 600 per day of 2.4.2 (!) ia64 version of 2.5.1 has 1054 hits this month, vs 36642 for the x86 amd 2410 for the amd64 -- Anthony Baxter It's never too late to have a happy childhood. From martin at v.loewis.de Fri May 4 08:26:01 2007 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Fri, 04 May 2007 08:26:01 +0200 Subject: [Python-checkins] r55103 - in python/trunk: Modules/itertoolsmodule.c Modules/posixmodule.c Objects/intobject.c Objects/longobject.c PC/config.c PC/pyconfig.h Python/thread_nt.h In-Reply-To: <200705041524.59134.anthony@interlink.com.au> References: <20070503202712.69E601E4005@bag.python.org> <4E9372E6B2234D4F859320D896059A9508CD57DBEF@exchis.ccp.ad.local> <463ABD23.1070304@v.loewis.de> <200705041524.59134.anthony@interlink.com.au> Message-ID: <463AD1F9.6010006@v.loewis.de> > I'm mystified at the 3k+ downloads per day for 2.5.msi instead of > 2.5.1.msi, or the 600 per day of 2.4.2 (!) I checked some referrers; for the 2.4.2 download, the most recent Apache log (which rotates daily) gives http://www.cnd8.com/down.htm?id=5952&no=1&url=http%3A//python%2Eorg/ftp/python/2%2E4%2E2/python-2%2E4%2E2%2Emsi http://zhidao.baidu.com/question/2944490.html For 2.5.msi, some referrers are http://softbank705nk.loudland.net/index.php/%E3%83%86%E3%83%BC%E3%83%9E http://www.cyber-security.org/CW/Forum/display_topic_threads.asp?ForumID=32&TopicID=153018&PagePosition=1 So people don't go to python.org to get Python, but they find the link in some other place on the net. However, for 2.5, we also have http://wiki.python.org/moin/BeginnersGuide/Download?highlight=%28BeginnersGuide%2F%29 which should be fixed, plus http://www.python.org/ftp/python/2.5/ for which one would have to recursively investigate referrers. > ia64 version of 2.5.1 has 1054 hits this month, vs 36642 for the x86 > amd 2410 for the amd64 So of all three, the Itanium binaries see least interest. Regards, Martin From anthony at interlink.com.au Fri May 4 08:38:43 2007 From: anthony at interlink.com.au (Anthony Baxter) Date: Fri, 4 May 2007 16:38:43 +1000 Subject: [Python-checkins] r55103 - in python/trunk: Modules/itertoolsmodule.c Modules/posixmodule.c Objects/intobject.c Objects/longobject.c PC/config.c PC/pyconfig.h Python/thread_nt.h In-Reply-To: <463AD1F9.6010006@v.loewis.de> References: <20070503202712.69E601E4005@bag.python.org> <200705041524.59134.anthony@interlink.com.au> <463AD1F9.6010006@v.loewis.de> Message-ID: <200705041638.44246.anthony@interlink.com.au> Maybe we should have a permalink for something like Python-Current.msi and the like, that other sites can link to? From python-checkins at python.org Fri May 4 09:14:40 2007 From: python-checkins at python.org (thomas.heller) Date: Fri, 4 May 2007 09:14:40 +0200 (CEST) Subject: [Python-checkins] r55115 - python/trunk/Lib/ctypes/test/test_checkretval.py python/trunk/Lib/ctypes/test/test_python_api.py python/trunk/Lib/ctypes/test/test_random_things.py Message-ID: <20070504071440.DF9101E4015@bag.python.org> Author: thomas.heller Date: Fri May 4 09:14:39 2007 New Revision: 55115 Modified: python/trunk/Lib/ctypes/test/test_checkretval.py python/trunk/Lib/ctypes/test/test_python_api.py python/trunk/Lib/ctypes/test/test_random_things.py Log: Fix some ctypes test crashes, when running with a debug Python version on win64 by using proper argtypes and restype function attributes. Modified: python/trunk/Lib/ctypes/test/test_checkretval.py ============================================================================== --- python/trunk/Lib/ctypes/test/test_checkretval.py (original) +++ python/trunk/Lib/ctypes/test/test_checkretval.py Fri May 4 09:14:39 2007 @@ -34,7 +34,7 @@ def test_oledll(self): self.failUnlessRaises(WindowsError, oledll.oleaut32.CreateTypeLib2, - 0, 0, 0) + 0, None, None) if __name__ == "__main__": unittest.main() Modified: python/trunk/Lib/ctypes/test/test_python_api.py ============================================================================== --- python/trunk/Lib/ctypes/test/test_python_api.py (original) +++ python/trunk/Lib/ctypes/test/test_python_api.py Fri May 4 09:14:39 2007 @@ -10,7 +10,10 @@ ################################################################ from sys import getrefcount as grc - +if sys.version_info > (2, 4): + c_py_ssize_t = c_size_t +else: + c_py_ssize_t = c_int class PythonAPITestCase(unittest.TestCase): @@ -18,7 +21,7 @@ PyString_FromStringAndSize = pythonapi.PyString_FromStringAndSize PyString_FromStringAndSize.restype = py_object - PyString_FromStringAndSize.argtypes = c_char_p, c_int + PyString_FromStringAndSize.argtypes = c_char_p, c_py_ssize_t self.failUnlessEqual(PyString_FromStringAndSize("abcdefghi", 3), "abc") @@ -66,7 +69,7 @@ def test_PyOS_snprintf(self): PyOS_snprintf = pythonapi.PyOS_snprintf - PyOS_snprintf.argtypes = POINTER(c_char), c_int, c_char_p + PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p buf = c_buffer(256) PyOS_snprintf(buf, sizeof(buf), "Hello from %s", "ctypes") Modified: python/trunk/Lib/ctypes/test/test_random_things.py ============================================================================== --- python/trunk/Lib/ctypes/test/test_random_things.py (original) +++ python/trunk/Lib/ctypes/test/test_random_things.py Fri May 4 09:14:39 2007 @@ -13,6 +13,10 @@ def test(self): from _ctypes import call_function + windll.kernel32.LoadLibraryA.restype = c_void_p + windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p + windll.kernel32.GetProcAddress.restype = c_void_p + hdll = windll.kernel32.LoadLibraryA("kernel32") funcaddr = windll.kernel32.GetProcAddress(hdll, "GetModuleHandleA") From python-checkins at python.org Fri May 4 09:18:12 2007 From: python-checkins at python.org (walter.doerwald) Date: Fri, 4 May 2007 09:18:12 +0200 (CEST) Subject: [Python-checkins] r55116 - python/branches/py3k-struni/Lib/test/test_support.py Message-ID: <20070504071812.BFDD91E4016@bag.python.org> Author: walter.doerwald Date: Fri May 4 09:18:10 2007 New Revision: 55116 Modified: python/branches/py3k-struni/Lib/test/test_support.py Log: Use basestring instead of (str, str8) to test whether cls is a module *name*. Modified: python/branches/py3k-struni/Lib/test/test_support.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_support.py (original) +++ python/branches/py3k-struni/Lib/test/test_support.py Fri May 4 09:18:10 2007 @@ -534,7 +534,7 @@ valid_types = (unittest.TestSuite, unittest.TestCase) suite = unittest.TestSuite() for cls in classes: - if isinstance(cls, (str, str8)): + if isinstance(cls, basestring): if cls in sys.modules: suite.addTest(unittest.findTestCases(sys.modules[cls])) else: From python-checkins at python.org Fri May 4 10:20:47 2007 From: python-checkins at python.org (thomas.heller) Date: Fri, 4 May 2007 10:20:47 +0200 (CEST) Subject: [Python-checkins] r55117 - python/trunk/Modules/_ctypes/libffi_msvc/ffitarget.h Message-ID: <20070504082047.6100E1E4006@bag.python.org> Author: thomas.heller Date: Fri May 4 10:20:41 2007 New Revision: 55117 Modified: python/trunk/Modules/_ctypes/libffi_msvc/ffitarget.h Log: On 64-bit Windows, ffi_arg must be 8 bytes long. This fixes the remaining crashes in the ctypes tests, when functions return float or double types. Modified: python/trunk/Modules/_ctypes/libffi_msvc/ffitarget.h ============================================================================== --- python/trunk/Modules/_ctypes/libffi_msvc/ffitarget.h (original) +++ python/trunk/Modules/_ctypes/libffi_msvc/ffitarget.h Fri May 4 10:20:41 2007 @@ -36,7 +36,11 @@ /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM +#ifndef _WIN64 typedef unsigned long ffi_arg; +#else +typedef unsigned __int64 ffi_arg; +#endif typedef signed long ffi_sarg; typedef enum ffi_abi { From buildbot at python.org Fri May 4 11:04:29 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 May 2007 09:04:29 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070504090429.72B811E4006@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/1988 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver sincerely, -The Buildbot From python-checkins at python.org Fri May 4 12:48:28 2007 From: python-checkins at python.org (walter.doerwald) Date: Fri, 4 May 2007 12:48:28 +0200 (CEST) Subject: [Python-checkins] r55118 - python/branches/py3k-struni/Objects/unicodeobject.c Message-ID: <20070504104828.D03CB1E4006@bag.python.org> Author: walter.doerwald Date: Fri May 4 12:48:27 2007 New Revision: 55118 Modified: python/branches/py3k-struni/Objects/unicodeobject.c Log: Change PyUnicode_EncodeUTF16() so that it returns bytes objects instead of str8 objects. Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Fri May 4 12:48:27 2007 @@ -1726,12 +1726,12 @@ if (s[i] >= 0x10000) pairs++; #endif - v = PyString_FromStringAndSize(NULL, + v = PyBytes_FromStringAndSize(NULL, 2 * (size + pairs + (byteorder == 0))); if (v == NULL) return NULL; - p = (unsigned char *)PyString_AS_STRING(v); + p = (unsigned char *)PyBytes_AS_STRING(v); if (byteorder == 0) STORECHAR(0xFEFF); if (size == 0) From python-checkins at python.org Fri May 4 15:05:14 2007 From: python-checkins at python.org (walter.doerwald) Date: Fri, 4 May 2007 15:05:14 +0200 (CEST) Subject: [Python-checkins] r55119 - in python/branches/py3k-struni/Lib: codecs.py test/test_codecs.py Message-ID: <20070504130514.640D01E4018@bag.python.org> Author: walter.doerwald Date: Fri May 4 15:05:09 2007 New Revision: 55119 Modified: python/branches/py3k-struni/Lib/codecs.py python/branches/py3k-struni/Lib/test/test_codecs.py Log: Make the BOM constants in codecs.py bytes. Make the buffered input for decoders a bytes object. Fix some of the codec tests. Modified: python/branches/py3k-struni/Lib/codecs.py ============================================================================== --- python/branches/py3k-struni/Lib/codecs.py (original) +++ python/branches/py3k-struni/Lib/codecs.py Fri May 4 15:05:09 2007 @@ -33,19 +33,19 @@ # # UTF-8 -BOM_UTF8 = '\xef\xbb\xbf' +BOM_UTF8 = b'\xef\xbb\xbf' # UTF-16, little endian -BOM_LE = BOM_UTF16_LE = '\xff\xfe' +BOM_LE = BOM_UTF16_LE = b'\xff\xfe' # UTF-16, big endian -BOM_BE = BOM_UTF16_BE = '\xfe\xff' +BOM_BE = BOM_UTF16_BE = b'\xfe\xff' # UTF-32, little endian -BOM_UTF32_LE = '\xff\xfe\x00\x00' +BOM_UTF32_LE = b'\xff\xfe\x00\x00' # UTF-32, big endian -BOM_UTF32_BE = '\x00\x00\xfe\xff' +BOM_UTF32_BE = b'\x00\x00\xfe\xff' if sys.byteorder == 'little': @@ -261,7 +261,7 @@ Return the current state of the decoder. This must be a (buffered_input, additional_state_info) tuple. """ - return ("", 0) + return (b"", 0) def setstate(self, state): """ @@ -278,7 +278,7 @@ def __init__(self, errors='strict'): IncrementalDecoder.__init__(self, errors) # undecoded input that is kept between calls to decode() - self.buffer = "" + self.buffer = b"" def _buffer_decode(self, input, errors, final): # Overwrite this method in subclasses: It must decode input @@ -295,7 +295,7 @@ def reset(self): IncrementalDecoder.reset(self) - self.buffer = "" + self.buffer = b"" def getstate(self): # additional state info is always 0 @@ -402,7 +402,7 @@ """ self.stream = stream self.errors = errors - self.bytebuffer = "" + self.bytebuffer = b"" # For str->str decoding this will stay a str # For str->unicode decoding the first read will promote it to unicode self.charbuffer = "" @@ -588,7 +588,7 @@ from decoding errors. """ - self.bytebuffer = "" + self.bytebuffer = b"" self.charbuffer = "" self.linebuffer = None @@ -1005,7 +1005,7 @@ output = decoder.decode(input) if output: yield output - output = decoder.decode("", True) + output = decoder.decode(b"", True) if output: yield output Modified: python/branches/py3k-struni/Lib/test/test_codecs.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_codecs.py (original) +++ python/branches/py3k-struni/Lib/test/test_codecs.py Fri May 4 15:05:09 2007 @@ -1,14 +1,14 @@ from test import test_support import unittest import codecs -import sys, StringIO, _testcapi +import sys, cStringIO, _testcapi class Queue(object): """ queue: write bytes at one end, read bytes from the other end """ - def __init__(self): - self._buffer = "" + def __init__(self, buffer): + self._buffer = buffer def write(self, chars): self._buffer += chars @@ -16,7 +16,7 @@ def read(self, size=-1): if size<0: s = self._buffer - self._buffer = "" + self._buffer = self._buffer[:0] # make empty return s else: s = self._buffer[:size] @@ -62,48 +62,48 @@ # of input to the reader byte by byte. Read every available from # the StreamReader and check that the results equal the appropriate # entries from partialresults. - q = Queue() + q = Queue(b"") r = codecs.getreader(self.encoding)(q) result = "" for (c, partialresult) in zip(input.encode(self.encoding), partialresults): - q.write(c) + q.write(bytes([c])) result += r.read() self.assertEqual(result, partialresult) # check that there's nothing left in the buffers self.assertEqual(r.read(), "") - self.assertEqual(r.bytebuffer, "") + self.assertEqual(r.bytebuffer, b"") self.assertEqual(r.charbuffer, "") # do the check again, this time using a incremental decoder d = codecs.getincrementaldecoder(self.encoding)() result = "" for (c, partialresult) in zip(input.encode(self.encoding), partialresults): - result += d.decode(c) + result += d.decode(bytes([c])) self.assertEqual(result, partialresult) # check that there's nothing left in the buffers - self.assertEqual(d.decode("", True), "") - self.assertEqual(d.buffer, "") + self.assertEqual(d.decode(b"", True), "") + self.assertEqual(d.buffer, b"") - # Check whether the rest method works properly + # Check whether the reset method works properly d.reset() result = "" for (c, partialresult) in zip(input.encode(self.encoding), partialresults): - result += d.decode(c) + result += d.decode(bytes([c])) self.assertEqual(result, partialresult) # check that there's nothing left in the buffers - self.assertEqual(d.decode("", True), "") - self.assertEqual(d.buffer, "") + self.assertEqual(d.decode(b"", True), "") + self.assertEqual(d.buffer, b"") # check iterdecode() encoded = input.encode(self.encoding) self.assertEqual( input, - "".join(codecs.iterdecode(encoded, self.encoding)) + "".join(codecs.iterdecode([bytes([c]) for c in encoded], self.encoding)) ) def test_readline(self): def getreader(input): - stream = StringIO.StringIO(input.encode(self.encoding)) + stream = cStringIO.StringIO(input.encode(self.encoding)) return codecs.getreader(self.encoding)(stream) def readalllines(input, keepends=True, size=None): @@ -215,13 +215,13 @@ ' break\r\n', ' \r\n', ] - stream = StringIO.StringIO("".join(s).encode(self.encoding)) + stream = cStringIO.StringIO("".join(s).encode(self.encoding)) reader = codecs.getreader(self.encoding)(stream) for (i, line) in enumerate(reader): self.assertEqual(line, s[i]) def test_readlinequeue(self): - q = Queue() + q = Queue(b"") writer = codecs.getwriter(self.encoding)(q) reader = codecs.getreader(self.encoding)(q) @@ -253,7 +253,7 @@ s3 = "next line.\r\n" s = (s1+s2+s3).encode(self.encoding) - stream = StringIO.StringIO(s) + stream = cStringIO.StringIO(s) reader = codecs.getreader(self.encoding)(stream) self.assertEqual(reader.readline(), s1) self.assertEqual(reader.readline(), s2) @@ -268,7 +268,7 @@ s5 = "againokay.\r\n" s = (s1+s2+s3+s4+s5).encode(self.encoding) - stream = StringIO.StringIO(s) + stream = cStringIO.StringIO(s) reader = codecs.getreader(self.encoding)(stream) self.assertEqual(reader.readline(), s1) self.assertEqual(reader.readline(), s2) @@ -280,13 +280,13 @@ class UTF16Test(ReadTest): encoding = "utf-16" - spamle = '\xff\xfes\x00p\x00a\x00m\x00s\x00p\x00a\x00m\x00' - spambe = '\xfe\xff\x00s\x00p\x00a\x00m\x00s\x00p\x00a\x00m' + spamle = b'\xff\xfes\x00p\x00a\x00m\x00s\x00p\x00a\x00m\x00' + spambe = b'\xfe\xff\x00s\x00p\x00a\x00m\x00s\x00p\x00a\x00m' def test_only_one_bom(self): _,_,reader,writer = codecs.lookup(self.encoding) # encode some stream - s = StringIO.StringIO() + s = cStringIO.StringIO() f = writer(s) f.write("spam") f.write("spam") @@ -294,16 +294,16 @@ # check whether there is exactly one BOM in it self.assert_(d == self.spamle or d == self.spambe) # try to read it back - s = StringIO.StringIO(d) + s = cStringIO.StringIO(d) f = reader(s) self.assertEquals(f.read(), "spamspam") def test_badbom(self): - s = StringIO.StringIO("\xff\xff") + s = cStringIO.StringIO(b"\xff\xff") f = codecs.getreader(self.encoding)(s) self.assertRaises(UnicodeError, f.read) - s = StringIO.StringIO("\xff\xff\xff\xff") + s = cStringIO.StringIO(b"\xff\xff\xff\xff") f = codecs.getreader(self.encoding)(s) self.assertRaises(UnicodeError, f.read) @@ -326,7 +326,7 @@ def test_errors(self): self.assertRaises(UnicodeDecodeError, codecs.utf_16_decode, - "\xff", "strict", True) + b"\xff", "strict", True) def test_decoder_state(self): self.check_state_handling_decode(self.encoding, @@ -354,7 +354,7 @@ def test_errors(self): self.assertRaises(UnicodeDecodeError, codecs.utf_16_le_decode, - "\xff", "strict", True) + b"\xff", "strict", True) class UTF16BETest(ReadTest): encoding = "utf-16-be" @@ -376,7 +376,7 @@ def test_errors(self): self.assertRaises(UnicodeDecodeError, codecs.utf_16_be_decode, - "\xff", "strict", True) + b"\xff", "strict", True) class UTF8Test(ReadTest): encoding = "utf-8" @@ -412,7 +412,7 @@ class UTF16ExTest(unittest.TestCase): def test_errors(self): - self.assertRaises(UnicodeDecodeError, codecs.utf_16_ex_decode, "\xff", "strict", 0, True) + self.assertRaises(UnicodeDecodeError, codecs.utf_16_ex_decode, b"\xff", "strict", 0, True) def test_bad_args(self): self.assertRaises(TypeError, codecs.utf_16_ex_decode) @@ -474,7 +474,7 @@ def test_bug1601501(self): # SF bug #1601501: check that the codec works with a buffer - str("\xef\xbb\xbf", "utf-8-sig") + str(b"\xef\xbb\xbf", "utf-8-sig") def test_bom(self): d = codecs.getincrementaldecoder("utf-8-sig")() @@ -492,7 +492,7 @@ class RecodingTest(unittest.TestCase): def test_recoding(self): - f = StringIO.StringIO() + f = cStringIO.StringIO() f2 = codecs.EncodedFile(f, "unicode_internal", "utf-8") f2.write("a") f2.close() @@ -856,8 +856,7 @@ self.assertEquals("pyth\xf6n.org.".encode("idna"), "xn--pythn-mua.org.") def test_stream(self): - import StringIO - r = codecs.getreader("idna")(StringIO.StringIO("abc")) + r = codecs.getreader("idna")(cStringIO.StringIO(b"abc")) r.read(3) self.assertEquals(r.read(), "") @@ -922,18 +921,18 @@ class CodecsModuleTest(unittest.TestCase): def test_decode(self): - self.assertEquals(codecs.decode('\xe4\xf6\xfc', 'latin-1'), + self.assertEquals(codecs.decode(b'\xe4\xf6\xfc', 'latin-1'), '\xe4\xf6\xfc') self.assertRaises(TypeError, codecs.decode) - self.assertEquals(codecs.decode('abc'), 'abc') - self.assertRaises(UnicodeDecodeError, codecs.decode, '\xff', 'ascii') + self.assertEquals(codecs.decode(b'abc'), 'abc') + self.assertRaises(UnicodeDecodeError, codecs.decode, b'\xff', 'ascii') def test_encode(self): self.assertEquals(codecs.encode('\xe4\xf6\xfc', 'latin-1'), - '\xe4\xf6\xfc') + b'\xe4\xf6\xfc') self.assertRaises(TypeError, codecs.encode) self.assertRaises(LookupError, codecs.encode, "foo", "__spam__") - self.assertEquals(codecs.encode('abc'), 'abc') + self.assertEquals(codecs.encode('abc'), b'abc') self.assertRaises(UnicodeEncodeError, codecs.encode, '\xffff', 'ascii') def test_register(self): @@ -965,7 +964,7 @@ def setUp(self): self.reader = codecs.getreader('utf-8') - self.stream = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') + self.stream = cStringIO.StringIO(b'\xed\x95\x9c\n\xea\xb8\x80') def test_readlines(self): f = self.reader(self.stream) @@ -974,27 +973,27 @@ class EncodedFileTest(unittest.TestCase): def test_basic(self): - f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') + f = cStringIO.StringIO(b'\xed\x95\x9c\n\xea\xb8\x80') ef = codecs.EncodedFile(f, 'utf-16-le', 'utf-8') - self.assertEquals(ef.read(), '\\\xd5\n\x00\x00\xae') + self.assertEquals(ef.read(), b'\\\xd5\n\x00\x00\xae') - f = StringIO.StringIO() + f = cStringIO.StringIO() ef = codecs.EncodedFile(f, 'utf-8', 'latin1') - ef.write('\xc3\xbc') - self.assertEquals(f.getvalue(), '\xfc') + ef.write(b'\xc3\xbc') + self.assertEquals(f.getvalue(), b'\xfc') class Str2StrTest(unittest.TestCase): def test_read(self): sin = "\x80".encode("base64_codec") - reader = codecs.getreader("base64_codec")(StringIO.StringIO(sin)) + reader = codecs.getreader("base64_codec")(cStringIO.StringIO(sin)) sout = reader.read() self.assertEqual(sout, "\x80") self.assert_(isinstance(sout, str)) def test_readline(self): sin = "\x80".encode("base64_codec") - reader = codecs.getreader("base64_codec")(StringIO.StringIO(sin)) + reader = codecs.getreader("base64_codec")(cStringIO.StringIO(sin)) sout = reader.readline() self.assertEqual(sout, "\x80") self.assert_(isinstance(sout, str)) @@ -1162,25 +1161,25 @@ elif encoding == "latin_1": name = "latin_1" self.assertEqual(encoding.replace("_", "-"), name.replace("_", "-")) - (bytes, size) = codecs.getencoder(encoding)(s) + (b, size) = codecs.getencoder(encoding)(s) if encoding != "unicode_internal": self.assertEqual(size, len(s), "%r != %r (encoding=%r)" % (size, len(s), encoding)) - (chars, size) = codecs.getdecoder(encoding)(bytes) + (chars, size) = codecs.getdecoder(encoding)(b) self.assertEqual(chars, s, "%r != %r (encoding=%r)" % (chars, s, encoding)) if encoding not in broken_unicode_with_streams: # check stream reader/writer - q = Queue() + q = Queue(b"") writer = codecs.getwriter(encoding)(q) - encodedresult = "" + encodedresult = b"" for c in s: writer.write(c) encodedresult += q.read() - q = Queue() + q = Queue(b"") reader = codecs.getreader(encoding)(q) decodedresult = "" for c in encodedresult: - q.write(c) + q.write(bytes([c])) decodedresult += reader.read() self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) @@ -1194,26 +1193,26 @@ pass else: # check incremental decoder/encoder - encodedresult = "" + encodedresult = b"" for c in s: encodedresult += encoder.encode(c) encodedresult += encoder.encode("", True) decoder = codecs.getincrementaldecoder(encoding)() decodedresult = "" for c in encodedresult: - decodedresult += decoder.decode(c) + decodedresult += decoder.decode(bytes([c])) decodedresult += decoder.decode("", True) self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) # check C API - encodedresult = "" + encodedresult = b"" for c in s: encodedresult += cencoder.encode(c) encodedresult += cencoder.encode("", True) cdecoder = _testcapi.codec_incrementaldecoder(encoding) decodedresult = "" for c in encodedresult: - decodedresult += cdecoder.decode(c) + decodedresult += cdecoder.decode(bytes([c])) decodedresult += cdecoder.decode("", True) self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) @@ -1233,14 +1232,14 @@ except LookupError: # no IncrementalEncoder pass else: - encodedresult = "".join(encoder.encode(c) for c in s) + encodedresult = b"".join(encoder.encode(c) for c in s) decoder = codecs.getincrementaldecoder(encoding)("ignore") - decodedresult = "".join(decoder.decode(c) for c in encodedresult) + decodedresult = "".join(decoder.decode(bytes([c])) for c in encodedresult) self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) - encodedresult = "".join(cencoder.encode(c) for c in s) + encodedresult = b"".join(cencoder.encode(c) for c in s) cdecoder = _testcapi.codec_incrementaldecoder(encoding, "ignore") - decodedresult = "".join(cdecoder.decode(c) for c in encodedresult) + decodedresult = "".join(cdecoder.decode(bytes([c])) for c in encodedresult) self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) def test_seek(self): @@ -1251,7 +1250,7 @@ continue if encoding in broken_unicode_with_streams: continue - reader = codecs.getreader(encoding)(StringIO.StringIO(s.encode(encoding))) + reader = codecs.getreader(encoding)(cStringIO.StringIO(s.encode(encoding))) for t in xrange(5): # Test that calling seek resets the internal codec state and buffers reader.seek(0, 0) @@ -1288,39 +1287,39 @@ def test_basics(self): s = "abc123" for encoding in all_string_encodings: - (bytes, size) = codecs.getencoder(encoding)(s) + (encoded, size) = codecs.getencoder(encoding)(s) self.assertEqual(size, len(s)) - (chars, size) = codecs.getdecoder(encoding)(bytes) + (chars, size) = codecs.getdecoder(encoding)(encoded) self.assertEqual(chars, s, "%r != %r (encoding=%r)" % (chars, s, encoding)) class CharmapTest(unittest.TestCase): def test_decode_with_string_map(self): self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "strict", "abc"), + codecs.charmap_decode(b"\x00\x01\x02", "strict", "abc"), ("abc", 3) ) self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "replace", "ab"), + codecs.charmap_decode(b"\x00\x01\x02", "replace", "ab"), ("ab\ufffd", 3) ) self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "replace", "ab\ufffe"), + codecs.charmap_decode(b"\x00\x01\x02", "replace", "ab\ufffe"), ("ab\ufffd", 3) ) self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "ignore", "ab"), + codecs.charmap_decode(b"\x00\x01\x02", "ignore", "ab"), ("ab", 3) ) self.assertEquals( - codecs.charmap_decode("\x00\x01\x02", "ignore", "ab\ufffe"), + codecs.charmap_decode(b"\x00\x01\x02", "ignore", "ab\ufffe"), ("ab", 3) ) - allbytes = "".join(chr(i) for i in xrange(256)) + allbytes = bytes(xrange(256)) self.assertEquals( codecs.charmap_decode(allbytes, "ignore", ""), ("", len(allbytes)) @@ -1328,12 +1327,12 @@ class WithStmtTest(unittest.TestCase): def test_encodedfile(self): - f = StringIO.StringIO("\xc3\xbc") + f = cStringIO.StringIO(b"\xc3\xbc") with codecs.EncodedFile(f, "latin-1", "utf-8") as ef: - self.assertEquals(ef.read(), "\xfc") + self.assertEquals(ef.read(), b"\xfc") def test_streamreaderwriter(self): - f = StringIO.StringIO("\xc3\xbc") + f = cStringIO.StringIO(b"\xc3\xbc") info = codecs.lookup("utf-8") with codecs.StreamReaderWriter(f, info.streamreader, info.streamwriter, 'strict') as srw: From mal at egenix.com Fri May 4 15:23:35 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Fri, 04 May 2007 15:23:35 +0200 Subject: [Python-checkins] Changing string constants to byte arrays ( r55119 - in python/branches/py3k-struni/Lib: codecs.py test/test_codecs.py) In-Reply-To: <20070504130514.640D01E4018@bag.python.org> References: <20070504130514.640D01E4018@bag.python.org> Message-ID: <463B33D7.9060208@egenix.com> Hi Walter, if the bytes type does turn out to be a mutable type as suggested in PEP 358, then please make sure that no code (C code in particular), relies on the constantness of these byte objects. This is especially important when it comes to codecs, since the error callback logic would allow the callback to manipulate the byte object contents and length without the codec taking note of this change. I expect there to be other places in the interpreter which would break as well. Otherwise, you end up opening the door for segfaults and easy DOS attacks on Python3. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 04 2007) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 On 2007-05-04 15:05, walter.doerwald wrote: > Author: walter.doerwald > Date: Fri May 4 15:05:09 2007 > New Revision: 55119 > > Modified: > python/branches/py3k-struni/Lib/codecs.py > python/branches/py3k-struni/Lib/test/test_codecs.py > Log: > Make the BOM constants in codecs.py bytes. > > Make the buffered input for decoders a bytes object. > From walter at livinglogic.de Fri May 4 16:29:15 2007 From: walter at livinglogic.de (=?UTF-8?B?V2FsdGVyIETDtnJ3YWxk?=) Date: Fri, 04 May 2007 16:29:15 +0200 Subject: [Python-checkins] Changing string constants to byte arrays ( r55119 - in python/branches/py3k-struni/Lib: codecs.py test/test_codecs.py) In-Reply-To: <463B33D7.9060208@egenix.com> References: <20070504130514.640D01E4018@bag.python.org> <463B33D7.9060208@egenix.com> Message-ID: <463B433B.4030506@livinglogic.de> M.-A. Lemburg wrote: > Hi Walter, > > if the bytes type does turn out to be a mutable type as suggested > in PEP 358, it is. > then please make sure that no code (C code in > particular), relies on the constantness of these byte objects. > > This is especially important when it comes to codecs, since > the error callback logic would allow the callback to manipulate > the byte object contents and length without the codec taking > note of this change. Encoding is not a problem because the error callback never sees or returns a byte object. However decoding is a problem. After the callback returns the codec has to recalculate it's variables. > I expect there to be other places in the interpreter which would > break as well. > > Otherwise, you end up opening the door for segfaults and > easy DOS attacks on Python3. True, registering an even callback could crash the interpreter. Seems we have to update all decoding functions. Servus, Walter From python-checkins at python.org Fri May 4 17:48:19 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Fri, 4 May 2007 17:48:19 +0200 (CEST) Subject: [Python-checkins] r55120 - in python/trunk/PCbuild8: _ctypes/_ctypes.vcproj _ctypes/_ctypes.vsprops _ctypes/masm64.rules pcbuild.sln Message-ID: <20070504154819.780DD1E4006@bag.python.org> Author: kristjan.jonsson Date: Fri May 4 17:48:15 2007 New Revision: 55120 Added: python/trunk/PCbuild8/_ctypes/_ctypes.vsprops python/trunk/PCbuild8/_ctypes/masm64.rules Modified: python/trunk/PCbuild8/_ctypes/_ctypes.vcproj python/trunk/PCbuild8/pcbuild.sln Log: Update the pcbuild8 solution. Straightened out the _ctypes project by using a .vsproj file and a masm64.rules file to avoid redundancy Modified: python/trunk/PCbuild8/_ctypes/_ctypes.vcproj ============================================================================== --- python/trunk/PCbuild8/_ctypes/_ctypes.vcproj (original) +++ python/trunk/PCbuild8/_ctypes/_ctypes.vcproj Fri May 4 17:48:15 2007 @@ -16,15 +16,15 @@ /> - @@ -191,7 +188,7 @@ Name="VCCustomBuildTool" /> @@ -269,7 +265,7 @@ Name="VCCustomBuildTool" /> @@ -348,7 +343,7 @@ Name="VCCustomBuildTool" /> @@ -426,7 +420,7 @@ Name="VCCustomBuildTool" /> @@ -505,7 +498,7 @@ Name="VCCustomBuildTool" /> @@ -583,7 +575,7 @@ Name="VCCustomBuildTool" /> - - - - - - - - - - - - Added: python/trunk/PCbuild8/_ctypes/_ctypes.vsprops ============================================================================== --- (empty file) +++ python/trunk/PCbuild8/_ctypes/_ctypes.vsprops Fri May 4 17:48:15 2007 @@ -0,0 +1,11 @@ + + + + Added: python/trunk/PCbuild8/_ctypes/masm64.rules ============================================================================== --- (empty file) +++ python/trunk/PCbuild8/_ctypes/masm64.rules Fri May 4 17:48:15 2007 @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PCbuild8/pcbuild.sln ============================================================================== --- python/trunk/PCbuild8/pcbuild.sln (original) +++ python/trunk/PCbuild8/pcbuild.sln Fri May 4 17:48:15 2007 @@ -2,8 +2,8 @@ # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore\pythoncore.vcproj", "{987306EC-6BAD-4440-B4FB-A699A1EE6A28}" ProjectSection(ProjectDependencies) = postProject - {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} = {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} {87AB87DB-B665-4621-A67B-878C15B93FF0} = {87AB87DB-B665-4621-A67B-878C15B93FF0} + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} = {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo\make_versioninfo.vcproj", "{2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}" @@ -16,6 +16,9 @@ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test\_ctypes_test.vcproj", "{F548A318-960A-4B37-9CD6-86B1B0E33CC8}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree\_elementtree.vcproj", "{CB025148-F0A1-4B32-A669-19EE0534136D}" ProjectSection(ProjectDependencies) = postProject From python-checkins at python.org Fri May 4 19:28:08 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Fri, 4 May 2007 19:28:08 +0200 (CEST) Subject: [Python-checkins] r55121 - python/trunk/PCbuild8/_ctypes/_ctypes.vcproj python/trunk/PCbuild8/_ctypes/_ctypes.vsprops Message-ID: <20070504172808.A306D1E4006@bag.python.org> Author: kristjan.jonsson Date: Fri May 4 19:28:06 2007 New Revision: 55121 Modified: python/trunk/PCbuild8/_ctypes/_ctypes.vcproj python/trunk/PCbuild8/_ctypes/_ctypes.vsprops Log: Minor fix of PCBuild8/_ctypes vcproj, moving include dir into the .vsprops file. Modified: python/trunk/PCbuild8/_ctypes/_ctypes.vcproj ============================================================================== --- python/trunk/PCbuild8/_ctypes/_ctypes.vcproj (original) +++ python/trunk/PCbuild8/_ctypes/_ctypes.vcproj Fri May 4 19:28:06 2007 @@ -48,7 +48,7 @@ + From mal at egenix.com Fri May 4 19:38:56 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Fri, 04 May 2007 19:38:56 +0200 Subject: [Python-checkins] [Python-Dev] Changing string constants to byte arrays ( r55119 - in python/branches/py3k-struni/Lib: codecs.py test/test_codecs.py) In-Reply-To: References: <20070504130514.640D01E4018@bag.python.org> <463B33D7.9060208@egenix.com> Message-ID: <463B6FB0.5070604@egenix.com> On 2007-05-04 18:53, Georg Brandl wrote: > M.-A. Lemburg schrieb: >> Hi Walter, >> >> if the bytes type does turn out to be a mutable type as suggested >> in PEP 358, then please make sure that no code (C code in >> particular), relies on the constantness of these byte objects. >> >> This is especially important when it comes to codecs, since >> the error callback logic would allow the callback to manipulate >> the byte object contents and length without the codec taking >> note of this change. >> >> I expect there to be other places in the interpreter which would >> break as well. >> >> Otherwise, you end up opening the door for segfaults and >> easy DOS attacks on Python3. > > If the user does not need to change these bytes objects and this is needed > in more places, adding an "immutable" flag for "internal" bytes objects > only settable from C, or even an immutable byte base class might be an idea. +1 I also suggest making all bytes literals immutable to avoid running into any issues like the above. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 04 2007) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From fdrake at acm.org Fri May 4 19:42:45 2007 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Fri, 4 May 2007 13:42:45 -0400 Subject: [Python-checkins] =?iso-8859-1?q?=5BPython-Dev=5D_Changing_string?= =?iso-8859-1?q?_constants_to_byte_arrays_=28_r55119_-_in_python/branches/?= =?iso-8859-1?q?py3k-struni/Lib=3A=09codecs=2Epy_test/test=5Fcodecs=2Epy_?= =?iso-8859-1?q?=29?= In-Reply-To: <463B6FB0.5070604@egenix.com> References: <20070504130514.640D01E4018@bag.python.org> <463B6FB0.5070604@egenix.com> Message-ID: <200705041342.46028.fdrake@acm.org> On Friday 04 May 2007, M.-A. Lemburg wrote: > I also suggest making all bytes literals immutable to avoid running > into any issues like the above. +1 from me. -Fred -- Fred L. Drake, Jr. From python-checkins at python.org Fri May 4 19:43:19 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 19:43:19 +0200 (CEST) Subject: [Python-checkins] r55122 - python/branches/py3k-struni/Python/bltinmodule.c Message-ID: <20070504174319.EC5511E401A@bag.python.org> Author: guido.van.rossum Date: Fri May 4 19:43:11 2007 New Revision: 55122 Modified: python/branches/py3k-struni/Python/bltinmodule.c Log: Add 8-bit chr() back as chr8(). Modified: python/branches/py3k-struni/Python/bltinmodule.c ============================================================================== --- python/branches/py3k-struni/Python/bltinmodule.c (original) +++ python/branches/py3k-struni/Python/bltinmodule.c Fri May 4 19:43:11 2007 @@ -378,6 +378,29 @@ static PyObject * +builtin_chr(PyObject *self, PyObject *args) +{ + long x; + char s[1]; + + if (!PyArg_ParseTuple(args, "l:chr8", &x)) + return NULL; + if (x < 0 || x >= 256) { + PyErr_SetString(PyExc_ValueError, + "chr8() arg not in range(256)"); + return NULL; + } + s[0] = (char)x; + return PyString_FromStringAndSize(s, 1); +} + +PyDoc_STRVAR(chr_doc, +"chr8(i) -> 8-bit character\n\ +\n\ +Return a string of one character with ordinal i; 0 <= i < 256."); + + +static PyObject * builtin_unichr(PyObject *self, PyObject *args) { long x; @@ -2223,6 +2246,7 @@ {"any", builtin_any, METH_O, any_doc}, {"callable", builtin_callable, METH_O, callable_doc}, {"chr", builtin_unichr, METH_VARARGS, unichr_doc}, + {"chr8", builtin_chr, METH_VARARGS, chr_doc}, {"cmp", builtin_cmp, METH_VARARGS, cmp_doc}, {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, From python-checkins at python.org Fri May 4 19:44:49 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 19:44:49 +0200 (CEST) Subject: [Python-checkins] r55123 - python/branches/py3k-struni/Lib/optparse.py Message-ID: <20070504174449.557381E4006@bag.python.org> Author: guido.van.rossum Date: Fri May 4 19:44:47 2007 New Revision: 55123 Modified: python/branches/py3k-struni/Lib/optparse.py Log: Don't use StringType -- always test for basestring. Modified: python/branches/py3k-struni/Lib/optparse.py ============================================================================== --- python/branches/py3k-struni/Lib/optparse.py (original) +++ python/branches/py3k-struni/Lib/optparse.py Fri May 4 19:44:47 2007 @@ -823,7 +823,7 @@ (True, False) = (1, 0) def isbasestring(x): - return isinstance(x, types.StringType) or isinstance(x, types.UnicodeType) + return isinstance(x, basestring) class Values: @@ -1001,7 +1001,7 @@ """add_option(Option) add_option(opt_str, ..., kwarg=val, ...) """ - if type(args[0]) is types.StringType: + if isbasestring(args[0]): option = self.option_class(*args, **kwargs) elif len(args) == 1 and not kwargs: option = args[0] @@ -1312,7 +1312,7 @@ def add_option_group(self, *args, **kwargs): # XXX lots of overlap with OptionContainer.add_option() - if type(args[0]) is types.StringType: + if isbasestring(args[0]): group = OptionGroup(self, *args, **kwargs) elif len(args) == 1 and not kwargs: group = args[0] From python-checkins at python.org Fri May 4 20:47:32 2007 From: python-checkins at python.org (facundo.batista) Date: Fri, 4 May 2007 20:47:32 +0200 (CEST) Subject: [Python-checkins] r55124 - python/branches/decimal-branch/Lib/test/decimaltestdata/trim.decTest Message-ID: <20070504184732.C4FB01E4006@bag.python.org> Author: facundo.batista Date: Fri May 4 20:47:31 2007 New Revision: 55124 Removed: python/branches/decimal-branch/Lib/test/decimaltestdata/trim.decTest Log: The trim operation was added on 5-Jul-2002, but removed on 9-Oct-2002 when normalize appeared. Deleted: /python/branches/decimal-branch/Lib/test/decimaltestdata/trim.decTest ============================================================================== --- /python/branches/decimal-branch/Lib/test/decimaltestdata/trim.decTest Fri May 4 20:47:31 2007 +++ (empty file) @@ -1,152 +0,0 @@ ------------------------------------------------------------------------- --- trim.decTest -- remove insignificant trailing zeros -- --- Copyright (c) IBM Corporation, 2003, 2007. All rights reserved. -- ------------------------------------------------------------------------- --- Please see the document "General Decimal Arithmetic Testcases" -- --- at http://www2.hursley.ibm.com/decimal for the description of -- --- these testcases. -- --- -- --- These testcases are experimental ('beta' versions), and they -- --- may contain errors. They are offered on an as-is basis. In -- --- particular, achieving the same results as the tests here is not -- --- a guarantee that an implementation complies with any Standard -- --- or specification. The tests are not exhaustive. -- --- -- --- Please send comments, suggestions, and corrections to the author: -- --- Mike Cowlishaw, IBM Fellow -- --- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- --- mfc at uk.ibm.com -- ------------------------------------------------------------------------- -version: 2.53 - -extended: 1 -precision: 9 -rounding: half_up -maxExponent: 999 -minexponent: -999 - -trmx001 trim '1' -> '1' -trmx002 trim '-1' -> '-1' -trmx003 trim '1.00' -> '1' -trmx004 trim '-1.00' -> '-1' -trmx005 trim '0' -> '0' -trmx006 trim '0.00' -> '0' -trmx007 trim '00.0' -> '0' -trmx008 trim '00.00' -> '0' -trmx009 trim '00' -> '0' - -trmx010 trim '-2' -> '-2' -trmx011 trim '2' -> '2' -trmx012 trim '-2.00' -> '-2' -trmx013 trim '2.00' -> '2' -trmx014 trim '-0' -> '-0' -trmx015 trim '-0.00' -> '-0' -trmx016 trim '-00.0' -> '-0' -trmx017 trim '-00.00' -> '-0' -trmx018 trim '-00' -> '-0' -trmx019 trim '0E+5' -> '0' -trmx020 trim '-0E+1' -> '-0' - -trmx030 trim '+0.1' -> '0.1' -trmx031 trim '-0.1' -> '-0.1' -trmx032 trim '+0.01' -> '0.01' -trmx033 trim '-0.01' -> '-0.01' -trmx034 trim '+0.001' -> '0.001' -trmx035 trim '-0.001' -> '-0.001' -trmx036 trim '+0.000001' -> '0.000001' -trmx037 trim '-0.000001' -> '-0.000001' -trmx038 trim '+0.000000000001' -> '1E-12' -trmx039 trim '-0.000000000001' -> '-1E-12' - -trmx041 trim 1.1 -> 1.1 -trmx042 trim 1.10 -> 1.1 -trmx043 trim 1.100 -> 1.1 -trmx044 trim 1.110 -> 1.11 -trmx045 trim -1.1 -> -1.1 -trmx046 trim -1.10 -> -1.1 -trmx047 trim -1.100 -> -1.1 -trmx048 trim -1.110 -> -1.11 -trmx049 trim 9.9 -> 9.9 -trmx050 trim 9.90 -> 9.9 -trmx051 trim 9.900 -> 9.9 -trmx052 trim 9.990 -> 9.99 -trmx053 trim -9.9 -> -9.9 -trmx054 trim -9.90 -> -9.9 -trmx055 trim -9.900 -> -9.9 -trmx056 trim -9.990 -> -9.99 - --- some insignificant trailing fractional zeros -trmx060 trim 10.0 -> 10 -trmx061 trim 10.00 -> 10 -trmx062 trim 100.0 -> 100 -trmx063 trim 100.00 -> 100 -trmx064 trim 1.1000E+3 -> 1100 -trmx065 trim 1.10000E+3 -> 1100 -trmx066 trim -10.0 -> -10 -trmx067 trim -10.00 -> -10 -trmx068 trim -100.0 -> -100 -trmx069 trim -100.00 -> -100 -trmx070 trim -1.1000E+3 -> -1100 -trmx071 trim -1.10000E+3 -> -1100 - --- some insignificant trailing zeros with positive exponent -trmx080 trim 10E+1 -> 1E+2 -trmx081 trim 100E+1 -> 1E+3 -trmx082 trim 1.0E+2 -> 1E+2 -trmx083 trim 1.0E+3 -> 1E+3 -trmx084 trim 1.1E+3 -> 1.1E+3 -trmx085 trim 1.00E+3 -> 1E+3 -trmx086 trim 1.10E+3 -> 1.1E+3 -trmx087 trim -10E+1 -> -1E+2 -trmx088 trim -100E+1 -> -1E+3 -trmx089 trim -1.0E+2 -> -1E+2 -trmx090 trim -1.0E+3 -> -1E+3 -trmx091 trim -1.1E+3 -> -1.1E+3 -trmx092 trim -1.00E+3 -> -1E+3 -trmx093 trim -1.10E+3 -> -1.1E+3 - --- some significant trailing zeros -trmx100 trim 11 -> 11 -trmx101 trim 10 -> 10 -trmx102 trim 10. -> 10 -trmx103 trim 1.1E+1 -> 11 -trmx104 trim 1.0E+1 -> 10 -trmx105 trim 1.10E+2 -> 110 -trmx106 trim 1.00E+2 -> 100 -trmx107 trim 1.100E+3 -> 1100 -trmx108 trim 1.000E+3 -> 1000 -trmx109 trim 1.000000E+6 -> 1000000 -trmx110 trim -11 -> -11 -trmx111 trim -10 -> -10 -trmx112 trim -10. -> -10 -trmx113 trim -1.1E+1 -> -11 -trmx114 trim -1.0E+1 -> -10 -trmx115 trim -1.10E+2 -> -110 -trmx116 trim -1.00E+2 -> -100 -trmx117 trim -1.100E+3 -> -1100 -trmx118 trim -1.000E+3 -> -1000 -trmx119 trim -1.00000E+5 -> -100000 -trmx120 trim -1.000000E+6 -> -1000000 - --- examples from decArith -trmx140 trim '2.1' -> '2.1' -trmx141 trim '-2.0' -> '-2' -trmx142 trim '1.200' -> '1.2' -trmx143 trim '-120' -> '-120' -trmx144 trim '120.00' -> '120' -trmx145 trim '0.00' -> '0' - --- utilities pass through specials without raising exceptions -trmx320 trim 'Inf' -> 'Infinity' -trmx321 trim '-Inf' -> '-Infinity' -trmx322 trim NaN -> NaN -trmx323 trim sNaN -> sNaN -trmx324 trim NaN999 -> NaN999 -trmx325 trim sNaN777 -> sNaN777 -trmx326 trim -NaN -> -NaN -trmx327 trim -sNaN -> -sNaN -trmx328 trim -NaN999 -> -NaN999 -trmx329 trim -sNaN777 -> -sNaN777 - --- Null test -trmx900 trim # -> NaN Invalid_operation From python-checkins at python.org Fri May 4 21:07:02 2007 From: python-checkins at python.org (facundo.batista) Date: Fri, 4 May 2007 21:07:02 +0200 (CEST) Subject: [Python-checkins] r55125 - in python/branches/decimal-branch/Lib: decimal.py test/test_decimal.py Message-ID: <20070504190702.CA73F1E4006@bag.python.org> Author: facundo.batista Date: Fri May 4 21:06:58 2007 New Revision: 55125 Modified: python/branches/decimal-branch/Lib/decimal.py python/branches/decimal-branch/Lib/test/test_decimal.py Log: All the new operations were added to the decimal module, with docstring and some examples, but no code. Also the corresponding name changes were added to test_decimal. Right now, all the tests that are not ok, just fail, no error. We're entering now in the phase of actually code the new operations. Modified: python/branches/decimal-branch/Lib/decimal.py ============================================================================== --- python/branches/decimal-branch/Lib/decimal.py (original) +++ python/branches/decimal-branch/Lib/decimal.py Fri May 4 21:06:58 2007 @@ -627,7 +627,7 @@ self._sign, self._int, self._exp = _string2exact(value) except ValueError: self._is_special = True - return context._raise_error(ConversionSyntax, + return context._raise_error(ConversionSyntax, "non parseable string") return self @@ -1650,7 +1650,7 @@ # # See if we need to extend precision expdiff = prec - numdigits - + # not allowing subnormal for quantize if fromQuantize and (forceExp - context.Emax) > context.prec: context._raise_error(InvalidOperation, "Quantize doesn't allow subnormal") @@ -1709,7 +1709,7 @@ context._raise_error(Rounded) context._raise_error(Inexact, 'Changed in rounding') return ans - + if len(ans._int) > origprec: context._raise_error(InvalidOperation, 'Beyond guarded precision') return NaN @@ -1801,8 +1801,13 @@ if context is None: context = getcontext() + if n._exp == 0 and n._sign == 0 and len(n._int) > context.prec: + return context._raise_error(InvalidContext) -# # FIXME: study if this finally disappears... +# # FIXME: this block code was against the new handling of Infinities +# # I think we could remove them safely, do not know what the "n.adjusted()>8" +# # actually means, so I won't be sure until all the tests passes ok. +# # . Facundo # if self._is_special or n._is_special:# or n.adjusted() > 8: # # Because the spot << doesn't work with really big exponents # if n._isinfinity() or n.adjusted() > 8: @@ -1812,9 +1817,13 @@ if ans: return ans - if not self: - if not n: + if not n: + if self: + return Decimal(1) # something ** 0 + else: return context._raise_error(InvalidOperation, '0 ** 0') + + if not self: if n._sign == 0: zero = Decimal(0) if n._iseven(): @@ -1830,39 +1839,29 @@ else: return negInf - if not n: - return Decimal(1) - - # FIXME: Reduce the following to something more readable + self_inf = self._isinfinity() + n_inf = n._isinfinity() if self == Decimal(1): - if n._isinfinity(): + if n_inf: context._raise_error(Inexact) context._raise_error(Rounded) digits = (1,)+(0,)*(context.prec-1) return Decimal((0, digits, -context.prec+1)) return Decimal(1) - if self._isinfinity() == -1 and n._isinfinity(): + if self_inf == -1 and n_inf: return context._raise_error(InvalidOperation, '-Inf ** +-Inf') - if self._isinfinity() == 1: - if n._isinfinity() == 1: - return Inf - if n._isinfinity() == -1: - return Decimal(0) - - if self._isinfinity() == 1: + + if self_inf: if modulo: return context._raise_error(InvalidOperation, 'INF % x') if not n: return Decimal(1) + if self_inf == 1: if n._sign == 1: return Decimal(0) return Inf - if self._isinfinity() == -1: - if modulo: - return context._raise_error(InvalidOperation, '-INF % x') - if not n: - return Decimal(1) + if self_inf == -1: if abs(n) < 1: return context._raise_error(InvalidOperation, '-INF ** -1 1: return Decimal(0) else: @@ -2052,7 +2049,7 @@ return context._raise_error(InvalidOperation, 'rescale(a, INF)') return tmp - def to_integral(self, rounding=None, context=None): + def to_integral_value(self, rounding=None, context=None): """Rounds to the nearest integer, without raising inexact, rounded.""" if self._is_special: ans = self._check_nans(context=context) @@ -2067,6 +2064,9 @@ context._regard_flags(flags) return ans + # the method name changed, but we provide also the old one, for compatibility + to_integral = to_integral_value + def sqrt(self, context=None): """Return the square root of self. @@ -2309,6 +2309,154 @@ except TypeError: return 0 + def canonical(self, context=None): + """Returns the same Decimal object. + + As we do not have different encodings for the same number, the + received object already is in it's canonical form. + """ + + def compare_signal(self, other, context=None): + """Compares self to the other operand numerically. + + It's pretty much like compare(), but all NaNs signal, with signaling + NaNs taking precedence over quiet NaNs. + """ + + def compare_total(self, other, context=None): + """Compares self to other using the abstract representations. + + This is not like the standard compare, which use their numerical + value. Note that a total ordering is defined for all possible abstract + representations. + """ + + def compare_total_mag (self, other, context=None): + """Compares self to other using abstract repr., ignoring sign. + + Like compare_total, but with operand's sign ignored and assumed to be 0. + """ + + def copy_abs(self, context=None): + """Returns a copy with the sign set to 0. """ + + def copy_negate(self, context=None): + """Returns a copy with the sign inverted.""" + + def copy_sign(self, other, context=None): + """Returns self with the sign of other.""" + + def exp(self, context=None): + """Returns e ** self.""" + + def is_canonical(self, context=None): + """Returns 1 if self is canonical; otherwise returns 0.""" + + def is_finite(self, context=None): + """Returns 1 if self is finite, otherwise returns 0. + + For it to be finite, it must be neither infinite nor a NaN. + """ + + def is_infinite(self, context=None): + """Returns 1 if self is an Infinite, otherwise returns 0.""" + + def is_nan(self, context=None): + """Returns 1 if self is qNaN or sNaN, otherwise returns 0.""" + + def is_normal(self, context=None): + """Returns 1 if self is a normal number, otherwise returns 0.""" + + def is_qnan(self, context=None): + """Returns 1 if self is a quiet NaN, otherwise returns 0.""" + + def is_signed(self, context=None): + """Returns 1 if self is negative, otherwise returns 0.""" + + def is_snan(self, context=None): + """Returns 1 if self is a signaling NaN, otherwise returns 0.""" + + def is_subnormal(self, context=None): + """Returns 1 if self is subnormal, otherwise returns 0.""" + + def is_zero(self, context=None): + """Returns 1 if self is a zero, otherwise returns 0.""" + + def ln(self, context=None): + """Returns the natural (base e) logarithm of self.""" + + def log10(self, context=None): + """Returns the base 10 logarithm of self.""" + + def logb(self, context=None): + """ Returns the exponent of the magnitude of self's MSD. + + The result is the integer which is the exponent of the magnitude + of the most significant digit of self (as though it were truncated + to a single digit while maintaining the value of that digit and + without limiting the resulting exponent). + """ + + def logical_and(self, other, context=None): + """Applies an 'and' operation between self and other's digits.""" + + def logical_invert(self, context=None): + """Invert all its digits.""" + + def logical_or(self, other, context=None): + """Applies an 'or' operation between self and other's digits.""" + + def logical_xor(self, other, context=None): + """Applies an 'xor' operation between self and other's digits.""" + + def max_mag(self, other, context=None): + """Compares the values numerically with their sign ignored.""" + + def min_mag(self, other, context=None): + """Compares the values numerically with their sign ignored.""" + + def next_minus(self, context=None): + """Returns the largest representable number smaller than itself.""" + + def next_plus(self, context=None): + """Returns the smallest representable number larger than itself.""" + + def next_toward(self, other, context=None): + """Returns the number closest to itself, in direction towards other. + + The result is the closest to self representable number (but not + self) that is in the direction towards other, unless the both have + the same value. + """ + + def number_class(self, context=None): + """Returns an indication of the class of self. + + The class is one of the following strings: + -sNaN + -NaN + -Infinity + -Normal + -Subnormal + -Zero + +Zero + +Subnormal + +Normal + +Infinity + """ + + def radix(self, context=None): + """Just returns 10, as this is Decimal, :)""" + return Decimal(10) + + def rotate(self, other, context=None): + """Returns a rotated copy of self, value-of-other times.""" + + def scaleb (self, other, context=None): + """Returns self operand after adding the second value to its exp.""" + + def shift(self, other, context=None): + """Returns a shifted copy of self, value-of-other times.""" # Support for pickling, copy, and deepcopy def __reduce__(self): return (self.__class__, (str(self),)) @@ -2557,6 +2705,17 @@ def _apply(self, a): return str(a._fix(self)) + def canonical(self, a): + """Returns the same Decimal object. + + As we do not have different encodings for the same number, the + received object already is in it's canonical form. + + >>> ExtendedContext.canonical(Decimal('2.50')) + Decimal('2.50') + """ + return a.canonical(context=self) + def compare(self, a, b): """Compares values numerically. @@ -2586,6 +2745,90 @@ """ return a.compare(b, context=self) + def compare_signal(self, a, b): + """Compares the values of the two operands numerically. + + It's pretty much like compare(), but all NaNs signal, with signaling + NaNs taking precedence over quiet NaNs. + """ + return a.compare_signal(b, context=self) + + def compare_total(self, a, b): + """Compares two operands using their abstract representation. + + This is not like the standard compare, which use their numerical + value. Note that a total ordering is defined for all possible abstract + representations. + + >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9')) + Decimal('-1') + >>> ExtendedContext.compare_total(Decimal('-127'), Decimal('12')) + Decimal('-1') + >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3')) + Decimal('-1') + >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30')) + Decimal('0') + >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('12.300')) + Decimal('1') + >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('NaN')) + Decimal('-1') + """ + return a.compare_total(b, context=self) + + def compare_total_mag (self, a, b): + """Compares two operands using their abstract representation ignoring sign. + + Like compare_total, but with operand's sign ignored and assumed to be 0. + """ + return a.compare_total_mag (b, context=self) + + def copy_abs(self, a): + """Returns a copy of the operand with the sign set to 0. + + >>> ExtendedContext.copy_abs(Decimal('2.1')) + Decimal('2.1') + >>> ExtendedContext.copy_abs(Decimal('-100')) + Decimal('100') + """ + return a.copy_abs(context=self) + + def copy_decimal(self, a): + """Returns a copy of the decimal objet. + + >>> ExtendedContext.copy_decimal(Decimal('2.1')) + Decimal('2.1') + >>> ExtendedContext.copy_decimal(Decimal('-1.00')) + Decimal('-1.00') + """ + return a + + def copy_negate(self, a): + """Returns a copy of the operand with the sign inverted. + + >>> ExtendedContext.copy_negate(Decimal('101.5')) + Decimal('-101.5') + >>> ExtendedContext.copy_negate(Decimal('-101.5')) + Decimal('101.5') + """ + return a.copy_negate(context=self) + + def copy_sign(self, a, b): + """Copys the second operand's sign to the first one. + + In detail, it returns a copy of the first operand with the sign + equal to the sign of the second operand. + + >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33')) + Decimal('1.50') + >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33')) + Decimal('1.50') + >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33')) + Decimal('-1.50') + >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33')) + Decimal('-1.50') + """ + return a.copy_sign(b, context=self) + def divide(self, a, b): """Decimal division in a specified context. @@ -2627,6 +2870,300 @@ def divmod(self, a, b): return a.__divmod__(b, context=self) + def exp(self, a): + """Returns e ** a. + + >>> ExtendedContext.exp(Decimal('-Infinity')) + Decimal('0') + >>> ExtendedContext.exp(Decimal('-1')) + Decimal('0.367879441') + >>> ExtendedContext.exp(Decimal('0')) + Decimal('1') + >>> ExtendedContext.exp(Decimal('1')) + Decimal('2.71828183') + >>> ExtendedContext.exp(Decimal('0.693147181')) + Decimal('2.00000000') + >>> ExtendedContext.exp(Decimal('+Infinity')) + Decimal('Inf') + """ + return a.exp(context=self) + + def fma(self, a, b, c): + """Returns a multiplied by b, plus c. + + The first two operands are multiplied together, using multiply, + the third operand is then added to the result of that + multiplication, using add, all with only one final rounding. + + >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7')) + Decimal('22') + >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7')) + Decimal('-8') + >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578')) + Decimal('1.38435736E+12') + """ + + def is_canonical(self, a): + """Returns 1 if the operand is canonical; otherwise returns 0. + + >>> ExtendedContext.is_canonical(Decimal('2.50')) + Decimal('1') + """ + return a.is_canonical(context=self) + + def is_finite(self, a): + """Returns 1 if the operand is finite, otherwise returns 0. + + For it to be finite, it must be neither infinite nor a NaN. + + >>> ExtendedContext.is_finite(Decimal('2.50')) + Decimal('1') + >>> ExtendedContext.is_finite(Decimal('-0.3')) + Decimal('1') + >>> ExtendedContext.is_finite(Decimal('0')) + Decimal('1') + >>> ExtendedContext.is_finite(Decimal('Inf')) + Decimal('0') + >>> ExtendedContext.is_finite(Decimal('NaN')) + Decimal('0') + """ + return a.is_finite(context=self) + + def is_infinite(self, a): + """Returns 1 if the operand is an Infinite, otherwise returns 0. + + >>> ExtendedContext.is_infinite(Decimal('2.50')) + Decimal('0') + >>> ExtendedContext.is_infinite(Decimal('-Inf')) + Decimal('1') + >>> ExtendedContext.is_infinite(Decimal('NaN')) + Decimal('0') + """ + return a.is_infinite(context=self) + + def is_nan(self, a): + """Returns 1 if the operand is qNaN or sNaN, otherwise returns 0. + + >>> ExtendedContext.is_nan(Decimal('2.50')) + Decimal('0') + >>> ExtendedContext.is_nan(Decimal('NaN')) + Decimal('1') + >>> ExtendedContext.is_nan(Decimal('-sNaN')) + Decimal('1') + """ + return a.is_nan(context=self) + + def is_normal(self, a): + """Returns 1 if the operand is a normal number, otherwise returns 0. + + >>> ExtendedContext.is_normal(Decimal('2.50')) + Decimal('1') + >>> ExtendedContext.is_normal(Decimal('0.1E-999')) + Decimal('0') + >>> ExtendedContext.is_normal(Decimal('0.00')) + Decimal('0') + >>> ExtendedContext.is_normal(Decimal('-Inf')) + Decimal('0') + >>> ExtendedContext.is_normal(Decimal('NaN')) + Decimal('0') + """ + return a.is_normal(context=self) + + def is_qnan(self, a): + """Returns 1 if the operand is a quiet NaN, otherwise returns 0. + + >>> ExtendedContext.is_qnan(Decimal('2.50')) + Decimal('0') + >>> ExtendedContext.is_qnan(Decimal('NaN')) + Decimal('1') + >>> ExtendedContext.is_qnan(Decimal('sNaN')) + Decimal('0') + """ + return a.is_qnan(context=self) + + def is_signed(self, a): + """Returns 1 if the operand is negative, otherwise returns 0. + + >>> ExtendedContext.is_signed(Decimal('2.50')) + Decimal('0') + >>> ExtendedContext.is_signed(Decimal('-12')) + Decimal('1') + >>> ExtendedContext.is_signed(Decimal('-0')) + Decimal('1') + """ + return a.is_signed(context=self) + + def is_snan(self, a): + """Returns 1 if the operand is a signaling NaN, otherwise returns 0. + + >>> ExtendedContext.is_snan(Decimal('2.50')) + Decimal('0') + >>> ExtendedContext.is_snan(Decimal('NaN')) + Decimal('0') + >>> ExtendedContext.is_snan(Decimal('sNaN')) + Decimal('1') + """ + return a.is_snan(context=self) + + def is_subnormal(self, a): + """Returns 1 if the operand is subnormal, otherwise returns 0. + + >>> ExtendedContext.is_subnormal(Decimal('2.50')) + Decimal('0') + >>> ExtendedContext.is_subnormal(Decimal('0.1E-999')) + Decimal('1') + >>> ExtendedContext.is_subnormal(Decimal('0.00')) + Decimal('0') + >>> ExtendedContext.is_subnormal(Decimal('-Inf')) + Decimal('0') + >>> ExtendedContext.is_subnormal(Decimal('NaN')) + Decimal('0') + """ + return a.is_subnormal(context=self) + + def is_zero(self, a): + """Returns 1 if the operand is a zero, otherwise returns 0. + + >>> ExtendedContext.is_zero(Decimal('0')) + Decimal('1') + >>> ExtendedContext.is_zero(Decimal('2.50')) + Decimal('0') + >>> ExtendedContext.is_zero(Decimal('-0E+2')) + Decimal('1') + """ + return a.is_zero(context=self) + + def ln(self, a): + """Returns the natural (base e) logarithm of the operand. + + >>> ExtendedContext.ln(Decimal('0')) + Decimal('-Inf') + >>> ExtendedContext.ln(Decimal('1.000')) + Decimal('0') + >>> ExtendedContext.ln(Decimal('2.71828183')) + Decimal('1.00000000') + >>> ExtendedContext.ln(Decimal('10')) + Decimal('2.30258509') + >>> ExtendedContext.ln(Decimal('+Infinity')) + Decimal('Inf') + """ + return a.ln(context=self) + + def log10(self, a): + """Returns the base 10 logarithm of the operand. + + >>> ExtendedContext.log10(Decimal('0')) + Decimal('-In') + >>> ExtendedContext.log10(Decimal('0.001')) + Decimal('-3') + >>> ExtendedContext.log10(Decimal('1.000')) + Decimal('0') + >>> ExtendedContext.log10(Decimal('2')) + Decimal('0.301029996') + >>> ExtendedContext.log10(Decimal('10')) + Decimal('1') + >>> ExtendedContext.log10(Decimal('70')) + Decimal('1.84509804') + >>> ExtendedContext.log10(Decimal('+Infinity')) + Decimal('Inf') + """ + return a.log10(context=self) + + def logb(self, a): + """ Returns the exponent of the magnitude of the operand's MSD. + + The result is the integer which is the exponent of the magnitude + of the most significant digit of the operand (as though the + operand were truncated to a single digit while maintaining the + value of that digit and without limiting the resulting exponent). + + >>> ExtendedContext.logb(Decimal('250')) + Decimal('2') + >>> ExtendedContext.logb(Decimal('2.50')) + Decimal('0') + >>> ExtendedContext.logb(Decimal('0.03')) + Decimal('-2') + >>> ExtendedContext.logb(Decimal('0')) + Decimal('-Inf') + """ + return a.logb(context=self) + + def logical_and(self, a, b): + """Applies the logical operation 'and' between each operand's digits. + + The operands must be both logical numbers. + + >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0')) + Decimal('0') + >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1')) + Decimal('0') + >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0')) + Decimal('0') + >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1')) + Decimal('1') + >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010')) + Decimal('1000') + >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10')) + Decimal('10') + """ + return a.logical_and(b, context=self) + + def logical_invert(self, a): + """Invert all the digits in the operand. + + The operand must be a logical number. + + >>> ExtendedContext.logical_invert(Decimal('0')) + Decimal('111111111') + >>> ExtendedContext.logical_invert(Decimal('1')) + Decimal('111111110') + >>> ExtendedContext.logical_invert(Decimal('111111111')) + Decimal('0') + >>> ExtendedContext.logical_invert(Decimal('101010101')) + Decimal('10101010') + """ + return a.logical_invert(context=self) + + def logical_or(self, a, b): + """Applies the logical operation 'or' between each operand's digits. + + The operands must be both logical numbers. + + >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0')) + Decimal('0') + >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1')) + Decimal('1') + >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0')) + Decimal('1') + >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1')) + Decimal('1') + >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010')) + Decimal('1110') + >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10')) + Decimal('1110') + """ + return a.logical_or(b, context=self) + + def logical_xor(self, a, b): + """Applies the logical operation 'xor' between each operand's digits. + + The operands must be both logical numbers. + + >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) + Decimal('0') + >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) + Decimal('1') + >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0')) + Decimal('1') + >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1')) + Decimal('0') + >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010')) + Decimal('110') + >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10')) + Decimal('1101') + """ + return a.logical_xor(b, context=self) + def max(self, a,b): """max compares two values numerically and returns the maximum. @@ -2647,6 +3184,10 @@ """ return a.max(b, context=self) + def max_mag(self, a, b): + """Compares the values numerically with their sign ignored.""" + return a.max_mag(b, context=self) + def min(self, a,b): """min compares two values numerically and returns the minimum. @@ -2667,6 +3208,10 @@ """ return a.min(b, context=self) + def min_mag(self, a, b): + """Compares the values numerically with their sign ignored.""" + return a.min_mag(b, context=self) + def minus(self, a): """Minus corresponds to unary prefix minus in Python. @@ -2702,6 +3247,59 @@ """ return a.__mul__(b, context=self) + def next_minus(self, a): + """Returns the largest representable number smaller than a. + + >>> ExtendedContext.next_minus(Decimal('1')) + Decimal('0.999999999') + >>> ExtendedContext.next_minus(Decimal('1E-1007')) + Decimal('0E-1007') + >>> ExtendedContext.next_minus(Decimal('-1.00000003')) + Decimal('-1.00000004') + >>> ExtendedContext.next_minus(Decimal('Infinity')) + Decimal('9.99999999E+999') + """ + return a.next_minus(context=self) + + def next_plus(self, a): + """Returns the smallest representable number larger than a. + + >>> ExtendedContext.next_plus(Decimal('1')) + Decimal('1.00000001') + >>> ExtendedContext.next_plus(Decimal('-1E-1007')) + Decimal('-0E-1007') + >>> ExtendedContext.next_plus(Decimal('-1.00000003')) + Decimal('-1.00000002') + >>> ExtendedContext.next_plus(Decimal('-Infinity')) + Decimal('-9.99999999E+999') + """ + return a.next_plus(context=self) + + def next_toward(self, a, b): + """Returns the number closest to a, in direction towards b. + + The result is the closest representable number from the first + operand (but not the first operand) that is in the direction + towards the second operand, unless the operands have the same + value. + + >>> ExtendedContext.next_toward(Decimal('1'), Decimal('2')) + Decimal('1.00000001') + >>> ExtendedContext.next_toward(Decimal('-1E-1007'), Decimal('1')) + Decimal('-0E-1007') + >>> ExtendedContext.next_toward(Decimal('-1.00000003'), Decimal('0')) + Decimal('-1.00000002') + >>> ExtendedContext.next_toward(Decimal('1'), Decimal('0')) + Decimal('0.999999999') + >>> ExtendedContext.next_toward(Decimal('1E-1007'), Decimal('-100')) + Decimal('0E-1007') + >>> ExtendedContext.next_toward(Decimal('-1.00000003'), Decimal('-10')) + Decimal('-1.00000004') + >>> ExtendedContext.next_toward(Decimal('0.00'), Decimal('-0.0000')) + Decimal('-0.00') + """ + return a.next_toward(b, context=self) + def normalize(self, a): """normalize reduces an operand to its simplest form. @@ -2723,6 +3321,50 @@ """ return a.normalize(context=self) + def number_class(self, a): + """Returns an indication of the class of the operand. + + The class is one of the following strings: + -sNaN + -NaN + -Infinity + -Normal + -Subnormal + -Zero + +Zero + +Subnormal + +Normal + +Infinity + + >>> ExtendedContext.number_class(Decimal('Infinity')) + "+Infinity" + >>> ExtendedContext.number_class(Decimal('1E-10')) + "+Normal" + >>> ExtendedContext.number_class(Decimal('2.50')) + "+Normal" + >>> ExtendedContext.number_class(Decimal('0.1E-999')) + "+Subnormal" + >>> ExtendedContext.number_class(Decimal('0')) + "+Zero" + >>> ExtendedContext.number_class(Decimal('-0')) + "-Zero" + >>> ExtendedContext.number_class(Decimal('-0.1E-999')) + "-Subnormal" + >>> ExtendedContext.number_class(Decimal('-1E-10')) + "-Normal" + >>> ExtendedContext.number_class(Decimal('-2.50')) + "-Normal" + >>> ExtendedContext.number_class(Decimal('-Infinity')) + "-Infinity" + >>> ExtendedContext.number_class(Decimal('NaN')) + "NaN" + >>> ExtendedContext.number_class(Decimal('-NaN')) + "NaN" + >>> ExtendedContext.number_class(Decimal('sNaN')) + "sNaN" + """ + return a.number_class(context=self) + def plus(self, a): """Plus corresponds to unary prefix plus in Python. @@ -2748,7 +3390,7 @@ 1) before use. If the increased precision needed for the intermediate calculations - exceeds the capabilities of the implementation then an Invalid + exceeds the capabilities of the implementation then an Invalid operation condition is raised. If, when raising to a negative power, an underflow occurs during the @@ -2837,12 +3479,20 @@ """ return a.quantize(b, context=self) + def radix(self): + """Just returns 10, as this is Decimal, :) + + >>> ExtendedContext.radix() + Decimal('10') + """ + return Decimal(10) + def remainder(self, a, b): """Returns the remainder from integer division. The result is the residue of the dividend after the operation of calculating integer division as described for divide-integer, rounded - to precision digits if necessary. The sign of the result, if + to precision digits if necessary. The sign of the result, if non-zero, is the same as that of the original dividend. This operation will fail under the same conditions as integer division @@ -2891,6 +3541,28 @@ """ return a.remainder_near(b, context=self) + def rotate(self, a, b): + """Returns a rotated copy of a, b times. + + The coefficient of the result is a rotated copy of the digits in + the coefficient of the first operand. The number of places of + rotation is taken from the absolute value of the second operand, + with the rotation being to the left if the second operand is + positive or to the right otherwise. + + >>> ExtendedContext.rotate(Decimal('34'), Decimal('8')) + Decimal('400000003') + >>> ExtendedContext.rotate(Decimal('12'), Decimal('9')) + Decimal('12') + >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2')) + Decimal('891234567') + >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0')) + Decimal('123456789') + >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2')) + Decimal('345678912') + """ + return a.rotate(b, context=self) + def same_quantum(self, a, b): """Returns True if the two operands have the same exponent. @@ -2908,6 +3580,41 @@ """ return a.same_quantum(b) + def scaleb (self, a, b): + """Returns the first operand after adding the second value its exp. + + >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2')) + Decimal('0.0750') + >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0')) + Decimal('7.50') + >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3')) + Decimal('7.50E+3') + """ + return a.scaleb (b, context=self) + + def shift(self, a, b): + """Returns a shifted copy of a, b times. + + The coefficient of the result is a shifted copy of the digits + in the coefficient of the first operand. The number of places + to shift is taken from the absolute value of the second operand, + with the shift being to the left if the second operand is + positive or to the right otherwise. Digits shifted into the + coefficient are zeros. + + >>> ExtendedContext.shift(Decimal('34'), Decimal('8')) + Decimal('400000000') + >>> ExtendedContext.shift(Decimal('12'), Decimal('9')) + Decimal('0') + >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2')) + Decimal('1234567') + >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0')) + Decimal('123456789') + >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2')) + Decimal('345678900') + """ + return a.shift(b, context=self) + def sqrt(self, a): """Square root of a non-negative number to context precision. @@ -2965,7 +3672,35 @@ a = self._raise_error(ConversionSyntax) return a.__str__(context=self) - def to_integral(self, a): + def to_integral_exact(self, a): + """Rounds to an integer. + + When the operand has a negative exponent, the result is the same + as using the quantize() operation using the given operand as the + left-hand-operand, 1E+0 as the right-hand-operand, and the precision + of the operand as the precision setting; Inexact and Rounded flags + are allowed in this operation. The rounding mode is taken from the + context. + + >>> ExtendedContext.to_integral_exact(Decimal('2.1')) + Decimal('2') + >>> ExtendedContext.to_integral_exact(Decimal('100')) + Decimal('100') + >>> ExtendedContext.to_integral_exact(Decimal('100.0')) + Decimal('100') + >>> ExtendedContext.to_integral_exact(Decimal('101.5')) + Decimal('102') + >>> ExtendedContext.to_integral_exact(Decimal('-101.5')) + Decimal('-102') + >>> ExtendedContext.to_integral_exact(Decimal('10E+5')) + Decimal('1.0E+6') + >>> ExtendedContext.to_integral_exact(Decimal('7.89E+77')) + Decimal('7.89E+77') + >>> ExtendedContext.to_integral_exact(Decimal('-Inf')) + Decimal('-Infinity') + """ + + def to_integral_value(self, a): """Rounds to an integer. When the operand has a negative exponent, the result is the same @@ -2974,24 +3709,27 @@ of the operand as the precision setting, except that no flags will be set. The rounding mode is taken from the context. - >>> ExtendedContext.to_integral(Decimal('2.1')) + >>> ExtendedContext.to_integral_value(Decimal('2.1')) Decimal("2") - >>> ExtendedContext.to_integral(Decimal('100')) + >>> ExtendedContext.to_integral_value(Decimal('100')) Decimal("100") - >>> ExtendedContext.to_integral(Decimal('100.0')) + >>> ExtendedContext.to_integral_value(Decimal('100.0')) Decimal("100") - >>> ExtendedContext.to_integral(Decimal('101.5')) + >>> ExtendedContext.to_integral_value(Decimal('101.5')) Decimal("102") - >>> ExtendedContext.to_integral(Decimal('-101.5')) + >>> ExtendedContext.to_integral_value(Decimal('-101.5')) Decimal("-102") - >>> ExtendedContext.to_integral(Decimal('10E+5')) + >>> ExtendedContext.to_integral_value(Decimal('10E+5')) Decimal("1.0E+6") - >>> ExtendedContext.to_integral(Decimal('7.89E+77')) + >>> ExtendedContext.to_integral_value(Decimal('7.89E+77')) Decimal("7.89E+77") - >>> ExtendedContext.to_integral(Decimal('-Inf')) + >>> ExtendedContext.to_integral_value(Decimal('-Inf')) Decimal("-Infinity") """ - return a.to_integral(context=self) + return a.to_integral_value(context=self) + + # the method name changed, but we provide also the old one, for compatibility + to_integral = to_integral_value class _WorkRep(object): __slots__ = ('sign','int','exp') @@ -3048,7 +3786,7 @@ if numdigits > (other_len + prec + 1 - tmp_len): # If the difference in adjusted exps is > prec+1, we know # other is insignificant, so might as well put a 1 after the - # precision (since this is only for addition). Also stops + # precision (since this is only for addition). Also stops # use of massive longs. extend = prec + 2 - tmp_len @@ -3216,7 +3954,7 @@ def _string2exact(s): """Return sign, n, p s.t. - + Float string value == -1**sign * n * 10**p exactly """ m = _parser(s) Modified: python/branches/decimal-branch/Lib/test/test_decimal.py ============================================================================== --- python/branches/decimal-branch/Lib/test/test_decimal.py (original) +++ python/branches/decimal-branch/Lib/test/test_decimal.py Fri May 4 21:06:58 2007 @@ -99,11 +99,28 @@ nameAdapter = {'toeng':'to_eng_string', 'tosci':'to_sci_string', 'samequantum':'same_quantum', - 'tointegral':'to_integral', + 'tointegral':'to_integral_value', + 'tointegralx':'to_integral_exact', 'remaindernear':'remainder_near', 'divideint':'divide_int', 'squareroot':'sqrt', 'apply':'_apply', + 'class':'number_class', + 'comparetotal':'compare_total', + 'comparetotmag':'compare_total_mag', + 'copyabs':'copy_abs', + 'copy':'copy_decimal', + 'copynegate':'copy_negate', + 'copysign':'copy_sign', + 'and':'logical_and', + 'or':'logical_or', + 'xor':'logical_xor', + 'invert':'logical_invert', + 'maxmag':'max_mag', + 'minmag':'min_mag', + 'nextminus':'next_minus', + 'nextplus':'next_plus', + 'nexttoward':'next_toward', } class DecimalTest(unittest.TestCase): @@ -948,7 +965,7 @@ d1 = Decimal('-25e55') b1 = Decimal('-25e55') - d2 = Decimal('33e-33') + d2 = Decimal('33e+33') b2 = Decimal('33e-33') def checkSameDec(operation, useOther=False): From python-checkins at python.org Fri May 4 21:26:31 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 May 2007 21:26:31 +0200 (CEST) Subject: [Python-checkins] r55126 - peps/trunk/pep-3125.txt Message-ID: <20070504192631.474531E4013@bag.python.org> Author: georg.brandl Date: Fri May 4 21:26:28 2007 New Revision: 55126 Modified: peps/trunk/pep-3125.txt Log: Updated PEP 3125 from Jim Jewett. Modified: peps/trunk/pep-3125.txt ============================================================================== --- peps/trunk/pep-3125.txt (original) +++ peps/trunk/pep-3125.txt Fri May 4 21:26:28 2007 @@ -5,99 +5,236 @@ Author: Jim J. Jewett Status: Draft Type: Standards Track -Content-Type: text/plain +Content-Type: text/x-rst Created: 29-Apr-2007 -Post-History: 29-Apr-2007, 30-Apr-2007 +Post-History: 29-Apr-2007, 30-Apr-2007, 04-May-2007 Abstract +======== + +Python initially inherited its parsing from C. While this has been +generally useful, there are some remnants which have been less useful +for Python, and should be eliminated. + +This PEP proposes elimination of terminal ``\`` as a marker for line +continuation. + + +Motivation +========== + +One goal for Python 3000 should be to simplify the language by +removing unnecessary or duplicated features. There are currently +several ways to indicate that a logical line is continued on the +following physical line. + +The other continuation methods are easily explained as a logical +consequence of the semantics they provide; ``\`` is simply an escape +character that needs to be memorized. + + +Existing Line Continuation Methods +================================== + + +Parenthetical Expression - ``([{}])`` +------------------------------------- + +Open a parenthetical expression. It doesn't matter whether people +view the "line" as continuing; they do immediately recognize that the +expression needs to be closed before the statement can end. + +Examples using each of ``()``, ``[]``, and ``{}``:: + + def fn(long_argname1, + long_argname2): + settings = {"background": "random noise", + "volume": "barely audible"} + restrictions = ["Warrantee void if used", + "Notice must be received by yesterday", + "Not responsible for sales pitch"] + +Note that it is always possible to parenthesize an expression, but it +can seem odd to parenthesize an expression that needs parentheses only +for the line break:: + + assert val>4, ( + "val is too small") + + +Triple-Quoted Strings +--------------------- + +Open a triple-quoted string; again, people recognize that the string +needs to finish before the next statement starts. + + banner_message = """ + Satisfaction Guaranteed, + or DOUBLE YOUR MONEY BACK!!! + - Python initially inherited its parsing from C. While this has - been generally useful, there are some remnants which have been - less useful for python, and should be eliminated. - This PEP proposes elimination of terminal "\" as a marker for - line continuation. - -Rationale for Removing Explicit Line Continuation - A terminal "\" indicates that the logical line is continued on the - following physical line (after whitespace). + some minor restrictions apply""" - Note that a non-terminal "\" does not have this meaning, even if the - only additional characters are invisible whitespace. (Python depends - heavily on *visible* whitespace at the beginning of a line; it does - not otherwise depend on *invisible* terminal whitespace.) Adding - whitespace after a "\" will typically cause a syntax error rather - than a silent bug, but it still isn't desirable. - The reason to keep "\" is that occasionally code looks better with - a "\" than with a () pair. +Terminal ``\`` in the general case +---------------------------------- - assert True, ( - "This Paren is goofy") +A terminal ``\`` indicates that the logical line is continued on the +following physical line (after whitespace). There are no particular +semantics associated with this. This form is never required, although +it may look better (particularly for people with a C language +background) in some cases:: - But realistically, that parenthesis is no worse than a "\". The - only advantage of "\" is that it is slightly more familiar to users of - C-based languages. These same languages all also support line - continuation with (), so reading code will not be a problem, and - there will be one less rule to learn for people entirely new to - programming. + >>> assert val>4, \ + "val is too small" +Also note that the ``\`` must be the final character in the line. If +your editor navigation can add whitespace to the end of a line, that +invisible change will alter the semantics of the program. +Fortunately, the typical result is only a syntax error, rather than a +runtime bug:: -Alternate proposal + >>> assert val>4, \ + "val is too small" - Several people have suggested alternative ways of marking the line - end. Most of these were rejected for not actually simplifying things. + SyntaxError: unexpected character after line continuation character - The one exception was to let any unfished expression signify a line - continuation, possibly in conjunction with increased indentation +This PEP proposes to eliminate this redundant and potentially +confusing alternative. - assert True, # comma implies tuple implies continue - "No goofy parens" - The objections to this are: +Terminal ``\`` within a string +------------------------------ + +A terminal ``\`` within a single-quoted string, at the end of the +line. This is arguably a special case of the terminal ``\``, but it +is a special case that may be worth keeping. - - The amount of whitespace may be contentious; expression - continuation should not be confused with opening a new - suite. + >>> "abd\ + def" + 'abd def' - - The "expression continuation" markers are not as clearly marked - in Python as the grouping punctuation "(), [], {}" marks are. +* Pro: Many of the objections to removing ``\`` termination were + really just objections to removing it within literal strings; + several people clarified that they want to keep this literal-string + usage, but don't mind losing the general case. - "abc" + # Plus needs another operand, so it continues - "def" +* Pro: The use of ``\`` for an escape character within strings is well + known. - "abc" # String ends an expression, so - + "def" # this is a syntax error. +* Contra: But note that this particular usage is odd, because the + escaped character (the newline) is invisible, and the special + treatment is to delete the character. That said, the ``\`` of + ``\(newline)`` is still an escape which changes the meaning of the + following character. - - Guido says so. [1] His reasoning is that it may not even be - feasible. (See next reason.) - - As a technical concern, supporting this would require allowing - INDENT or DEDENT tokens anywhere, or at least in a widely - expanded (and ill-defined) set of locations. While this is - in some sense a concern only for the internal parsing - implementation, it would be a major new source of complexity. [1] +Alternate Proposals +=================== + +Several people have suggested alternative ways of marking the line +end. Most of these were rejected for not actually simplifying things. + +The one exception was to let any unfinished expression signify a line +continuation, possibly in conjunction with increased indentation. + +This is attractive because it is a generalization of the rule for +parentheses. + +The initial objections to this were: + +- The amount of whitespace may be contentious; expression continuation + should not be confused with opening a new suite. + +- The "expression continuation" markers are not as clearly marked in + Python as the grouping punctuation "(), [], {}" marks are:: + + # Plus needs another operand, so the line continues + "abc" + + "def" + + # String ends an expression, so the line does not + # not continue. The next line is a syntax error because + # unary plus does not apply to strings. + "abc" + + "def" + +- Guido objected for technical reasons. [#dedent]_ The most obvious + implementation would require allowing INDENT or DEDENT tokens + anywhere, or at least in a widely expanded (and ill-defined) set of + locations. While this is of concern only for the internal parsing + mechanism (rather than for users), it would be a major new source of + complexity. + +Andrew Koenig then pointed out [#lexical]_ a better implementation +strategy, and said that it had worked quite well in other +languages. [#snocone]_ The improved suggestion boiled down to: + + The whitespace that follows an (operator or) open bracket or + parenthesis can include newline characters. + + It would be implemented at a very low lexical level -- even before + the decision is made to turn a newline followed by spaces into an + INDENT or DEDENT token. + +There is still some concern that it could mask bugs, as in this +example [#guidobughide]_:: + + # Used to be y+1, the 1 got dropped. Syntax Error (today) + # would become nonsense. + x = y+ + f(x) + +Requiring that the continuation be indented more than the initial line +would add both safety and complexity. + + +Open Issues +=========== + +* Should ``\``-continuation be removed even inside strings? + +* Should the continuation markers be expanded from just ([{}]) to + include lines ending with an operator? + +* As a safety measure, should the continuation line be required to be + more indented than the initial line? References +========== + +.. [#dedent] (email subject) PEP 30XZ: Simplified Parsing, van Rossum + http://mail.python.org/pipermail/python-3000/2007-April/007063.html + +.. [#lexical] (email subject) PEP-3125 -- remove backslash + continuation, Koenig + http://mail.python.org/pipermail/python-3000/2007-May/007237.html + +.. [#snocone] The Snocone Programming Language, Koenig + http://www.snobol4.com/report.htm - [1] PEP 30XZ: Simplified Parsing, van Rossum - http://mail.python.org/pipermail/python-3000/2007-April/007063.html +.. [#guidobughide] (email subject) PEP-3125 -- remove backslash + continuation, van Rossum + http://mail.python.org/pipermail/python-3000/2007-May/007244.html Copyright +========= - This document has been placed in the public domain. +This document has been placed in the public domain. -Local Variables: -mode: indented-text -indent-tabs-mode: nil -sentence-end-double-space: t -fill-column: 70 -coding: utf-8 -End: +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Fri May 4 21:28:22 2007 From: python-checkins at python.org (walter.doerwald) Date: Fri, 4 May 2007 21:28:22 +0200 (CEST) Subject: [Python-checkins] r55127 - in python/branches/py3k-struni: Doc/api/utilities.tex Doc/ext/extending.tex Objects/exceptions.c Python/getargs.c Python/modsupport.c Message-ID: <20070504192822.B63421E4006@bag.python.org> Author: walter.doerwald Date: Fri May 4 21:28:21 2007 New Revision: 55127 Modified: python/branches/py3k-struni/Doc/api/utilities.tex python/branches/py3k-struni/Doc/ext/extending.tex python/branches/py3k-struni/Objects/exceptions.c python/branches/py3k-struni/Python/getargs.c python/branches/py3k-struni/Python/modsupport.c Log: Change UnicodeDecodeError objects so that the 'object' attribute is a bytes object. Add 'y' and 'y#' format specifiers that work like 's' and 's#' but only accept bytes objects. Modified: python/branches/py3k-struni/Doc/api/utilities.tex ============================================================================== --- python/branches/py3k-struni/Doc/api/utilities.tex (original) +++ python/branches/py3k-struni/Doc/api/utilities.tex Fri May 4 21:28:21 2007 @@ -424,6 +424,18 @@ compatible objects pass back a reference to the raw internal data representation. + \item[\samp{y} (bytes object) + {[const char *]}] + This variant on \samp{s} convert a Python bytes object to a C pointer to a + character string. The bytes object must not contain embedded NUL bytes; + if it does, a \exception{TypeError} exception is raised. + + \item[\samp{y\#} (bytes object) + {[const char *, int]}] + This variant on \samp{s#} stores into two C variables, the first one + a pointer to a character string, the second one its length. This only + accepts bytes objects. + \item[\samp{z} (string or \code{None}) {[const char *]}] Like \samp{s}, but the Python object may also be \code{None}, in which case the C pointer is set to \NULL. Modified: python/branches/py3k-struni/Doc/ext/extending.tex ============================================================================== --- python/branches/py3k-struni/Doc/ext/extending.tex (original) +++ python/branches/py3k-struni/Doc/ext/extending.tex Fri May 4 21:28:21 2007 @@ -802,8 +802,10 @@ Py_BuildValue("i", 123) 123 Py_BuildValue("iii", 123, 456, 789) (123, 456, 789) Py_BuildValue("s", "hello") 'hello' + Py_BuildValue("y", "hello") b'hello' Py_BuildValue("ss", "hello", "world") ('hello', 'world') Py_BuildValue("s#", "hello", 4) 'hell' + Py_BuildValue("y#", "hello", 4) b'hell' Py_BuildValue("()") () Py_BuildValue("(i)", 123) (123,) Py_BuildValue("(ii)", 123, 456) (123, 456) Modified: python/branches/py3k-struni/Objects/exceptions.c ============================================================================== --- python/branches/py3k-struni/Objects/exceptions.c (original) +++ python/branches/py3k-struni/Objects/exceptions.c Fri May 4 21:28:21 2007 @@ -1243,6 +1243,22 @@ static PyObject * +get_bytes(PyObject *attr, const char *name) +{ + if (!attr) { + PyErr_Format(PyExc_TypeError, "%.200s attribute not set", name); + return NULL; + } + + if (!PyBytes_Check(attr)) { + PyErr_Format(PyExc_TypeError, "%.200s attribute must be bytes", name); + return NULL; + } + Py_INCREF(attr); + return attr; +} + +static PyObject * get_unicode(PyObject *attr, const char *name) { if (!attr) { @@ -1280,7 +1296,7 @@ PyObject * PyUnicodeDecodeError_GetObject(PyObject *exc) { - return get_string(((PyUnicodeErrorObject *)exc)->object, "object"); + return get_bytes(((PyUnicodeErrorObject *)exc)->object, "object"); } PyObject * @@ -1314,10 +1330,10 @@ { if (!get_int(((PyUnicodeErrorObject *)exc)->start, start, "start")) { Py_ssize_t size; - PyObject *obj = get_string(((PyUnicodeErrorObject *)exc)->object, + PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object, "object"); if (!obj) return -1; - size = PyString_GET_SIZE(obj); + size = PyBytes_GET_SIZE(obj); if (*start<0) *start = 0; if (*start>=size) @@ -1382,10 +1398,10 @@ { if (!get_int(((PyUnicodeErrorObject *)exc)->end, end, "end")) { Py_ssize_t size; - PyObject *obj = get_string(((PyUnicodeErrorObject *)exc)->object, + PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object, "object"); if (!obj) return -1; - size = PyString_GET_SIZE(obj); + size = PyBytes_GET_SIZE(obj); if (*end<1) *end = 1; if (*end>size) @@ -1629,7 +1645,7 @@ if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) return -1; return UnicodeError_init((PyUnicodeErrorObject *)self, args, - kwds, &PyString_Type); + kwds, &PyBytes_Type); } static PyObject * @@ -1648,7 +1664,7 @@ /* FromFormat does not support %02x, so format that separately */ char byte[4]; PyOS_snprintf(byte, sizeof(byte), "%02x", - ((int)PyString_AS_STRING(((PyUnicodeErrorObject *)self)->object)[start])&0xff); + ((int)PyBytes_AS_STRING(((PyUnicodeErrorObject *)self)->object)[start])&0xff); return PyString_FromFormat( "'%.400s' codec can't decode byte 0x%s in position %zd: %.400s", PyString_AS_STRING(((PyUnicodeErrorObject *)self)->encoding), @@ -1689,7 +1705,7 @@ assert(length < INT_MAX); assert(start < INT_MAX); assert(end < INT_MAX); - return PyObject_CallFunction(PyExc_UnicodeDecodeError, "ss#nns", + return PyObject_CallFunction(PyExc_UnicodeDecodeError, "sy#nns", encoding, object, length, start, end, reason); } Modified: python/branches/py3k-struni/Python/getargs.c ============================================================================== --- python/branches/py3k-struni/Python/getargs.c (original) +++ python/branches/py3k-struni/Python/getargs.c Fri May 4 21:28:21 2007 @@ -819,6 +819,32 @@ break; } + case 'y': {/* bytes */ + if (*format == '#') { + void **p = (void **)va_arg(*p_va, char **); + FETCH_SIZE; + + if (PyBytes_Check(arg)) { + *p = PyBytes_AS_STRING(arg); + STORE_SIZE(PyBytes_GET_SIZE(arg)); + } + else + return converterr("bytes", arg, msgbuf, bufsize); + format++; + } else { + char **p = va_arg(*p_va, char **); + + if (PyBytes_Check(arg)) + *p = PyBytes_AS_STRING(arg); + else + return converterr("bytes", arg, msgbuf, bufsize); + if ((Py_ssize_t)strlen(*p) != PyBytes_Size(arg)) + return converterr("bytes without null bytes", + arg, msgbuf, bufsize); + } + break; + } + case 'z': {/* string, may be NULL (None) */ if (*format == '#') { /* any buffer-like object */ void **p = (void **)va_arg(*p_va, char **); @@ -1595,6 +1621,7 @@ case 's': /* string */ case 'z': /* string or None */ + case 'y': /* bytes */ case 'u': /* unicode string */ case 't': /* buffer, read-only */ case 'w': /* buffer, read-write */ Modified: python/branches/py3k-struni/Python/modsupport.c ============================================================================== --- python/branches/py3k-struni/Python/modsupport.c (original) +++ python/branches/py3k-struni/Python/modsupport.c Fri May 4 21:28:21 2007 @@ -424,6 +424,39 @@ return v; } + case 'y': + { + PyObject *v; + char *str = va_arg(*p_va, char *); + Py_ssize_t n; + if (**p_format == '#') { + ++*p_format; + if (flags & FLAG_SIZE_T) + n = va_arg(*p_va, Py_ssize_t); + else + n = va_arg(*p_va, int); + } + else + n = -1; + if (str == NULL) { + v = Py_None; + Py_INCREF(v); + } + else { + if (n < 0) { + size_t m = strlen(str); + if (m > PY_SSIZE_T_MAX) { + PyErr_SetString(PyExc_OverflowError, + "string too long for Python bytes"); + return NULL; + } + n = (Py_ssize_t)m; + } + v = PyBytes_FromStringAndSize(str, n); + } + return v; + } + case 'N': case 'S': case 'O': From python-checkins at python.org Fri May 4 21:28:34 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 May 2007 21:28:34 +0200 (CEST) Subject: [Python-checkins] r55128 - peps/trunk/pep-3125.txt Message-ID: <20070504192834.6BDEF1E4006@bag.python.org> Author: georg.brandl Date: Fri May 4 21:28:34 2007 New Revision: 55128 Modified: peps/trunk/pep-3125.txt Log: Add two missing literal block markers. Modified: peps/trunk/pep-3125.txt ============================================================================== --- peps/trunk/pep-3125.txt (original) +++ peps/trunk/pep-3125.txt Fri May 4 21:28:34 2007 @@ -67,7 +67,7 @@ --------------------- Open a triple-quoted string; again, people recognize that the string -needs to finish before the next statement starts. +needs to finish before the next statement starts. :: banner_message = """ Satisfaction Guaranteed, @@ -112,7 +112,7 @@ A terminal ``\`` within a single-quoted string, at the end of the line. This is arguably a special case of the terminal ``\``, but it -is a special case that may be worth keeping. +is a special case that may be worth keeping. :: >>> "abd\ def" From python-checkins at python.org Fri May 4 21:54:26 2007 From: python-checkins at python.org (thomas.heller) Date: Fri, 4 May 2007 21:54:26 +0200 (CEST) Subject: [Python-checkins] r55129 - in python/trunk: Lib/ctypes/test/test_loading.py Modules/_ctypes/callproc.c Modules/_ctypes/ctypes.h Message-ID: <20070504195426.58D0F1E4006@bag.python.org> Author: thomas.heller Date: Fri May 4 21:54:22 2007 New Revision: 55129 Modified: python/trunk/Lib/ctypes/test/test_loading.py python/trunk/Modules/_ctypes/callproc.c python/trunk/Modules/_ctypes/ctypes.h Log: Do not truncate 64-bit pointers to 32-bit integers. Fixes SF #1703286, will backport to release25-maint. Modified: python/trunk/Lib/ctypes/test/test_loading.py ============================================================================== --- python/trunk/Lib/ctypes/test/test_loading.py (original) +++ python/trunk/Lib/ctypes/test/test_loading.py Fri May 4 21:54:22 2007 @@ -58,6 +58,33 @@ windll.LoadLibrary("coredll").GetModuleHandleW WinDLL("coredll").GetModuleHandleW + def test_1703286_A(self): + from _ctypes import LoadLibrary, FreeLibrary + # On winXP 64-bit, advapi32 loads at an address that does + # NOT fit into a 32-bit integer. FreeLibrary must be able + # to accept this address. + + # These are tests for http://www.python.org/sf/1703286 + handle = LoadLibrary("advapi32") + FreeLibrary(handle) + + def test_1703286_B(self): + # Since on winXP 64-bit advapi32 loads like described + # above, the (arbitrarily selected) CloseEventLog function + # also has a high address. 'call_function' should accept + # addresses so large. + from _ctypes import call_function + advapi32 = windll.advapi32 + # Calling CloseEventLog with a NULL argument should fail, + # but the call should not segfault or so. + self.failUnlessEqual(0, advapi32.CloseEventLog(None)) + windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p + windll.kernel32.GetProcAddress.restype = c_void_p + proc = windll.kernel32.GetProcAddress(advapi32._handle, "CloseEventLog") + self.failUnless(proc) + # This is the real test: call the function via 'call_function' + self.failUnlessEqual(0, call_function(proc, (None,))) + def test_load_ordinal_functions(self): import _ctypes_test dll = WinDLL(_ctypes_test.__file__) Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Fri May 4 21:54:22 2007 @@ -1128,10 +1128,10 @@ Free the handle of an executable previously loaded by LoadLibrary.\n"; static PyObject *free_library(PyObject *self, PyObject *args) { - HMODULE hMod; - if (!PyArg_ParseTuple(args, "i:FreeLibrary", &hMod)) + void *hMod; + if (!PyArg_ParseTuple(args, PY_VOID_P_CODE ":FreeLibrary", &hMod)) return NULL; - if (!FreeLibrary(hMod)) + if (!FreeLibrary((HMODULE)hMod)) return PyErr_SetFromWindowsErr(GetLastError()); Py_INCREF(Py_None); return Py_None; @@ -1250,11 +1250,11 @@ static PyObject *py_dl_close(PyObject *self, PyObject *args) { - int handle; + void *handle; - if (!PyArg_ParseTuple(args, "i:dlclose", &handle)) + if (!PyArg_ParseTuple(args, PY_VOID_P_CODE ":dlclose", &handle)) return NULL; - if (dlclose((void*)handle)) { + if (dlclose(handle)) { PyErr_SetString(PyExc_OSError, ctypes_dlerror()); return NULL; @@ -1266,10 +1266,10 @@ static PyObject *py_dl_sym(PyObject *self, PyObject *args) { char *name; - int handle; + void *handle; void *ptr; - if (!PyArg_ParseTuple(args, "is:dlsym", &handle, &name)) + if (!PyArg_ParseTuple(args, PY_VOID_P_CODE "s:dlsym", &handle, &name)) return NULL; ptr = ctypes_dlsym((void*)handle, name); if (!ptr) { @@ -1277,7 +1277,7 @@ ctypes_dlerror()); return NULL; } - return Py_BuildValue("i", ptr); + return PyLong_FromVoidPtr(ptr); } #endif @@ -1289,12 +1289,12 @@ static PyObject * call_function(PyObject *self, PyObject *args) { - int func; + void *func; PyObject *arguments; PyObject *result; if (!PyArg_ParseTuple(args, - "iO!", + PY_VOID_P_CODE "O!", &func, &PyTuple_Type, &arguments)) return NULL; @@ -1320,12 +1320,12 @@ static PyObject * call_cdeclfunction(PyObject *self, PyObject *args) { - int func; + void *func; PyObject *arguments; PyObject *result; if (!PyArg_ParseTuple(args, - "iO!", + PY_VOID_P_CODE "O!", &func, &PyTuple_Type, &arguments)) return NULL; Modified: python/trunk/Modules/_ctypes/ctypes.h ============================================================================== --- python/trunk/Modules/_ctypes/ctypes.h (original) +++ python/trunk/Modules/_ctypes/ctypes.h Fri May 4 21:54:22 2007 @@ -23,6 +23,12 @@ #define PY_LONG_LONG LONG_LONG #endif +#if SIZEOF_VOID_P == SIZEOF_LONG +#define PY_VOID_P_CODE "k" +#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG) +#define PY_VOID_P_CODE "K" +#endif + typedef struct tagPyCArgObject PyCArgObject; typedef struct tagCDataObject CDataObject; typedef PyObject *(* GETFUNC)(void *, unsigned size); From python-checkins at python.org Fri May 4 21:56:26 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 21:56:26 +0200 (CEST) Subject: [Python-checkins] r55130 - python/branches/py3k-struni/Lib/pickle.py python/branches/py3k-struni/Lib/struct.py Message-ID: <20070504195626.D733D1E4006@bag.python.org> Author: guido.van.rossum Date: Fri May 4 21:56:22 2007 New Revision: 55130 Modified: python/branches/py3k-struni/Lib/pickle.py python/branches/py3k-struni/Lib/struct.py Log: Checkpoint. Make pickle.py read/write bytes. Fix strict.py so it reads/writes bytes and accepts both string types as format. Modified: python/branches/py3k-struni/Lib/pickle.py ============================================================================== --- python/branches/py3k-struni/Lib/pickle.py (original) +++ python/branches/py3k-struni/Lib/pickle.py Fri May 4 21:56:22 2007 @@ -33,6 +33,7 @@ import sys import struct import re +import io __all__ = ["PickleError", "PicklingError", "UnpicklingError", "Pickler", "Unpickler", "dump", "dumps", "load", "loads"] @@ -50,6 +51,9 @@ # know how to read. HIGHEST_PROTOCOL = 2 +# The protocol we write by default. May be less than HIGHEST_PROTOCOL. +DEFAULT_PROTOCOL = 2 + # Why use struct.pack() for pickling but marshal.loads() for # unpickling? struct.pack() is 40% faster than marshal.dumps(), but # marshal.loads() is twice as fast as struct.unpack()! @@ -89,75 +93,69 @@ except ImportError: PyStringMap = None -# UnicodeType may or may not be exported (normally imported from types) -try: - UnicodeType -except NameError: - UnicodeType = None - # Pickle opcodes. See pickletools.py for extensive docs. The listing # here is in kind-of alphabetical order of 1-character pickle code. # pickletools groups them by purpose. -MARK = '(' # push special markobject on stack -STOP = '.' # every pickle ends with STOP -POP = '0' # discard topmost stack item -POP_MARK = '1' # discard stack top through topmost markobject -DUP = '2' # duplicate top stack item -FLOAT = 'F' # push float object; decimal string argument -INT = 'I' # push integer or bool; decimal string argument -BININT = 'J' # push four-byte signed int -BININT1 = 'K' # push 1-byte unsigned int -LONG = 'L' # push long; decimal string argument -BININT2 = 'M' # push 2-byte unsigned int -NONE = 'N' # push None -PERSID = 'P' # push persistent object; id is taken from string arg -BINPERSID = 'Q' # " " " ; " " " " stack -REDUCE = 'R' # apply callable to argtuple, both on stack -STRING = 'S' # push string; NL-terminated string argument -BINSTRING = 'T' # push string; counted binary string argument -SHORT_BINSTRING = 'U' # " " ; " " " " < 256 bytes -UNICODE = 'V' # push Unicode string; raw-unicode-escaped'd argument -BINUNICODE = 'X' # " " " ; counted UTF-8 string argument -APPEND = 'a' # append stack top to list below it -BUILD = 'b' # call __setstate__ or __dict__.update() -GLOBAL = 'c' # push self.find_class(modname, name); 2 string args -DICT = 'd' # build a dict from stack items -EMPTY_DICT = '}' # push empty dict -APPENDS = 'e' # extend list on stack by topmost stack slice -GET = 'g' # push item from memo on stack; index is string arg -BINGET = 'h' # " " " " " " ; " " 1-byte arg -INST = 'i' # build & push class instance -LONG_BINGET = 'j' # push item from memo on stack; index is 4-byte arg -LIST = 'l' # build list from topmost stack items -EMPTY_LIST = ']' # push empty list -OBJ = 'o' # build & push class instance -PUT = 'p' # store stack top in memo; index is string arg -BINPUT = 'q' # " " " " " ; " " 1-byte arg -LONG_BINPUT = 'r' # " " " " " ; " " 4-byte arg -SETITEM = 's' # add key+value pair to dict -TUPLE = 't' # build tuple from topmost stack items -EMPTY_TUPLE = ')' # push empty tuple -SETITEMS = 'u' # modify dict by adding topmost key+value pairs -BINFLOAT = 'G' # push float; arg is 8-byte float encoding +MARK = b'(' # push special markobject on stack +STOP = b'.' # every pickle ends with STOP +POP = b'0' # discard topmost stack item +POP_MARK = b'1' # discard stack top through topmost markobject +DUP = b'2' # duplicate top stack item +FLOAT = b'F' # push float object; decimal string argument +INT = b'I' # push integer or bool; decimal string argument +BININT = b'J' # push four-byte signed int +BININT1 = b'K' # push 1-byte unsigned int +LONG = b'L' # push long; decimal string argument +BININT2 = b'M' # push 2-byte unsigned int +NONE = b'N' # push None +PERSID = b'P' # push persistent object; id is taken from string arg +BINPERSID = b'Q' # " " " ; " " " " stack +REDUCE = b'R' # apply callable to argtuple, both on stack +STRING = b'S' # push string; NL-terminated string argument +BINSTRING = b'T' # push string; counted binary string argument +SHORT_BINSTRING= b'U' # " " ; " " " " < 256 bytes +UNICODE = b'V' # push Unicode string; raw-unicode-escaped'd argument +BINUNICODE = b'X' # " " " ; counted UTF-8 string argument +APPEND = b'a' # append stack top to list below it +BUILD = b'b' # call __setstate__ or __dict__.update() +GLOBAL = b'c' # push self.find_class(modname, name); 2 string args +DICT = b'd' # build a dict from stack items +EMPTY_DICT = b'}' # push empty dict +APPENDS = b'e' # extend list on stack by topmost stack slice +GET = b'g' # push item from memo on stack; index is string arg +BINGET = b'h' # " " " " " " ; " " 1-byte arg +INST = b'i' # build & push class instance +LONG_BINGET = b'j' # push item from memo on stack; index is 4-byte arg +LIST = b'l' # build list from topmost stack items +EMPTY_LIST = b']' # push empty list +OBJ = b'o' # build & push class instance +PUT = b'p' # store stack top in memo; index is string arg +BINPUT = b'q' # " " " " " ; " " 1-byte arg +LONG_BINPUT = b'r' # " " " " " ; " " 4-byte arg +SETITEM = b's' # add key+value pair to dict +TUPLE = b't' # build tuple from topmost stack items +EMPTY_TUPLE = b')' # push empty tuple +SETITEMS = b'u' # modify dict by adding topmost key+value pairs +BINFLOAT = b'G' # push float; arg is 8-byte float encoding -TRUE = 'I01\n' # not an opcode; see INT docs in pickletools.py -FALSE = 'I00\n' # not an opcode; see INT docs in pickletools.py +TRUE = b'I01\n' # not an opcode; see INT docs in pickletools.py +FALSE = b'I00\n' # not an opcode; see INT docs in pickletools.py # Protocol 2 -PROTO = '\x80' # identify pickle protocol -NEWOBJ = '\x81' # build object by applying cls.__new__ to argtuple -EXT1 = '\x82' # push object from extension registry; 1-byte index -EXT2 = '\x83' # ditto, but 2-byte index -EXT4 = '\x84' # ditto, but 4-byte index -TUPLE1 = '\x85' # build 1-tuple from stack top -TUPLE2 = '\x86' # build 2-tuple from two topmost stack items -TUPLE3 = '\x87' # build 3-tuple from three topmost stack items -NEWTRUE = '\x88' # push True -NEWFALSE = '\x89' # push False -LONG1 = '\x8a' # push long from < 256 bytes -LONG4 = '\x8b' # push really big long +PROTO = b'\x80' # identify pickle protocol +NEWOBJ = b'\x81' # build object by applying cls.__new__ to argtuple +EXT1 = b'\x82' # push object from extension registry; 1-byte index +EXT2 = b'\x83' # ditto, but 2-byte index +EXT4 = b'\x84' # ditto, but 4-byte index +TUPLE1 = b'\x85' # build 1-tuple from stack top +TUPLE2 = b'\x86' # build 2-tuple from two topmost stack items +TUPLE3 = b'\x87' # build 3-tuple from three topmost stack items +NEWTRUE = b'\x88' # push True +NEWFALSE = b'\x89' # push False +LONG1 = b'\x8a' # push long from < 256 bytes +LONG4 = b'\x8b' # push really big long _tuplesize2code = [EMPTY_TUPLE, TUPLE1, TUPLE2, TUPLE3] @@ -170,15 +168,13 @@ class Pickler: def __init__(self, file, protocol=None): - """This takes a file-like object for writing a pickle data stream. + """This takes a binary file for writing a pickle data stream. + + All protocols now read and write bytes. The optional protocol argument tells the pickler to use the given protocol; supported protocols are 0, 1, 2. The default - protocol is 0, to be backwards compatible. (Protocol 0 is the - only protocol that can be written to a file opened in text - mode and read back successfully. When using a protocol higher - than 0, make sure the file is opened in binary mode, both when - pickling and unpickling.) + protocol is 2; it's been supported for many years now. Protocol 1 is more efficient than protocol 0; protocol 2 is more efficient than protocol 1. @@ -194,7 +190,7 @@ """ if protocol is None: - protocol = 0 + protocol = DEFAULT_PROTOCOL if protocol < 0: protocol = HIGHEST_PROTOCOL elif not 0 <= protocol <= HIGHEST_PROTOCOL: @@ -219,7 +215,7 @@ def dump(self, obj): """Write a pickled representation of obj to the open file.""" if self.proto >= 2: - self.write(PROTO + chr(self.proto)) + self.write(PROTO + bytes([self.proto])) self.save(obj) self.write(STOP) @@ -249,21 +245,21 @@ def put(self, i, pack=struct.pack): if self.bin: if i < 256: - return BINPUT + chr(i) + return BINPUT + bytes([i]) else: return LONG_BINPUT + pack("= 0: if obj <= 0xff: - self.write(BININT1 + chr(obj)) + self.write(BININT1 + bytes([obj])) return if obj <= 0xffff: - self.write("%c%c%c" % (BININT2, obj&0xff, obj>>8)) + self.write(BININT2 + bytes([obj&0xff, obj>>8])) return # Next check for 4-byte signed ints: high_bits = obj >> 31 # note that Python shift sign-extends @@ -454,7 +450,7 @@ self.write(BININT + pack("= 0: if obj <= 0xff: - self.write(BININT1 + chr(obj)) + self.write(BININT1 + bytes([obj])) return if obj <= 0xffff: - self.write("%c%c%c" % (BININT2, obj&0xff, obj>>8)) + self.write(BININT2, bytes([obj&0xff, obj>>8])) return # Next check for 4-byte signed ints: high_bits = obj >> 31 # note that Python shift sign-extends @@ -479,74 +475,46 @@ self.write(BININT + pack("= 2: - bytes = encode_long(obj) - n = len(bytes) + encoded = encode_long(obj) + n = len(encoded) if n < 256: - self.write(LONG1 + chr(n) + bytes) + self.write(LONG1 + bytes([n]) + encoded) else: - self.write(LONG4 + pack("d', obj)) else: - self.write(FLOAT + repr(obj) + '\n') + self.write(FLOAT + bytes(repr(obj)) + b'\n') dispatch[FloatType] = save_float def save_string(self, obj, pack=struct.pack): if self.bin: n = len(obj) if n < 256: - self.write(SHORT_BINSTRING + chr(n) + obj) + self.write(SHORT_BINSTRING + bytes([n]) + bytes(obj)) else: - self.write(BINSTRING + pack(" 0 if code <= 0xff: - write(EXT1 + chr(code)) + write(EXT1 + bytes([code])) elif code <= 0xffff: - write("%c%c%c" % (EXT2, code&0xff, code>>8)) + write(EXT2 + bytes([code&0xff, code>>8])) else: write(EXT4 + pack("d', self.read(8))[0]) - dispatch[BINFLOAT] = load_binfloat + dispatch[BINFLOAT[0]] = load_binfloat def load_string(self): rep = self.readline()[:-1] @@ -948,60 +929,60 @@ else: raise ValueError, "insecure string pickle" self.append(rep.decode("string-escape")) - dispatch[STRING] = load_string + dispatch[STRING[0]] = load_string def load_binstring(self): - len = mloads('i' + self.read(4)) + len = mloads(b'i' + self.read(4)) self.append(self.read(len)) - dispatch[BINSTRING] = load_binstring + dispatch[BINSTRING[0]] = load_binstring def load_unicode(self): - self.append(str(self.readline()[:-1],'raw-unicode-escape')) - dispatch[UNICODE] = load_unicode + self.append(str(self.readline()[:-1], 'raw-unicode-escape')) + dispatch[UNICODE[0]] = load_unicode def load_binunicode(self): - len = mloads('i' + self.read(4)) - self.append(str(self.read(len),'utf-8')) - dispatch[BINUNICODE] = load_binunicode + len = mloads(b'i' + self.read(4)) + self.append(str(self.read(len), 'utf-8')) + dispatch[BINUNICODE[0]] = load_binunicode def load_short_binstring(self): len = ord(self.read(1)) self.append(self.read(len)) - dispatch[SHORT_BINSTRING] = load_short_binstring + dispatch[SHORT_BINSTRING[0]] = load_short_binstring def load_tuple(self): k = self.marker() self.stack[k:] = [tuple(self.stack[k+1:])] - dispatch[TUPLE] = load_tuple + dispatch[TUPLE[0]] = load_tuple def load_empty_tuple(self): self.stack.append(()) - dispatch[EMPTY_TUPLE] = load_empty_tuple + dispatch[EMPTY_TUPLE[0]] = load_empty_tuple def load_tuple1(self): self.stack[-1] = (self.stack[-1],) - dispatch[TUPLE1] = load_tuple1 + dispatch[TUPLE1[0]] = load_tuple1 def load_tuple2(self): self.stack[-2:] = [(self.stack[-2], self.stack[-1])] - dispatch[TUPLE2] = load_tuple2 + dispatch[TUPLE2[0]] = load_tuple2 def load_tuple3(self): self.stack[-3:] = [(self.stack[-3], self.stack[-2], self.stack[-1])] - dispatch[TUPLE3] = load_tuple3 + dispatch[TUPLE3[0]] = load_tuple3 def load_empty_list(self): self.stack.append([]) - dispatch[EMPTY_LIST] = load_empty_list + dispatch[EMPTY_LIST[0]] = load_empty_list def load_empty_dictionary(self): self.stack.append({}) - dispatch[EMPTY_DICT] = load_empty_dictionary + dispatch[EMPTY_DICT[0]] = load_empty_dictionary def load_list(self): k = self.marker() self.stack[k:] = [self.stack[k+1:]] - dispatch[LIST] = load_list + dispatch[LIST[0]] = load_list def load_dict(self): k = self.marker() @@ -1012,7 +993,7 @@ value = items[i+1] d[key] = value self.stack[k:] = [d] - dispatch[DICT] = load_dict + dispatch[DICT[0]] = load_dict # INST and OBJ differ only in how they get a class object. It's not # only sensible to do the rest in a common routine, the two routines @@ -1047,43 +1028,43 @@ name = self.readline()[:-1] klass = self.find_class(module, name) self._instantiate(klass, self.marker()) - dispatch[INST] = load_inst + dispatch[INST[0]] = load_inst def load_obj(self): # Stack is ... markobject classobject arg1 arg2 ... k = self.marker() klass = self.stack.pop(k+1) self._instantiate(klass, k) - dispatch[OBJ] = load_obj + dispatch[OBJ[0]] = load_obj def load_newobj(self): args = self.stack.pop() cls = self.stack[-1] obj = cls.__new__(cls, *args) self.stack[-1] = obj - dispatch[NEWOBJ] = load_newobj + dispatch[NEWOBJ[0]] = load_newobj def load_global(self): module = self.readline()[:-1] name = self.readline()[:-1] klass = self.find_class(module, name) self.append(klass) - dispatch[GLOBAL] = load_global + dispatch[GLOBAL[0]] = load_global def load_ext1(self): code = ord(self.read(1)) self.get_extension(code) - dispatch[EXT1] = load_ext1 + dispatch[EXT1[0]] = load_ext1 def load_ext2(self): - code = mloads('i' + self.read(2) + '\000\000') + code = mloads(b'i' + self.read(2) + b'\000\000') self.get_extension(code) - dispatch[EXT2] = load_ext2 + dispatch[EXT2[0]] = load_ext2 def load_ext4(self): - code = mloads('i' + self.read(4)) + code = mloads(b'i' + self.read(4)) self.get_extension(code) - dispatch[EXT4] = load_ext4 + dispatch[EXT4[0]] = load_ext4 def get_extension(self, code): nil = [] @@ -1111,55 +1092,55 @@ func = stack[-1] value = func(*args) stack[-1] = value - dispatch[REDUCE] = load_reduce + dispatch[REDUCE[0]] = load_reduce def load_pop(self): del self.stack[-1] - dispatch[POP] = load_pop + dispatch[POP[0]] = load_pop def load_pop_mark(self): k = self.marker() del self.stack[k:] - dispatch[POP_MARK] = load_pop_mark + dispatch[POP_MARK[0]] = load_pop_mark def load_dup(self): self.append(self.stack[-1]) - dispatch[DUP] = load_dup + dispatch[DUP[0]] = load_dup def load_get(self): self.append(self.memo[self.readline()[:-1]]) - dispatch[GET] = load_get + dispatch[GET[0]] = load_get def load_binget(self): i = ord(self.read(1)) self.append(self.memo[repr(i)]) - dispatch[BINGET] = load_binget + dispatch[BINGET[0]] = load_binget def load_long_binget(self): - i = mloads('i' + self.read(4)) + i = mloads(b'i' + self.read(4)) self.append(self.memo[repr(i)]) - dispatch[LONG_BINGET] = load_long_binget + dispatch[LONG_BINGET[0]] = load_long_binget def load_put(self): self.memo[self.readline()[:-1]] = self.stack[-1] - dispatch[PUT] = load_put + dispatch[PUT[0]] = load_put def load_binput(self): i = ord(self.read(1)) self.memo[repr(i)] = self.stack[-1] - dispatch[BINPUT] = load_binput + dispatch[BINPUT[0]] = load_binput def load_long_binput(self): - i = mloads('i' + self.read(4)) + i = mloads(b'i' + self.read(4)) self.memo[repr(i)] = self.stack[-1] - dispatch[LONG_BINPUT] = load_long_binput + dispatch[LONG_BINPUT[0]] = load_long_binput def load_append(self): stack = self.stack value = stack.pop() list = stack[-1] list.append(value) - dispatch[APPEND] = load_append + dispatch[APPEND[0]] = load_append def load_appends(self): stack = self.stack @@ -1167,7 +1148,7 @@ list = stack[mark - 1] list.extend(stack[mark + 1:]) del stack[mark:] - dispatch[APPENDS] = load_appends + dispatch[APPENDS[0]] = load_appends def load_setitem(self): stack = self.stack @@ -1175,7 +1156,7 @@ key = stack.pop() dict = stack[-1] dict[key] = value - dispatch[SETITEM] = load_setitem + dispatch[SETITEM[0]] = load_setitem def load_setitems(self): stack = self.stack @@ -1185,7 +1166,7 @@ dict[stack[i]] = stack[i + 1] del stack[mark:] - dispatch[SETITEMS] = load_setitems + dispatch[SETITEMS[0]] = load_setitems def load_build(self): stack = self.stack @@ -1216,16 +1197,16 @@ if slotstate: for k, v in slotstate.items(): setattr(inst, k, v) - dispatch[BUILD] = load_build + dispatch[BUILD[0]] = load_build def load_mark(self): self.append(self.mark) - dispatch[MARK] = load_mark + dispatch[MARK[0]] = load_mark def load_stop(self): value = self.stack.pop() raise _Stop(value) - dispatch[STOP] = load_stop + dispatch[STOP[0]] = load_stop # Helper class for load_inst/load_obj @@ -1332,16 +1313,11 @@ # Shorthands -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO - def dump(obj, file, protocol=None): Pickler(file, protocol).dump(obj) def dumps(obj, protocol=None): - file = StringIO() + file = io.BytesIO() Pickler(file, protocol).dump(obj) return file.getvalue() @@ -1349,7 +1325,7 @@ return Unpickler(file).load() def loads(str): - file = StringIO(str) + file = io.BytesIO(str) return Unpickler(file).load() # Doctest Modified: python/branches/py3k-struni/Lib/struct.py ============================================================================== --- python/branches/py3k-struni/Lib/struct.py (original) +++ python/branches/py3k-struni/Lib/struct.py Fri May 4 21:56:22 2007 @@ -25,7 +25,11 @@ The variable struct.error is an exception raised on errors. """ -__version__ = '0.1' + +# XXX Move the bytes and str8 casts into the _struct module + +__version__ = '3.0' + from _struct import Struct, error @@ -36,7 +40,7 @@ # Internal: compile struct pattern if len(_cache) >= _MAXCACHE: _cache.clear() - s = Struct(fmt) + s = Struct(str8(fmt)) _cache[fmt] = s return s @@ -60,7 +64,7 @@ o = _cache[fmt] except KeyError: o = _compile(fmt) - return o.pack(*args) + return bytes(o.pack(*args)) def pack_into(fmt, buf, offset, *args): """ @@ -72,7 +76,7 @@ o = _cache[fmt] except KeyError: o = _compile(fmt) - return o.pack_into(buf, offset, *args) + return bytes(o.pack_into(buf, offset, *args)) def unpack(fmt, s): """ From python-checkins at python.org Fri May 4 21:56:34 2007 From: python-checkins at python.org (thomas.heller) Date: Fri, 4 May 2007 21:56:34 +0200 (CEST) Subject: [Python-checkins] r55131 - python/trunk/Lib/ctypes/test/test_loading.py Message-ID: <20070504195634.89A4B1E4006@bag.python.org> Author: thomas.heller Date: Fri May 4 21:56:32 2007 New Revision: 55131 Modified: python/trunk/Lib/ctypes/test/test_loading.py Log: Oops, these tests do not run on Windows CE. Modified: python/trunk/Lib/ctypes/test/test_loading.py ============================================================================== --- python/trunk/Lib/ctypes/test/test_loading.py (original) +++ python/trunk/Lib/ctypes/test/test_loading.py Fri May 4 21:56:32 2007 @@ -58,6 +58,22 @@ windll.LoadLibrary("coredll").GetModuleHandleW WinDLL("coredll").GetModuleHandleW + def test_load_ordinal_functions(self): + import _ctypes_test + dll = WinDLL(_ctypes_test.__file__) + # We load the same function both via ordinal and name + func_ord = dll[2] + func_name = dll.GetString + # addressof gets the address where the function pointer is stored + a_ord = addressof(func_ord) + a_name = addressof(func_name) + f_ord_addr = c_void_p.from_address(a_ord).value + f_name_addr = c_void_p.from_address(a_name).value + self.failUnlessEqual(hex(f_ord_addr), hex(f_name_addr)) + + self.failUnlessRaises(AttributeError, dll.__getitem__, 1234) + + if os.name == "nt": def test_1703286_A(self): from _ctypes import LoadLibrary, FreeLibrary # On winXP 64-bit, advapi32 loads at an address that does @@ -85,20 +101,5 @@ # This is the real test: call the function via 'call_function' self.failUnlessEqual(0, call_function(proc, (None,))) - def test_load_ordinal_functions(self): - import _ctypes_test - dll = WinDLL(_ctypes_test.__file__) - # We load the same function both via ordinal and name - func_ord = dll[2] - func_name = dll.GetString - # addressof gets the address where the function pointer is stored - a_ord = addressof(func_ord) - a_name = addressof(func_name) - f_ord_addr = c_void_p.from_address(a_ord).value - f_name_addr = c_void_p.from_address(a_name).value - self.failUnlessEqual(hex(f_ord_addr), hex(f_name_addr)) - - self.failUnlessRaises(AttributeError, dll.__getitem__, 1234) - if __name__ == "__main__": unittest.main() From python-checkins at python.org Fri May 4 22:08:41 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 22:08:41 +0200 (CEST) Subject: [Python-checkins] r55132 - peps/trunk/pep-3125.txt Message-ID: <20070504200841.DB0B81E401A@bag.python.org> Author: guido.van.rossum Date: Fri May 4 22:08:39 2007 New Revision: 55132 Modified: peps/trunk/pep-3125.txt Log: Major rewrite by Jim Jewett. The inside-a-string continuation is separated from the general continuation. The alternatives section is expaned to als list Andrew Koenig's improved inside-expressions variant, since that is a real contender. Modified: peps/trunk/pep-3125.txt ============================================================================== --- peps/trunk/pep-3125.txt (original) +++ peps/trunk/pep-3125.txt Fri May 4 22:08:39 2007 @@ -13,208 +13,209 @@ Abstract ======== -Python initially inherited its parsing from C. While this has been -generally useful, there are some remnants which have been less useful -for Python, and should be eliminated. + Python initially inherited its parsing from C. While this has + been generally useful, there are some remnants which have been + less useful for python, and should be eliminated. -This PEP proposes elimination of terminal ``\`` as a marker for line -continuation. + This PEP proposes elimination of terminal ``\`` as a marker for + line continuation. Motivation ========== -One goal for Python 3000 should be to simplify the language by -removing unnecessary or duplicated features. There are currently -several ways to indicate that a logical line is continued on the -following physical line. - -The other continuation methods are easily explained as a logical -consequence of the semantics they provide; ``\`` is simply an escape -character that needs to be memorized. + One goal for Python 3000 should be to simplify the language by + removing unnecessary or duplicated features. There are currently + several ways to indicate that a logical line is continued on the + following physical line. + + The other continuation methods are easily explained as a logical + consequence of the semantics they provide; ``\`` is simply an escape + character that needs to be memorized. Existing Line Continuation Methods ================================== -Parenthetical Expression - ``([{}])`` -------------------------------------- +Parenthetical Expression - ([{}]) +--------------------------------- -Open a parenthetical expression. It doesn't matter whether people -view the "line" as continuing; they do immediately recognize that the -expression needs to be closed before the statement can end. - -Examples using each of ``()``, ``[]``, and ``{}``:: - - def fn(long_argname1, - long_argname2): - settings = {"background": "random noise", - "volume": "barely audible"} - restrictions = ["Warrantee void if used", - "Notice must be received by yesterday", - "Not responsible for sales pitch"] - -Note that it is always possible to parenthesize an expression, but it -can seem odd to parenthesize an expression that needs parentheses only -for the line break:: + Open a parenthetical expression. It doesn't matter whether people + view the "line" as continuing; they do immediately recognize that + the expression needs to be closed before the statement can end. + + An examples using each of (), [], and {}:: + + def fn(long_argname1, + long_argname2): + settings = {"background": "random noise" + "volume": "barely audible"} + restrictions = ["Warrantee void if used", + "Notice must be recieved by yesterday" + "Not responsible for sales pitch"] + + Note that it is always possible to parenthesize an expression, + but it can seem odd to parenthesize an expression that needs + them only for the line break:: - assert val>4, ( - "val is too small") + assert val>4, ( + "val is too small") Triple-Quoted Strings --------------------- -Open a triple-quoted string; again, people recognize that the string -needs to finish before the next statement starts. :: + Open a triple-quoted string; again, people recognize that the + string needs to finish before the next statement starts. - banner_message = """ - Satisfaction Guaranteed, - or DOUBLE YOUR MONEY BACK!!! + banner_message = """ + Satisfaction Guaranteed, + or DOUBLE YOUR MONEY BACK!!! - some minor restrictions apply""" + some minor restrictions apply""" Terminal ``\`` in the general case ---------------------------------- -A terminal ``\`` indicates that the logical line is continued on the -following physical line (after whitespace). There are no particular -semantics associated with this. This form is never required, although -it may look better (particularly for people with a C language -background) in some cases:: - - >>> assert val>4, \ - "val is too small" - -Also note that the ``\`` must be the final character in the line. If -your editor navigation can add whitespace to the end of a line, that -invisible change will alter the semantics of the program. -Fortunately, the typical result is only a syntax error, rather than a -runtime bug:: + A terminal ``\`` indicates that the logical line is continued on the + following physical line (after whitespace). There are no + particular semantics associated with this. This form is never + required, although it may look better (particularly for people + with a C language background) in some cases:: + + >>> assert val>4, \ + "val is too small" + + Also note that the ``\`` must be the final character in the line. + If your editor navigation can add whitespace to the end of a line, + that invisible change will alter the semantics of the program. + Fortunately, the typical result is only a syntax error, rather + than a runtime bug:: - >>> assert val>4, \ - "val is too small" + >>> assert val>4, \ + "val is too small" - SyntaxError: unexpected character after line continuation character + SyntaxError: unexpected character after line continuation character -This PEP proposes to eliminate this redundant and potentially -confusing alternative. + This PEP proposes to eliminate this redundant and potentially + confusing alternative. Terminal ``\`` within a string ------------------------------ - -A terminal ``\`` within a single-quoted string, at the end of the -line. This is arguably a special case of the terminal ``\``, but it -is a special case that may be worth keeping. :: - - >>> "abd\ - def" - 'abd def' - -* Pro: Many of the objections to removing ``\`` termination were - really just objections to removing it within literal strings; - several people clarified that they want to keep this literal-string - usage, but don't mind losing the general case. - -* Pro: The use of ``\`` for an escape character within strings is well - known. - -* Contra: But note that this particular usage is odd, because the - escaped character (the newline) is invisible, and the special - treatment is to delete the character. That said, the ``\`` of - ``\(newline)`` is still an escape which changes the meaning of the - following character. + + A terminal ``\`` within a single-quoted string, at the end of the + line. This is arguably a special case of the terminal ``\``, but + it is a special case that may be worth keeping. + + >>> "abd\ + def" + 'abd def' + + + Many of the objections to removing ``\`` termination were really + just objections to removing it within literal strings; several + people clarified that they want to keep this literal-string + usage, but don't mind losing the general case. + + + The use of ``\`` for an escape character within strings is well + known. + + - But note that this particular usage is odd, because the escaped + character (the newline) is invisible, and the special treatment + is to delete the character. That said, the ``\`` of + ``\(newline)`` is still an escape which changes the meaning of + the following character. Alternate Proposals =================== -Several people have suggested alternative ways of marking the line -end. Most of these were rejected for not actually simplifying things. - -The one exception was to let any unfinished expression signify a line -continuation, possibly in conjunction with increased indentation. - -This is attractive because it is a generalization of the rule for -parentheses. - -The initial objections to this were: - -- The amount of whitespace may be contentious; expression continuation - should not be confused with opening a new suite. - -- The "expression continuation" markers are not as clearly marked in - Python as the grouping punctuation "(), [], {}" marks are:: - - # Plus needs another operand, so the line continues - "abc" + - "def" + Several people have suggested alternative ways of marking the line + end. Most of these were rejected for not actually simplifying things. - # String ends an expression, so the line does not - # not continue. The next line is a syntax error because - # unary plus does not apply to strings. - "abc" - + "def" + The one exception was to let any unfished expression signify a line + continuation, possibly in conjunction with increased indentation. -- Guido objected for technical reasons. [#dedent]_ The most obvious - implementation would require allowing INDENT or DEDENT tokens - anywhere, or at least in a widely expanded (and ill-defined) set of - locations. While this is of concern only for the internal parsing - mechanism (rather than for users), it would be a major new source of - complexity. + This is attractive because it is a generalization of the rule for + parentheses. -Andrew Koenig then pointed out [#lexical]_ a better implementation -strategy, and said that it had worked quite well in other -languages. [#snocone]_ The improved suggestion boiled down to: + The initial objections to this were: + + - The amount of whitespace may be contentious; expression + continuation should not be confused with opening a new + suite. + + - The "expression continuation" markers are not as clearly marked + in Python as the grouping punctuation "(), [], {}" marks are:: + + # Plus needs another operand, so the line continues + "abc" + + "def" + + # String ends an expression, so the line does not + # not continue. The next line is a syntax error because + # unary plus does not apply to strings. + "abc" + + "def" + + - Guido objected for technical reasons. [#dedent]_ The most + obvious implementation would require allowing INDENT or + DEDENT tokens anywhere, or at least in a widely expanded + (and ill-defined) set of locations. While this is concern + only for the internal parsing mechanism (rather than for + users), it would be a major new source of complexity. + + Andrew Koenig then pointed out [#lexical]_ a better implementation + strategy, and said that it had worked quite well in other + languages. [#snocone]_ The improved suggestion boiled down to:: + + The whitespace that follows an (operator or) open bracket or + parenthesis can include newline characters. + + It would be implemented at a very low lexical level -- even + before the decision is made to turn a newline followed by + spaces into an INDENT or DEDENT token. + + There is still some concern that it could mask bugs, as in this + example [#guidobughide]_:: + + # Used to be y+1, the 1 got dropped. Syntax Error (today) + # would become nonsense. + x = y+ + f(x) - The whitespace that follows an (operator or) open bracket or - parenthesis can include newline characters. - - It would be implemented at a very low lexical level -- even before - the decision is made to turn a newline followed by spaces into an - INDENT or DEDENT token. - -There is still some concern that it could mask bugs, as in this -example [#guidobughide]_:: - - # Used to be y+1, the 1 got dropped. Syntax Error (today) - # would become nonsense. - x = y+ - f(x) - -Requiring that the continuation be indented more than the initial line -would add both safety and complexity. + Requiring that the continuation be indented more than the initial + line would add both safety and complexity. Open Issues =========== -* Should ``\``-continuation be removed even inside strings? + + Should ``\``-continuation be removed even inside strings? -* Should the continuation markers be expanded from just ([{}]) to - include lines ending with an operator? + + Should the continuation markers be expanced from just ([{}]) + to include lines ending with an operator? -* As a safety measure, should the continuation line be required to be - more indented than the initial line? + + As a safety measure, should the continuation line be required + to be more indented than the initial line? References ========== - + .. [#dedent] (email subject) PEP 30XZ: Simplified Parsing, van Rossum http://mail.python.org/pipermail/python-3000/2007-April/007063.html .. [#lexical] (email subject) PEP-3125 -- remove backslash continuation, Koenig http://mail.python.org/pipermail/python-3000/2007-May/007237.html - + .. [#snocone] The Snocone Programming Language, Koenig http://www.snobol4.com/report.htm @@ -226,15 +227,14 @@ Copyright ========= -This document has been placed in the public domain. + This document has been placed in the public domain. -.. - Local Variables: - mode: indented-text - indent-tabs-mode: nil - sentence-end-double-space: t - fill-column: 70 - coding: utf-8 - End: +Local Variables: +mode: indented-text +indent-tabs-mode: nil +sentence-end-double-space: t +fill-column: 70 +coding: utf-8 +End: From nnorwitz at gmail.com Fri May 4 22:09:43 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 4 May 2007 16:09:43 -0400 Subject: [Python-checkins] Python Regression Test Failures basics (1) Message-ID: <20070504200943.GA19175@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another WARNING: failed to listen on port 9907, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test test_ftplib failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_ftplib.py", line 59, in testTimeoutConnect ftp.connect("localhost", timeout=30) File "/tmp/python-test/local/lib/python2.6/ftplib.py", line 129, in connect self.sock = socket.create_connection((self.host, self.port), self.timeout) File "/tmp/python-test/local/lib/python2.6/socket.py", line 443, in create_connection raise error, msg error: (111, 'Connection refused') test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7328 refs] [7328 refs] [7328 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7703 refs] [7703 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket WARNING: failed to listen on port 50007, trying another WARNING: failed to listen on port 9907, trying another test_socket_ssl test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7323 refs] [7321 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7321 refs] [8869 refs] [7539 refs] [7324 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] [7323 refs] . [7323 refs] [7323 refs] this bit of output is from a test of stdout in a different process ... [7323 refs] [7323 refs] [7539 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7323 refs] [7323 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7327 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 297 tests OK. 1 test failed: test_ftplib 29 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [482723 refs] From buildbot at python.org Fri May 4 22:20:34 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 May 2007 20:20:34 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070504202034.6543B1E4006@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/513 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri May 4 22:24:02 2007 From: python-checkins at python.org (facundo.batista) Date: Fri, 4 May 2007 22:24:02 +0200 (CEST) Subject: [Python-checkins] r55133 - python/branches/decimal-branch/Lib/decimal.py Message-ID: <20070504202402.9F60B1E4006@bag.python.org> Author: facundo.batista Date: Fri May 4 22:24:00 2007 New Revision: 55133 Modified: python/branches/decimal-branch/Lib/decimal.py Log: Changed simple to double quotes in the result of the doc tests, because that's the way the result is built. Modified: python/branches/decimal-branch/Lib/decimal.py ============================================================================== --- python/branches/decimal-branch/Lib/decimal.py (original) +++ python/branches/decimal-branch/Lib/decimal.py Fri May 4 22:24:00 2007 @@ -2712,7 +2712,7 @@ received object already is in it's canonical form. >>> ExtendedContext.canonical(Decimal('2.50')) - Decimal('2.50') + Decimal("2.50") """ return a.canonical(context=self) @@ -2761,17 +2761,17 @@ representations. >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9')) - Decimal('-1') + Decimal("-1") >>> ExtendedContext.compare_total(Decimal('-127'), Decimal('12')) - Decimal('-1') + Decimal("-1") >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3')) - Decimal('-1') + Decimal("-1") >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30')) - Decimal('0') + Decimal("0") >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('12.300')) - Decimal('1') + Decimal("1") >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('NaN')) - Decimal('-1') + Decimal("-1") """ return a.compare_total(b, context=self) @@ -2786,9 +2786,9 @@ """Returns a copy of the operand with the sign set to 0. >>> ExtendedContext.copy_abs(Decimal('2.1')) - Decimal('2.1') + Decimal("2.1") >>> ExtendedContext.copy_abs(Decimal('-100')) - Decimal('100') + Decimal("100") """ return a.copy_abs(context=self) @@ -2796,9 +2796,9 @@ """Returns a copy of the decimal objet. >>> ExtendedContext.copy_decimal(Decimal('2.1')) - Decimal('2.1') + Decimal("2.1") >>> ExtendedContext.copy_decimal(Decimal('-1.00')) - Decimal('-1.00') + Decimal("-1.00") """ return a @@ -2806,9 +2806,9 @@ """Returns a copy of the operand with the sign inverted. >>> ExtendedContext.copy_negate(Decimal('101.5')) - Decimal('-101.5') + Decimal("-101.5") >>> ExtendedContext.copy_negate(Decimal('-101.5')) - Decimal('101.5') + Decimal("101.5") """ return a.copy_negate(context=self) @@ -2819,13 +2819,13 @@ equal to the sign of the second operand. >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33')) - Decimal('1.50') + Decimal("1.50") >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33')) - Decimal('1.50') + Decimal("1.50") >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33')) - Decimal('-1.50') + Decimal("-1.50") >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33')) - Decimal('-1.50') + Decimal("-1.50") """ return a.copy_sign(b, context=self) @@ -2874,17 +2874,17 @@ """Returns e ** a. >>> ExtendedContext.exp(Decimal('-Infinity')) - Decimal('0') + Decimal("0") >>> ExtendedContext.exp(Decimal('-1')) - Decimal('0.367879441') + Decimal("0.367879441") >>> ExtendedContext.exp(Decimal('0')) - Decimal('1') + Decimal("1") >>> ExtendedContext.exp(Decimal('1')) - Decimal('2.71828183') + Decimal("2.71828183") >>> ExtendedContext.exp(Decimal('0.693147181')) - Decimal('2.00000000') + Decimal("2.00000000") >>> ExtendedContext.exp(Decimal('+Infinity')) - Decimal('Inf') + Decimal("Inf") """ return a.exp(context=self) @@ -2896,18 +2896,18 @@ multiplication, using add, all with only one final rounding. >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7')) - Decimal('22') + Decimal("22") >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7')) - Decimal('-8') + Decimal("-8") >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578')) - Decimal('1.38435736E+12') + Decimal("1.38435736E+12") """ def is_canonical(self, a): """Returns 1 if the operand is canonical; otherwise returns 0. >>> ExtendedContext.is_canonical(Decimal('2.50')) - Decimal('1') + Decimal("1") """ return a.is_canonical(context=self) @@ -2917,15 +2917,15 @@ For it to be finite, it must be neither infinite nor a NaN. >>> ExtendedContext.is_finite(Decimal('2.50')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_finite(Decimal('-0.3')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_finite(Decimal('0')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_finite(Decimal('Inf')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_finite(Decimal('NaN')) - Decimal('0') + Decimal("0") """ return a.is_finite(context=self) @@ -2933,11 +2933,11 @@ """Returns 1 if the operand is an Infinite, otherwise returns 0. >>> ExtendedContext.is_infinite(Decimal('2.50')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_infinite(Decimal('-Inf')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_infinite(Decimal('NaN')) - Decimal('0') + Decimal("0") """ return a.is_infinite(context=self) @@ -2945,11 +2945,11 @@ """Returns 1 if the operand is qNaN or sNaN, otherwise returns 0. >>> ExtendedContext.is_nan(Decimal('2.50')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_nan(Decimal('NaN')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_nan(Decimal('-sNaN')) - Decimal('1') + Decimal("1") """ return a.is_nan(context=self) @@ -2957,15 +2957,15 @@ """Returns 1 if the operand is a normal number, otherwise returns 0. >>> ExtendedContext.is_normal(Decimal('2.50')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_normal(Decimal('0.1E-999')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_normal(Decimal('0.00')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_normal(Decimal('-Inf')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_normal(Decimal('NaN')) - Decimal('0') + Decimal("0") """ return a.is_normal(context=self) @@ -2973,11 +2973,11 @@ """Returns 1 if the operand is a quiet NaN, otherwise returns 0. >>> ExtendedContext.is_qnan(Decimal('2.50')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_qnan(Decimal('NaN')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_qnan(Decimal('sNaN')) - Decimal('0') + Decimal("0") """ return a.is_qnan(context=self) @@ -2985,11 +2985,11 @@ """Returns 1 if the operand is negative, otherwise returns 0. >>> ExtendedContext.is_signed(Decimal('2.50')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_signed(Decimal('-12')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_signed(Decimal('-0')) - Decimal('1') + Decimal("1") """ return a.is_signed(context=self) @@ -2997,11 +2997,11 @@ """Returns 1 if the operand is a signaling NaN, otherwise returns 0. >>> ExtendedContext.is_snan(Decimal('2.50')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_snan(Decimal('NaN')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_snan(Decimal('sNaN')) - Decimal('1') + Decimal("1") """ return a.is_snan(context=self) @@ -3009,15 +3009,15 @@ """Returns 1 if the operand is subnormal, otherwise returns 0. >>> ExtendedContext.is_subnormal(Decimal('2.50')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_subnormal(Decimal('0.1E-999')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_subnormal(Decimal('0.00')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_subnormal(Decimal('-Inf')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_subnormal(Decimal('NaN')) - Decimal('0') + Decimal("0") """ return a.is_subnormal(context=self) @@ -3025,11 +3025,11 @@ """Returns 1 if the operand is a zero, otherwise returns 0. >>> ExtendedContext.is_zero(Decimal('0')) - Decimal('1') + Decimal("1") >>> ExtendedContext.is_zero(Decimal('2.50')) - Decimal('0') + Decimal("0") >>> ExtendedContext.is_zero(Decimal('-0E+2')) - Decimal('1') + Decimal("1") """ return a.is_zero(context=self) @@ -3037,15 +3037,15 @@ """Returns the natural (base e) logarithm of the operand. >>> ExtendedContext.ln(Decimal('0')) - Decimal('-Inf') + Decimal("-Inf") >>> ExtendedContext.ln(Decimal('1.000')) - Decimal('0') + Decimal("0") >>> ExtendedContext.ln(Decimal('2.71828183')) - Decimal('1.00000000') + Decimal("1.00000000") >>> ExtendedContext.ln(Decimal('10')) - Decimal('2.30258509') + Decimal("2.30258509") >>> ExtendedContext.ln(Decimal('+Infinity')) - Decimal('Inf') + Decimal("Inf") """ return a.ln(context=self) @@ -3053,19 +3053,19 @@ """Returns the base 10 logarithm of the operand. >>> ExtendedContext.log10(Decimal('0')) - Decimal('-In') + Decimal("-In") >>> ExtendedContext.log10(Decimal('0.001')) - Decimal('-3') + Decimal("-3") >>> ExtendedContext.log10(Decimal('1.000')) - Decimal('0') + Decimal("0") >>> ExtendedContext.log10(Decimal('2')) - Decimal('0.301029996') + Decimal("0.301029996") >>> ExtendedContext.log10(Decimal('10')) - Decimal('1') + Decimal("1") >>> ExtendedContext.log10(Decimal('70')) - Decimal('1.84509804') + Decimal("1.84509804") >>> ExtendedContext.log10(Decimal('+Infinity')) - Decimal('Inf') + Decimal("Inf") """ return a.log10(context=self) @@ -3078,13 +3078,13 @@ value of that digit and without limiting the resulting exponent). >>> ExtendedContext.logb(Decimal('250')) - Decimal('2') + Decimal("2") >>> ExtendedContext.logb(Decimal('2.50')) - Decimal('0') + Decimal("0") >>> ExtendedContext.logb(Decimal('0.03')) - Decimal('-2') + Decimal("-2") >>> ExtendedContext.logb(Decimal('0')) - Decimal('-Inf') + Decimal("-Inf") """ return a.logb(context=self) @@ -3094,17 +3094,17 @@ The operands must be both logical numbers. >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0')) - Decimal('0') + Decimal("0") >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1')) - Decimal('0') + Decimal("0") >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0')) - Decimal('0') + Decimal("0") >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1')) - Decimal('1') + Decimal("1") >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010')) - Decimal('1000') + Decimal("1000") >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10')) - Decimal('10') + Decimal("10") """ return a.logical_and(b, context=self) @@ -3114,13 +3114,13 @@ The operand must be a logical number. >>> ExtendedContext.logical_invert(Decimal('0')) - Decimal('111111111') + Decimal("111111111") >>> ExtendedContext.logical_invert(Decimal('1')) - Decimal('111111110') + Decimal("111111110") >>> ExtendedContext.logical_invert(Decimal('111111111')) - Decimal('0') + Decimal("0") >>> ExtendedContext.logical_invert(Decimal('101010101')) - Decimal('10101010') + Decimal("10101010") """ return a.logical_invert(context=self) @@ -3130,17 +3130,17 @@ The operands must be both logical numbers. >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0')) - Decimal('0') + Decimal("0") >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1')) - Decimal('1') + Decimal("1") >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0')) - Decimal('1') + Decimal("1") >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1')) - Decimal('1') + Decimal("1") >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010')) - Decimal('1110') + Decimal("1110") >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10')) - Decimal('1110') + Decimal("1110") """ return a.logical_or(b, context=self) @@ -3150,17 +3150,17 @@ The operands must be both logical numbers. >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) - Decimal('0') + Decimal("0") >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) - Decimal('1') + Decimal("1") >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0')) - Decimal('1') + Decimal("1") >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1')) - Decimal('0') + Decimal("0") >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010')) - Decimal('110') + Decimal("110") >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10')) - Decimal('1101') + Decimal("1101") """ return a.logical_xor(b, context=self) @@ -3251,13 +3251,13 @@ """Returns the largest representable number smaller than a. >>> ExtendedContext.next_minus(Decimal('1')) - Decimal('0.999999999') + Decimal("0.999999999") >>> ExtendedContext.next_minus(Decimal('1E-1007')) - Decimal('0E-1007') + Decimal("0E-1007") >>> ExtendedContext.next_minus(Decimal('-1.00000003')) - Decimal('-1.00000004') + Decimal("-1.00000004") >>> ExtendedContext.next_minus(Decimal('Infinity')) - Decimal('9.99999999E+999') + Decimal("9.99999999E+999") """ return a.next_minus(context=self) @@ -3265,13 +3265,13 @@ """Returns the smallest representable number larger than a. >>> ExtendedContext.next_plus(Decimal('1')) - Decimal('1.00000001') + Decimal("1.00000001") >>> ExtendedContext.next_plus(Decimal('-1E-1007')) - Decimal('-0E-1007') + Decimal("-0E-1007") >>> ExtendedContext.next_plus(Decimal('-1.00000003')) - Decimal('-1.00000002') + Decimal("-1.00000002") >>> ExtendedContext.next_plus(Decimal('-Infinity')) - Decimal('-9.99999999E+999') + Decimal("-9.99999999E+999") """ return a.next_plus(context=self) @@ -3284,19 +3284,19 @@ value. >>> ExtendedContext.next_toward(Decimal('1'), Decimal('2')) - Decimal('1.00000001') + Decimal("1.00000001") >>> ExtendedContext.next_toward(Decimal('-1E-1007'), Decimal('1')) - Decimal('-0E-1007') + Decimal("-0E-1007") >>> ExtendedContext.next_toward(Decimal('-1.00000003'), Decimal('0')) - Decimal('-1.00000002') + Decimal("-1.00000002") >>> ExtendedContext.next_toward(Decimal('1'), Decimal('0')) - Decimal('0.999999999') + Decimal("0.999999999") >>> ExtendedContext.next_toward(Decimal('1E-1007'), Decimal('-100')) - Decimal('0E-1007') + Decimal("0E-1007") >>> ExtendedContext.next_toward(Decimal('-1.00000003'), Decimal('-10')) - Decimal('-1.00000004') + Decimal("-1.00000004") >>> ExtendedContext.next_toward(Decimal('0.00'), Decimal('-0.0000')) - Decimal('-0.00') + Decimal("-0.00") """ return a.next_toward(b, context=self) @@ -3483,7 +3483,7 @@ """Just returns 10, as this is Decimal, :) >>> ExtendedContext.radix() - Decimal('10') + Decimal("10") """ return Decimal(10) @@ -3551,15 +3551,15 @@ positive or to the right otherwise. >>> ExtendedContext.rotate(Decimal('34'), Decimal('8')) - Decimal('400000003') + Decimal("400000003") >>> ExtendedContext.rotate(Decimal('12'), Decimal('9')) - Decimal('12') + Decimal("12") >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2')) - Decimal('891234567') + Decimal("891234567") >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0')) - Decimal('123456789') + Decimal("123456789") >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2')) - Decimal('345678912') + Decimal("345678912") """ return a.rotate(b, context=self) @@ -3584,11 +3584,11 @@ """Returns the first operand after adding the second value its exp. >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2')) - Decimal('0.0750') + Decimal("0.0750") >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0')) - Decimal('7.50') + Decimal("7.50") >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3')) - Decimal('7.50E+3') + Decimal("7.50E+3") """ return a.scaleb (b, context=self) @@ -3603,15 +3603,15 @@ coefficient are zeros. >>> ExtendedContext.shift(Decimal('34'), Decimal('8')) - Decimal('400000000') + Decimal("400000000") >>> ExtendedContext.shift(Decimal('12'), Decimal('9')) - Decimal('0') + Decimal("0") >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2')) - Decimal('1234567') + Decimal("1234567") >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0')) - Decimal('123456789') + Decimal("123456789") >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2')) - Decimal('345678900') + Decimal("345678900") """ return a.shift(b, context=self) @@ -3683,21 +3683,21 @@ context. >>> ExtendedContext.to_integral_exact(Decimal('2.1')) - Decimal('2') + Decimal("2") >>> ExtendedContext.to_integral_exact(Decimal('100')) - Decimal('100') + Decimal("100") >>> ExtendedContext.to_integral_exact(Decimal('100.0')) - Decimal('100') + Decimal("100") >>> ExtendedContext.to_integral_exact(Decimal('101.5')) - Decimal('102') + Decimal("102") >>> ExtendedContext.to_integral_exact(Decimal('-101.5')) - Decimal('-102') + Decimal("-102") >>> ExtendedContext.to_integral_exact(Decimal('10E+5')) - Decimal('1.0E+6') + Decimal("1.0E+6") >>> ExtendedContext.to_integral_exact(Decimal('7.89E+77')) - Decimal('7.89E+77') + Decimal("7.89E+77") >>> ExtendedContext.to_integral_exact(Decimal('-Inf')) - Decimal('-Infinity') + Decimal("-Infinity") """ def to_integral_value(self, a): From python-checkins at python.org Fri May 4 22:30:23 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 4 May 2007 22:30:23 +0200 (CEST) Subject: [Python-checkins] r55134 - python/branches/py3k-struni/Lib/pickle.py Message-ID: <20070504203023.498961E4006@bag.python.org> Author: guido.van.rossum Date: Fri May 4 22:30:19 2007 New Revision: 55134 Modified: python/branches/py3k-struni/Lib/pickle.py Log: Much more pickling now works. Modified: python/branches/py3k-struni/Lib/pickle.py ============================================================================== --- python/branches/py3k-struni/Lib/pickle.py (original) +++ python/branches/py3k-struni/Lib/pickle.py Fri May 4 22:30:19 2007 @@ -308,7 +308,7 @@ (t.__name__, obj)) # Check for string returned by reduce(), meaning "save as global" - if inistance(rv, basestring): + if isinstance(rv, basestring): self.save_global(obj, rv) return @@ -512,7 +512,8 @@ else: obj = obj.replace("\\", "\\u005c") obj = obj.replace("\n", "\\u000a") - self.write(UNICODE + obj.encode('raw-unicode-escape') + 'b\n') + self.write(UNICODE + bytes(obj.encode('raw-unicode-escape')) + + b'\n') self.memoize(obj) dispatch[str] = save_unicode @@ -895,7 +896,7 @@ dispatch[BININT2[0]] = load_binint2 def load_long(self): - self.append(int(self.readline()[:-1], 0)) + self.append(int(str(self.readline()[:-1]), 0)) dispatch[LONG[0]] = load_long def load_long1(self): @@ -1081,6 +1082,8 @@ def find_class(self, module, name): # Subclasses may override this + module = str(module) + name = str(name) __import__(module) mod = sys.modules[module] klass = getattr(mod, name) @@ -1122,7 +1125,7 @@ dispatch[LONG_BINGET[0]] = load_long_binget def load_put(self): - self.memo[self.readline()[:-1]] = self.stack[-1] + self.memo[str(self.readline()[:-1])] = self.stack[-1] dispatch[PUT[0]] = load_put def load_binput(self): From python-checkins at python.org Fri May 4 22:42:46 2007 From: python-checkins at python.org (facundo.batista) Date: Fri, 4 May 2007 22:42:46 +0200 (CEST) Subject: [Python-checkins] r55135 - python/branches/decimal-branch/Lib/decimal.py Message-ID: <20070504204246.7915D1E4006@bag.python.org> Author: facundo.batista Date: Fri May 4 22:42:39 2007 New Revision: 55135 Modified: python/branches/decimal-branch/Lib/decimal.py Log: Made the copy_abs, copy_sign, copy_negate, copy_decimal, is_finite, is_infinite, is_nan, is_qnan, is_signed, is_snan and is_zero operations. Modified: python/branches/decimal-branch/Lib/decimal.py ============================================================================== --- python/branches/decimal-branch/Lib/decimal.py (original) +++ python/branches/decimal-branch/Lib/decimal.py Fri May 4 22:42:39 2007 @@ -2339,48 +2339,80 @@ def copy_abs(self, context=None): """Returns a copy with the sign set to 0. """ + return Decimal((0, self._int, self._exp)) def copy_negate(self, context=None): """Returns a copy with the sign inverted.""" + if self._sign: + return Decimal((0, self._int, self._exp)) + else: + return Decimal((1, self._int, self._exp)) def copy_sign(self, other, context=None): """Returns self with the sign of other.""" + return Decimal((other._sign, self._int, self._exp)) def exp(self, context=None): """Returns e ** self.""" def is_canonical(self, context=None): """Returns 1 if self is canonical; otherwise returns 0.""" + return Decimal(1) def is_finite(self, context=None): """Returns 1 if self is finite, otherwise returns 0. For it to be finite, it must be neither infinite nor a NaN. """ + if self._is_special: + return Decimal(0) + else: + return Decimal(1) def is_infinite(self, context=None): """Returns 1 if self is an Infinite, otherwise returns 0.""" + if self._isinfinity(): + return Decimal(1) + else: + return Decimal(0) def is_nan(self, context=None): """Returns 1 if self is qNaN or sNaN, otherwise returns 0.""" + if self._isnan(): + return Decimal(1) + else: + return Decimal(0) def is_normal(self, context=None): """Returns 1 if self is a normal number, otherwise returns 0.""" def is_qnan(self, context=None): """Returns 1 if self is a quiet NaN, otherwise returns 0.""" + if self._isnan() == 1: + return Decimal(1) + else: + return Decimal(0) def is_signed(self, context=None): """Returns 1 if self is negative, otherwise returns 0.""" + return Decimal(self._sign) def is_snan(self, context=None): """Returns 1 if self is a signaling NaN, otherwise returns 0.""" + if self._isnan() == 2: + return Decimal(1) + else: + return Decimal(0) def is_subnormal(self, context=None): """Returns 1 if self is subnormal, otherwise returns 0.""" def is_zero(self, context=None): """Returns 1 if self is a zero, otherwise returns 0.""" + if self: + return Decimal(0) + else: + return Decimal(1) def ln(self, context=None): """Returns the natural (base e) logarithm of self.""" @@ -2457,6 +2489,8 @@ def shift(self, other, context=None): """Returns a shifted copy of self, value-of-other times.""" + + # Support for pickling, copy, and deepcopy def __reduce__(self): return (self.__class__, (str(self),)) @@ -2909,7 +2943,7 @@ >>> ExtendedContext.is_canonical(Decimal('2.50')) Decimal("1") """ - return a.is_canonical(context=self) + return Decimal(1) def is_finite(self, a): """Returns 1 if the operand is finite, otherwise returns 0. From python-checkins at python.org Fri May 4 22:46:08 2007 From: python-checkins at python.org (facundo.batista) Date: Fri, 4 May 2007 22:46:08 +0200 (CEST) Subject: [Python-checkins] r55136 - python/branches/decimal-branch/Lib/test/test_decimal.py Message-ID: <20070504204608.284DD1E401E@bag.python.org> Author: facundo.batista Date: Fri May 4 22:46:06 2007 New Revision: 55136 Modified: python/branches/decimal-branch/Lib/test/test_decimal.py Log: Finished touching small test in test_decimal for immutability, previously I changed a sign and forgot to change it pair. Modified: python/branches/decimal-branch/Lib/test/test_decimal.py ============================================================================== --- python/branches/decimal-branch/Lib/test/test_decimal.py (original) +++ python/branches/decimal-branch/Lib/test/test_decimal.py Fri May 4 22:46:06 2007 @@ -966,7 +966,7 @@ d1 = Decimal('-25e55') b1 = Decimal('-25e55') d2 = Decimal('33e+33') - b2 = Decimal('33e-33') + b2 = Decimal('33e+33') def checkSameDec(operation, useOther=False): if useOther: From python-checkins at python.org Fri May 4 22:46:35 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 May 2007 22:46:35 +0200 (CEST) Subject: [Python-checkins] r55137 - peps/trunk/pep-3125.txt Message-ID: <20070504204635.E28C51E401E@bag.python.org> Author: georg.brandl Date: Fri May 4 22:46:34 2007 New Revision: 55137 Modified: peps/trunk/pep-3125.txt Log: Revert r55132. Sorry Guido, but I was faster :) Modified: peps/trunk/pep-3125.txt ============================================================================== --- peps/trunk/pep-3125.txt (original) +++ peps/trunk/pep-3125.txt Fri May 4 22:46:34 2007 @@ -13,197 +13,196 @@ Abstract ======== - Python initially inherited its parsing from C. While this has - been generally useful, there are some remnants which have been - less useful for python, and should be eliminated. +Python initially inherited its parsing from C. While this has been +generally useful, there are some remnants which have been less useful +for Python, and should be eliminated. - This PEP proposes elimination of terminal ``\`` as a marker for - line continuation. +This PEP proposes elimination of terminal ``\`` as a marker for line +continuation. Motivation ========== - One goal for Python 3000 should be to simplify the language by - removing unnecessary or duplicated features. There are currently - several ways to indicate that a logical line is continued on the - following physical line. - - The other continuation methods are easily explained as a logical - consequence of the semantics they provide; ``\`` is simply an escape - character that needs to be memorized. +One goal for Python 3000 should be to simplify the language by +removing unnecessary or duplicated features. There are currently +several ways to indicate that a logical line is continued on the +following physical line. + +The other continuation methods are easily explained as a logical +consequence of the semantics they provide; ``\`` is simply an escape +character that needs to be memorized. Existing Line Continuation Methods ================================== -Parenthetical Expression - ([{}]) ---------------------------------- +Parenthetical Expression - ``([{}])`` +------------------------------------- - Open a parenthetical expression. It doesn't matter whether people - view the "line" as continuing; they do immediately recognize that - the expression needs to be closed before the statement can end. - - An examples using each of (), [], and {}:: - - def fn(long_argname1, - long_argname2): - settings = {"background": "random noise" - "volume": "barely audible"} - restrictions = ["Warrantee void if used", - "Notice must be recieved by yesterday" - "Not responsible for sales pitch"] - - Note that it is always possible to parenthesize an expression, - but it can seem odd to parenthesize an expression that needs - them only for the line break:: +Open a parenthetical expression. It doesn't matter whether people +view the "line" as continuing; they do immediately recognize that the +expression needs to be closed before the statement can end. + +Examples using each of ``()``, ``[]``, and ``{}``:: + + def fn(long_argname1, + long_argname2): + settings = {"background": "random noise", + "volume": "barely audible"} + restrictions = ["Warrantee void if used", + "Notice must be received by yesterday", + "Not responsible for sales pitch"] + +Note that it is always possible to parenthesize an expression, but it +can seem odd to parenthesize an expression that needs parentheses only +for the line break:: - assert val>4, ( - "val is too small") + assert val>4, ( + "val is too small") Triple-Quoted Strings --------------------- - Open a triple-quoted string; again, people recognize that the - string needs to finish before the next statement starts. +Open a triple-quoted string; again, people recognize that the string +needs to finish before the next statement starts. :: - banner_message = """ - Satisfaction Guaranteed, - or DOUBLE YOUR MONEY BACK!!! + banner_message = """ + Satisfaction Guaranteed, + or DOUBLE YOUR MONEY BACK!!! - some minor restrictions apply""" + some minor restrictions apply""" Terminal ``\`` in the general case ---------------------------------- - A terminal ``\`` indicates that the logical line is continued on the - following physical line (after whitespace). There are no - particular semantics associated with this. This form is never - required, although it may look better (particularly for people - with a C language background) in some cases:: - - >>> assert val>4, \ - "val is too small" - - Also note that the ``\`` must be the final character in the line. - If your editor navigation can add whitespace to the end of a line, - that invisible change will alter the semantics of the program. - Fortunately, the typical result is only a syntax error, rather - than a runtime bug:: +A terminal ``\`` indicates that the logical line is continued on the +following physical line (after whitespace). There are no particular +semantics associated with this. This form is never required, although +it may look better (particularly for people with a C language +background) in some cases:: + + >>> assert val>4, \ + "val is too small" + +Also note that the ``\`` must be the final character in the line. If +your editor navigation can add whitespace to the end of a line, that +invisible change will alter the semantics of the program. +Fortunately, the typical result is only a syntax error, rather than a +runtime bug:: - >>> assert val>4, \ - "val is too small" + >>> assert val>4, \ + "val is too small" - SyntaxError: unexpected character after line continuation character + SyntaxError: unexpected character after line continuation character - This PEP proposes to eliminate this redundant and potentially - confusing alternative. +This PEP proposes to eliminate this redundant and potentially +confusing alternative. Terminal ``\`` within a string ------------------------------ - A terminal ``\`` within a single-quoted string, at the end of the - line. This is arguably a special case of the terminal ``\``, but - it is a special case that may be worth keeping. - - >>> "abd\ - def" - 'abd def' - - + Many of the objections to removing ``\`` termination were really - just objections to removing it within literal strings; several - people clarified that they want to keep this literal-string - usage, but don't mind losing the general case. - - + The use of ``\`` for an escape character within strings is well - known. - - - But note that this particular usage is odd, because the escaped - character (the newline) is invisible, and the special treatment - is to delete the character. That said, the ``\`` of - ``\(newline)`` is still an escape which changes the meaning of - the following character. +A terminal ``\`` within a single-quoted string, at the end of the +line. This is arguably a special case of the terminal ``\``, but it +is a special case that may be worth keeping. :: + + >>> "abd\ + def" + 'abd def' + +* Pro: Many of the objections to removing ``\`` termination were + really just objections to removing it within literal strings; + several people clarified that they want to keep this literal-string + usage, but don't mind losing the general case. + +* Pro: The use of ``\`` for an escape character within strings is well + known. + +* Contra: But note that this particular usage is odd, because the + escaped character (the newline) is invisible, and the special + treatment is to delete the character. That said, the ``\`` of + ``\(newline)`` is still an escape which changes the meaning of the + following character. Alternate Proposals =================== - Several people have suggested alternative ways of marking the line - end. Most of these were rejected for not actually simplifying things. +Several people have suggested alternative ways of marking the line +end. Most of these were rejected for not actually simplifying things. - The one exception was to let any unfished expression signify a line - continuation, possibly in conjunction with increased indentation. +The one exception was to let any unfinished expression signify a line +continuation, possibly in conjunction with increased indentation. - This is attractive because it is a generalization of the rule for - parentheses. +This is attractive because it is a generalization of the rule for +parentheses. - The initial objections to this were: - - - The amount of whitespace may be contentious; expression - continuation should not be confused with opening a new - suite. - - - The "expression continuation" markers are not as clearly marked - in Python as the grouping punctuation "(), [], {}" marks are:: - - # Plus needs another operand, so the line continues - "abc" + - "def" - - # String ends an expression, so the line does not - # not continue. The next line is a syntax error because - # unary plus does not apply to strings. - "abc" - + "def" - - - Guido objected for technical reasons. [#dedent]_ The most - obvious implementation would require allowing INDENT or - DEDENT tokens anywhere, or at least in a widely expanded - (and ill-defined) set of locations. While this is concern - only for the internal parsing mechanism (rather than for - users), it would be a major new source of complexity. - - Andrew Koenig then pointed out [#lexical]_ a better implementation - strategy, and said that it had worked quite well in other - languages. [#snocone]_ The improved suggestion boiled down to:: - - The whitespace that follows an (operator or) open bracket or - parenthesis can include newline characters. - - It would be implemented at a very low lexical level -- even - before the decision is made to turn a newline followed by - spaces into an INDENT or DEDENT token. - - There is still some concern that it could mask bugs, as in this - example [#guidobughide]_:: - - # Used to be y+1, the 1 got dropped. Syntax Error (today) - # would become nonsense. - x = y+ - f(x) +The initial objections to this were: - Requiring that the continuation be indented more than the initial - line would add both safety and complexity. +- The amount of whitespace may be contentious; expression continuation + should not be confused with opening a new suite. + +- The "expression continuation" markers are not as clearly marked in + Python as the grouping punctuation "(), [], {}" marks are:: + + # Plus needs another operand, so the line continues + "abc" + + "def" + + # String ends an expression, so the line does not + # not continue. The next line is a syntax error because + # unary plus does not apply to strings. + "abc" + + "def" + +- Guido objected for technical reasons. [#dedent]_ The most obvious + implementation would require allowing INDENT or DEDENT tokens + anywhere, or at least in a widely expanded (and ill-defined) set of + locations. While this is of concern only for the internal parsing + mechanism (rather than for users), it would be a major new source of + complexity. + +Andrew Koenig then pointed out [#lexical]_ a better implementation +strategy, and said that it had worked quite well in other +languages. [#snocone]_ The improved suggestion boiled down to: + + The whitespace that follows an (operator or) open bracket or + parenthesis can include newline characters. + + It would be implemented at a very low lexical level -- even before + the decision is made to turn a newline followed by spaces into an + INDENT or DEDENT token. + +There is still some concern that it could mask bugs, as in this +example [#guidobughide]_:: + + # Used to be y+1, the 1 got dropped. Syntax Error (today) + # would become nonsense. + x = y+ + f(x) + +Requiring that the continuation be indented more than the initial line +would add both safety and complexity. Open Issues =========== - + Should ``\``-continuation be removed even inside strings? +* Should ``\``-continuation be removed even inside strings? - + Should the continuation markers be expanced from just ([{}]) - to include lines ending with an operator? +* Should the continuation markers be expanded from just ([{}]) to + include lines ending with an operator? - + As a safety measure, should the continuation line be required - to be more indented than the initial line? +* As a safety measure, should the continuation line be required to be + more indented than the initial line? References @@ -227,14 +226,15 @@ Copyright ========= - This document has been placed in the public domain. +This document has been placed in the public domain. -Local Variables: -mode: indented-text -indent-tabs-mode: nil -sentence-end-double-space: t -fill-column: 70 -coding: utf-8 -End: +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Fri May 4 23:00:54 2007 From: python-checkins at python.org (facundo.batista) Date: Fri, 4 May 2007 23:00:54 +0200 (CEST) Subject: [Python-checkins] r55138 - python/branches/decimal-branch/Lib/decimal.py Message-ID: <20070504210054.9555D1E4006@bag.python.org> Author: facundo.batista Date: Fri May 4 23:00:49 2007 New Revision: 55138 Modified: python/branches/decimal-branch/Lib/decimal.py Log: Added a private function _islogical(), which determines if the operand is a logical one or not. Also coded the logical_invert() operation, which passes all tests ok. Modified: python/branches/decimal-branch/Lib/decimal.py ============================================================================== --- python/branches/decimal-branch/Lib/decimal.py (original) +++ python/branches/decimal-branch/Lib/decimal.py Fri May 4 23:00:49 2007 @@ -2429,11 +2429,53 @@ without limiting the resulting exponent). """ + def _islogical(self): + """Return 1 is self is a logical operand. + + For being logical, it must be a finite numbers with a sign of 0, + an exponent of 0, and a coefficient whose digits must all be + either 0 or 1. + """ + if self._sign != 0 or self._exp != 0: + return 0 + for dig in self._int: + if dig not in (0, 1): + return 0 + return 1 + def logical_and(self, other, context=None): """Applies an 'and' operation between self and other's digits.""" def logical_invert(self, context=None): """Invert all its digits.""" + if context is None: + context = getcontext() + + if not self._islogical(): + return context._raise_error(InvalidOperation) + + # fill to context.prec + dif = context.prec - len(self._int) + if dif: + self._int = (0,)*dif + self._int + + # invert, only starting after the first resulting 1 + result = [] + started = False + for dig in self._int: + if dig == 1 and not started: + continue + if dig == 1: + result.append(0) + else: + result.append(1) + started = True + result = tuple(result) + + # if empty, we must have at least a zero + if not result: + result = (0,) + return Decimal((0, result, 0)) def logical_or(self, other, context=None): """Applies an 'or' operation between self and other's digits.""" From python-checkins at python.org Sat May 5 00:08:23 2007 From: python-checkins at python.org (thomas.heller) Date: Sat, 5 May 2007 00:08:23 +0200 (CEST) Subject: [Python-checkins] r55139 - in python/branches/release25-maint: Lib/ctypes Modules/_ctypes Message-ID: <20070504220823.7FE871E4006@bag.python.org> Author: thomas.heller Date: Sat May 5 00:08:22 2007 New Revision: 55139 Modified: python/branches/release25-maint/Lib/ctypes/ (props changed) python/branches/release25-maint/Modules/_ctypes/ (props changed) Log: Blocked revisions 54357 via svnmerge ........ r54357 | thomas.heller | 2007-03-13 21:42:52 +0100 (Tue, 13 Mar 2007) | 1 line Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl. ........ From martin at v.loewis.de Sat May 5 00:48:10 2007 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat, 05 May 2007 00:48:10 +0200 Subject: [Python-checkins] r55103 - in python/trunk: Modules/itertoolsmodule.c Modules/posixmodule.c Objects/intobject.c Objects/longobject.c PC/config.c PC/pyconfig.h Python/thread_nt.h In-Reply-To: <200705041638.44246.anthony@interlink.com.au> References: <20070503202712.69E601E4005@bag.python.org> <200705041524.59134.anthony@interlink.com.au> <463AD1F9.6010006@v.loewis.de> <200705041638.44246.anthony@interlink.com.au> Message-ID: <463BB82A.80703@v.loewis.de> Anthony Baxter schrieb: > Maybe we should have a permalink for something like > Python-Current.msi and the like, that other sites can link to? I think that would only work if the most recent release page uses that link (i.e. 2.5.1 at the moment); when a new release is made, the previous release would have to be changed to point to the real file. Regards, Martin From nnorwitz at gmail.com Sat May 5 01:09:42 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 4 May 2007 16:09:42 -0700 Subject: [Python-checkins] r55138 - python/branches/decimal-branch/Lib/decimal.py In-Reply-To: <20070504210054.9555D1E4006@bag.python.org> References: <20070504210054.9555D1E4006@bag.python.org> Message-ID: On 5/4/07, facundo.batista wrote: > Author: facundo.batista > Date: Fri May 4 23:00:49 2007 > New Revision: 55138 > > Modified: > python/branches/decimal-branch/Lib/decimal.py > Log: > > Added a private function _islogical(), which determines if the > operand is a logical one or not. Also coded the logical_invert() > operation, which passes all tests ok. > > > Modified: python/branches/decimal-branch/Lib/decimal.py > ============================================================================== > --- python/branches/decimal-branch/Lib/decimal.py (original) > +++ python/branches/decimal-branch/Lib/decimal.py Fri May 4 23:00:49 2007 > @@ -2429,11 +2429,53 @@ > without limiting the resulting exponent). > """ > > + def _islogical(self): > + """Return 1 is self is a logical operand. > + > + For being logical, it must be a finite numbers with a sign of 0, > + an exponent of 0, and a coefficient whose digits must all be > + either 0 or 1. > + """ > + if self._sign != 0 or self._exp != 0: > + return 0 > + for dig in self._int: > + if dig not in (0, 1): > + return 0 > + return 1 Why not use a boolean instead of 0/1? n From python-checkins at python.org Sat May 5 03:34:08 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 5 May 2007 03:34:08 +0200 (CEST) Subject: [Python-checkins] r55140 - in python/trunk: Doc/lib/libexcs.tex Lib/ConfigParser.py Lib/test/test_defaultdict.py Lib/test/test_exceptions.py Lib/test/test_pep352.py Misc/NEWS Objects/exceptions.c Message-ID: <20070505013408.2D04E1E4006@bag.python.org> Author: brett.cannon Date: Sat May 5 03:34:02 2007 New Revision: 55140 Modified: python/trunk/Doc/lib/libexcs.tex python/trunk/Lib/ConfigParser.py python/trunk/Lib/test/test_defaultdict.py python/trunk/Lib/test/test_exceptions.py python/trunk/Lib/test/test_pep352.py python/trunk/Misc/NEWS python/trunk/Objects/exceptions.c Log: Deprecate BaseException.message as per PEP 352. Modified: python/trunk/Doc/lib/libexcs.tex ============================================================================== --- python/trunk/Doc/lib/libexcs.tex (original) +++ python/trunk/Doc/lib/libexcs.tex Sat May 5 03:34:02 2007 @@ -23,14 +23,10 @@ This may be a string or a tuple containing several items of information (e.g., an error code and a string explaining the code). The associated value is the second argument to the -\keyword{raise}\stindex{raise} statement. For string exceptions, the -associated value itself will be stored in the variable named as the -second argument of the \keyword{except} clause (if any). For class -exceptions, that variable receives the exception instance. If the -exception class is derived from the standard root class -\exception{BaseException}, the associated value is present as the -exception instance's \member{args} attribute. If there is a single argument -(as is preferred), it is bound to the \member{message} attribute. +\keyword{raise}\stindex{raise} statement. If the exception class is +derived from the standard root class \exception{BaseException}, the +associated value is present as the exception instance's \member{args} +attribute. User code can raise built-in exceptions. This can be used to test an exception handler or to report an error condition ``just like'' the @@ -56,14 +52,8 @@ inherited by user-defined classes (for that use \exception{Exception}). If \function{str()} or \function{unicode()} is called on an instance of this class, the representation of the argument(s) to the instance are returned or -the emptry string when there were no arguments. If only a single argument is -passed in, it is stored in the \member{message} attribute. If more than one -argument is passed in, \member{message} is set to the empty string. These -semantics are meant to reflect the fact that \member{message} is to store a -text message explaining why the exception had been raised. If more data needs -to be attached to the exception, attach it through arbitrary attributes on the -instance. All arguments are also stored in \member{args} as a tuple, but it will -eventually be deprecated and thus its use is discouraged. +the emptry string when there were no arguments. All arguments are +stored in \member{args} as a tuple. \versionadded{2.5} \end{excdesc} Modified: python/trunk/Lib/ConfigParser.py ============================================================================== --- python/trunk/Lib/ConfigParser.py (original) +++ python/trunk/Lib/ConfigParser.py Sat May 5 03:34:02 2007 @@ -106,6 +106,21 @@ class Error(Exception): """Base class for ConfigParser exceptions.""" + def _get_message(self): + """Getter for 'message'; needed only to override deprecation in + BaseException.""" + return self.__message + + def _set_message(self, value): + """Setter for 'message'; needed only to override deprecation in + BaseException.""" + self.__message = value + + # BaseException.message has been deprecated since Python 2.6. To prevent + # DeprecationWarning from popping up over this pre-existing attribute, use + # a new property that takes lookup precedence. + message = property(_get_message, _set_message) + def __init__(self, msg=''): self.message = msg Exception.__init__(self, msg) Modified: python/trunk/Lib/test/test_defaultdict.py ============================================================================== --- python/trunk/Lib/test/test_defaultdict.py (original) +++ python/trunk/Lib/test/test_defaultdict.py Sat May 5 03:34:02 2007 @@ -137,7 +137,7 @@ try: d1[(1,)] except KeyError, err: - self.assertEqual(err.message, (1,)) + self.assertEqual(err.args[0], (1,)) else: self.fail("expected KeyError") Modified: python/trunk/Lib/test/test_exceptions.py ============================================================================== --- python/trunk/Lib/test/test_exceptions.py (original) +++ python/trunk/Lib/test/test_exceptions.py Sat May 5 03:34:02 2007 @@ -5,7 +5,9 @@ import unittest import pickle, cPickle -from test.test_support import TESTFN, unlink, run_unittest +from test.test_support import (TESTFN, unlink, run_unittest, + guard_warnings_filter) +from test.test_pep352 import ignore_message_warning # XXX This is not really enough, each *operation* should be tested! @@ -272,32 +274,34 @@ except NameError: pass - for exc, args, expected in exceptionList: - try: - raise exc(*args) - except BaseException, e: - if type(e) is not exc: - raise - # Verify module name - self.assertEquals(type(e).__module__, 'exceptions') - # Verify no ref leaks in Exc_str() - s = str(e) - for checkArgName in expected: - self.assertEquals(repr(getattr(e, checkArgName)), - repr(expected[checkArgName]), - 'exception "%s", attribute "%s"' % - (repr(e), checkArgName)) - - # test for pickling support - for p in pickle, cPickle: - for protocol in range(p.HIGHEST_PROTOCOL + 1): - new = p.loads(p.dumps(e, protocol)) - for checkArgName in expected: - got = repr(getattr(new, checkArgName)) - want = repr(expected[checkArgName]) - self.assertEquals(got, want, - 'pickled "%r", attribute "%s' % - (e, checkArgName)) + with guard_warnings_filter(): + ignore_message_warning() + for exc, args, expected in exceptionList: + try: + raise exc(*args) + except BaseException, e: + if type(e) is not exc: + raise + # Verify module name + self.assertEquals(type(e).__module__, 'exceptions') + # Verify no ref leaks in Exc_str() + s = str(e) + for checkArgName in expected: + self.assertEquals(repr(getattr(e, checkArgName)), + repr(expected[checkArgName]), + 'exception "%s", attribute "%s"' % + (repr(e), checkArgName)) + + # test for pickling support + for p in pickle, cPickle: + for protocol in range(p.HIGHEST_PROTOCOL + 1): + new = p.loads(p.dumps(e, protocol)) + for checkArgName in expected: + got = repr(getattr(new, checkArgName)) + want = repr(expected[checkArgName]) + self.assertEquals(got, want, + 'pickled "%r", attribute "%s' % + (e, checkArgName)) def testSlicing(self): # Test that you can slice an exception directly instead of requiring Modified: python/trunk/Lib/test/test_pep352.py ============================================================================== --- python/trunk/Lib/test/test_pep352.py (original) +++ python/trunk/Lib/test/test_pep352.py Sat May 5 03:34:02 2007 @@ -6,6 +6,13 @@ import os from platform import system as platform_system +def ignore_message_warning(): + """Ignore the DeprecationWarning for BaseException.message.""" + warnings.resetwarnings() + warnings.filterwarnings("ignore", "BaseException.message", + DeprecationWarning) + + class ExceptionClassTests(unittest.TestCase): """Tests for anything relating to exception objects themselves (e.g., @@ -15,9 +22,13 @@ self.failUnless(issubclass(Exception, object)) def verify_instance_interface(self, ins): - for attr in ("args", "message", "__str__", "__repr__", "__getitem__"): - self.failUnless(hasattr(ins, attr), "%s missing %s attribute" % - (ins.__class__.__name__, attr)) + with guard_warnings_filter(): + ignore_message_warning() + for attr in ("args", "message", "__str__", "__repr__", + "__getitem__"): + self.failUnless(hasattr(ins, attr), + "%s missing %s attribute" % + (ins.__class__.__name__, attr)) def test_inheritance(self): # Make sure the inheritance hierarchy matches the documentation @@ -84,30 +95,61 @@ # Make sure interface works properly when given a single argument arg = "spam" exc = Exception(arg) - results = ([len(exc.args), 1], [exc.args[0], arg], [exc.message, arg], - [str(exc), str(arg)], [unicode(exc), unicode(arg)], - [repr(exc), exc.__class__.__name__ + repr(exc.args)], [exc[0], arg]) - self.interface_test_driver(results) + with guard_warnings_filter(): + ignore_message_warning() + results = ([len(exc.args), 1], [exc.args[0], arg], + [exc.message, arg], + [str(exc), str(arg)], [unicode(exc), unicode(arg)], + [repr(exc), exc.__class__.__name__ + repr(exc.args)], [exc[0], + arg]) + self.interface_test_driver(results) def test_interface_multi_arg(self): # Make sure interface correct when multiple arguments given arg_count = 3 args = tuple(range(arg_count)) exc = Exception(*args) - results = ([len(exc.args), arg_count], [exc.args, args], - [exc.message, ''], [str(exc), str(args)], - [unicode(exc), unicode(args)], - [repr(exc), exc.__class__.__name__ + repr(exc.args)], - [exc[-1], args[-1]]) - self.interface_test_driver(results) + with guard_warnings_filter(): + ignore_message_warning() + results = ([len(exc.args), arg_count], [exc.args, args], + [exc.message, ''], [str(exc), str(args)], + [unicode(exc), unicode(args)], + [repr(exc), exc.__class__.__name__ + repr(exc.args)], + [exc[-1], args[-1]]) + self.interface_test_driver(results) def test_interface_no_arg(self): # Make sure that with no args that interface is correct exc = Exception() - results = ([len(exc.args), 0], [exc.args, tuple()], [exc.message, ''], - [str(exc), ''], [unicode(exc), u''], - [repr(exc), exc.__class__.__name__ + '()'], [True, True]) - self.interface_test_driver(results) + with guard_warnings_filter(): + ignore_message_warning() + results = ([len(exc.args), 0], [exc.args, tuple()], + [exc.message, ''], + [str(exc), ''], [unicode(exc), u''], + [repr(exc), exc.__class__.__name__ + '()'], [True, True]) + self.interface_test_driver(results) + + + def test_message_deprecation(self): + # As of Python 2.6, BaseException.message is deprecated. + with guard_warnings_filter(): + warnings.resetwarnings() + warnings.filterwarnings('error') + + try: + BaseException().message + except DeprecationWarning: + pass + else: + self.fail("BaseException.message not deprecated") + + exc = BaseException() + try: + exc.message = '' + except DeprecationWarning: + pass + else: + self.fail("BaseException.message assignment not deprecated") class UsageTests(unittest.TestCase): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat May 5 03:34:02 2007 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Deprecate BaseException.message as per PEP 352. + - Bug #1303614: don't expose object's __dict__ when the dict is inherited from a builtin base. Modified: python/trunk/Objects/exceptions.c ============================================================================== --- python/trunk/Objects/exceptions.c (original) +++ python/trunk/Objects/exceptions.c Sat May 5 03:34:02 2007 @@ -212,13 +212,6 @@ 0 /* sq_inplace_repeat; */ }; -static PyMemberDef BaseException_members[] = { - {"message", T_OBJECT, offsetof(PyBaseExceptionObject, message), 0, - PyDoc_STR("exception message")}, - {NULL} /* Sentinel */ -}; - - static PyObject * BaseException_get_dict(PyBaseExceptionObject *self) { @@ -274,9 +267,42 @@ return 0; } +static PyObject * +BaseException_get_message(PyBaseExceptionObject *self) +{ + int ret; + ret = PyErr_WarnEx(PyExc_DeprecationWarning, + "BaseException.message has been deprecated as " + "of Python 2.6", + 1); + if (ret == -1) + return NULL; + + Py_INCREF(self->message); + return self->message; +} + +static int +BaseException_set_message(PyBaseExceptionObject *self, PyObject *val) +{ + int ret; + ret = PyErr_WarnEx(PyExc_DeprecationWarning, + "BaseException.message has been deprecated as " + "of Python 2.6", + 1); + if (ret == -1) + return -1; + Py_INCREF(val); + Py_DECREF(self->message); + self->message = val; + return 0; +} + static PyGetSetDef BaseException_getset[] = { {"__dict__", (getter)BaseException_get_dict, (setter)BaseException_set_dict}, {"args", (getter)BaseException_get_args, (setter)BaseException_set_args}, + {"message", (getter)BaseException_get_message, + (setter)BaseException_set_message}, {NULL}, }; @@ -312,7 +338,7 @@ 0, /* tp_iter */ 0, /* tp_iternext */ BaseException_methods, /* tp_methods */ - BaseException_members, /* tp_members */ + 0, /* tp_members */ BaseException_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ From python-checkins at python.org Sat May 5 03:34:52 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 5 May 2007 03:34:52 +0200 (CEST) Subject: [Python-checkins] r55141 - peps/trunk/pep-0361.txt Message-ID: <20070505013452.553B41E4006@bag.python.org> Author: brett.cannon Date: Sat May 5 03:34:50 2007 New Revision: 55141 Modified: peps/trunk/pep-0361.txt Log: Add mention about PEP 352 and the deprecation of BaseException.message. Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Sat May 5 03:34:50 2007 @@ -53,6 +53,7 @@ 352: Raising a string exception now triggers a TypeError. Attempting to catch a string exception raises DeprecationWarning. + BaseException.message has been deprecated. New modules in the standard library: From python-checkins at python.org Sat May 5 10:32:04 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 5 May 2007 10:32:04 +0200 (CEST) Subject: [Python-checkins] r55144 - in python/branches/release25-maint/PCbuild8: _ctypes/_ctypes.vcproj _ctypes/_ctypes.vsprops _ctypes/masm64.rules make_versioninfo/make_versioninfo.vcproj pyproject.vsprops python/python.vcproj pythoncore/pythoncore.vcproj pythonw/pythonw.vcproj Message-ID: <20070505083204.E138A1E4002@bag.python.org> Author: kristjan.jonsson Date: Sat May 5 10:32:03 2007 New Revision: 55144 Added: python/branches/release25-maint/PCbuild8/_ctypes/_ctypes.vsprops - copied unchanged from r55143, python/trunk/PCbuild8/_ctypes/_ctypes.vsprops python/branches/release25-maint/PCbuild8/_ctypes/masm64.rules - copied unchanged from r55143, python/trunk/PCbuild8/_ctypes/masm64.rules Modified: python/branches/release25-maint/PCbuild8/_ctypes/_ctypes.vcproj python/branches/release25-maint/PCbuild8/make_versioninfo/make_versioninfo.vcproj python/branches/release25-maint/PCbuild8/pyproject.vsprops python/branches/release25-maint/PCbuild8/python/python.vcproj python/branches/release25-maint/PCbuild8/pythoncore/pythoncore.vcproj python/branches/release25-maint/PCbuild8/pythonw/pythonw.vcproj Log: Merging changes 55092, 55101,55120 from trunk, making PCBuild8 solution up to date. Modified: python/branches/release25-maint/PCbuild8/_ctypes/_ctypes.vcproj ============================================================================== --- python/branches/release25-maint/PCbuild8/_ctypes/_ctypes.vcproj (original) +++ python/branches/release25-maint/PCbuild8/_ctypes/_ctypes.vcproj Sat May 5 10:32:03 2007 @@ -16,12 +16,15 @@ /> + + + @@ -180,6 +188,9 @@ Name="VCCustomBuildTool" /> + @@ -254,6 +265,9 @@ Name="VCCustomBuildTool" /> + @@ -329,6 +343,9 @@ Name="VCCustomBuildTool" /> + @@ -403,6 +420,9 @@ Name="VCCustomBuildTool" /> + @@ -478,6 +498,9 @@ Name="VCCustomBuildTool" /> + @@ -552,6 +575,9 @@ Name="VCCustomBuildTool" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/release25-maint/PCbuild8/pyproject.vsprops ============================================================================== --- python/branches/release25-maint/PCbuild8/pyproject.vsprops (original) +++ python/branches/release25-maint/PCbuild8/pyproject.vsprops Sat May 5 10:32:03 2007 @@ -15,6 +15,10 @@ Name="VCLinkerTool" AdditionalLibraryDirectories="$(OutDir)" /> + + + Author: walter.doerwald Date: Sat May 5 14:00:46 2007 New Revision: 55146 Modified: python/branches/py3k-struni/Doc/api/concrete.tex python/branches/py3k-struni/Include/unicodeobject.h python/branches/py3k-struni/Objects/unicodeobject.c Log: Add PyUnicode_FromString(), which create a unicode object from a const char * (i.e. 0-terminated latin-1 encoded bytes). Modified: python/branches/py3k-struni/Doc/api/concrete.tex ============================================================================== --- python/branches/py3k-struni/Doc/api/concrete.tex (original) +++ python/branches/py3k-struni/Doc/api/concrete.tex Sat May 5 14:00:46 2007 @@ -995,6 +995,17 @@ \var{u} is \NULL{}. \end{cfuncdesc} +\begin{cfuncdesc}{PyObject*}{PyUnicode_FromString}{const char *u} + Create a Unicode Object from the char buffer \var{u} of the. + \var{u} must be 0-terminated, the bytes will be interpreted as + being latin-1 encoded. \var{u} may also be \NULL{} which causes the + contents to be undefined. It is the user's responsibility to fill + in the needed data. The buffer is copied into the new object. + If the buffer is not \NULL{}, the return value might be a shared object. + Therefore, modification of the resulting Unicode object is only allowed + when \var{u} is \NULL{}. +\end{cfuncdesc} + \begin{cfuncdesc}{Py_UNICODE*}{PyUnicode_AsUnicode}{PyObject *unicode} Return a read-only pointer to the Unicode object's internal \ctype{Py_UNICODE} buffer, \NULL{} if \var{unicode} is not a Unicode Modified: python/branches/py3k-struni/Include/unicodeobject.h ============================================================================== --- python/branches/py3k-struni/Include/unicodeobject.h (original) +++ python/branches/py3k-struni/Include/unicodeobject.h Sat May 5 14:00:46 2007 @@ -172,6 +172,7 @@ # define PyUnicode_FromObject PyUnicodeUCS2_FromObject # define PyUnicode_FromOrdinal PyUnicodeUCS2_FromOrdinal # define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode +# define PyUnicode_FromString PyUnicodeUCS2_FromString # define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar # define PyUnicode_GetDefaultEncoding PyUnicodeUCS2_GetDefaultEncoding # define PyUnicode_GetMax PyUnicodeUCS2_GetMax @@ -250,6 +251,7 @@ # define PyUnicode_FromObject PyUnicodeUCS4_FromObject # define PyUnicode_FromOrdinal PyUnicodeUCS4_FromOrdinal # define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode +# define PyUnicode_FromString PyUnicodeUCS4_FromString # define PyUnicode_FromWideChar PyUnicodeUCS4_FromWideChar # define PyUnicode_GetDefaultEncoding PyUnicodeUCS4_GetDefaultEncoding # define PyUnicode_GetMax PyUnicodeUCS4_GetMax @@ -427,6 +429,12 @@ Py_ssize_t size /* size of buffer */ ); +/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated + Latin-1 encoded bytes */ +PyAPI_FUNC(PyObject*) PyUnicode_FromString( + const char *u /* string */ + ); + /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer. */ Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Sat May 5 14:00:46 2007 @@ -393,6 +393,51 @@ return (PyObject *)unicode; } +PyObject *PyUnicode_FromString(const char *u) +{ + PyUnicodeObject *unicode; + Py_ssize_t size = strlen(u); + + /* If the Unicode data is known at construction time, we can apply + some optimizations which share commonly used objects. */ + if (u != NULL) { + + /* Optimization for empty strings */ + if (size == 0 && unicode_empty != NULL) { + Py_INCREF(unicode_empty); + return (PyObject *)unicode_empty; + } + + /* Single character Unicode objects in the Latin-1 range are + shared when using this constructor */ + if (size == 1 && *u < 256) { + unicode = unicode_latin1[*u]; + if (!unicode) { + unicode = _PyUnicode_New(1); + if (!unicode) + return NULL; + unicode->str[0] = *u; + unicode_latin1[*u] = unicode; + } + Py_INCREF(unicode); + return (PyObject *)unicode; + } + } + + unicode = _PyUnicode_New(size); + if (!unicode) + return NULL; + + /* Copy the Unicode data into the new object */ + if (u != NULL) { + char *p = unicode->str; + while (*p++ = *u++) + ; + } + + return (PyObject *)unicode; +} + #ifdef HAVE_WCHAR_H PyObject *PyUnicode_FromWideChar(register const wchar_t *w, From python-checkins at python.org Sat May 5 14:26:29 2007 From: python-checkins at python.org (walter.doerwald) Date: Sat, 5 May 2007 14:26:29 +0200 (CEST) Subject: [Python-checkins] r55147 - python/branches/py3k-struni/Lib/test/string_tests.py python/branches/py3k-struni/Lib/test/test_unicode.py Message-ID: <20070505122629.BA4D61E4002@bag.python.org> Author: walter.doerwald Date: Sat May 5 14:26:27 2007 New Revision: 55147 Modified: python/branches/py3k-struni/Lib/test/string_tests.py python/branches/py3k-struni/Lib/test/test_unicode.py Log: test_unicode.py passes again 9except for problems with the idna codec. Modified: python/branches/py3k-struni/Lib/test/string_tests.py ============================================================================== --- python/branches/py3k-struni/Lib/test/string_tests.py (original) +++ python/branches/py3k-struni/Lib/test/string_tests.py Sat May 5 14:26:27 2007 @@ -642,17 +642,6 @@ self.checkequal('xyzzyhello', 'xyzzyhelloxyzzy', 'rstrip', 'xyz') self.checkequal('hello', 'hello', 'strip', 'xyz') - # strip/lstrip/rstrip with unicode arg - if test_support.have_unicode: - self.checkequal(str('hello', 'ascii'), 'xyzzyhelloxyzzy', - 'strip', str('xyz', 'ascii')) - self.checkequal(str('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy', - 'lstrip', str('xyz', 'ascii')) - self.checkequal(str('xyzzyhello', 'ascii'), 'xyzzyhelloxyzzy', - 'rstrip', str('xyz', 'ascii')) - self.checkequal(str('hello', 'ascii'), 'hello', - 'strip', str('xyz', 'ascii')) - self.checkraises(TypeError, 'hello', 'strip', 42, 42) self.checkraises(TypeError, 'hello', 'lstrip', 42, 42) self.checkraises(TypeError, 'hello', 'rstrip', 42, 42) @@ -956,12 +945,8 @@ self.checkequal('w x y z', ' ', 'join', Sequence()) self.checkequal('abc', 'a', 'join', ('abc',)) self.checkequal('z', 'a', 'join', UserList(['z'])) - if test_support.have_unicode: - self.checkequal(str('a.b.c'), str('.'), 'join', ['a', 'b', 'c']) - self.checkequal(str('a.b.c'), '.', 'join', [str('a'), 'b', 'c']) - self.checkequal(str('a.b.c'), '.', 'join', ['a', str('b'), 'c']) - self.checkequal(str('a.b.c'), '.', 'join', ['a', 'b', str('c')]) - self.checkraises(TypeError, '.', 'join', ['a', str('b'), 3]) + self.checkequal('a.b.c', '.', 'join', ['a', 'b', 'c']) + self.checkraises(TypeError, '.', 'join', ['a', 'b', 3]) for i in [5, 25, 125]: self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join', ['a' * i] * i) Modified: python/branches/py3k-struni/Lib/test/test_unicode.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_unicode.py (original) +++ python/branches/py3k-struni/Lib/test/test_unicode.py Sat May 5 14:26:27 2007 @@ -62,21 +62,21 @@ def test_repr(self): if not sys.platform.startswith('java'): # Test basic sanity of repr() - self.assertEqual(repr('abc'), "u'abc'") - self.assertEqual(repr('ab\\c'), "u'ab\\\\c'") - self.assertEqual(repr('ab\\'), "u'ab\\\\'") - self.assertEqual(repr('\\c'), "u'\\\\c'") - self.assertEqual(repr('\\'), "u'\\\\'") - self.assertEqual(repr('\n'), "u'\\n'") - self.assertEqual(repr('\r'), "u'\\r'") - self.assertEqual(repr('\t'), "u'\\t'") - self.assertEqual(repr('\b'), "u'\\x08'") - self.assertEqual(repr("'\""), """u'\\'"'""") - self.assertEqual(repr("'\""), """u'\\'"'""") - self.assertEqual(repr("'"), '''u"'"''') - self.assertEqual(repr('"'), """u'"'""") + self.assertEqual(repr('abc'), "'abc'") + self.assertEqual(repr('ab\\c'), "'ab\\\\c'") + self.assertEqual(repr('ab\\'), "'ab\\\\'") + self.assertEqual(repr('\\c'), "'\\\\c'") + self.assertEqual(repr('\\'), "'\\\\'") + self.assertEqual(repr('\n'), "'\\n'") + self.assertEqual(repr('\r'), "'\\r'") + self.assertEqual(repr('\t'), "'\\t'") + self.assertEqual(repr('\b'), "'\\x08'") + self.assertEqual(repr("'\""), """'\\'"'""") + self.assertEqual(repr("'\""), """'\\'"'""") + self.assertEqual(repr("'"), '''"'"''') + self.assertEqual(repr('"'), """'"'""") latin1repr = ( - "u'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r" + "'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r" "\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a" "\\x1b\\x1c\\x1d\\x1e\\x1f !\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHI" "JKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\x7f" @@ -165,7 +165,7 @@ self.checkequalnofix('xyyx', 'xzx', 'translate', {ord('z'):'yy'}) self.assertRaises(TypeError, 'hello'.translate) - self.assertRaises(TypeError, 'abababc'.translate, {ord('a'):''}) + self.assertRaises(TypeError, 'abababc'.translate, 'abc', 'xyz') def test_split(self): string_tests.CommonTest.test_split(self) @@ -187,10 +187,6 @@ self.checkequalnofix('abcd', '', 'join', ('a', 'b', 'c', 'd')) self.checkequalnofix('w x y z', ' ', 'join', string_tests.Sequence('wxyz')) - def test_strip(self): - string_tests.CommonTest.test_strip(self) - self.assertRaises(UnicodeError, "hello".strip, "\xff") - def test_replace(self): string_tests.CommonTest.test_replace(self) @@ -323,58 +319,27 @@ self.assert_('a' in 'bdab') self.assert_('a' in 'bdaba') self.assert_('a' in 'bdba') - self.assert_('a' in 'bdba') - self.assert_('a' in 'bdba') - self.assert_('a' not in 'bdb') self.assert_('a' not in 'bdb') self.assert_('a' in 'bdba') self.assert_('a' in ('a',1,None)) self.assert_('a' in (1,None,'a')) - self.assert_('a' in (1,None,'a')) self.assert_('a' in ('a',1,None)) self.assert_('a' in (1,None,'a')) - self.assert_('a' in (1,None,'a')) self.assert_('a' not in ('x',1,'y')) self.assert_('a' not in ('x',1,None)) self.assert_('abcd' not in 'abcxxxx') self.assert_('ab' in 'abcd') self.assert_('ab' in 'abc') - self.assert_('ab' in 'abc') self.assert_('ab' in (1,None,'ab')) self.assert_('' in 'abc') - self.assert_('' in 'abc') - - # If the following fails either - # the contains operator does not propagate UnicodeErrors or - # someone has changed the default encoding - self.assertRaises(UnicodeError, 'g\xe2teau'.__contains__, '\xe2') - - self.assert_('' in '') self.assert_('' in '') - self.assert_('' in '') - self.assert_('' in 'abc') - self.assert_('' in 'abc') self.assert_('' in 'abc') self.assert_('\0' not in 'abc') - self.assert_('\0' not in 'abc') - self.assert_('\0' not in 'abc') - self.assert_('\0' in '\0abc') - self.assert_('\0' in '\0abc') self.assert_('\0' in '\0abc') self.assert_('\0' in 'abc\0') - self.assert_('\0' in 'abc\0') - self.assert_('\0' in 'abc\0') - self.assert_('a' in '\0abc') self.assert_('a' in '\0abc') - self.assert_('a' in '\0abc') - self.assert_('asdf' in 'asdf') self.assert_('asdf' in 'asdf') - self.assert_('asdf' in 'asdf') - self.assert_('asdf' not in 'asd') self.assert_('asdf' not in 'asd') - self.assert_('asdf' not in 'asd') - self.assert_('asdf' not in '') - self.assert_('asdf' not in '') self.assert_('asdf' not in '') self.assertRaises(TypeError, "abc".__contains__) @@ -389,7 +354,7 @@ self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", -1, -2, 3.57), 'abc, abc, -1, -2.000000, 3.57') self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", -1, -2, 1003.57), 'abc, abc, -1, -2.000000, 1003.57') if not sys.platform.startswith('java'): - self.assertEqual("%r, %r" % ("abc", "abc"), "u'abc', 'abc'") + self.assertEqual("%r, %r" % (b"abc", "abc"), "b'abc', 'abc'") self.assertEqual("%(x)s, %(y)s" % {'x':"abc", 'y':"def"}, 'abc, def') self.assertEqual("%(x)s, %(\xfc)s" % {'x':"abc", '\xfc':"def"}, 'abc, def') @@ -495,7 +460,7 @@ ) self.assertEqual( - str('strings are decoded to unicode', 'utf-8', 'strict'), + str(b'strings are decoded to unicode', 'utf-8', 'strict'), 'strings are decoded to unicode' ) @@ -513,38 +478,38 @@ def test_codecs_utf7(self): utfTests = [ - ('A\u2262\u0391.', 'A+ImIDkQ.'), # RFC2152 example - ('Hi Mom -\u263a-!', 'Hi Mom -+Jjo--!'), # RFC2152 example - ('\u65E5\u672C\u8A9E', '+ZeVnLIqe-'), # RFC2152 example - ('Item 3 is \u00a31.', 'Item 3 is +AKM-1.'), # RFC2152 example - ('+', '+-'), - ('+-', '+--'), - ('+?', '+-?'), - ('\?', '+AFw?'), - ('+?', '+-?'), - (r'\\?', '+AFwAXA?'), - (r'\\\?', '+AFwAXABc?'), - (r'++--', '+-+---') + ('A\u2262\u0391.', b'A+ImIDkQ.'), # RFC2152 example + ('Hi Mom -\u263a-!', b'Hi Mom -+Jjo--!'), # RFC2152 example + ('\u65E5\u672C\u8A9E', b'+ZeVnLIqe-'), # RFC2152 example + ('Item 3 is \u00a31.', b'Item 3 is +AKM-1.'), # RFC2152 example + ('+', b'+-'), + ('+-', b'+--'), + ('+?', b'+-?'), + ('\?', b'+AFw?'), + ('+?', b'+-?'), + (r'\\?', b'+AFwAXA?'), + (r'\\\?', b'+AFwAXABc?'), + (r'++--', b'+-+---') ] for (x, y) in utfTests: self.assertEqual(x.encode('utf-7'), y) # surrogates not supported - self.assertRaises(UnicodeError, str, '+3ADYAA-', 'utf-7') + self.assertRaises(UnicodeError, str, b'+3ADYAA-', 'utf-7') - self.assertEqual(str('+3ADYAA-', 'utf-7', 'replace'), '\ufffd') + self.assertEqual(str(b'+3ADYAA-', 'utf-7', 'replace'), '\ufffd') def test_codecs_utf8(self): - self.assertEqual(''.encode('utf-8'), '') - self.assertEqual('\u20ac'.encode('utf-8'), '\xe2\x82\xac') - self.assertEqual('\ud800\udc02'.encode('utf-8'), '\xf0\x90\x80\x82') - self.assertEqual('\ud84d\udc56'.encode('utf-8'), '\xf0\xa3\x91\x96') - self.assertEqual('\ud800'.encode('utf-8'), '\xed\xa0\x80') - self.assertEqual('\udc00'.encode('utf-8'), '\xed\xb0\x80') + self.assertEqual(''.encode('utf-8'), b'') + self.assertEqual('\u20ac'.encode('utf-8'), b'\xe2\x82\xac') + self.assertEqual('\ud800\udc02'.encode('utf-8'), b'\xf0\x90\x80\x82') + self.assertEqual('\ud84d\udc56'.encode('utf-8'), b'\xf0\xa3\x91\x96') + self.assertEqual('\ud800'.encode('utf-8'), b'\xed\xa0\x80') + self.assertEqual('\udc00'.encode('utf-8'), b'\xed\xb0\x80') self.assertEqual( ('\ud800\udc02'*1000).encode('utf-8'), - '\xf0\x90\x80\x82'*1000 + b'\xf0\x90\x80\x82'*1000 ) self.assertEqual( '\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f' @@ -553,22 +518,22 @@ '\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067' '\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das' ' Nunstuck git und'.encode('utf-8'), - '\xe6\xad\xa3\xe7\xa2\xba\xe3\x81\xab\xe8\xa8\x80\xe3\x81' - '\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3\xe3\x81\xaf\xe3' - '\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe' - '\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82\xe4\xb8\x80\xe9\x83' - '\xa8\xe3\x81\xaf\xe3\x83\x89\xe3\x82\xa4\xe3\x83\x84\xe8' - '\xaa\x9e\xe3\x81\xa7\xe3\x81\x99\xe3\x81\x8c\xe3\x80\x81' - '\xe3\x81\x82\xe3\x81\xa8\xe3\x81\xaf\xe3\x81\xa7\xe3\x81' - '\x9f\xe3\x82\x89\xe3\x82\x81\xe3\x81\xa7\xe3\x81\x99\xe3' - '\x80\x82\xe5\xae\x9f\xe9\x9a\x9b\xe3\x81\xab\xe3\x81\xaf' - '\xe3\x80\x8cWenn ist das Nunstuck git und' + b'\xe6\xad\xa3\xe7\xa2\xba\xe3\x81\xab\xe8\xa8\x80\xe3\x81' + b'\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3\xe3\x81\xaf\xe3' + b'\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe' + b'\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82\xe4\xb8\x80\xe9\x83' + b'\xa8\xe3\x81\xaf\xe3\x83\x89\xe3\x82\xa4\xe3\x83\x84\xe8' + b'\xaa\x9e\xe3\x81\xa7\xe3\x81\x99\xe3\x81\x8c\xe3\x80\x81' + b'\xe3\x81\x82\xe3\x81\xa8\xe3\x81\xaf\xe3\x81\xa7\xe3\x81' + b'\x9f\xe3\x82\x89\xe3\x82\x81\xe3\x81\xa7\xe3\x81\x99\xe3' + b'\x80\x82\xe5\xae\x9f\xe9\x9a\x9b\xe3\x81\xab\xe3\x81\xaf' + b'\xe3\x80\x8cWenn ist das Nunstuck git und' ) # UTF-8 specific decoding tests - self.assertEqual(str('\xf0\xa3\x91\x96', 'utf-8'), '\U00023456' ) - self.assertEqual(str('\xf0\x90\x80\x82', 'utf-8'), '\U00010002' ) - self.assertEqual(str('\xe2\x82\xac', 'utf-8'), '\u20ac' ) + self.assertEqual(str(b'\xf0\xa3\x91\x96', 'utf-8'), '\U00023456' ) + self.assertEqual(str(b'\xf0\x90\x80\x82', 'utf-8'), '\U00010002' ) + self.assertEqual(str(b'\xe2\x82\xac', 'utf-8'), '\u20ac' ) # Other possible utf-8 test cases: # * strict decoding testing for all of the @@ -582,14 +547,14 @@ # Error handling (encoding) self.assertRaises(UnicodeError, 'Andr\202 x'.encode, 'ascii') self.assertRaises(UnicodeError, 'Andr\202 x'.encode, 'ascii','strict') - self.assertEqual('Andr\202 x'.encode('ascii','ignore'), "Andr x") - self.assertEqual('Andr\202 x'.encode('ascii','replace'), "Andr? x") + self.assertEqual('Andr\202 x'.encode('ascii','ignore'), b"Andr x") + self.assertEqual('Andr\202 x'.encode('ascii','replace'), b"Andr? x") # Error handling (decoding) - self.assertRaises(UnicodeError, str, 'Andr\202 x', 'ascii') - self.assertRaises(UnicodeError, str, 'Andr\202 x', 'ascii','strict') - self.assertEqual(str('Andr\202 x','ascii','ignore'), "Andr x") - self.assertEqual(str('Andr\202 x','ascii','replace'), 'Andr\uFFFD x') + self.assertRaises(UnicodeError, str, b'Andr\202 x', 'ascii') + self.assertRaises(UnicodeError, str, b'Andr\202 x', 'ascii', 'strict') + self.assertEqual(str(b'Andr\202 x', 'ascii', 'ignore'), "Andr x") + self.assertEqual(str(b'Andr\202 x', 'ascii', 'replace'), 'Andr\uFFFD x') # Error handling (unknown character names) self.assertEqual("\\N{foo}xx".decode("unicode-escape", "ignore"), "xx") @@ -618,13 +583,13 @@ def test_codecs(self): # Encoding - self.assertEqual('hello'.encode('ascii'), 'hello') - self.assertEqual('hello'.encode('utf-7'), 'hello') - self.assertEqual('hello'.encode('utf-8'), 'hello') - self.assertEqual('hello'.encode('utf8'), 'hello') - self.assertEqual('hello'.encode('utf-16-le'), 'h\000e\000l\000l\000o\000') - self.assertEqual('hello'.encode('utf-16-be'), '\000h\000e\000l\000l\000o') - self.assertEqual('hello'.encode('latin-1'), 'hello') + self.assertEqual('hello'.encode('ascii'), b'hello') + self.assertEqual('hello'.encode('utf-7'), b'hello') + self.assertEqual('hello'.encode('utf-8'), b'hello') + self.assertEqual('hello'.encode('utf8'), b'hello') + self.assertEqual('hello'.encode('utf-16-le'), b'h\000e\000l\000l\000o\000') + self.assertEqual('hello'.encode('utf-16-be'), b'\000h\000e\000l\000l\000o') + self.assertEqual('hello'.encode('latin-1'), b'hello') # Roundtrip safety for BMP (just the first 1024 chars) for c in xrange(1024): @@ -663,7 +628,7 @@ def test_codecs_charmap(self): # 0-127 - s = ''.join(map(chr, xrange(128))) + s = bytes(xrange(128)) for encoding in ( 'cp037', 'cp1026', 'cp437', 'cp500', 'cp737', 'cp775', 'cp850', @@ -691,7 +656,7 @@ self.assertEqual(str(s, encoding).encode(encoding), s) # 128-255 - s = ''.join(map(chr, xrange(128, 256))) + s = bytes(xrange(128, 256)) for encoding in ( 'cp037', 'cp1026', 'cp437', 'cp500', 'cp737', 'cp775', 'cp850', @@ -805,7 +770,6 @@ self.assertEqual(str(Foo6("bar")), "foou") self.assertEqual(str(Foo7("bar")), "foou") self.assertEqual(str(Foo8("foo")), "foofoo") - self.assertEqual(str(Foo9("foo")), "string") self.assertEqual(str(Foo9("foo")), "not unicode") def test_unicode_repr(self): From python-checkins at python.org Sat May 5 16:12:29 2007 From: python-checkins at python.org (walter.doerwald) Date: Sat, 5 May 2007 16:12:29 +0200 (CEST) Subject: [Python-checkins] r55148 - python/branches/py3k-struni/Lib/test/test_str.py Message-ID: <20070505141229.CB8991E4002@bag.python.org> Author: walter.doerwald Date: Sat May 5 16:12:24 2007 New Revision: 55148 Modified: python/branches/py3k-struni/Lib/test/test_str.py Log: Fix %c overflow test. Modified: python/branches/py3k-struni/Lib/test/test_str.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_str.py (original) +++ python/branches/py3k-struni/Lib/test/test_str.py Sat May 5 16:12:24 2007 @@ -17,7 +17,7 @@ def test_formatting(self): string_tests.MixinStrUnicodeUserStringTest.test_formatting(self) - self.assertRaises(OverflowError, '%c'.__mod__, 0x1234) + self.assertRaises(OverflowError, '%c'.__mod__, 0x12341234) def test_iterators(self): # Make sure str objects have an __iter__ method From python-checkins at python.org Sat May 5 16:21:23 2007 From: python-checkins at python.org (walter.doerwald) Date: Sat, 5 May 2007 16:21:23 +0200 (CEST) Subject: [Python-checkins] r55149 - python/branches/py3k-struni/Objects/unicodeobject.c Message-ID: <20070505142123.E7D6D1E4002@bag.python.org> Author: walter.doerwald Date: Sat May 5 16:21:20 2007 New Revision: 55149 Modified: python/branches/py3k-struni/Objects/unicodeobject.c Log: When creating a unicode object from a char * characters are always < 256 => remove the test. Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Sat May 5 16:21:20 2007 @@ -408,9 +408,8 @@ return (PyObject *)unicode_empty; } - /* Single character Unicode objects in the Latin-1 range are - shared when using this constructor */ - if (size == 1 && *u < 256) { + /* Single characters are shared when using this constructor */ + if (size == 1) { unicode = unicode_latin1[*u]; if (!unicode) { unicode = _PyUnicode_New(1); From python-checkins at python.org Sat May 5 16:27:05 2007 From: python-checkins at python.org (walter.doerwald) Date: Sat, 5 May 2007 16:27:05 +0200 (CEST) Subject: [Python-checkins] r55150 - python/branches/py3k-struni/Objects/unicodeobject.c Message-ID: <20070505142705.7ADD11E4002@bag.python.org> Author: walter.doerwald Date: Sat May 5 16:26:59 2007 New Revision: 55150 Modified: python/branches/py3k-struni/Objects/unicodeobject.c Log: Silence gcc warnings. Use correct type for copy target pointer. Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Sat May 5 16:26:59 2007 @@ -410,13 +410,13 @@ /* Single characters are shared when using this constructor */ if (size == 1) { - unicode = unicode_latin1[*u]; + unicode = unicode_latin1[(int)*u]; if (!unicode) { unicode = _PyUnicode_New(1); if (!unicode) return NULL; unicode->str[0] = *u; - unicode_latin1[*u] = unicode; + unicode_latin1[(int)*u] = unicode; } Py_INCREF(unicode); return (PyObject *)unicode; @@ -429,8 +429,8 @@ /* Copy the Unicode data into the new object */ if (u != NULL) { - char *p = unicode->str; - while (*p++ = *u++) + Py_UNICODE *p = unicode->str; + while ((*p++ = *u++)) ; } From python-checkins at python.org Sat May 5 16:43:41 2007 From: python-checkins at python.org (walter.doerwald) Date: Sat, 5 May 2007 16:43:41 +0200 (CEST) Subject: [Python-checkins] r55151 - python/branches/py3k-struni/Objects/unicodeobject.c Message-ID: <20070505144341.DD0F21E4002@bag.python.org> Author: walter.doerwald Date: Sat May 5 16:43:36 2007 New Revision: 55151 Modified: python/branches/py3k-struni/Objects/unicodeobject.c Log: Change PyUnicode_EncodeUTF7() to return a bytes object. Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Sat May 5 16:43:36 2007 @@ -1149,13 +1149,13 @@ char * start; if (size == 0) - return PyString_FromStringAndSize(NULL, 0); + return PyBytes_FromStringAndSize(NULL, 0); - v = PyString_FromStringAndSize(NULL, cbAllocated); + v = PyBytes_FromStringAndSize(NULL, cbAllocated); if (v == NULL) return NULL; - start = out = PyString_AS_STRING(v); + start = out = PyBytes_AS_STRING(v); for (;i < size; ++i) { Py_UNICODE ch = s[i]; @@ -1221,7 +1221,10 @@ *out++ = '-'; } - _PyString_Resize(&v, out - start); + if (PyBytes_Resize(v, out - start)) { + Py_DECREF(v); + return NULL; + } return v; } From python-checkins at python.org Sat May 5 17:57:23 2007 From: python-checkins at python.org (walter.doerwald) Date: Sat, 5 May 2007 17:57:23 +0200 (CEST) Subject: [Python-checkins] r55152 - python/branches/py3k-struni/Lib/test/test_bool.py Message-ID: <20070505155723.AA9361E401B@bag.python.org> Author: walter.doerwald Date: Sat May 5 17:57:18 2007 New Revision: 55152 Modified: python/branches/py3k-struni/Lib/test/test_bool.py Log: Remove duplicate tests. Modified: python/branches/py3k-struni/Lib/test/test_bool.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_bool.py (original) +++ python/branches/py3k-struni/Lib/test/test_bool.py Sat May 5 17:57:18 2007 @@ -198,6 +198,10 @@ self.assertIs("xyz".isdigit(), False) self.assertIs("xyz".islower(), True) self.assertIs("XYZ".islower(), False) + self.assertIs("0123".isdecimal(), True) + self.assertIs("xyz".isdecimal(), False) + self.assertIs("0123".isnumeric(), True) + self.assertIs("xyz".isnumeric(), False) self.assertIs(" ".isspace(), True) self.assertIs("XYZ".isspace(), False) self.assertIs("X".istitle(), True) @@ -207,30 +211,6 @@ self.assertIs("xyz".startswith("x"), True) self.assertIs("xyz".startswith("z"), False) - if test_support.have_unicode: - self.assertIs(str("xyz", 'ascii').endswith(str("z", 'ascii')), True) - self.assertIs(str("xyz", 'ascii').endswith(str("x", 'ascii')), False) - self.assertIs(str("xyz0123", 'ascii').isalnum(), True) - self.assertIs(str("@#$%", 'ascii').isalnum(), False) - self.assertIs(str("xyz", 'ascii').isalpha(), True) - self.assertIs(str("@#$%", 'ascii').isalpha(), False) - self.assertIs(str("0123", 'ascii').isdecimal(), True) - self.assertIs(str("xyz", 'ascii').isdecimal(), False) - self.assertIs(str("0123", 'ascii').isdigit(), True) - self.assertIs(str("xyz", 'ascii').isdigit(), False) - self.assertIs(str("xyz", 'ascii').islower(), True) - self.assertIs(str("XYZ", 'ascii').islower(), False) - self.assertIs(str("0123", 'ascii').isnumeric(), True) - self.assertIs(str("xyz", 'ascii').isnumeric(), False) - self.assertIs(str(" ", 'ascii').isspace(), True) - self.assertIs(str("XYZ", 'ascii').isspace(), False) - self.assertIs(str("X", 'ascii').istitle(), True) - self.assertIs(str("x", 'ascii').istitle(), False) - self.assertIs(str("XYZ", 'ascii').isupper(), True) - self.assertIs(str("xyz", 'ascii').isupper(), False) - self.assertIs(str("xyz", 'ascii').startswith(str("x", 'ascii')), True) - self.assertIs(str("xyz", 'ascii').startswith(str("z", 'ascii')), False) - def test_boolean(self): self.assertEqual(True & 1, 1) self.assert_(not isinstance(True & 1, bool)) From python-checkins at python.org Sat May 5 18:04:49 2007 From: python-checkins at python.org (walter.doerwald) Date: Sat, 5 May 2007 18:04:49 +0200 (CEST) Subject: [Python-checkins] r55153 - python/branches/py3k-struni/Lib/test/test_bool.py Message-ID: <20070505160449.F19251E4002@bag.python.org> Author: walter.doerwald Date: Sat May 5 18:04:46 2007 New Revision: 55153 Modified: python/branches/py3k-struni/Lib/test/test_bool.py Log: Add two more space tests. Modified: python/branches/py3k-struni/Lib/test/test_bool.py ============================================================================== --- python/branches/py3k-struni/Lib/test/test_bool.py (original) +++ python/branches/py3k-struni/Lib/test/test_bool.py Sat May 5 18:04:46 2007 @@ -203,6 +203,8 @@ self.assertIs("0123".isnumeric(), True) self.assertIs("xyz".isnumeric(), False) self.assertIs(" ".isspace(), True) + self.assertIs("\xa0".isspace(), True) + self.assertIs("\u3000".isspace(), True) self.assertIs("XYZ".isspace(), False) self.assertIs("X".istitle(), True) self.assertIs("x".istitle(), False) From nnorwitz at gmail.com Sat May 5 20:16:03 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 5 May 2007 11:16:03 -0700 Subject: [Python-checkins] r55146 - in python/branches/py3k-struni: Doc/api/concrete.tex Include/unicodeobject.h Objects/unicodeobject.c In-Reply-To: <20070505120055.344CC1E4018@bag.python.org> References: <20070505120055.344CC1E4018@bag.python.org> Message-ID: On 5/5/07, walter.doerwald wrote: > Author: walter.doerwald > Date: Sat May 5 14:00:46 2007 > New Revision: 55146 > > Modified: > python/branches/py3k-struni/Doc/api/concrete.tex > python/branches/py3k-struni/Include/unicodeobject.h > python/branches/py3k-struni/Objects/unicodeobject.c > Log: > Add PyUnicode_FromString(), which create a unicode object from a > const char * (i.e. 0-terminated latin-1 encoded bytes). > > > Modified: python/branches/py3k-struni/Doc/api/concrete.tex > ============================================================================== > --- python/branches/py3k-struni/Doc/api/concrete.tex (original) > +++ python/branches/py3k-struni/Doc/api/concrete.tex Sat May 5 14:00:46 2007 > @@ -995,6 +995,17 @@ > \var{u} is \NULL{}. > \end{cfuncdesc} > > +\begin{cfuncdesc}{PyObject*}{PyUnicode_FromString}{const char *u} > + Create a Unicode Object from the char buffer \var{u} of the. > + \var{u} must be 0-terminated, the bytes will be interpreted as > + being latin-1 encoded. \var{u} may also be \NULL{} which causes the > + contents to be undefined. It is the user's responsibility to fill > + in the needed data. The buffer is copied into the new object. > + If the buffer is not \NULL{}, the return value might be a shared object. > + Therefore, modification of the resulting Unicode object is only allowed > + when \var{u} is \NULL{}. > +\end{cfuncdesc} > + > \begin{cfuncdesc}{Py_UNICODE*}{PyUnicode_AsUnicode}{PyObject *unicode} > Return a read-only pointer to the Unicode object's internal > \ctype{Py_UNICODE} buffer, \NULL{} if \var{unicode} is not a Unicode > > Modified: python/branches/py3k-struni/Include/unicodeobject.h > ============================================================================== > --- python/branches/py3k-struni/Include/unicodeobject.h (original) > +++ python/branches/py3k-struni/Include/unicodeobject.h Sat May 5 14:00:46 2007 > @@ -172,6 +172,7 @@ > # define PyUnicode_FromObject PyUnicodeUCS2_FromObject > # define PyUnicode_FromOrdinal PyUnicodeUCS2_FromOrdinal > # define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode > +# define PyUnicode_FromString PyUnicodeUCS2_FromString > # define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar > # define PyUnicode_GetDefaultEncoding PyUnicodeUCS2_GetDefaultEncoding > # define PyUnicode_GetMax PyUnicodeUCS2_GetMax > @@ -250,6 +251,7 @@ > # define PyUnicode_FromObject PyUnicodeUCS4_FromObject > # define PyUnicode_FromOrdinal PyUnicodeUCS4_FromOrdinal > # define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode > +# define PyUnicode_FromString PyUnicodeUCS4_FromString > # define PyUnicode_FromWideChar PyUnicodeUCS4_FromWideChar > # define PyUnicode_GetDefaultEncoding PyUnicodeUCS4_GetDefaultEncoding > # define PyUnicode_GetMax PyUnicodeUCS4_GetMax > @@ -427,6 +429,12 @@ > Py_ssize_t size /* size of buffer */ > ); > > +/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated > + Latin-1 encoded bytes */ > +PyAPI_FUNC(PyObject*) PyUnicode_FromString( > + const char *u /* string */ > + ); > + > /* Return a read-only pointer to the Unicode object's internal > Py_UNICODE buffer. */ > > > Modified: python/branches/py3k-struni/Objects/unicodeobject.c > ============================================================================== > --- python/branches/py3k-struni/Objects/unicodeobject.c (original) > +++ python/branches/py3k-struni/Objects/unicodeobject.c Sat May 5 14:00:46 2007 > @@ -393,6 +393,51 @@ > return (PyObject *)unicode; > } > > +PyObject *PyUnicode_FromString(const char *u) > +{ > + PyUnicodeObject *unicode; > + Py_ssize_t size = strlen(u); This should check for overflow. It's possible to have a 2+GB string on a 32-bit platform which would result in a negative size. n From python-checkins at python.org Sat May 5 20:55:38 2007 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 May 2007 20:55:38 +0200 (CEST) Subject: [Python-checkins] r55154 - python/trunk/Doc/lib/liblogging.tex Message-ID: <20070505185538.3541D1E4002@bag.python.org> Author: georg.brandl Date: Sat May 5 20:55:37 2007 New Revision: 55154 Modified: python/trunk/Doc/lib/liblogging.tex Log: Bug #1713535: typo in logging example. Modified: python/trunk/Doc/lib/liblogging.tex ============================================================================== --- python/trunk/Doc/lib/liblogging.tex (original) +++ python/trunk/Doc/lib/liblogging.tex Sat May 5 20:55:37 2007 @@ -203,7 +203,7 @@ \begin{verbatim} FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s" logging.basicConfig(format=FORMAT) - dict = { 'clientip' : '192.168.0.1', 'user' : 'fbloggs' } + d = {'clientip': '192.168.0.1', 'user': 'fbloggs'} logging.warning("Protocol problem: %s", "connection reset", extra=d) \end{verbatim} From python-checkins at python.org Sat May 5 20:57:10 2007 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 May 2007 20:57:10 +0200 (CEST) Subject: [Python-checkins] r55155 - python/branches/release25-maint/Doc/lib/liblogging.tex Message-ID: <20070505185710.924341E4002@bag.python.org> Author: georg.brandl Date: Sat May 5 20:57:09 2007 New Revision: 55155 Modified: python/branches/release25-maint/Doc/lib/liblogging.tex Log: Bug #1713535 backport. Modified: python/branches/release25-maint/Doc/lib/liblogging.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/liblogging.tex (original) +++ python/branches/release25-maint/Doc/lib/liblogging.tex Sat May 5 20:57:09 2007 @@ -203,7 +203,7 @@ \begin{verbatim} FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s" logging.basicConfig(format=FORMAT) - dict = { 'clientip' : '192.168.0.1', 'user' : 'fbloggs' } + d = {'clientip': '192.168.0.1', 'user': 'fbloggs'} logging.warning("Protocol problem: %s", "connection reset", extra=d) \end{verbatim} From python-checkins at python.org Sun May 6 12:00:03 2007 From: python-checkins at python.org (walter.doerwald) Date: Sun, 6 May 2007 12:00:03 +0200 (CEST) Subject: [Python-checkins] r55156 - python/branches/py3k-struni/Objects/unicodeobject.c Message-ID: <20070506100003.DF91B1E4003@bag.python.org> Author: walter.doerwald Date: Sun May 6 12:00:02 2007 New Revision: 55156 Modified: python/branches/py3k-struni/Objects/unicodeobject.c Log: Check whether the strlen() result overflows Py_ssize_t. Modified: python/branches/py3k-struni/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k-struni/Objects/unicodeobject.c (original) +++ python/branches/py3k-struni/Objects/unicodeobject.c Sun May 6 12:00:02 2007 @@ -396,7 +396,11 @@ PyObject *PyUnicode_FromString(const char *u) { PyUnicodeObject *unicode; - Py_ssize_t size = strlen(u); + size_t size = strlen(u); + if (size > PY_SSIZE_T_MAX) { + PyErr_SetString(PyExc_OverflowError, "input too long"); + return NULL; + } /* If the Unicode data is known at construction time, we can apply some optimizations which share commonly used objects. */ From walter at livinglogic.de Sun May 6 12:01:01 2007 From: walter at livinglogic.de (=?ISO-8859-1?Q?Walter_D=F6rwald?=) Date: Sun, 06 May 2007 12:01:01 +0200 Subject: [Python-checkins] r55146 - in python/branches/py3k-struni: Doc/api/concrete.tex Include/unicodeobject.h Objects/unicodeobject.c In-Reply-To: References: <20070505120055.344CC1E4018@bag.python.org> Message-ID: <463DA75D.4020502@livinglogic.de> Neal Norwitz wrote: > On 5/5/07, walter.doerwald wrote: >> Author: walter.doerwald >> [...] >> Modified: python/branches/py3k-struni/Objects/unicodeobject.c >> ============================================================================== >> >> --- python/branches/py3k-struni/Objects/unicodeobject.c (original) >> +++ python/branches/py3k-struni/Objects/unicodeobject.c Sat May 5 >> 14:00:46 2007 >> @@ -393,6 +393,51 @@ >> return (PyObject *)unicode; >> } >> >> +PyObject *PyUnicode_FromString(const char *u) >> +{ >> + PyUnicodeObject *unicode; >> + Py_ssize_t size = strlen(u); > > This should check for overflow. It's possible to have a 2+GB string > on a 32-bit platform which would result in a negative size. Done. Thanks for the hint. Servus, Walter From jimjjewett at gmail.com Sun May 6 19:10:19 2007 From: jimjjewett at gmail.com (Jim Jewett) Date: Sun, 6 May 2007 13:10:19 -0400 Subject: [Python-checkins] r55137 - peps/trunk/pep-3125.txt In-Reply-To: <20070504204635.E28C51E401E@bag.python.org> References: <20070504204635.E28C51E401E@bag.python.org> Message-ID: On 5/4/07, georg.brandl wrote: > Author: georg.brandl > Date: Fri May 4 22:46:34 2007 > New Revision: 55137 > > Modified: > peps/trunk/pep-3125.txt > Log: > Revert r55132. Sorry Guido, but I was faster :) Useful anyhow; I had made edits since your checkin, and missed some of your fixes; seeing this diff highlighted them. :D -jJ From python-checkins at python.org Sun May 6 19:53:41 2007 From: python-checkins at python.org (vinay.sajip) Date: Sun, 6 May 2007 19:53:41 +0200 (CEST) Subject: [Python-checkins] r55158 - python/trunk/Misc/NEWS Message-ID: <20070506175341.AF6D21E4002@bag.python.org> Author: vinay.sajip Date: Sun May 6 19:53:37 2007 New Revision: 55158 Modified: python/trunk/Misc/NEWS Log: Updates of recent changes to logging. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun May 6 19:53:37 2007 @@ -17,7 +17,7 @@ - Bug #1303614: don't expose object's __dict__ when the dict is inherited from a builtin base. -- When __slots__ are set to a unicode string, make it work the same as +- When __slots__ are set to a unicode string, make it work the same as setting a plain string, ie don't expand to single letter identifiers. - Request #1191699: Slices can now be pickled. @@ -207,6 +207,17 @@ Library ------- +- Added an optional credentials argument to SMTPHandler, for use with SMTP + servers which require authentication. + +- Patch #1695948: Added optional timeout parameter to SocketHandler. + +- Bug #1652788: Minor fix for currentframe. + +- Patch #1598415: Added WatchedFileHandler to better support external + log file rotation using e.g. newsyslog or logrotate. This handler is + only useful in Unix/Linux environments. + - Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file (as opposed to the command line) will now write file names ending in ".cpp" too. @@ -225,8 +236,8 @@ work started with create_connection() and timeout in httplib, and closes patch #723312. -- Patch #1676823: Added create_connection() to socket.py, which may be - called with a timeout, and use it from httplib (whose HTTPConnection +- Patch #1676823: Added create_connection() to socket.py, which may be + called with a timeout, and use it from httplib (whose HTTPConnection now accepts an optional timeout). - Bug #978833: Revert r50844, as it broke _socketobject.dup. @@ -349,7 +360,7 @@ - Patch #1673619: setup.py identifies extension modules it doesn't know how to build and those it knows how to build but that fail to build. -- Patch #912410: Replace HTML entity references for attribute values +- Patch #912410: Replace HTML entity references for attribute values in HTMLParser. - Patch #1663234: you can now run doctest on test files and modules @@ -389,7 +400,7 @@ allow appending to empty files. - Bug #1124861: Automatically create pipes if GetStdHandle fails in - subprocess. + subprocess. - Patch #1634778: add missing encoding aliases for iso8859_15 and iso8859_16. From python-checkins at python.org Mon May 7 09:02:26 2007 From: python-checkins at python.org (neal.norwitz) Date: Mon, 7 May 2007 09:02:26 +0200 (CEST) Subject: [Python-checkins] r55165 - python/trunk/Misc/build.sh Message-ID: <20070507070226.782491E4002@bag.python.org> Author: neal.norwitz Date: Mon May 7 09:02:26 2007 New Revision: 55165 Modified: python/trunk/Misc/build.sh Log: Verify changes to the trunk go to the normal checkins list Modified: python/trunk/Misc/build.sh ============================================================================== --- python/trunk/Misc/build.sh (original) +++ python/trunk/Misc/build.sh Mon May 7 09:02:26 2007 @@ -241,4 +241,3 @@ rsync $RSYNC_OPTS html/* $REMOTE_SYSTEM:$REMOTE_DIR cd ../build rsync $RSYNC_OPTS index.html *.out $REMOTE_SYSTEM:$REMOTE_DIR/results/ - From python-checkins at python.org Mon May 7 15:33:40 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Mon, 7 May 2007 15:33:40 +0200 (CEST) Subject: [Python-checkins] r55168 - python/branches/release25-maint/Lib/test/string_tests.py python/branches/release25-maint/Lib/test/test_format.py python/branches/release25-maint/Lib/test/test_index.py python/branches/release25-maint/Lib/test/test_itertools.py Message-ID: <20070507133340.221021E400B@bag.python.org> Author: kristjan.jonsson Date: Mon May 7 15:33:39 2007 New Revision: 55168 Modified: python/branches/release25-maint/Lib/test/string_tests.py python/branches/release25-maint/Lib/test/test_format.py python/branches/release25-maint/Lib/test/test_index.py python/branches/release25-maint/Lib/test/test_itertools.py Log: Merging change 55102 from the trunk: Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform. Modified: python/branches/release25-maint/Lib/test/string_tests.py ============================================================================== --- python/branches/release25-maint/Lib/test/string_tests.py (original) +++ python/branches/release25-maint/Lib/test/string_tests.py Mon May 7 15:33:39 2007 @@ -2,7 +2,7 @@ Common tests shared by test_str, test_unicode, test_userstring and test_string. """ -import unittest, string, sys +import unittest, string, sys, struct from test import test_support from UserList import UserList @@ -671,7 +671,7 @@ def test_replace_overflow(self): # Check for overflow checking on 32 bit machines - if sys.maxint != 2147483647: + if sys.maxint != 2147483647 or struct.calcsize("P") > 4: return A2_16 = "A" * (2**16) self.checkraises(OverflowError, A2_16, "replace", "", A2_16) Modified: python/branches/release25-maint/Lib/test/test_format.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_format.py (original) +++ python/branches/release25-maint/Lib/test/test_format.py Mon May 7 15:33:39 2007 @@ -1,5 +1,7 @@ from test.test_support import verbose, have_unicode, TestFailed import sys +from test.test_support import MAX_Py_ssize_t +maxsize = MAX_Py_ssize_t # test string formatting operator (I am not sure if this is being tested # elsewhere but, surely, some of the given cases are *not* tested because @@ -238,11 +240,11 @@ test_exc('%o', Foobar(), TypeError, "expected string or Unicode object, long found") -if sys.maxint == 2**31-1: +if maxsize == 2**31-1: # crashes 2.2.1 and earlier: try: - "%*d"%(sys.maxint, -127) + "%*d"%(maxsize, -127) except MemoryError: pass else: - raise TestFailed, '"%*d"%(sys.maxint, -127) should fail' + raise TestFailed, '"%*d"%(maxsize, -127) should fail' Modified: python/branches/release25-maint/Lib/test/test_index.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_index.py (original) +++ python/branches/release25-maint/Lib/test/test_index.py Mon May 7 15:33:39 2007 @@ -1,7 +1,10 @@ import unittest from test import test_support import operator +import sys from sys import maxint +maxsize = test_support.MAX_Py_ssize_t +minsize = -maxsize-1 class oldstyle: def __index__(self): @@ -185,7 +188,7 @@ def _getitem_helper(self, base): class GetItem(base): def __len__(self): - return maxint + return maxint #cannot return long here def __getitem__(self, key): return key def __getslice__(self, i, j): @@ -193,8 +196,8 @@ x = GetItem() self.assertEqual(x[self.pos], self.pos) self.assertEqual(x[self.neg], self.neg) - self.assertEqual(x[self.neg:self.pos], (-1, maxint)) - self.assertEqual(x[self.neg:self.pos:1].indices(maxint), (0, maxint, 1)) + self.assertEqual(x[self.neg:self.pos], (maxint+minsize, maxsize)) + self.assertEqual(x[self.neg:self.pos:1].indices(maxsize), (0, maxsize, 1)) def test_getitem(self): self._getitem_helper(object) Modified: python/branches/release25-maint/Lib/test/test_itertools.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_itertools.py (original) +++ python/branches/release25-maint/Lib/test/test_itertools.py Mon May 7 15:33:39 2007 @@ -5,6 +5,8 @@ import sys import operator import random +maxsize = test_support.MAX_Py_ssize_t +minsize = -maxsize-1 def onearg(x): 'Test function of one argument' @@ -52,7 +54,7 @@ self.assertEqual(take(2, zip('abc',count(3))), [('a', 3), ('b', 4)]) self.assertRaises(TypeError, count, 2, 3) self.assertRaises(TypeError, count, 'a') - self.assertRaises(OverflowError, list, islice(count(sys.maxint-5), 10)) + self.assertRaises(OverflowError, list, islice(count(maxsize-5), 10)) c = count(3) self.assertEqual(repr(c), 'count(3)') c.next() @@ -285,7 +287,7 @@ self.assertRaises(ValueError, islice, xrange(10), 1, 'a') self.assertRaises(ValueError, islice, xrange(10), 'a', 1, 1) self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1) - self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1) + self.assertEqual(len(list(islice(count(), 1, 10, maxsize))), 1) def test_takewhile(self): data = [1, 3, 5, 20, 2, 4, 6, 8] From python-checkins at python.org Mon May 7 18:46:56 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Mon, 7 May 2007 18:46:56 +0200 (CEST) Subject: [Python-checkins] r55169 - python/trunk/Objects/classobject.c python/trunk/Objects/intobject.c Message-ID: <20070507164656.B7BF81E401E@bag.python.org> Author: kristjan.jonsson Date: Mon May 7 18:46:54 2007 New Revision: 55169 Modified: python/trunk/Objects/classobject.c python/trunk/Objects/intobject.c Log: As per Armin Rigo's suggestion, remove special handing from intobject.c to deal with the peculiarities of classobject's implementation of the number protocol. The nb_long method of classobject now falls back to nb_int if there is no __long__ attribute present. Modified: python/trunk/Objects/classobject.c ============================================================================== --- python/trunk/Objects/classobject.c (original) +++ python/trunk/Objects/classobject.c Mon May 7 18:46:54 2007 @@ -1539,6 +1539,18 @@ return generic_unary_op(self, o); \ } +/* unary function with a fallback */ +#define UNARY_FB(funcname, methodname, funcname_fb) \ +static PyObject *funcname(PyInstanceObject *self) { \ + static PyObject *o; \ + if (o == NULL) { o = PyString_InternFromString(methodname); \ + if (o == NULL) return NULL; } \ + if (PyObject_HasAttr((PyObject*)self, o)) \ + return generic_unary_op(self, o); \ + else \ + return funcname_fb(self); \ +} + #define BINARY(f, m, n) \ static PyObject *f(PyObject *v, PyObject *w) { \ return do_binop(v, w, "__" m "__", "__r" m "__", n); \ @@ -1777,7 +1789,7 @@ UNARY(instance_invert, "__invert__") UNARY(instance_int, "__int__") -UNARY(instance_long, "__long__") +UNARY_FB(instance_long, "__long__", instance_int) UNARY(instance_float, "__float__") UNARY(instance_oct, "__oct__") UNARY(instance_hex, "__hex__") Modified: python/trunk/Objects/intobject.c ============================================================================== --- python/trunk/Objects/intobject.c (original) +++ python/trunk/Objects/intobject.c Mon May 7 18:46:54 2007 @@ -213,15 +213,10 @@ return -1; } - if (nb->nb_long != 0) { + if (nb->nb_long != 0) io = (PyIntObject*) (*nb->nb_long) (op); - if (io == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - io = (PyIntObject*) (*nb->nb_int) (op); - } - } else { + else io = (PyIntObject*) (*nb->nb_int) (op); - } if (io == NULL) return -1; if (!PyInt_Check(io)) { From facundobatista at gmail.com Mon May 7 19:08:44 2007 From: facundobatista at gmail.com (Facundo Batista) Date: Mon, 7 May 2007 14:08:44 -0300 Subject: [Python-checkins] r55138 - python/branches/decimal-branch/Lib/decimal.py In-Reply-To: References: <20070504210054.9555D1E4006@bag.python.org> Message-ID: 2007/5/4, Neal Norwitz : > Why not use a boolean instead of 0/1? Because of the spec, there says we must return a 0 or a 1 (actually, I first coded it returning bool, then had the doubt, re-read the spect, changed the code, :p). Regards, -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ From python-checkins at python.org Mon May 7 20:05:28 2007 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 7 May 2007 20:05:28 +0200 (CEST) Subject: [Python-checkins] r55172 - peps/trunk/pep-3126.txt Message-ID: <20070507180528.2E14E1E4002@bag.python.org> Author: guido.van.rossum Date: Mon May 7 20:05:23 2007 New Revision: 55172 Modified: peps/trunk/pep-3126.txt Log: New version, Raymond is now co-author. Modified: peps/trunk/pep-3126.txt ============================================================================== --- peps/trunk/pep-3126.txt (original) +++ peps/trunk/pep-3126.txt Mon May 7 20:05:23 2007 @@ -2,111 +2,380 @@ Title: Remove Implicit String Concatenation Version: $Revision$ Last-Modified: $Date$ -Author: Jim J. Jewett +Author: Jim J. Jewett , + Raymond D. Hettinger Status: Draft Type: Standards Track -Content-Type: text/plain +Content-Type: text/x-rst Created: 29-Apr-2007 -Post-History: 29-Apr-2007, 30-Apr-2007 +Post-History: 29-Apr-2007, 30-Apr-2007, 07-May-2007 Abstract +======== - Python initially inherited its parsing from C. While this has - been generally useful, there are some remnants which have been - less useful for python, and should be eliminated. +Python inherited many of its parsing rules from C. While this has +been generally useful, there are some individual rules which are less +useful for python, and should be eliminated. - This PEP proposes to eliminate Implicit String concatenation - based on adjacency of literals. +This PEP proposes to eliminate implicit string concatenation based +only on the adjacency of literals. - Instead of +Instead of:: - "abc" "def" == "abcdef" + "abc" "def" == "abcdef" - authors will need to be explicit, and add the strings +authors will need to be explicit, and either add the strings:: - "abc" + "def" == "abcdef" + "abc" + "def" == "abcdef" +or join them:: -Rationale for Removing Implicit String Concatenation + "".join(["abc", "def"]) == "abcdef" - Implicit String concatentation can lead to confusing, or even - silent, errors. - def f(arg1, arg2=None): pass +Motivation +========== - f("abc" "def") # forgot the comma, no warning ... - # silently becomes f("abcdef", None) +One goal for Python 3000 should be to simplify the language by +removing unnecessary features. Implicit string concatenation should +be dropped in favor of existing techniques. This will simplify the +grammar and simplify a user's mental picture of Python. The latter is +important for letting the language "fit in your head". A large group +of current users do not even know about implicit concatenation. Of +those who do know about it, a large portion never use it or habitually +avoid it. Of those who both know about it and use it, very few could +state with confidence the implicit operator precedence and under what +circumstances it is computed when the definition is compiled versus +when it is run. - or, using the scons build framework, + +History or Future +----------------- + +Many Python parsing rules are intentionally compatible with C. This +is a useful default, but Special Cases need to be justified based on +their utility in Python. We should no longer assume that python +programmers will also be familiar with C, so compatibility between +languages should be treated as a tie-breaker, rather than a +justification. + +In C, implicit concatenation is the only way to join strings without +using a (run-time) function call to store into a variable. In Python, +the strings can be joined (and still recognized as immutable) using +more standard Python idioms, such ``+`` or ``"".join``. + + +Problem +------- + +Implicit String concatentation leads to tuples and lists which are +shorter than they appear; this is turn can lead to confusing, or even +silent, errors. For example, given a function which accepts several +parameters, but offers a default value for some of them:: + + def f(fmt, *args): + print fmt % args + +This looks like a valid call, but isn't:: + + >>> f("User %s got a message %s", + "Bob" + "Time for dinner") + + Traceback (most recent call last): + File "", line 2, in + "Bob" + File "", line 2, in f + print fmt % args + TypeError: not enough arguments for format string + + +Calls to this function can silently do the wrong thing:: + + def g(arg1, arg2=None): + ... + + # silently transformed into the possibly very different + # g("arg1 on this linearg2 on this line", None) + g("arg1 on this line" + "arg2 on this line") + +To quote Jason Orendorff [#Orendorff] + + Oh. I just realized this happens a lot out here. Where I work, + we use scons, and each SConscript has a long list of filenames:: sourceFiles = [ - 'foo.c' - 'bar.c', - #...many lines omitted... - 'q1000x.c'] - - It's a common mistake to leave off a comma, and then scons complains - that it can't find 'foo.cbar.c'. This is pretty bewildering behavior - even if you *are* a Python programmer, and not everyone here is. [1] - - Note that in C, the implicit concatenation is more justified; there - is no other way to join strings without (at least) a function call. - - In Python, strings are objects which support the __add__ operator; - it is possible to write: - - "abc" + "def" - - Because these are literals, this addition can still be optimized - away by the compiler. (The CPython compiler already does. [2]) - - Guido indicated [2] that this change should be handled by PEP, because - there were a few edge cases with other string operators, such as the %. - (Assuming that str % stays -- it may be eliminated in favor of - PEP 3101 -- Advanced String Formatting. [3] [4]) - - The resolution is to treat them the same as today. - - ("abc %s def" + "ghi" % var) # fails like today. - # raises TypeError because of - # precedence. (% before +) - - ("abc" + "def %s ghi" % var) # works like today; precedence makes - # the optimization more difficult to - # recognize, but does not change the - # semantics. - - ("abc %s def" + "ghi") % var # works like today, because of - # precedence: () before % - # CPython compiler can already - # add the literals at compile-time. - - + 'foo.c' + 'bar.c', + #...many lines omitted... + 'q1000x.c'] + + It's a common mistake to leave off a comma, and then scons + complains that it can't find 'foo.cbar.c'. This is pretty + bewildering behavior even if you *are* a Python programmer, + and not everyone here is. + + +Solution +======== + +In Python, strings are objects and they support the __add__ operator, +so it is possible to write:: + + "abc" + "def" + +Because these are literals, this addition can still be optimized away +by the compiler; the CPython compiler already does so. +[#rcn-constantfold]_ + +Other existing alternatives include multiline (triple-quoted) strings, +and the join method:: + + """This string + extends across + multiple lines, but you may want to use something like + Textwrap.dedent + to clear out the leading spaces + and/or reformat. + """ + + + >>> "".join(["empty", "string", "joiner"]) == "emptystringjoiner" + True + + >>> " ".join(["space", "string", "joiner"]) == "space string joiner" + + >>> "\n".join(["multiple", "lines"]) == "multiple\nlines" == ( + """multiple + lines""") + True + + +Concerns +======== + + +Operator Precedence +------------------- + +Guido indicated [#rcn-constantfold]_ that this change should be +handled by PEP, because there were a few edge cases with other string +operators, such as the %. (Assuming that str % stays -- it may be +eliminated in favor of PEP 3101 -- Advanced String Formatting. +[#PEP3101]_ [#elimpercent]_) + +The resolution is to use parentheses to enforce precedence -- the same +solution that can be used today:: + + # Clearest, works today, continues to work, optimization is + # already possible. + ("abc %s def" + "ghi") % var + + # Already works today; precedence makes the optimization more + # difficult to recognize, but does not change the semantics. + "abc" + "def %s ghi" % var + +as opposed to:: + + # Already fails because modulus (%) is higher precedence than + # addition (+) + ("abc %s def" + "ghi" % var) + + # Works today only because adjacency is higher precedence than + # modulus. This will no longer be available. + "abc %s" "def" % var + + # So the 2-to-3 translator can automically replace it with the + # (already valid): + ("abc %s" + "def") % var + + +Long Commands +------------- + + ... build up (what I consider to be) readable SQL queries [#skipSQL]_:: + + rows = self.executesql("select cities.city, state, country" + " from cities, venues, events, addresses" + " where cities.city like %s" + " and events.active = 1" + " and venues.address = addresses.id" + " and addresses.city = cities.id" + " and events.venue = venues.id", + (city,)) + +Alternatives again include triple-quoted strings, ``+``, and ``.join``:: + + query="""select cities.city, state, country + from cities, venues, events, addresses + where cities.city like %s + and events.active = 1" + and venues.address = addresses.id + and addresses.city = cities.id + and events.venue = venues.id""" + + query=( "select cities.city, state, country" + + " from cities, venues, events, addresses" + + " where cities.city like %s" + + " and events.active = 1" + + " and venues.address = addresses.id" + + " and addresses.city = cities.id" + + " and events.venue = venues.id" + ) + + query="\n".join(["select cities.city, state, country", + " from cities, venues, events, addresses", + " where cities.city like %s", + " and events.active = 1", + " and venues.address = addresses.id", + " and addresses.city = cities.id", + " and events.venue = venues.id"]) + + # And yes, you *could* inline any of the above querystrings + # the same way the original was inlined. + rows = self.executesql(query, (city,)) + + +Regular Expressions +------------------- + +Complex regular expressions are sometimes stated in terms of several +implicitly concatenated strings with each regex component on a +different line and followed by a comment. The plus operator can be +inserted here but it does make the regex harder to read. One +alternative is to use the re.VERBOSE option. Another alternative is +to build-up the regex with a series of += lines:: + + # Existing idiom which relies on implicit concatenation + r = ('a{20}' # Twenty A's + 'b{5}' # Followed by Five B's + ) + + # Mechanical replacement + r = ('a{20}' +# Twenty A's + 'b{5}' # Followed by Five B's + ) + + # already works today + r = '''a{20} # Twenty A's + b{5} # Followed by Five B's + ''' # Compiled with the re.VERBOSE flag + + # already works today + r = 'a{20}' # Twenty A's + r += 'b{5}' # Followed by Five B's + + +Internationalization +-------------------- + +Some internationalization tools -- notably xgettext -- have already +been special-cased for implicit concatenation, but not for Python's +explicit concatenation. [#barryi8]_ + +These tools will fail to extract the (already legal):: + + _("some string" + + " and more of it") + +but often have a special case for:: + + _("some string" + " and more of it") + +It should also be possible to just use an overly long line (xgettext +limits messages to 2048 characters [#xgettext2048]_, which is less +than Python's enforced limit) or triple-quoted strings, but these +solutions sacrifice some readability in the code:: + + # Lines over a certain length are unpleasant. + _("some string and more of it") + + # Changing whitespace is not ideal. + _("""Some string + and more of it""") + _("""Some string + and more of it""") + _("Some string \ + and more of it") + +I do not see a good short-term resolution for this. + + +Transition +========== + +The proposed new constructs are already legal in current Python, and +can be used immediately. + +The 2 to 3 translator can be made to mechanically change:: + + "str1" "str2" + ("line1" #comment + "line2") + +into:: + + ("str1" + "str2") + ("line1" +#comments + "line2") + +If users want to use one of the other idioms, they can; as these +idioms are all already legal in python 2, the edits can be made +to the original source, rather than patching up the translator. + + +Open Issues +=========== + +Is there a better way to support external text extraction tools, or at +least ``xgettext`` [#gettext]_ in particular? + + References +========== + +.. [#Orendorff] Implicit String Concatenation, Orendorff + http://mail.python.org/pipermail/python-ideas/2007-April/000397.html + +.. [#rcn-constantfold] Reminder: Py3k PEPs due by April, Hettinger, + van Rossum + http://mail.python.org/pipermail/python-3000/2007-April/006563.html + +.. [#PEP3101] PEP 3101, Advanced String Formatting, Talin + http://www.python.org/peps/pep-3101.html + +.. [#elimpercent] ps to question Re: Need help completing ABC pep, + van Rossum + http://mail.python.org/pipermail/python-3000/2007-April/006737.html + +.. [#skipSQL] (email Subject) PEP 30XZ: Simplified Parsing, Skip, + http://mail.python.org/pipermail/python-3000/2007-May/007261.html - [1] Implicit String Concatenation, Jewett, Orendorff - http://mail.python.org/pipermail/python-ideas/2007-April/000397.html +.. [#barryi8] (email Subject) PEP 30XZ: Simplified Parsing + http://mail.python.org/pipermail/python-3000/2007-May/007305.html - [2] Reminder: Py3k PEPs due by April, Hettinger, van Rossum - http://mail.python.org/pipermail/python-3000/2007-April/006563.html +.. [#gettext] GNU gettext manual + http://www.gnu.org/software/gettext/ - [3] PEP 3101, Advanced String Formatting, Talin - http://www.python.org/peps/pep-3101.html +.. [#xgettext2048] Unix man page for xgettext -- Notes section + http://www.scit.wlv.ac.uk/cgi-bin/mansec?1+xgettext - [4] ps to question Re: Need help completing ABC pep, van Rossum - http://mail.python.org/pipermail/python-3000/2007-April/006737.html Copyright +========= This document has been placed in the public domain. -Local Variables: -mode: indented-text -indent-tabs-mode: nil -sentence-end-double-space: t -fill-column: 70 -coding: utf-8 -End: +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Mon May 7 20:28:18 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Mon, 7 May 2007 20:28:18 +0200 (CEST) Subject: [Python-checkins] r55173 - python/branches/release25-maint/Python/thread_nt.h Message-ID: <20070507182818.3E7931E4002@bag.python.org> Author: kristjan.jonsson Date: Mon May 7 20:28:12 2007 New Revision: 55173 Modified: python/branches/release25-maint/Python/thread_nt.h Log: Fix NonRecursiveMutex on x64. The signature of the faux-InterlockedCompareExchange function was wrong: It works with LONG and not PVOID objects, and it needs to have the target marked as volatile. Further, it is not needed at all for x64 targets, since that platform always has the real McCoy. Modified: python/branches/release25-maint/Python/thread_nt.h ============================================================================== --- python/branches/release25-maint/Python/thread_nt.h (original) +++ python/branches/release25-maint/Python/thread_nt.h Mon May 7 20:28:12 2007 @@ -15,14 +15,14 @@ HANDLE hevent ; } NRMUTEX, *PNRMUTEX ; -typedef PVOID WINAPI interlocked_cmp_xchg_t(PVOID *dest, PVOID exc, PVOID comperand) ; +typedef LONG WINAPI interlocked_cmp_xchg_t(LONG volatile *dest, LONG exc, LONG comperand) ; /* Sorry mate, but we haven't got InterlockedCompareExchange in Win95! */ -static PVOID WINAPI -interlocked_cmp_xchg(PVOID *dest, PVOID exc, PVOID comperand) +static LONG WINAPI +interlocked_cmp_xchg(LONG volatile *dest, LONG exc, LONG comperand) { static LONG spinlock = 0 ; - PVOID result ; + LONG result ; DWORD dwSleep = 0; /* Acqire spinlock (yielding control to other threads if cant aquire for the moment) */ @@ -76,10 +76,12 @@ return mutex->hevent != NULL ; /* TRUE if the mutex is created */ } +#ifndef MS_WIN64 #ifdef InterlockedCompareExchange #undef InterlockedCompareExchange #endif #define InterlockedCompareExchange(dest,exchange,comperand) (ixchg((dest), (exchange), (comperand))) +#endif VOID DeleteNonRecursiveMutex(PNRMUTEX mutex) @@ -98,7 +100,7 @@ /* InterlockedIncrement(&mutex->owned) == 0 means that no thread currently owns the mutex */ if (!wait) { - if (InterlockedCompareExchange((PVOID *)&mutex->owned, (PVOID)0, (PVOID)-1) != (PVOID)-1) + if (InterlockedCompareExchange(&mutex->owned, 0, -1) != -1) return WAIT_TIMEOUT ; ret = WAIT_OBJECT_0 ; } From python-checkins at python.org Mon May 7 20:30:54 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Mon, 7 May 2007 20:30:54 +0200 (CEST) Subject: [Python-checkins] r55174 - in python/branches/release25-maint: Modules/itertoolsmodule.c Objects/longobject.c Message-ID: <20070507183054.3362B1E400B@bag.python.org> Author: kristjan.jonsson Date: Mon May 7 20:30:48 2007 New Revision: 55174 Modified: python/branches/release25-maint/Modules/itertoolsmodule.c python/branches/release25-maint/Objects/longobject.c Log: Fix two problems that emerged when the testsuite was run with an x64 build: PyLong_FromSSize_t incorrectly assumed an unsigned object, and itertools.count() had the wrong upper limit for the iterator. Modified: python/branches/release25-maint/Modules/itertoolsmodule.c ============================================================================== --- python/branches/release25-maint/Modules/itertoolsmodule.c (original) +++ python/branches/release25-maint/Modules/itertoolsmodule.c Mon May 7 20:30:48 2007 @@ -2073,9 +2073,9 @@ static PyObject * count_next(countobject *lz) { - if (lz->cnt == LONG_MAX) { + if (lz->cnt == PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, - "cannot count beyond LONG_MAX"); + "cannot count beyond PY_SSIZE_T_MAX"); return NULL; } return PyInt_FromSsize_t(lz->cnt++); Modified: python/branches/release25-maint/Objects/longobject.c ============================================================================== --- python/branches/release25-maint/Objects/longobject.c (original) +++ python/branches/release25-maint/Objects/longobject.c Mon May 7 20:30:48 2007 @@ -893,7 +893,7 @@ int one = 1; return _PyLong_FromByteArray( (unsigned char *)&bytes, - SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 0); + SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 1); } /* Create a new long int object from a C size_t. */ From buildbot at python.org Mon May 7 20:35:55 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 May 2007 18:35:55 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070507183556.2DD701E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/424 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,kristjan.jonsson,neal.norwitz,vinay.sajip Build had warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon May 7 20:36:40 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Mon, 7 May 2007 20:36:40 +0200 (CEST) Subject: [Python-checkins] r55175 - python/branches/release25-maint/Objects/classobject.c Message-ID: <20070507183640.E71B51E4002@bag.python.org> Author: kristjan.jonsson Date: Mon May 7 20:36:39 2007 New Revision: 55175 Modified: python/branches/release25-maint/Objects/classobject.c Log: the nb_long slot on classobject instances now defaults to call the nb_int slot member if there is no __long__ attribute found. This is in accordance with a suggestion from Armin Rigo, and allows the test_getargs2.py test in the testsuite for x64 Modified: python/branches/release25-maint/Objects/classobject.c ============================================================================== --- python/branches/release25-maint/Objects/classobject.c (original) +++ python/branches/release25-maint/Objects/classobject.c Mon May 7 20:36:39 2007 @@ -1539,6 +1539,18 @@ return generic_unary_op(self, o); \ } +/* unary function with a fallback */ +#define UNARY_FB(funcname, methodname, funcname_fb) \ +static PyObject *funcname(PyInstanceObject *self) { \ + static PyObject *o; \ + if (o == NULL) { o = PyString_InternFromString(methodname); \ + if (o == NULL) return NULL; } \ + if (PyObject_HasAttr((PyObject*)self, o)) \ + return generic_unary_op(self, o); \ + else \ + return funcname_fb(self); \ +} + #define BINARY(f, m, n) \ static PyObject *f(PyObject *v, PyObject *w) { \ return do_binop(v, w, "__" m "__", "__r" m "__", n); \ @@ -1777,7 +1789,7 @@ UNARY(instance_invert, "__invert__") UNARY(instance_int, "__int__") -UNARY(instance_long, "__long__") +UNARY_FB(instance_long, "__long__", instance_int) UNARY(instance_float, "__float__") UNARY(instance_oct, "__oct__") UNARY(instance_hex, "__hex__") From python-checkins at python.org Mon May 7 21:05:33 2007 From: python-checkins at python.org (collin.winter) Date: Mon, 7 May 2007 21:05:33 +0200 (CEST) Subject: [Python-checkins] r55176 - peps/trunk/pep-3129.txt Message-ID: <20070507190533.66F4E1E4007@bag.python.org> Author: collin.winter Date: Mon May 7 21:05:28 2007 New Revision: 55176 Modified: peps/trunk/pep-3129.txt Log: Add a post-history entry. Modified: peps/trunk/pep-3129.txt ============================================================================== --- peps/trunk/pep-3129.txt (original) +++ peps/trunk/pep-3129.txt Mon May 7 21:05:28 2007 @@ -1,14 +1,14 @@ PEP: 3129 Title: Class Decorators -Version: $Revision: 53815 $ -Last-Modified: $Date: 2007-04-27 16:42:06 -0700 (Fri, 27 Apr 2007) $ +Version: $Revision$ +Last-Modified: $Date$ Author: Collin Winter Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 1-May-2007 Python-Version: 3.0 -Post-History: +Post-History: 7-May-2007 Abstract From buildbot at python.org Mon May 7 21:23:10 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 May 2007 19:23:10 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP 2.5 Message-ID: <20070507192311.D27AC1E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/223 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: kristjan.jonsson Build had warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon May 7 21:25:42 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Mon, 7 May 2007 21:25:42 +0200 (CEST) Subject: [Python-checkins] r55177 - in python/branches/release25-maint: Include/fileobject.h Modules/posixmodule.c Objects/fileobject.c Message-ID: <20070507192542.E4DFE1E4002@bag.python.org> Author: kristjan.jonsson Date: Mon May 7 21:25:38 2007 New Revision: 55177 Modified: python/branches/release25-maint/Include/fileobject.h python/branches/release25-maint/Modules/posixmodule.c python/branches/release25-maint/Objects/fileobject.c Log: Merge change 54982 from the trunk. This fixes the test_subprocess test in the testsuite for VisualStudio2005 builds, by "sanitizing" the "mode" that is used in the posixmodule's fdopen(). In particular the non-standard "U" mode character is removed. Modified: python/branches/release25-maint/Include/fileobject.h ============================================================================== --- python/branches/release25-maint/Include/fileobject.h (original) +++ python/branches/release25-maint/Include/fileobject.h Mon May 7 21:25:38 2007 @@ -57,6 +57,11 @@ char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *); +/* A routine to do sanity checking on the file mode string. returns + non-zero on if an exception occurred +*/ +int _PyFile_SanitizeMode(char *mode); + #ifdef __cplusplus } #endif Modified: python/branches/release25-maint/Modules/posixmodule.c ============================================================================== --- python/branches/release25-maint/Modules/posixmodule.c (original) +++ python/branches/release25-maint/Modules/posixmodule.c Mon May 7 21:25:38 2007 @@ -6170,16 +6170,23 @@ posix_fdopen(PyObject *self, PyObject *args) { int fd; - char *mode = "r"; + char *orgmode = "r"; int bufsize = -1; FILE *fp; PyObject *f; - if (!PyArg_ParseTuple(args, "i|si", &fd, &mode, &bufsize)) + char *mode; + if (!PyArg_ParseTuple(args, "i|si", &fd, &orgmode, &bufsize)) return NULL; - if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') { - PyErr_Format(PyExc_ValueError, - "invalid file mode '%s'", mode); + /* Sanitize mode. See fileobject.c */ + mode = PyMem_MALLOC(strlen(orgmode)+3); + if (!mode) { + PyErr_NoMemory(); + return NULL; + } + strcpy(mode, orgmode); + if (_PyFile_SanitizeMode(mode)) { + PyMem_FREE(mode); return NULL; } Py_BEGIN_ALLOW_THREADS @@ -6200,10 +6207,11 @@ #else fp = fdopen(fd, mode); #endif + PyMem_FREE(mode); Py_END_ALLOW_THREADS if (fp == NULL) return posix_error(); - f = PyFile_FromFile(fp, "", mode, fclose); + f = PyFile_FromFile(fp, "", orgmode, fclose); if (f != NULL) PyFile_SetBufSize(f, bufsize); return f; Modified: python/branches/release25-maint/Objects/fileobject.c ============================================================================== --- python/branches/release25-maint/Objects/fileobject.c (original) +++ python/branches/release25-maint/Objects/fileobject.c Mon May 7 21:25:38 2007 @@ -139,17 +139,16 @@ ignore stuff they don't understand... write or append mode with universal newline support is expressly forbidden by PEP 278. Additionally, remove the 'U' from the mode string as platforms - won't know what it is. */ -/* zero return is kewl - one is un-kewl */ -static int -sanitize_the_mode(char *mode) + won't know what it is. Non-zero return signals an exception */ +int +_PyFile_SanitizeMode(char *mode) { char *upos; size_t len = strlen(mode); if (!len) { PyErr_SetString(PyExc_ValueError, "empty mode string"); - return 1; + return -1; } upos = strchr(mode, 'U'); @@ -160,7 +159,7 @@ PyErr_Format(PyExc_ValueError, "universal newline " "mode can only be used with modes " "starting with 'r'"); - return 1; + return -1; } if (mode[0] != 'r') { @@ -175,7 +174,7 @@ } else if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') { PyErr_Format(PyExc_ValueError, "mode string must begin with " "one of 'r', 'w', 'a' or 'U', not '%.200s'", mode); - return 1; + return -1; } return 0; @@ -204,7 +203,7 @@ } strcpy(newmode, mode); - if (sanitize_the_mode(newmode)) { + if (_PyFile_SanitizeMode(newmode)) { f = NULL; goto cleanup; } From python-checkins at python.org Mon May 7 21:31:44 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Mon, 7 May 2007 21:31:44 +0200 (CEST) Subject: [Python-checkins] r55178 - python/branches/release25-maint/Lib/test/test_locale.py Message-ID: <20070507193144.224541E4002@bag.python.org> Author: kristjan.jonsson Date: Mon May 7 21:31:41 2007 New Revision: 55178 Modified: python/branches/release25-maint/Lib/test/test_locale.py Log: Merge change 54983 from the trunk: Add the locale "English" to test_locale.py for a windows run, since "En" isn't legal for the Visual C 8 runtime. This update restores full testsuite compliance to VisualStudio 2005 builds, apart from unavailible external modules. Modified: python/branches/release25-maint/Lib/test/test_locale.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_locale.py (original) +++ python/branches/release25-maint/Lib/test/test_locale.py Mon May 7 21:31:41 2007 @@ -7,7 +7,7 @@ oldlocale = locale.setlocale(locale.LC_NUMERIC) if sys.platform.startswith("win"): - tlocs = ("en",) + tlocs = ("En", "English") else: tlocs = ("en_US.UTF-8", "en_US.US-ASCII", "en_US") From b_davidsmark at latinmail.com Tue May 8 02:12:24 2007 From: b_davidsmark at latinmail.com (Ben Smith.) Date: Tue, 08 May 2007 01:12:24 +0100 Subject: [Python-checkins] YOURS Message-ID: Good day, This is a personal email directed to you and I request that it be treated as such. I am Ben Smith ,a solicitor at law. I am the personal attorney/sole executor to the late Mr Morris Thompson, hereinafter referred to as 'my client' who worked as an independent oil magnate in my country and who died in a car crash with his immediate family on the 4th of oct,1998. Since the death of my client in oct,1998, I have written several letters to the embassy with an intent to locate any of his extended relatives whom shall be claimants/beneficiaries of his abandoned personal belonging and all such efforts have been to no avail. Moreso,I have received official letters in the last few weeks suggesting a likely proceeding for confiscation of his abandoned personal assets in line with existing laws by the bank in which my client deposited the sum of 35.8 million U.S.D. On this note i decided to search for a credible person and finding that you are God fearly person, I was urged to contact you, that I may,with your consent, present you to the "trustee" bank as my late client's surviving family member so as to enable you put up a claim to the bank in that capacity as a next of kin of my client. It a lot easier for you to put up a claim in that capacity.I propose that 20% of the net sum will accrue to you at the conclusion of this deal in so far as I do not incur further expenses. Therefore, to facilitate the immediate transfer of this fund, you need, first to contact me via signifying your interest and as soon as I obtain your confidence,I will immediately appraise you with the complete details as well as fax you the documents, with which you are to proceed and i shall direct on how to put up an application to the bank. HOWEVER, you will have to accent to an express agreement which I will forward to you in order to bind us in this transaction. Upon the reciept of your reply,I will send you by fax or E-mail the next step to take.I will not fail to bring to your notice that this proposal is hitch-free and that you should not entertain any fears as the required arrangem! ents have been made for the completion of this transfer. Like I said, I require only a solemn confidentiality on this. Best regards, Ben Smith. From python-checkins at python.org Tue May 8 21:31:20 2007 From: python-checkins at python.org (collin.winter) Date: Tue, 8 May 2007 21:31:20 +0200 (CEST) Subject: [Python-checkins] r55190 - peps/trunk/pep-0000.txt peps/trunk/pep-3129.txt Message-ID: <20070508193120.B3C101E4011@bag.python.org> Author: collin.winter Date: Tue May 8 21:31:17 2007 New Revision: 55190 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3129.txt Log: Mark PEP 3129 as accepted. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 8 21:31:17 2007 @@ -81,6 +81,7 @@ SA 3112 Bytes literals in Python 3000 Orendorff SA 3113 Removal of Tuple Parameter Unpacking Cannon SA 3115 Metaclasses in Python 3000 Talin + SA 3129 Class Decorators Winter Open PEPs (under consideration) @@ -124,7 +125,6 @@ S 3126 Remove Implicit String Concatenation Jewett S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach - S 3129 Class Decorators Winter S 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis S 3132 Extended Iterable Unpacking Brandl @@ -498,7 +498,7 @@ S 3126 Remove Implicit String Concatenation Jewett S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach - S 3129 Class Decorators Winter + SA 3129 Class Decorators Winter S 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis S 3132 Extended Iterable Unpacking Brandl Modified: peps/trunk/pep-3129.txt ============================================================================== --- peps/trunk/pep-3129.txt (original) +++ peps/trunk/pep-3129.txt Tue May 8 21:31:17 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Collin Winter -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 1-May-2007 From python-checkins at python.org Wed May 9 06:14:47 2007 From: python-checkins at python.org (collin.winter) Date: Wed, 9 May 2007 06:14:47 +0200 (CEST) Subject: [Python-checkins] r55197 - python/trunk/Lib/test/test_support.py Message-ID: <20070509041447.B6D7B1E4002@bag.python.org> Author: collin.winter Date: Wed May 9 06:14:36 2007 New Revision: 55197 Modified: python/trunk/Lib/test/test_support.py Log: Fix a bug in test.test_support.open_urlresource(). If the call to requires() doesn't precede the filesystem check, we get the following situation: 1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped 2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs 3. ./python Lib/test/regrtest.py test_foo # test runs (!) By moving the call to requires() *after* the filesystem check, the fact that fetched files are cached on the local disk becomes an implementation detail, rather than a semantics-changing point of note. Modified: python/trunk/Lib/test/test_support.py ============================================================================== --- python/trunk/Lib/test/test_support.py (original) +++ python/trunk/Lib/test/test_support.py Wed May 9 06:14:36 2007 @@ -259,6 +259,7 @@ def open_urlresource(url): import urllib, urlparse + requires('urlfetch') filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL! for path in [os.path.curdir, os.path.pardir]: @@ -266,7 +267,6 @@ if os.path.exists(fn): return open(fn) - requires('urlfetch') print >> get_original_stdout(), '\tfetching %s ...' % url fn, _ = urllib.urlretrieve(url, filename) return open(fn) From python-checkins at python.org Wed May 9 06:18:34 2007 From: python-checkins at python.org (collin.winter) Date: Wed, 9 May 2007 06:18:34 +0200 (CEST) Subject: [Python-checkins] r55197 - svn:log Message-ID: <20070509041834.A0F2D1E4002@bag.python.org> Author: collin.winter Revision: 55197 Property Name: svn:log New Property Value: Fix a bug in test.test_support.open_urlresource(). If the call to requires() doesn't precede the filesystem check, we get the following situation: 1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped 2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs 3. ./python Lib/test/regrtest.py test_foo # test runs (!) By moving the call to requires() *before* the filesystem check, the fact that fetched files are cached on the local disk becomes an implementation detail, rather than a semantics-changing point of note. From collinw at gmail.com Wed May 9 06:20:29 2007 From: collinw at gmail.com (Collin Winter) Date: Tue, 8 May 2007 21:20:29 -0700 Subject: [Python-checkins] r55197 - python/trunk/Lib/test/test_support.py In-Reply-To: <20070509041447.B6D7B1E4002@bag.python.org> References: <20070509041447.B6D7B1E4002@bag.python.org> Message-ID: <43aa6ff70705082120o29bf9d38rf94e2c2b63757dd1@mail.gmail.com> On 5/8/07, collin.winter wrote: > If the call to requires() doesn't precede the filesystem check, we get the following situation: > 1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped > 2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs > 3. ./python Lib/test/regrtest.py test_foo # test runs (!) > > By moving the call to requires() *after* the filesystem check, [snip] That should be "before", not "after"; fixed with propedit. From fdrake at acm.org Wed May 9 06:27:47 2007 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Wed, 9 May 2007 00:27:47 -0400 Subject: [Python-checkins] r55197 - svn:log In-Reply-To: <20070509041834.A0F2D1E4002@bag.python.org> References: <20070509041834.A0F2D1E4002@bag.python.org> Message-ID: <200705090027.47298.fdrake@acm.org> On Wednesday 09 May 2007, collin.winter wrote: > If the call to requires() doesn't precede the filesystem check, we get the > following situation: 1. ./python Lib/test/regrtest.py test_foo # test > needs urlfetch, not enabled, so skipped 2. ./python Lib/test/regrtest.py > -u urlfetch test_foo # test runs 3. ./python Lib/test/regrtest.py test_foo > # test runs (!) > > By moving the call to requires() *before* the filesystem check, the fact > that fetched files are cached on the local disk becomes an implementation > detail, rather than a semantics-changing point of note. Is this the intent of the requirement? Or is the intent to protect the actual use of the network to perform the fetch? I think I understand your motivation, but it seems more important to protect against unintentional use of the network than to avoid running the tests. Running the tests when the needed resource is available seems like a good thing. -Fred -- Fred L. Drake, Jr. From collinw at gmail.com Wed May 9 06:33:44 2007 From: collinw at gmail.com (Collin Winter) Date: Tue, 8 May 2007 21:33:44 -0700 Subject: [Python-checkins] r55197 - svn:log In-Reply-To: <200705090027.47298.fdrake@acm.org> References: <20070509041834.A0F2D1E4002@bag.python.org> <200705090027.47298.fdrake@acm.org> Message-ID: <43aa6ff70705082133k547f2e18m74b1d5fc2e0413fb@mail.gmail.com> On 5/8/07, Fred L. Drake, Jr. wrote: > On Wednesday 09 May 2007, collin.winter wrote: > > If the call to requires() doesn't precede the filesystem check, we get the > > following situation: 1. ./python Lib/test/regrtest.py test_foo # test > > needs urlfetch, not enabled, so skipped 2. ./python Lib/test/regrtest.py > > -u urlfetch test_foo # test runs 3. ./python Lib/test/regrtest.py test_foo > > # test runs (!) > > > > By moving the call to requires() *before* the filesystem check, the fact > > that fetched files are cached on the local disk becomes an implementation > > detail, rather than a semantics-changing point of note. > > Is this the intent of the requirement? Or is the intent to protect the actual > use of the network to perform the fetch? > > I think I understand your motivation, but it seems more important to protect > against unintentional use of the network than to avoid running the tests. > Running the tests when the needed resource is available seems like a good > thing. The network is still used to fetch the file the first time, and all subsequent requests for the file will use the cached version from the local disk. The behaviour change is that the presence of the locally-cached file no longer removes the need to enable the urlfetch resource; see http://mail.python.org/pipermail/python-dev/2007-April/072646.html for the motivating case. Collin Winter From python-checkins at python.org Wed May 9 08:43:19 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 9 May 2007 08:43:19 +0200 (CEST) Subject: [Python-checkins] r55198 - python/trunk/Doc/lib/libpprint.tex Message-ID: <20070509064319.112101E4002@bag.python.org> Author: neal.norwitz Date: Wed May 9 08:43:15 2007 New Revision: 55198 Modified: python/trunk/Doc/lib/libpprint.tex Log: Add markup for True/False. Will backport Modified: python/trunk/Doc/lib/libpprint.tex ============================================================================== --- python/trunk/Doc/lib/libpprint.tex (original) +++ python/trunk/Doc/lib/libpprint.tex Wed May 9 08:43:15 2007 @@ -118,7 +118,7 @@ \begin{funcdesc}{isreadable}{object} Determine if the formatted representation of \var{object} is ``readable,'' or can be used to reconstruct the value using -\function{eval()}\bifuncindex{eval}. This always returns false for +\function{eval()}\bifuncindex{eval}. This always returns \code{False} for recursive objects. \begin{verbatim} @@ -176,10 +176,10 @@ \begin{methoddesc}[PrettyPrinter]{isreadable}{object} Determine if the formatted representation of the object is ``readable,'' or can be used to reconstruct the value using -\function{eval()}\bifuncindex{eval}. Note that this returns false for +\function{eval()}\bifuncindex{eval}. Note that this returns \code{False} for recursive objects. If the \var{depth} parameter of the \class{PrettyPrinter} is set and the object is deeper than allowed, -this returns false. +this returns \code{False}. \end{methoddesc} \begin{methoddesc}[PrettyPrinter]{isrecursive}{object} @@ -199,7 +199,7 @@ context (direct and indirect containers for \var{object} that are affecting the presentation) as the keys; if an object needs to be presented which is already represented in \var{context}, the third -return value should be true. Recursive calls to the \method{format()} +return value should be \code{True}. Recursive calls to the \method{format()} method should add additional entries for containers to this dictionary. The third argument, \var{maxlevels}, gives the requested limit to recursion; this will be \code{0} if there is no requested From python-checkins at python.org Wed May 9 08:44:25 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 9 May 2007 08:44:25 +0200 (CEST) Subject: [Python-checkins] r55199 - python/branches/release25-maint/Doc/lib/libpprint.tex Message-ID: <20070509064425.08D1F1E4002@bag.python.org> Author: neal.norwitz Date: Wed May 9 08:44:23 2007 New Revision: 55199 Modified: python/branches/release25-maint/Doc/lib/libpprint.tex Log: Backport: Add markup for True/False. Modified: python/branches/release25-maint/Doc/lib/libpprint.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libpprint.tex (original) +++ python/branches/release25-maint/Doc/lib/libpprint.tex Wed May 9 08:44:23 2007 @@ -118,7 +118,7 @@ \begin{funcdesc}{isreadable}{object} Determine if the formatted representation of \var{object} is ``readable,'' or can be used to reconstruct the value using -\function{eval()}\bifuncindex{eval}. This always returns false for +\function{eval()}\bifuncindex{eval}. This always returns \code{False} for recursive objects. \begin{verbatim} @@ -176,10 +176,10 @@ \begin{methoddesc}{isreadable}{object} Determine if the formatted representation of the object is ``readable,'' or can be used to reconstruct the value using -\function{eval()}\bifuncindex{eval}. Note that this returns false for +\function{eval()}\bifuncindex{eval}. Note that this returns \code{False} for recursive objects. If the \var{depth} parameter of the \class{PrettyPrinter} is set and the object is deeper than allowed, -this returns false. +this returns \code{False}. \end{methoddesc} \begin{methoddesc}{isrecursive}{object} @@ -199,7 +199,7 @@ context (direct and indirect containers for \var{object} that are affecting the presentation) as the keys; if an object needs to be presented which is already represented in \var{context}, the third -return value should be true. Recursive calls to the \method{format()} +return value should be \code{True}. Recursive calls to the \method{format()} method should add additional entries for containers to this dictionary. The third argument, \var{maxlevels}, gives the requested limit to recursion; this will be \code{0} if there is no requested From python-checkins at python.org Wed May 9 08:45:53 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 9 May 2007 08:45:53 +0200 (CEST) Subject: [Python-checkins] r55200 - python/branches/release25-maint/Modules/posixmodule.c Message-ID: <20070509064553.D2B341E4002@bag.python.org> Author: neal.norwitz Date: Wed May 9 08:45:53 2007 New Revision: 55200 Modified: python/branches/release25-maint/Modules/posixmodule.c Log: Backport r55070: Stop using PyMem_FREE while the GIL is not held. Modified: python/branches/release25-maint/Modules/posixmodule.c ============================================================================== --- python/branches/release25-maint/Modules/posixmodule.c (original) +++ python/branches/release25-maint/Modules/posixmodule.c Wed May 9 08:45:53 2007 @@ -6207,8 +6207,8 @@ #else fp = fdopen(fd, mode); #endif - PyMem_FREE(mode); Py_END_ALLOW_THREADS + PyMem_FREE(mode); if (fp == NULL) return posix_error(); f = PyFile_FromFile(fp, "", orgmode, fclose); From buildbot at python.org Wed May 9 10:26:44 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 09 May 2007 08:26:44 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20070509082644.83A3C1E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/261 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Wed May 9 20:10:48 2007 From: python-checkins at python.org (walter.doerwald) Date: Wed, 9 May 2007 20:10:48 +0200 (CEST) Subject: [Python-checkins] r55205 - python/trunk/Modules/binascii.c Message-ID: <20070509181048.DBD771E4011@bag.python.org> Author: walter.doerwald Date: Wed May 9 20:10:47 2007 New Revision: 55205 Modified: python/trunk/Modules/binascii.c Log: Backport checkin: Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr() instead of memchr(). Modified: python/trunk/Modules/binascii.c ============================================================================== --- python/trunk/Modules/binascii.c (original) +++ python/trunk/Modules/binascii.c Wed May 9 20:10:47 2007 @@ -1150,7 +1150,7 @@ /* XXX: this function has the side effect of converting all of * the end of lines to be the same depending on this detection * here */ - p = (unsigned char *) strchr((char *)data, '\n'); + p = (unsigned char *) memchr(data, '\n', datalen); if ((p != NULL) && (p > data) && (*(p-1) == '\r')) crlf = 1; From python-checkins at python.org Wed May 9 20:13:54 2007 From: python-checkins at python.org (walter.doerwald) Date: Wed, 9 May 2007 20:13:54 +0200 (CEST) Subject: [Python-checkins] r55206 - python/branches/release25-maint/Modules/binascii.c Message-ID: <20070509181354.621351E4009@bag.python.org> Author: walter.doerwald Date: Wed May 9 20:13:53 2007 New Revision: 55206 Modified: python/branches/release25-maint/Modules/binascii.c Log: Backport checkin: Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr() instead of memchr(). Modified: python/branches/release25-maint/Modules/binascii.c ============================================================================== --- python/branches/release25-maint/Modules/binascii.c (original) +++ python/branches/release25-maint/Modules/binascii.c Wed May 9 20:13:53 2007 @@ -1150,7 +1150,7 @@ /* XXX: this function has the side effect of converting all of * the end of lines to be the same depending on this detection * here */ - p = (unsigned char *) strchr((char *)data, '\n'); + p = (unsigned char *) memchr(data, '\n', datalen); if ((p != NULL) && (p > data) && (*(p-1) == '\r')) crlf = 1; From buildbot at python.org Wed May 9 21:18:39 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 09 May 2007 19:18:39 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP 2.5 Message-ID: <20070509191839.75E501E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/227 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: walter.doerwald Build had warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Thu May 10 08:53:45 2007 From: python-checkins at python.org (thomas.heller) Date: Thu, 10 May 2007 08:53:45 +0200 (CEST) Subject: [Python-checkins] r55222 - python/branches/release25-maint/Modules/_ctypes Message-ID: <20070510065345.962C21E4004@bag.python.org> Author: thomas.heller Date: Thu May 10 08:53:40 2007 New Revision: 55222 Modified: python/branches/release25-maint/Modules/_ctypes/ (props changed) Log: Mark already merged revisions. From python-checkins at python.org Thu May 10 09:19:17 2007 From: python-checkins at python.org (thomas.heller) Date: Thu, 10 May 2007 09:19:17 +0200 (CEST) Subject: [Python-checkins] r55223 - python/branches/release25-maint/Lib/ctypes Message-ID: <20070510071917.8F1F01E4003@bag.python.org> Author: thomas.heller Date: Thu May 10 09:19:16 2007 New Revision: 55223 Modified: python/branches/release25-maint/Lib/ctypes/ (props changed) Log: Mark blocked revisions. From python-checkins at python.org Thu May 10 19:20:18 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 10 May 2007 19:20:18 +0200 (CEST) Subject: [Python-checkins] r55227 - python/trunk/Objects/setobject.c Message-ID: <20070510172018.844A11E4008@bag.python.org> Author: guido.van.rossum Date: Thu May 10 19:20:15 2007 New Revision: 55227 Modified: python/trunk/Objects/setobject.c Log: Fix a bug in test_c_api() that caused a negative refcount. Modified: python/trunk/Objects/setobject.c ============================================================================== --- python/trunk/Objects/setobject.c (original) +++ python/trunk/Objects/setobject.c Thu May 10 19:20:15 2007 @@ -2205,7 +2205,7 @@ Py_ssize_t count; char *s; Py_ssize_t i; - PyObject *elem, *dup, *t, *f, *dup2; + PyObject *elem=NULL, *dup=NULL, *t, *f, *dup2, *x; PyObject *ob = (PyObject *)so; /* Verify preconditions and exercise type/size checks */ @@ -2251,8 +2251,8 @@ /* Exercise direct iteration */ i = 0, count = 0; - while (_PySet_Next((PyObject *)dup, &i, &elem)) { - s = PyString_AsString(elem); + while (_PySet_Next((PyObject *)dup, &i, &x)) { + s = PyString_AsString(x); assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c')); count++; } From python-checkins at python.org Thu May 10 22:17:53 2007 From: python-checkins at python.org (collin.winter) Date: Thu, 10 May 2007 22:17:53 +0200 (CEST) Subject: [Python-checkins] r55232 - peps/trunk/pep-0000.txt peps/trunk/pep-3117.txt Message-ID: <20070510201753.D0BE71E4003@bag.python.org> Author: collin.winter Date: Thu May 10 22:17:53 2007 New Revision: 55232 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3117.txt Log: Mark PEP 3117 as rejected. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Thu May 10 22:17:53 2007 @@ -114,7 +114,6 @@ S 3101 Advanced String Formatting Talin S 3108 Standard Library Reorganization Cannon S 3116 New I/O Stutzbach, Verdone, GvR - S 3117 Postfix Type Declarations Brandl S 3118 Revising the buffer protocol Oliphant, Banks S 3119 Introducing Abstract Base Classes GvR, Talin S 3120 Using UTF-8 as the default source encoding von L?wis @@ -268,6 +267,7 @@ SR 363 Syntax For Dynamic Attribute Access North SR 666 Reject Foolish Indentation Creighton SR 3103 A Switch/Case Statement GvR + SR 3117 Postfix Type Declarations Brandl SR 3122 Delineation of the main module Cannon @@ -486,7 +486,7 @@ SF 3114 Renaming iterator.next() to .__next__() Yee SA 3115 Metaclasses in Python 3000 Talin S 3116 New I/O Stutzbach, Verdone, GvR - S 3117 Postfix Type Declarations Brandl + SR 3117 Postfix Type Declarations Brandl S 3118 Revising the buffer protocol Oliphant, Banks S 3119 Introducing Abstract Base Classes GvR, Talin S 3120 Using UTF-8 as the default source encoding von L?wis Modified: peps/trunk/pep-3117.txt ============================================================================== --- peps/trunk/pep-3117.txt (original) +++ peps/trunk/pep-3117.txt Thu May 10 22:17:53 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Georg Brandl -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 01-Apr-2007 @@ -185,6 +185,13 @@ and enforces correct types for all assignments and function calls. +Rejection +========= + +After careful considering, much soul-searching, gnashing of teeth and rending +of garments, it has been decided to reject this PEP. + + References ========== From python-checkins at python.org Fri May 11 00:18:20 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 00:18:20 +0200 (CEST) Subject: [Python-checkins] r55233 - peps/trunk/pep-0000.txt peps/trunk/pep-3125.txt peps/trunk/pep-3126.txt Message-ID: <20070510221820.0BBFD1E4003@bag.python.org> Author: guido.van.rossum Date: Fri May 11 00:18:18 2007 New Revision: 55233 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3125.txt peps/trunk/pep-3126.txt Log: Reject PEPs 3125 and 3126 (removing backslash continuation and implicit string concatenation, respectively). Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 11 00:18:18 2007 @@ -120,8 +120,6 @@ S 3121 Extension Module Initialization & Finalization von L?wis S 3123 Making PyObject_HEAD conform to standard C von L?wis S 3124 Overloading, Generic Functions, Interfaces Eby - S 3125 Remove Backslash Continuation Jewett - S 3126 Remove Implicit String Concatenation Jewett S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach S 3130 Access to Current Module/Class/Function Jewett @@ -269,6 +267,8 @@ SR 3103 A Switch/Case Statement GvR SR 3117 Postfix Type Declarations Brandl SR 3122 Delineation of the main module Cannon + SR 3125 Remove Backslash Continuation Jewett + SR 3126 Remove Implicit String Concatenation Jewett Numerical Index @@ -494,8 +494,8 @@ SR 3122 Delineation of the main module Cannon S 3123 Making PyObject_HEAD conform to standard C von L?wis S 3124 Overloading, Generic Functions, Interfaces Eby - S 3125 Remove Backslash Continuation Jewett - S 3126 Remove Implicit String Concatenation Jewett + SR 3125 Remove Backslash Continuation Jewett + SR 3126 Remove Implicit String Concatenation Jewett S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach SA 3129 Class Decorators Winter Modified: peps/trunk/pep-3125.txt ============================================================================== --- peps/trunk/pep-3125.txt (original) +++ peps/trunk/pep-3125.txt Fri May 11 00:18:18 2007 @@ -3,13 +3,21 @@ Version: $Revision$ Last-Modified: $Date$ Author: Jim J. Jewett -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 29-Apr-2007 Post-History: 29-Apr-2007, 30-Apr-2007, 04-May-2007 +Rejection Notice +================ + +This PEP is rejected. There wasn't enough support in favor, the +feature to be removed isn't all that harmful, and there are some use +cases that would become harder. + + Abstract ======== Modified: peps/trunk/pep-3126.txt ============================================================================== --- peps/trunk/pep-3126.txt (original) +++ peps/trunk/pep-3126.txt Fri May 11 00:18:18 2007 @@ -4,13 +4,21 @@ Last-Modified: $Date$ Author: Jim J. Jewett , Raymond D. Hettinger -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 29-Apr-2007 Post-History: 29-Apr-2007, 30-Apr-2007, 07-May-2007 +Rejection Notice +================ + +This PEP is rejected. There wasn't enough support in favor, the +feature to be removed isn't all that harmful, and there are some use +cases that would become harder. + + Abstract ======== From python-checkins at python.org Fri May 11 00:33:44 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 00:33:44 +0200 (CEST) Subject: [Python-checkins] r55234 - peps/trunk/pep-0000.txt peps/trunk/pep-3120.txt peps/trunk/pep-3121.txt peps/trunk/pep-3123.txt Message-ID: <20070510223344.5F2A71E4004@bag.python.org> Author: guido.van.rossum Date: Fri May 11 00:33:40 2007 New Revision: 55234 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3120.txt peps/trunk/pep-3121.txt peps/trunk/pep-3123.txt Log: Accept PEPs 3120 (UTF-8 default source encoding), 3121 (extension initialization and finalization) and 3123 (PyObject_HEAD vs. stdC). Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 11 00:33:40 2007 @@ -81,6 +81,9 @@ SA 3112 Bytes literals in Python 3000 Orendorff SA 3113 Removal of Tuple Parameter Unpacking Cannon SA 3115 Metaclasses in Python 3000 Talin + SA 3120 Using UTF-8 as the default source encoding von L?wis + SA 3121 Extension Module Initialization & Finalization von L?wis + SA 3123 Making PyObject_HEAD conform to standard C von L?wis SA 3129 Class Decorators Winter Open PEPs (under consideration) @@ -116,9 +119,6 @@ S 3116 New I/O Stutzbach, Verdone, GvR S 3118 Revising the buffer protocol Oliphant, Banks S 3119 Introducing Abstract Base Classes GvR, Talin - S 3120 Using UTF-8 as the default source encoding von L?wis - S 3121 Extension Module Initialization & Finalization von L?wis - S 3123 Making PyObject_HEAD conform to standard C von L?wis S 3124 Overloading, Generic Functions, Interfaces Eby S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach @@ -489,10 +489,10 @@ SR 3117 Postfix Type Declarations Brandl S 3118 Revising the buffer protocol Oliphant, Banks S 3119 Introducing Abstract Base Classes GvR, Talin - S 3120 Using UTF-8 as the default source encoding von L?wis - S 3121 Extension Module Initialization & Finalization von L?wis + SA 3120 Using UTF-8 as the default source encoding von L?wis + SA 3121 Extension Module Initialization & Finalization von L?wis SR 3122 Delineation of the main module Cannon - S 3123 Making PyObject_HEAD conform to standard C von L?wis + SA 3123 Making PyObject_HEAD conform to standard C von L?wis S 3124 Overloading, Generic Functions, Interfaces Eby SR 3125 Remove Backslash Continuation Jewett SR 3126 Remove Implicit String Concatenation Jewett Modified: peps/trunk/pep-3120.txt ============================================================================== --- peps/trunk/pep-3120.txt (original) +++ peps/trunk/pep-3120.txt Fri May 11 00:33:40 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Martin v. L?wis -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 15-Apr-2007 Modified: peps/trunk/pep-3121.txt ============================================================================== --- peps/trunk/pep-3121.txt (original) +++ peps/trunk/pep-3121.txt Fri May 11 00:33:40 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Martin v. L?wis -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 27-Apr-2007 Modified: peps/trunk/pep-3123.txt ============================================================================== --- peps/trunk/pep-3123.txt (original) +++ peps/trunk/pep-3123.txt Fri May 11 00:33:40 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Martin v. L?wis -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 27-Apr-2007 From python-checkins at python.org Fri May 11 00:55:36 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 00:55:36 +0200 (CEST) Subject: [Python-checkins] r55235 - peps/trunk/pep2html.py Message-ID: <20070510225536.06C4B1E4003@bag.python.org> Author: guido.van.rossum Date: Fri May 11 00:55:31 2007 New Revision: 55235 Modified: peps/trunk/pep2html.py Log: Fix some bugs when dealing with non-existent or non-PEP files. Modified: peps/trunk/pep2html.py ============================================================================== --- peps/trunk/pep2html.py (original) +++ peps/trunk/pep2html.py Fri May 11 00:55:31 2007 @@ -340,7 +340,7 @@ if e.errno <> errno.ENOENT: raise print >> sys.stderr, 'Error: Skipping missing PEP file:', e.filename sys.stderr.flush() - return None, None + return None lines = infile.read().splitlines(1) # handles x-platform line endings infile.close() return lines @@ -355,6 +355,8 @@ def make_html(inpath, verbose=0): input_lines = get_input_lines(inpath) + if input_lines is None: + return None pep_type = get_pep_type(input_lines) if pep_type is None: print >> sys.stderr, 'Error: Input file %s is not a PEP.' % inpath @@ -507,8 +509,8 @@ newfile = make_html(file, verbose=verbose) if newfile: html.append(newfile) - if browse and not update: - browse_file(pep) + if browse and not update: + browse_file(pep) else: # do them all peptxt = [] From python-checkins at python.org Fri May 11 00:56:50 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 00:56:50 +0200 (CEST) Subject: [Python-checkins] r55236 - peps/trunk/pep-0000.txt peps/trunk/pep-3127.txt peps/trunk/pep-3130.txt Message-ID: <20070510225650.AEBC31E4003@bag.python.org> Author: guido.van.rossum Date: Fri May 11 00:56:48 2007 New Revision: 55236 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3127.txt peps/trunk/pep-3130.txt Log: Accept PEP 3127 (integer literal and support) and reject PEP 3130 (access to current module/class/function). Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 11 00:56:48 2007 @@ -84,6 +84,7 @@ SA 3120 Using UTF-8 as the default source encoding von L?wis SA 3121 Extension Module Initialization & Finalization von L?wis SA 3123 Making PyObject_HEAD conform to standard C von L?wis + SA 3127 Integer Literal Support and Syntax Maupin SA 3129 Class Decorators Winter Open PEPs (under consideration) @@ -120,9 +121,7 @@ S 3118 Revising the buffer protocol Oliphant, Banks S 3119 Introducing Abstract Base Classes GvR, Talin S 3124 Overloading, Generic Functions, Interfaces Eby - S 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach - S 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis S 3132 Extended Iterable Unpacking Brandl S 3141 A Type Hierarchy for Numbers Yasskin @@ -269,6 +268,7 @@ SR 3122 Delineation of the main module Cannon SR 3125 Remove Backslash Continuation Jewett SR 3126 Remove Implicit String Concatenation Jewett + SR 3130 Access to Current Module/Class/Function Jewett Numerical Index @@ -496,10 +496,10 @@ S 3124 Overloading, Generic Functions, Interfaces Eby SR 3125 Remove Backslash Continuation Jewett SR 3126 Remove Implicit String Concatenation Jewett - S 3127 Integer Literal Support and Syntax Maupin + SA 3127 Integer Literal Support and Syntax Maupin S 3128 BList: A Faster List-like Type Stutzbach SA 3129 Class Decorators Winter - S 3130 Access to Current Module/Class/Function Jewett + SR 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis S 3132 Extended Iterable Unpacking Brandl S 3141 A Type Hierarchy for Numbers Yasskin Modified: peps/trunk/pep-3127.txt ============================================================================== --- peps/trunk/pep-3127.txt (original) +++ peps/trunk/pep-3127.txt Fri May 11 00:56:48 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Patrick Maupin Discussions-To: Python-3000 at python.org -Status: Draft +Status: Accepted Type: Standards Track Python-Version: 3.0 Content-Type: text/x-rst Modified: peps/trunk/pep-3130.txt ============================================================================== --- peps/trunk/pep-3130.txt (original) +++ peps/trunk/pep-3130.txt Fri May 11 00:56:48 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Jim J. Jewett -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/plain Created: 22-Apr-2007 @@ -11,6 +11,14 @@ Post-History: 22-Apr-2007 +Rejection Notice + + This PEP is rejected. It is not clear how it should be + implemented or what the precise semantics should be in edge cases, + and there aren't enough important use cases given. response has + been lukewarm at best. + + Abstract It is common to need a reference to the current module, class, From python-checkins at python.org Fri May 11 01:41:54 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 01:41:54 +0200 (CEST) Subject: [Python-checkins] r55237 - peps/trunk/pep-0000.txt peps/trunk/pep-3128.txt Message-ID: <20070510234154.90BEB1E4003@bag.python.org> Author: guido.van.rossum Date: Fri May 11 01:41:53 2007 New Revision: 55237 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3128.txt Log: Reject PEP 3128 (BList). Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 11 01:41:53 2007 @@ -121,7 +121,6 @@ S 3118 Revising the buffer protocol Oliphant, Banks S 3119 Introducing Abstract Base Classes GvR, Talin S 3124 Overloading, Generic Functions, Interfaces Eby - S 3128 BList: A Faster List-like Type Stutzbach S 3131 Supporting Non-ASCII Identifiers von L?wis S 3132 Extended Iterable Unpacking Brandl S 3141 A Type Hierarchy for Numbers Yasskin @@ -268,6 +267,7 @@ SR 3122 Delineation of the main module Cannon SR 3125 Remove Backslash Continuation Jewett SR 3126 Remove Implicit String Concatenation Jewett + SR 3128 BList: A Faster List-like Type Stutzbach SR 3130 Access to Current Module/Class/Function Jewett @@ -497,7 +497,7 @@ SR 3125 Remove Backslash Continuation Jewett SR 3126 Remove Implicit String Concatenation Jewett SA 3127 Integer Literal Support and Syntax Maupin - S 3128 BList: A Faster List-like Type Stutzbach + SR 3128 BList: A Faster List-like Type Stutzbach SA 3129 Class Decorators Winter SR 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis Modified: peps/trunk/pep-3128.txt ============================================================================== --- peps/trunk/pep-3128.txt (original) +++ peps/trunk/pep-3128.txt Fri May 11 01:41:53 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Daniel Stutzbach Discussions-To: Python 3000 List -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 30-Apr-2007 @@ -12,6 +12,33 @@ Post-History: 30-Apr-2007 +Rejection Notice +================ + +Rejectd based on Raymond Hettinger's sage advice [4]_: + + After looking at the source, I think this has almost zero chance + for replacing list(). There is too much value in a simple C API, + low space overhead for small lists, good performance is common use + cases, and having performance that is easily understood. The + BList implementation lacks these virtues and trades-off a little + performance is common cases for much better performance in + uncommon cases. As a Py3.0 PEP, I think it can be rejected. + + Depending on its success as a third-party module, it still has a + chance for inclusion in the collections module. The essential + criteria for that is whether it is a superior choice for some + real-world use cases. I've scanned my own code and found no instances + where BList would have been preferable to a regular list. However, + that scan has a selection bias because it doesn't reflect what I would + have written had BList been available. So, after a few months, I + intend to poll comp.lang.python for BList success stories. If they + exist, then I have no problem with inclusion in the collections + module. After all, its learning curve is near zero -- the only cost + is the clutter factor stemming from indecision about the most + appropriate data structure for a given task. + + Abstract ======== @@ -339,6 +366,9 @@ .. [3] Discussion on python-3000 starting at post: http://mail.python.org/pipermail/python-3000/2007-April/006757.html +.. [4] Raymond Hettinger's feedback on python-3000: + http://mail.python.org/pipermail/python-3000/2007-May/007491.html + Copyright ========= From python-checkins at python.org Fri May 11 02:56:27 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 02:56:27 +0200 (CEST) Subject: [Python-checkins] r55239 - sandbox/trunk/abc/xyz.py Message-ID: <20070511005627.D8B7D1E4003@bag.python.org> Author: guido.van.rossum Date: Fri May 11 02:56:23 2007 New Revision: 55239 Added: sandbox/trunk/abc/xyz.py (contents, props changed) Log: Checkpoint. Added: sandbox/trunk/abc/xyz.py ============================================================================== --- (empty file) +++ sandbox/trunk/abc/xyz.py Fri May 11 02:56:23 2007 @@ -0,0 +1,138 @@ +#!/usr/bin/env python3.0 +"""Abstract Base Classes, reloaded.""" + + +import sys + + +def closure(function, roots): + """Compute the closure of a function over a set of roots.""" + more = roots + result = set() + while more: + result.update(more) + todo = set() + for x in more: + for y in function(x): + if y not in result: + todo.add(y) + more = todo + return result + + +def subclasses(classes): + """Compute the closure of the __subclasses__ method over classes.""" + return closure(lambda c: c.__subclasses__(), classes) + + +class ABCMeta(type): + + """Metaclass for defining Abstract Base Classes (ABCs). + + Use this metaclass to create an ABC. An ABC can be subclassed + directly, and then acts as a mix-in class. You can also register + unrelated concrete classes (even built-in classes) and unrelated + ABCs as 'virtual subclasses' -- these and their descendants will + be considered subclasses of the registering ABC by the built-in + issubclass() function, but the registering ABC won't show up in + their MRO (Method Resolution Order) nor will method + implementations defined by the registering ABC be callable (not + even via super()). + + """ + + # A global counter that is incremented each time a class is + # registered as a virtual subclass of anything. It forces the + # negative cache to be cleared before its next use. + __invalidation_counter = 0 + + def __new__(mcls, name, bases, namespace): + cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace) + cls.__abc_registry__ = set() + cls.__abc_cache__ = set() + cls.__abc_negative_cache__ = set() + cls.__abc_negative_cache_version__ = ABCMeta.__invalidation_counter + return cls + + def register(cls, subclass): + """Register a virtual subclass of an ABC.""" + cls.__abc_registry__.add(subclass) + ABCMeta.__invalidation_counter += 1 # Invalidate negative cache + + def _dump_registry(cls, file=None): + """Debug helper to print the ABC registry.""" + if file is None: + file = sys.stdout + print("Class: %s.%s" % (cls.__module__, cls.__name__), file=file) + print("Inv.counter: %s" % ABCMeta.__invalidation_counter, file=file) + for name in sorted(cls.__dict__.keys()): + if name.startswith("__abc_"): + value = getattr(cls, name) + print("%s: %r" % (name, value), file=file) + + def __instancecheck__(cls, instance): + """Override for isinstance(instance, cls).""" + return any(cls.__subclasscheck__(c) + for c in {instance.__class__, type(instance)}) + + def __subclasscheck__(cls, subclass): + """Override for issubclass(subclass, cls).""" + # XXX I KNOW THIS IS WRONG + # Check cache + if subclass in cls.__abc_cache__: + return True + # Check negative cache; may have to invalidate + if cls.__abc_negative_cache_version__ < ABCMeta.__invalidation_counter: + # Invalidate the negative cache + cls.__abc_negative_cache_version__ = ABCMeta.__invalidation_counter + cls.__abc_negative_cache__ = set() + elif subclass in cls.__abc_negative_cache__: + return False + # Check for direct subclass + mro = subclass.mro() + if cls in mro: + cls.__abc_cache__.add(subclass) + return True + # Check registry + for base in mro: + if base in cls.__abc_registry__: + cls.__abc_cache__.add(subclass) + cls.__abc_cache__.add(base) + return True + # XXX Should really check all the registered classes too... + cls.__abc_negative_cache__.add(subclass) + return False + + +class Sequence(metaclass=ABCMeta): + """A sequence without any behavior implementation.""" + +Sequence.register(tuple) +Sequence.register(str) +Sequence.register(unicode) + +class Mapping(metaclass=ABCMeta): + """A mapping without any behavior implementation.""" + +Mapping.register(dict) + +class Set(metaclass=ABCMeta): + """A set without any behavior implementation.""" + +Set.register(set) +Set.register(frozenset) + +class MutableSequence(Sequence): + """A mutable sequence.""" + +MutableSequence.register(list) +MutableSequence.register(bytes) + +Sequence.register(MutableSequence) + +SAMPLES = [0, b"", "", u"", [], (), {}, set()] +for abc in Sequence, Mapping, Set, MutableSequence: + print("%s: %s" % (abc.__name__, + ", ".join([repr(sample) + for sample in SAMPLES + if isinstance(sample, abc)]))) From python-checkins at python.org Fri May 11 06:14:49 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 06:14:49 +0200 (CEST) Subject: [Python-checkins] r55240 - sandbox/trunk/abc/xyz.py Message-ID: <20070511041449.C89131E4003@bag.python.org> Author: guido.van.rossum Date: Fri May 11 06:14:44 2007 New Revision: 55240 Modified: sandbox/trunk/abc/xyz.py Log: Abstract Base Classes, reloaded. Modified: sandbox/trunk/abc/xyz.py ============================================================================== --- sandbox/trunk/abc/xyz.py (original) +++ sandbox/trunk/abc/xyz.py Fri May 11 06:14:44 2007 @@ -1,28 +1,9 @@ #!/usr/bin/env python3.0 """Abstract Base Classes, reloaded.""" - import sys - -def closure(function, roots): - """Compute the closure of a function over a set of roots.""" - more = roots - result = set() - while more: - result.update(more) - todo = set() - for x in more: - for y in function(x): - if y not in result: - todo.add(y) - more = todo - return result - - -def subclasses(classes): - """Compute the closure of the __subclasses__ method over classes.""" - return closure(lambda c: c.__subclasses__(), classes) +__all__ = ["ABCMeta"] class ABCMeta(type): @@ -56,6 +37,8 @@ def register(cls, subclass): """Register a virtual subclass of an ABC.""" + if issubclass(subclass, cls): + return # Already a subclass cls.__abc_registry__.add(subclass) ABCMeta.__invalidation_counter += 1 # Invalidate negative cache @@ -77,7 +60,6 @@ def __subclasscheck__(cls, subclass): """Override for issubclass(subclass, cls).""" - # XXX I KNOW THIS IS WRONG # Check cache if subclass in cls.__abc_cache__: return True @@ -88,51 +70,95 @@ cls.__abc_negative_cache__ = set() elif subclass in cls.__abc_negative_cache__: return False - # Check for direct subclass - mro = subclass.mro() - if cls in mro: + # Check if it's a direct subclass + if cls in subclass.mro(): cls.__abc_cache__.add(subclass) return True - # Check registry - for base in mro: - if base in cls.__abc_registry__: - cls.__abc_cache__.add(subclass) - cls.__abc_cache__.add(base) - return True - # XXX Should really check all the registered classes too... + # Check if it's a subclass of a registered class (recursive) + for rcls in cls.__abc_registry__: + if issubclass(subclass, rcls): + cls.__abc_registry__.add(subclass) + return True + # Check if it's a subclass of a subclass (recursive) + for scls in cls.__subclasses__(): + if issubclass(subclass, scls): + cls.__abc_registry__.add(subclass) + return True + # No dice; update negative cache cls.__abc_negative_cache__.add(subclass) return False -class Sequence(metaclass=ABCMeta): - """A sequence without any behavior implementation.""" +def _demo(): + + class Sequence(metaclass=ABCMeta): + """A sequence without any behavior implementation.""" + + class Mapping(metaclass=ABCMeta): + """A mapping.""" + + class MutableMapping(Mapping): + """A mutable mapping.""" + + MutableMapping.register(dict) + + class Set(metaclass=ABCMeta): + """A set.""" + + class ImmutableSet(metaclass=ABCMeta): + """An immutable set.""" + + ImmutableSet.register(frozenset) + + class MutableSet(metaclass=ABCMeta): + """A mutable set.""" + + Set.register(ImmutableSet) + Set.register(MutableSet) + + MutableSet.register(set) + + class ImmutableSequence(Sequence): + """An immutable sequence.""" + + ImmutableSequence.register(tuple) + ImmutableSequence.register(basestring) + + class MutableSequence(Sequence): + """A mutable sequence.""" + + MutableSequence.register(list) + MutableSequence.register(bytes) -Sequence.register(tuple) -Sequence.register(str) -Sequence.register(unicode) + Sequence.register(MutableSequence) -class Mapping(metaclass=ABCMeta): - """A mapping without any behavior implementation.""" + SAMPLES = [0, b"", "", u"", [], (), {}, set(), frozenset()] -Mapping.register(dict) + def show(abc): + print("%s: %s" % (abc.__name__, + ", ".join([repr(sample) + for sample in SAMPLES + if isinstance(sample, abc)]))) + ##abc._dump_registry() + ##print() -class Set(metaclass=ABCMeta): - """A set without any behavior implementation.""" + for abc in [Sequence, MutableSequence, ImmutableSequence, + Mapping, MutableMapping, + Set, ImmutableSet, MutableSet]: + show(abc) -Set.register(set) -Set.register(frozenset) + class Collection(metaclass=ABCMeta): + """A collection.""" -class MutableSequence(Sequence): - """A mutable sequence.""" + Collection.register(Set) + Collection.register(Sequence) + Collection.register(Mapping) + Collection.register(Collection) -MutableSequence.register(list) -MutableSequence.register(bytes) + for abc in [Collection]: + show(abc) + abc._dump_registry() -Sequence.register(MutableSequence) -SAMPLES = [0, b"", "", u"", [], (), {}, set()] -for abc in Sequence, Mapping, Set, MutableSequence: - print("%s: %s" % (abc.__name__, - ", ".join([repr(sample) - for sample in SAMPLES - if isinstance(sample, abc)]))) +if __name__ == "__main__": + _demo() From python-checkins at python.org Fri May 11 07:55:16 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 11 May 2007 07:55:16 +0200 (CEST) Subject: [Python-checkins] r55241 - in python/trunk: Lib/test/regrtest.py Misc/build.sh Message-ID: <20070511055516.E9AA81E4007@bag.python.org> Author: neal.norwitz Date: Fri May 11 07:55:15 2007 New Revision: 55241 Modified: python/trunk/Lib/test/regrtest.py python/trunk/Misc/build.sh Log: Don't ever report a failure when the sum of the reference count differences are zero. This should help reduce the false positives. The message about references leaking is maintained to provide as much info as possible rather than simply suppressing the message at the source. Modified: python/trunk/Lib/test/regrtest.py ============================================================================== --- python/trunk/Lib/test/regrtest.py (original) +++ python/trunk/Lib/test/regrtest.py Fri May 11 07:55:15 2007 @@ -682,9 +682,10 @@ deltas.append(sys.gettotalrefcount() - rc - 2) print >> sys.stderr if any(deltas): - print >> sys.stderr, test, 'leaked', deltas, 'references' + msg = '%s leaked %s references, sum=%s' % (test, deltas, sum(deltas)) + print >> sys.stderr, msg refrep = open(fname, "a") - print >> refrep, test, 'leaked', deltas, 'references' + print >> refrep, msg refrep.close() def dash_R_cleanup(fs, ps, pic): Modified: python/trunk/Misc/build.sh ============================================================================== --- python/trunk/Misc/build.sh (original) +++ python/trunk/Misc/build.sh Fri May 11 07:55:15 2007 @@ -192,7 +192,7 @@ ## ensure that the reflog exists so the grep doesn't fail touch $REFLOG $PYTHON $REGRTEST_ARGS -R 4:3:$REFLOG -u network $LEAKY_SKIPS >& build/$F - NUM_FAILURES=`egrep -vc "$LEAKY_TESTS" $REFLOG` + NUM_FAILURES=`egrep -vc "($LEAKY_TESTS|sum=0)" $REFLOG` update_status "Testing refleaks ($NUM_FAILURES failures)" "$F" $start mail_on_failure "refleak" $REFLOG From python-checkins at python.org Fri May 11 08:23:03 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 11 May 2007 08:23:03 +0200 (CEST) Subject: [Python-checkins] r55242 - python/trunk/Lib/subprocess.py Message-ID: <20070511062303.E61DC1E4003@bag.python.org> Author: neal.norwitz Date: Fri May 11 08:23:01 2007 New Revision: 55242 Modified: python/trunk/Lib/subprocess.py Log: Fix typo in docstring (the module is popen2, not 3). Modified: python/trunk/Lib/subprocess.py ============================================================================== --- python/trunk/Lib/subprocess.py (original) +++ python/trunk/Lib/subprocess.py Fri May 11 08:23:01 2007 @@ -340,7 +340,7 @@ stdin=PIPE, stdout=PIPE, close_fds=True) (child_stdout, child_stdin) = (p.stdout, p.stdin) -The popen2.Popen3 and popen3.Popen4 basically works as subprocess.Popen, +The popen2.Popen3 and popen2.Popen4 basically works as subprocess.Popen, except that: * subprocess.Popen raises an exception if the execution fails From python-checkins at python.org Fri May 11 08:23:45 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 11 May 2007 08:23:45 +0200 (CEST) Subject: [Python-checkins] r55243 - python/branches/release25-maint/Lib/subprocess.py Message-ID: <20070511062345.B1E2A1E4003@bag.python.org> Author: neal.norwitz Date: Fri May 11 08:23:43 2007 New Revision: 55243 Modified: python/branches/release25-maint/Lib/subprocess.py Log: Fix typo in docstring (the module is popen2, not 3). Modified: python/branches/release25-maint/Lib/subprocess.py ============================================================================== --- python/branches/release25-maint/Lib/subprocess.py (original) +++ python/branches/release25-maint/Lib/subprocess.py Fri May 11 08:23:43 2007 @@ -340,7 +340,7 @@ stdin=PIPE, stdout=PIPE, close_fds=True) (child_stdout, child_stdin) = (p.stdout, p.stdin) -The popen2.Popen3 and popen3.Popen4 basically works as subprocess.Popen, +The popen2.Popen3 and popen2.Popen4 basically works as subprocess.Popen, except that: * subprocess.Popen raises an exception if the execution fails From python-checkins at python.org Fri May 11 08:56:57 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 11 May 2007 08:56:57 +0200 (CEST) Subject: [Python-checkins] r55244 - python/trunk/Lib/subprocess.py Message-ID: <20070511065657.B897B1E4003@bag.python.org> Author: neal.norwitz Date: Fri May 11 08:56:52 2007 New Revision: 55244 Modified: python/trunk/Lib/subprocess.py Log: Remove trailing whitespace in docstring Modified: python/trunk/Lib/subprocess.py ============================================================================== --- python/trunk/Lib/subprocess.py (original) +++ python/trunk/Lib/subprocess.py Fri May 11 08:56:52 2007 @@ -348,8 +348,6 @@ * stdin=PIPE and stdout=PIPE must be specified. * popen2 closes all filedescriptors by default, but you have to specify close_fds=True with subprocess.Popen. - - """ import sys From python-checkins at python.org Fri May 11 08:57:37 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 11 May 2007 08:57:37 +0200 (CEST) Subject: [Python-checkins] r55245 - in python/trunk: Lib/os.py Lib/plat-mac/pimp.py Lib/popen2.py Lib/test/test___all__.py Lib/test/test_bz2.py Lib/test/test_cmd_line.py Lib/test/test_popen2.py Misc/NEWS Tools/msi/msilib.py Message-ID: <20070511065737.BBC871E4003@bag.python.org> Author: neal.norwitz Date: Fri May 11 08:57:33 2007 New Revision: 55245 Modified: python/trunk/Lib/os.py python/trunk/Lib/plat-mac/pimp.py python/trunk/Lib/popen2.py python/trunk/Lib/test/test___all__.py python/trunk/Lib/test/test_bz2.py python/trunk/Lib/test/test_cmd_line.py python/trunk/Lib/test/test_popen2.py python/trunk/Misc/NEWS python/trunk/Tools/msi/msilib.py Log: Deprecate os.popen* and popen2 module in favor of the subprocess module. Modified: python/trunk/Lib/os.py ============================================================================== --- python/trunk/Lib/os.py (original) +++ python/trunk/Lib/os.py Fri May 11 08:57:33 2007 @@ -666,9 +666,15 @@ is a string it will be passed to the shell (as with os.system()). If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects (child_stdin, child_stdout) are returned.""" - import popen2 - stdout, stdin = popen2.popen2(cmd, bufsize) - return stdin, stdout + import warnings + msg = "os.popen2 is deprecated. Use the subprocess module." + warnings.warn(msg, DeprecationWarning, stacklevel=2) + + import subprocess + PIPE = subprocess.PIPE + p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, close_fds=True) + return p.stdin, p.stdout __all__.append("popen2") if not _exists("popen3"): @@ -679,9 +685,16 @@ is a string it will be passed to the shell (as with os.system()). If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects (child_stdin, child_stdout, child_stderr) are returned.""" - import popen2 - stdout, stdin, stderr = popen2.popen3(cmd, bufsize) - return stdin, stdout, stderr + import warnings + msg = "os.popen3 is deprecated. Use the subprocess module." + warnings.warn(msg, DeprecationWarning, stacklevel=2) + + import subprocess + PIPE = subprocess.PIPE + p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, stderr=PIPE, + close_fds=True) + return p.stdin, p.stdout, p.stderr __all__.append("popen3") if not _exists("popen4"): @@ -692,9 +705,16 @@ is a string it will be passed to the shell (as with os.system()). If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects (child_stdin, child_stdout_stderr) are returned.""" - import popen2 - stdout, stdin = popen2.popen4(cmd, bufsize) - return stdin, stdout + import warnings + msg = "os.popen4 is deprecated. Use the subprocess module." + warnings.warn(msg, DeprecationWarning, stacklevel=2) + + import subprocess + PIPE = subprocess.PIPE + p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, + stderr=subprocess.STDOUT, close_fds=True) + return p.stdin, p.stdout __all__.append("popen4") import copy_reg as _copy_reg Modified: python/trunk/Lib/plat-mac/pimp.py ============================================================================== --- python/trunk/Lib/plat-mac/pimp.py (original) +++ python/trunk/Lib/plat-mac/pimp.py Fri May 11 08:57:33 2007 @@ -14,7 +14,7 @@ """ import sys import os -import popen2 +import subprocess import urllib import urllib2 import urlparse @@ -101,10 +101,11 @@ output.write("+ %s\n" % cmd) if NO_EXECUTE: return 0 - child = popen2.Popen4(cmd) - child.tochild.close() + child = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + child.stdin.close() while 1: - line = child.fromchild.readline() + line = child.stdout.readline() if not line: break if output: Modified: python/trunk/Lib/popen2.py ============================================================================== --- python/trunk/Lib/popen2.py (original) +++ python/trunk/Lib/popen2.py Fri May 11 08:57:33 2007 @@ -8,6 +8,9 @@ import os import sys +import warnings +warnings.warn("The popen2 module is deprecated. Use the subprocess module.", + DeprecationWarning, stacklevel=2) __all__ = ["popen2", "popen3", "popen4"] Modified: python/trunk/Lib/test/test___all__.py ============================================================================== --- python/trunk/Lib/test/test___all__.py (original) +++ python/trunk/Lib/test/test___all__.py Fri May 11 08:57:33 2007 @@ -9,6 +9,8 @@ "") warnings.filterwarnings("ignore", "the sets module is deprecated", DeprecationWarning, "") +warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*", + DeprecationWarning) class AllTest(unittest.TestCase): Modified: python/trunk/Lib/test/test_bz2.py ============================================================================== --- python/trunk/Lib/test/test_bz2.py (original) +++ python/trunk/Lib/test/test_bz2.py Fri May 11 08:57:33 2007 @@ -5,7 +5,7 @@ import unittest from cStringIO import StringIO import os -import popen2 +import subprocess import sys import bz2 @@ -21,18 +21,20 @@ if has_cmdline_bunzip2: def decompress(self, data): - pop = popen2.Popen3("bunzip2", capturestderr=1) - pop.tochild.write(data) - pop.tochild.close() - ret = pop.fromchild.read() - pop.fromchild.close() + pop = subprocess.Popen("bunzip2", shell=True, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + pop.stdin.write(data) + pop.stdin.close() + ret = pop.stdout.read() + pop.stdout.close() if pop.wait() != 0: ret = bz2.decompress(data) return ret else: - # popen2.Popen3 doesn't exist on Windows, and even if it did, bunzip2 - # isn't available to run. + # bunzip2 isn't available to run on Windows. def decompress(self, data): return bz2.decompress(data) Modified: python/trunk/Lib/test/test_cmd_line.py ============================================================================== --- python/trunk/Lib/test/test_cmd_line.py (original) +++ python/trunk/Lib/test/test_cmd_line.py Fri May 11 08:57:33 2007 @@ -1,18 +1,19 @@ import test.test_support, unittest import sys -import popen2 import subprocess class CmdLineTest(unittest.TestCase): def start_python(self, cmd_line): - outfp, infp = popen2.popen4('"%s" %s' % (sys.executable, cmd_line)) - infp.close() - data = outfp.read() - outfp.close() + cmd = '"%s" %s' % (sys.executable, cmd_line) + p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + p.stdin.close() + data = p.stdout.read() + p.stdout.close() # try to cleanup the child so we don't appear to leak when running # with regrtest -R. This should be a no-op on Windows. - popen2._cleanup() + subprocess._cleanup() return data def exit_code(self, *args): Modified: python/trunk/Lib/test/test_popen2.py ============================================================================== --- python/trunk/Lib/test/test_popen2.py (original) +++ python/trunk/Lib/test/test_popen2.py Fri May 11 08:57:33 2007 @@ -1,6 +1,12 @@ #! /usr/bin/env python """Test script for popen2.py""" +import warnings +warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*", + DeprecationWarning) +warnings.filterwarnings("ignore", "os\.popen. is deprecated.*", + DeprecationWarning) + import os import sys import unittest Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri May 11 08:57:33 2007 @@ -207,6 +207,8 @@ Library ------- +- The popen2 module and os.popen* are deprecated. Use the subprocess module. + - Added an optional credentials argument to SMTPHandler, for use with SMTP servers which require authentication. Modified: python/trunk/Tools/msi/msilib.py ============================================================================== --- python/trunk/Tools/msi/msilib.py (original) +++ python/trunk/Tools/msi/msilib.py Fri May 11 08:57:33 2007 @@ -5,7 +5,7 @@ import win32com.client import pythoncom, pywintypes from win32com.client import constants -import re, string, os, sets, glob, popen2, sys, _winreg, struct +import re, string, os, sets, glob, subprocess, sys, _winreg, struct try: basestring @@ -388,8 +388,10 @@ else: print "WARNING: cabarc.exe not found in registry" cabarc = "cabarc.exe" - f = popen2.popen4(r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name))[0] - for line in f: + cmd = r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name) + p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT)[0] + for line in (p.stdout, p.stdin): if line.startswith(" -- adding "): sys.stdout.write(".") else: From python-checkins at python.org Fri May 11 09:13:35 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 11 May 2007 09:13:35 +0200 (CEST) Subject: [Python-checkins] r55247 - python/trunk/Doc/lib/libos.tex python/trunk/Doc/lib/libpopen2.tex Message-ID: <20070511071335.3491F1E4003@bag.python.org> Author: neal.norwitz Date: Fri May 11 09:13:30 2007 New Revision: 55247 Modified: python/trunk/Doc/lib/libos.tex python/trunk/Doc/lib/libpopen2.tex Log: Deprecate os.popen* and popen2 module in favor of the subprocess module. (forgot the doc) Modified: python/trunk/Doc/lib/libos.tex ============================================================================== --- python/trunk/Doc/lib/libos.tex (original) +++ python/trunk/Doc/lib/libos.tex Fri May 11 09:13:30 2007 @@ -361,9 +361,8 @@ errors), \code{None} is returned. Availability: Macintosh, \UNIX, Windows. -The \module{subprocess} module provides more powerful facilities for -spawning new processes and retrieving their results; using that module -is preferable to using this function. +\deprecated{2.6}{This function is obsolete. Use the + \module{subprocess} module.} \versionchanged[This function worked unreliably under Windows in earlier versions of Python. This was due to the use of the @@ -380,10 +379,9 @@ \end{funcdesc} There are a number of different \function{popen*()} functions that -provide slightly different ways to create subprocesses. Note that the -\module{subprocess} module is easier to use and more powerful; -consider using that module before writing code using the -lower-level \function{popen*()} functions. +provide slightly different ways to create subprocesses. +\deprecated{2.6}{All of the \function{popen*()} functions are obsolete. + Use the \module{subprocess} module.} For each of the \function{popen*()} variants, if \var{bufsize} is specified, it specifies the buffer size for the I/O pipes. @@ -400,8 +398,7 @@ These methods do not make it possible to retrieve the exit status from the child processes. The only way to control the input and output streams and also retrieve the return codes is to use the -\class{Popen3} and \class{Popen4} classes from the \refmodule{popen2} -module; these are only available on \UNIX. +\refmodule{subprocess} module; these are only available on \UNIX. For a discussion of possible deadlock conditions related to the use of these functions, see ``\ulink{Flow Control @@ -411,6 +408,8 @@ \begin{funcdesc}{popen2}{cmd\optional{, mode\optional{, bufsize}}} Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout})}. +\deprecated{2.6}{All of the \function{popen*()} functions are obsolete. + Use the \module{subprocess} module.} Availability: Macintosh, \UNIX, Windows. \versionadded{2.0} \end{funcdesc} @@ -418,6 +417,8 @@ \begin{funcdesc}{popen3}{cmd\optional{, mode\optional{, bufsize}}} Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout}, \var{child_stderr})}. +\deprecated{2.6}{All of the \function{popen*()} functions are obsolete. + Use the \module{subprocess} module.} Availability: Macintosh, \UNIX, Windows. \versionadded{2.0} \end{funcdesc} @@ -425,6 +426,8 @@ \begin{funcdesc}{popen4}{cmd\optional{, mode\optional{, bufsize}}} Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout_and_stderr})}. +\deprecated{2.6}{All of the \function{popen*()} functions are obsolete. + Use the \module{subprocess} module.} Availability: Macintosh, \UNIX, Windows. \versionadded{2.0} \end{funcdesc} Modified: python/trunk/Doc/lib/libpopen2.tex ============================================================================== --- python/trunk/Doc/lib/libpopen2.tex (original) +++ python/trunk/Doc/lib/libpopen2.tex Fri May 11 09:13:30 2007 @@ -5,6 +5,7 @@ \modulesynopsis{Subprocesses with accessible standard I/O streams.} \sectionauthor{Drew Csillag}{drew_csillag at geocities.com} +\deprecated{2.6}{This module is obsolete. Use the \module{subprocess} module.} This module allows you to spawn processes and connect to their input/output/error pipes and obtain their return codes under From python-checkins at python.org Fri May 11 11:41:38 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 11 May 2007 11:41:38 +0200 (CEST) Subject: [Python-checkins] r55253 - python/trunk/Python/ceval.c Message-ID: <20070511094138.5DCA71E4004@bag.python.org> Author: georg.brandl Date: Fri May 11 11:41:37 2007 New Revision: 55253 Modified: python/trunk/Python/ceval.c Log: Remove an XXX that is unnecessary. Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Fri May 11 11:41:37 2007 @@ -490,7 +490,6 @@ PyObject * PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals) { - /* XXX raise SystemError if globals is NULL */ return PyEval_EvalCodeEx(co, globals, locals, (PyObject **)NULL, 0, From python-checkins at python.org Fri May 11 13:03:47 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 11 May 2007 13:03:47 +0200 (CEST) Subject: [Python-checkins] r55257 - python/branches/release25-maint/Doc/lib/libos.tex Message-ID: <20070511110347.5DF881E4004@bag.python.org> Author: georg.brandl Date: Fri May 11 13:03:46 2007 New Revision: 55257 Modified: python/branches/release25-maint/Doc/lib/libos.tex Log: Patch #1714700: clarify os.linesep vs. tfiles opened in text mode. (backport) Modified: python/branches/release25-maint/Doc/lib/libos.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libos.tex (original) +++ python/branches/release25-maint/Doc/lib/libos.tex Fri May 11 13:03:46 2007 @@ -1973,9 +1973,12 @@ \begin{datadesc}{linesep} The string used to separate (or, rather, terminate) lines on the -current platform. This may be a single character, such as \code{'\e -n'} for \POSIX{} or \code{'\e r'} for Mac OS, or multiple characters, -for example, \code{'\e r\e n'} for Windows. +current platform. This may be a single character, such as +\code{'\e n'} for \POSIX{} or \code{'\e r'} for Mac OS, or multiple +characters, for example, \code{'\e r\e n'} for Windows. +Do not use \var{os.linesep} as a line terminator when writing files +opened in text mode (the default); use a single \code{'\e n'} instead, +on all platforms. \end{datadesc} \begin{datadesc}{devnull} From python-checkins at python.org Fri May 11 13:04:27 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 11 May 2007 13:04:27 +0200 (CEST) Subject: [Python-checkins] r55258 - python/trunk/Doc/lib/libos.tex Message-ID: <20070511110427.E5ADF1E4004@bag.python.org> Author: georg.brandl Date: Fri May 11 13:04:26 2007 New Revision: 55258 Modified: python/trunk/Doc/lib/libos.tex Log: Patch #1714700: clarify os.linesep vs. tfiles opened in text mode. (backport) Modified: python/trunk/Doc/lib/libos.tex ============================================================================== --- python/trunk/Doc/lib/libos.tex (original) +++ python/trunk/Doc/lib/libos.tex Fri May 11 13:04:26 2007 @@ -2009,9 +2009,12 @@ \begin{datadesc}{linesep} The string used to separate (or, rather, terminate) lines on the -current platform. This may be a single character, such as \code{'\e -n'} for \POSIX{} or \code{'\e r'} for Mac OS, or multiple characters, -for example, \code{'\e r\e n'} for Windows. +current platform. This may be a single character, such as +\code{'\e n'} for \POSIX{} or \code{'\e r'} for Mac OS, or multiple +characters, for example, \code{'\e r\e n'} for Windows. +Do not use \var{os.linesep} as a line terminator when writing files +opened in text mode (the default); use a single \code{'\e n'} instead, +on all platforms. \end{datadesc} \begin{datadesc}{devnull} From python-checkins at python.org Fri May 11 13:43:57 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 11 May 2007 13:43:57 +0200 (CEST) Subject: [Python-checkins] r55259 - python/trunk/Doc/lib/libdifflib.tex Message-ID: <20070511114357.B58E11E4004@bag.python.org> Author: georg.brandl Date: Fri May 11 13:43:56 2007 New Revision: 55259 Modified: python/trunk/Doc/lib/libdifflib.tex Log: Update DDJ link. Modified: python/trunk/Doc/lib/libdifflib.tex ============================================================================== --- python/trunk/Doc/lib/libdifflib.tex (original) +++ python/trunk/Doc/lib/libdifflib.tex Fri May 11 13:43:56 2007 @@ -302,7 +302,7 @@ \begin{seealso} - \seetitle[http://www.ddj.com/documents/s=1103/ddj8807c/] + \seetitle[http://www.ddj.com/184407970?pgno=5] {Pattern Matching: The Gestalt Approach}{Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. This was published in From python-checkins at python.org Fri May 11 13:44:01 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 11 May 2007 13:44:01 +0200 (CEST) Subject: [Python-checkins] r55260 - python/branches/release25-maint/Doc/lib/libdifflib.tex Message-ID: <20070511114401.B60E31E4004@bag.python.org> Author: georg.brandl Date: Fri May 11 13:44:00 2007 New Revision: 55260 Modified: python/branches/release25-maint/Doc/lib/libdifflib.tex Log: Update DDJ link. (backport from rev. 55259) Modified: python/branches/release25-maint/Doc/lib/libdifflib.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libdifflib.tex (original) +++ python/branches/release25-maint/Doc/lib/libdifflib.tex Fri May 11 13:44:00 2007 @@ -302,7 +302,7 @@ \begin{seealso} - \seetitle[http://www.ddj.com/documents/s=1103/ddj8807c/] + \seetitle[http://www.ddj.com/184407970?pgno=5] {Pattern Matching: The Gestalt Approach}{Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. This was published in From python-checkins at python.org Fri May 11 17:36:11 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 11 May 2007 17:36:11 +0200 (CEST) Subject: [Python-checkins] r55263 - peps/trunk/pep-0000.txt peps/trunk/pep-3132.txt Message-ID: <20070511153611.9E6421E4004@bag.python.org> Author: georg.brandl Date: Fri May 11 17:36:08 2007 New Revision: 55263 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3132.txt Log: Mark PEP 3132 as final. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 11 17:36:08 2007 @@ -122,7 +122,6 @@ S 3119 Introducing Abstract Base Classes GvR, Talin S 3124 Overloading, Generic Functions, Interfaces Eby S 3131 Supporting Non-ASCII Identifiers von L?wis - S 3132 Extended Iterable Unpacking Brandl S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -189,6 +188,7 @@ SF 3105 Make print a function Brandl SF 3107 Function Annotations Winter, Lownds SF 3114 Renaming iterator.next() to .__next__() Yee + SF 3132 Extended Iterable Unpacking Brandl Empty PEPs (or containing only an abstract) @@ -501,7 +501,7 @@ SA 3129 Class Decorators Winter SR 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis - S 3132 Extended Iterable Unpacking Brandl + SF 3132 Extended Iterable Unpacking Brandl S 3141 A Type Hierarchy for Numbers Yasskin Modified: peps/trunk/pep-3132.txt ============================================================================== --- peps/trunk/pep-3132.txt (original) +++ peps/trunk/pep-3132.txt Fri May 11 17:36:08 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Georg Brandl -Status: Draft +Status: Final Type: Standards Track Content-Type: text/x-rst Created: 30-Apr-2007 @@ -153,16 +153,33 @@ tracker [SFPATCH]_. It now includes a minimal test case. -Open Issues -=========== +Acceptance +========== -- Should the catch-all expression be assigned a list or a tuple of items? +After a short discussion on the python-3000 list [1]_, the PEP was +accepted by Guido in its current form. Possible changes discussed +were: + +* Only allow a starred expression as the last item in the exprlist. + This would simplify the unpacking code a bit and allow for the + starred expression to be assigned an iterator. This behavior was + rejected because it would be too surprising. + +* Try to give the starred target the same type as the source + iterable, for example, ``b`` in ``a, *b = 'hello'`` would be + assigned the string ``'ello'``. This may seem nice, but is + impossible to get right consistently with all iterables. + +* Make the starred target a tuple instead of a list. This would be + consistent with a function's ``*args``, but make further processing + of the result harder. References ========== .. [SFPATCH] http://python.org/sf/1711529 +.. [1] http://mail.python.org/pipermail/python-3000/2007-May/007198.html Copyright From python-checkins at python.org Fri May 11 20:00:05 2007 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 11 May 2007 20:00:05 +0200 (CEST) Subject: [Python-checkins] r55273 - python/trunk/Lib/test/test_posixpath.py Message-ID: <20070511180005.86F5B1E4005@bag.python.org> Author: raymond.hettinger Date: Fri May 11 19:59:59 2007 New Revision: 55273 Modified: python/trunk/Lib/test/test_posixpath.py Log: Better tests for posixpath.commonprefix Modified: python/trunk/Lib/test/test_posixpath.py ============================================================================== --- python/trunk/Lib/test/test_posixpath.py (original) +++ python/trunk/Lib/test/test_posixpath.py Fri May 11 19:59:59 2007 @@ -130,6 +130,16 @@ "/home/swen/spam" ) + testlist = ['', 'abc', 'Xbcd', 'Xb', 'XY', 'abcd', 'aXc', 'abd', 'ab', 'aX', 'abcX'] + for s1 in testlist: + for s2 in testlist: + p = posixpath.commonprefix([s1, s2]) + self.assert_(s1.startswith(p)) + self.assert_(s2.startswith(p)) + if s1 != s2: + n = len(p) + self.assertNotEqual(s1[n:n+1], s2[n:n+1]) + def test_getsize(self): f = open(test_support.TESTFN, "wb") try: From python-checkins at python.org Fri May 11 20:16:09 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 20:16:09 +0200 (CEST) Subject: [Python-checkins] r55274 - sandbox/trunk/abc/def.py Message-ID: <20070511181609.308B41E4005@bag.python.org> Author: guido.van.rossum Date: Fri May 11 20:16:01 2007 New Revision: 55274 Added: sandbox/trunk/abc/def.py (contents, props changed) Log: Example from revised PEP 3119 (not yet submitted). Added: sandbox/trunk/abc/def.py ============================================================================== --- (empty file) +++ sandbox/trunk/abc/def.py Fri May 11 20:16:01 2007 @@ -0,0 +1,26 @@ +class ABC(type): + + def __instancecheck__(cls, inst): + """Implement isinstance(inst, cls).""" + return any(cls.__subclasscheck__(c) + for c in {type(inst), inst.__class__}) + + def __subclasscheck__(cls, sub): + """Implement issubclass(sub, cls).""" + candidates = cls.__dict__.get("__subclass__", set()) | {cls} + return any(c in candidates for c in sub.mro()) + +class Sequence(metaclass=ABC): + __subclass__ = {list, tuple} + +assert issubclass(list, Sequence) +assert issubclass(tuple, Sequence) + +class AppendableSequence(Sequence, metaclass=ABC): + __subclass__ = {list} + +assert issubclass(list, AppendableSequence) +assert isinstance([], AppendableSequence) + +assert not issubclass(tuple, AppendableSequence) +assert not isinstance((), AppendableSequence) From python-checkins at python.org Fri May 11 22:49:16 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 22:49:16 +0200 (CEST) Subject: [Python-checkins] r55276 - peps/trunk/pep-3119.txt Message-ID: <20070511204916.5FF991E4006@bag.python.org> Author: guido.van.rossum Date: Fri May 11 22:49:12 2007 New Revision: 55276 Modified: peps/trunk/pep-3119.txt Log: Checkpoint. Rewrote (and swapped) the sections on isinstance/issubclass overriding and the support framework. Next up: redesign the collection ABCs. Modified: peps/trunk/pep-3119.txt ============================================================================== --- peps/trunk/pep-3119.txt (original) +++ peps/trunk/pep-3119.txt Fri May 11 22:49:12 2007 @@ -16,12 +16,12 @@ This is a proposal to add Abstract Base Class (ABC) support to Python 3000. It proposes: -* An "ABC support framework" which defines a built-in decorator that - can be used to define abstract methods. A class containing an - abstract method that isn't overridden cannot be instantiated. - * A way to overload ``isinstance()`` and ``issubclass()``. +* A new module ``abc`` which serves as an "ABC support framework". It + defines a metaclass for use with ABCs and a decorator that can be + used to define abstract methods. + * Specific ABCs for containers and iterators, to be added to the collections module. @@ -100,8 +100,8 @@ known as Abstract Base Classes, or ABC. ABCs are simply Python classes that are added into an object's inheritance tree to signal certain features of that object to an external inspector. Tests are -done using isinstance(), and the presence of a particular ABC means -that the test has passed. +done using ``isinstance()``, and the presence of a particular ABC +means that the test has passed. In addition, the ABCs define a minimal set of methods that establish the characteristic behavior of the type. Code that discriminates @@ -123,72 +123,16 @@ The specification follows the categories listed in the abstract: -* An "ABC support framework" which defines a built-in decorator that - make it easy to define ABCs, and mechanisms to support it. - * A way to overload ``isinstance()`` and ``issubclass()``. +* A new module ``abc`` which serves as an "ABC support framework". It + defines a metaclass for use with ABCs and a decorator that can be + used to define abstract methods. + * Specific ABCs for containers and iterators, to be added to the collections module. -ABC Support Framework ---------------------- - -We define a new built-in decorator, ``@abstractmethod``, to be used to -declare abstract methods. A class containing at least one method -declared with this decorator that hasn't been overridden yet cannot be -instantiated. Such a methods may be called from the overriding method -in the subclass (using ``super`` or direct invocation). For example:: - - class A: - @abstractmethod - def foo(self): pass - - A() # raises TypeError - - class B(A): - pass - - B() # raises TypeError - - class C(A): - def foo(self): print(42) - - C() # works - -**Note:** The ``@abstractmethod`` decorator should only be used inside -a class body. Dynamically adding abstract methods to a class, or -attempting to modify the abstraction status of a method or class once -it is created, are not supported. - -**Implementation:** The ``@abstractmethod`` decorator sets the -function attribute ``__isabstractmethod__`` to the value ``True``. -The ``type.__new__`` method computes the type attribute -``__abstractmethods__`` as the set of all method names that have an -``__isabstractmethod__`` attribute whose value is true. It does this -by combining the ``__abstractmethods__`` attributes of the base -classes, adding the names of all methods in the new class dict that -have a true ``__isabstractmethod__`` attribute, and removing the names -of all methods in the new class dict that don't have a true -``__isabstractmethod__`` attribute. If the resulting -``__abstractmethods__`` set is non-empty, the class is considered -abstract, and attempts to instantiate it will raise ``TypeError``. -(CPython can uses an internal flag ``Py_TPFLAGS_ABSTRACT`` to speed up -this check [6]_.) - -**Discussion:** Unlike C++ or Java, abstract methods as defined here -may have an implementation. This implementation can be called via the -``super`` mechanism from the class that overrides it. This could be -useful as an end-point for a super-call in framework using a -cooperative multiple-inheritance [7]_, [8]_. - -**Open issues:** Should we also provide a standard way to declare -abstract data attributes? If so, how should these be spelled? -Perhaps place ``@abstractattribute`` decorators on properties? Or use -an ``@attributes(name1, name2, ...)`` class decorator? - - Overloading ``isinstance()`` and ``issubclass()`` ------------------------------------------------- @@ -199,10 +143,10 @@ numbers: MonoidUnderPlus, AdditiveGroup, Ring, Field, Complex (each derived from the previous). And the discussion mentioned several other algebraic categorizations that were left out: Algebraic, -Transcendental, and IntegralDomain, and PrincipalIdealDomain. In this -PEP, we are wondering about the use cases for separate classes like -Set, ComposableSet, MutableSet, HashableSet, MutableComposableSet, -HashableComposableSet. +Transcendental, and IntegralDomain, and PrincipalIdealDomain. In +earlier versions of the current PEP, we considered the use cases for +separate classes like Set, ComposableSet, MutableSet, HashableSet, +MutableComposableSet, HashableComposableSet. The dilemma here is that we'd rather have fewer ABCs, but then what should a user do who needs a less refined ABC? Consider e.g. the @@ -214,10 +158,33 @@ interpreters running in the same address space, as is used by mod_python). -The solution proposed here is to allow overloading the built-in -functions ``isinstance()`` and ``issubclass()``. The overloading -works as follows: The call ``isinstance(x, C)`` first checks whether -``C.__instancecheck__`` exists, and if so, calls +Another example would be someone who wants to define a generic +function (PEP 3124) for any sequences that has an ``append()`` method. +The ``Sequence`` ABC (see below) doesn't promise the ``append()`` +method, while ``MutableSequence`` requires not only ``append()`` but +also various other mutating methods. + +To solve these and similar dilemmas, the next section will propose a +metaclass for use with ABCs that will allow us to add an ABC as a +"virtual base class" (not the same concept as in C++) to any class, +including to another ABC. This allows the standard library to define +ABCs ``Sequence`` and ``MutableSequence`` and register these as +virtual base classes for built-in types like ``basestring``, ``tuple`` +and ``list``, so that for example the following conditions are all +true:: + + isinstance([], Sequence) + issubclass(list, Sequence) + issubclass(list, MutableSequence) + isinstance((), Sequence) + not issubclass(tuple, MutableSequence) + isinstance("", Sequence) + issubclass(bytes, MutableSequence) + +The primary mechanism proposed here is to allow overloading the +built-in functions ``isinstance()`` and ``issubclass()``. The +overloading works as follows: The call ``isinstance(x, C)`` first +checks whether ``C.__instancecheck__`` exists, and if so, calls ``C.__instancecheck__(x)`` instead of its normal implementation. Similarly, the call ``issubclass(D, C)`` first checks whether ``C.__subclasscheck__`` exists, and if so, calls @@ -227,20 +194,12 @@ ``__issubclass__``; this is because the reversal of the arguments could cause confusion, especially for the ``issubclass()`` overloader. -(We could also provide a default implementation of these that -implements the old algorithms; this would be more regular but would -have additional backwards compatibility issues, since the old -algorithms special-case objects not deriving from ``type`` in order to -support a different kind of overloading of these operations.) - A prototype implementation of this is given in [12]_. -Here is an example with (very simple) implementations of +Here is an example with (naively simple) implementations of ``__instancecheck__`` and ``__subclasscheck__``:: - assert issubclass(set, HashableSet) # Assume this is given - - class ABC: + class ABCMeta(type): def __instancecheck__(cls, inst): """Implement isinstance(inst, cls).""" @@ -252,11 +211,158 @@ candidates = cls.__dict__.get("__subclass__", set()) | {cls} return any(c in candidates for c in sub.mro()) - class NoncomposableHashableSet(Set, Hashable, metaclass=ABC): - __subclass__ = {HashableSet} + class Sequence(metaclass=ABCMeta): + __subclass__ = {list, tuple} + + assert issubclass(list, Sequence) + assert issubclass(tuple, Sequence) + + class AppendableSequence(Sequence): + __subclass__ = {list} + + assert issubclass(list, AppendableSequence) + assert isinstance([], AppendableSequence) + + assert not issubclass(tuple, AppendableSequence) + assert not isinstance((), AppendableSequence) + +The next section proposes a full-fledged implementation. + + +The ``abc`` Module: an ABC Support Framework +-------------------------------------------- + +The new standard library module ``abc``, written in pure Python, +serves as an ABC support framework. It defines a metaclass +``ABCMeta`` and a decorator ``@abstractmethod``. A sample +implementation is given by [13]_. + +The ``ABCMeta`` class overrides ``__instancecheck__`` and +``__subclasscheck__`` and defines a ``register`` method. The +``register`` method takes one argument, which much be a class; after +the call ``B.register(C)``, the call ``issubclass(C, B)`` will return +True, by virtue of of ``B.__subclasscheck__(C)`` returning True. +Also, ``isinstance(x, B)`` is equivalent to ``issubclass(x.__class__, +B) or issubclass(type(x), B)``. (It is possible ``type(x)`` and +``x.__class__`` are not the same object, e.g. when x is a proxy +object.) + +These methods are intended to be be called on classes whose metaclass +is (derived from) ``ABCMeta``; for example:: + + from abc import ABCMeta + + class MyABC(metaclass=ABCMeta): + pass + + MyABC.register(tuple) - assert issubclass(set, NoncomposableHashableSet) - assert isinstance({1, 2, 3}, NoncomposableHashableSet) + assert issubclass(tuple, MyABC) + assert isinstance((), MyABC) + +The last two asserts are equivalent to the following two:: + + assert MyABC.__subclasscheck__(tuple) + assert MyABC.__instancecheck__(()) + +Of course, you can also directly subclass MyABC:: + + class MyClass(MyABC): + pass + + assert issubclass(MyClass, MyABC) + assert isinstance(MyClass(), MyABC) + +Also, of course, a tuple is not a ``MyClass``:: + + assert not issubclass(tuple, MyClass) + assert not isinstance((), MyClass) + +You can register another class as a subclass of ``MyClass``:: + + MyClass.register(list) + + assert issubclass(list, MyClass) + assert issubclass(list, MyABC) + +You can also register another ABC:: + + class AnotherClass(metaclass=ABCMeta): + pass + + AnotherClass.register(basestring) + + MyClass.register(AnotherClass) + + assert isinstance(str, MyABC) + +That last assert requires tracing the following superclass-subclass +relationships:: + + MyABC -> MyClass (using regular subclassing) + MyClass -> AnotherClass (using registration) + AnotherClass -> basestring (using registration) + basestring -> str (using regular subclassing) + +The ``abc`` module also defines a new decorator, ``@abstractmethod``, +to be used to declare abstract methods. A class containing at least +one method declared with this decorator that hasn't been overridden +yet cannot be instantiated. Such a methods may be called from the +overriding method in the subclass (using ``super`` or direct +invocation). For example:: + + from abc import ABCMeta, abstractmethod + + class A(metaclass=ABCMeta): + @abstractmethod + def foo(self): pass + + A() # raises TypeError + + class B(A): + pass + + B() # raises TypeError + + class C(A): + def foo(self): print(42) + + C() # works + +**Notes:** The ``@abstractmethod`` decorator should only be used +inside a class body, and only for classes whose metaclass is (derived +from) ``ABCMeta``. Dynamically adding abstract methods to a class, or +attempting to modify the abstraction status of a method or class once +it is created, are not supported. The ``@abstractmethod`` only +affects subclasses derived using regular inheritance; "virtual +subclasses" registered with the ``register()`` method are not affected. + +**Implementation:** The ``@abstractmethod`` decorator sets the +function attribute ``__isabstractmethod__`` to the value ``True``. +The ``ABCMeta.__new__`` method computes the type attribute +``__abstractmethods__`` as the set of all method names that have an +``__isabstractmethod__`` attribute whose value is true. It does this +by combining the ``__abstractmethods__`` attributes of the base +classes, adding the names of all methods in the new class dict that +have a true ``__isabstractmethod__`` attribute, and removing the names +of all methods in the new class dict that don't have a true +``__isabstractmethod__`` attribute. If the resulting +``__abstractmethods__`` set is non-empty, the class is considered +abstract, and attempts to instantiate it will raise ``TypeError``. +(If this were implemented in CPython, an internal flag +``Py_TPFLAGS_ABSTRACT`` could be used to speed up this check [6]_.) + +**Discussion:** Unlike C++ or Java, abstract methods as defined here +may have an implementation. This implementation can be called via the +``super`` mechanism from the class that overrides it. This could be +useful as an end-point for a super-call in framework using a +cooperative multiple-inheritance [7]_, [8]_. + +**Open issues:** Should we also provide a standard way to declare +abstract data attributes? If so, how should these be spelled? +Perhaps place ``@abstractattribute`` decorators on properties? Or use +an ``@attributes(name1, name2, ...)`` class decorator? Strawman: +let's back off on this; it's easy enough to add this later. ABCs for Containers and Iterators @@ -831,6 +937,9 @@ .. [12] Make isinstance/issubclass overloadable (http://python.org/sf/1708353) +.. [13] ABCMeta sample implementation + (http://svn.python.org/view/sandbox/trunk/abc/xyz.py) + Copyright ========= From python-checkins at python.org Fri May 11 22:53:22 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 11 May 2007 22:53:22 +0200 (CEST) Subject: [Python-checkins] r55277 - sandbox/trunk/abc/def.py sandbox/trunk/abc/xyz.py Message-ID: <20070511205322.B04CC1E4007@bag.python.org> Author: guido.van.rossum Date: Fri May 11 22:53:14 2007 New Revision: 55277 Modified: sandbox/trunk/abc/def.py sandbox/trunk/abc/xyz.py Log: xyz.py: merged in @abstractmethod from abc.py; now matches PEP 3119. def.py: updated from PEP 3119. Modified: sandbox/trunk/abc/def.py ============================================================================== --- sandbox/trunk/abc/def.py (original) +++ sandbox/trunk/abc/def.py Fri May 11 22:53:14 2007 @@ -1,4 +1,4 @@ -class ABC(type): +class ACBMeta(type): def __instancecheck__(cls, inst): """Implement isinstance(inst, cls).""" @@ -10,13 +10,13 @@ candidates = cls.__dict__.get("__subclass__", set()) | {cls} return any(c in candidates for c in sub.mro()) -class Sequence(metaclass=ABC): +class Sequence(metaclass=ACBMeta): __subclass__ = {list, tuple} assert issubclass(list, Sequence) assert issubclass(tuple, Sequence) -class AppendableSequence(Sequence, metaclass=ABC): +class AppendableSequence(Sequence): __subclass__ = {list} assert issubclass(list, AppendableSequence) Modified: sandbox/trunk/abc/xyz.py ============================================================================== --- sandbox/trunk/abc/xyz.py (original) +++ sandbox/trunk/abc/xyz.py Fri May 11 22:53:14 2007 @@ -6,6 +6,56 @@ __all__ = ["ABCMeta"] +def abstractmethod(funcobj): + """A decorator indicating abstract methods. + + Requires that the metaclass is ABCMeta or derived from it. A + class that has a metaclass derived from ABCMeta cannot be + instantiated unless all of its abstract methods are overridden. + The abstract methods can be called using any of the the normal + 'super' call mechanisms. + + Usage: + + class C(metaclass=ABCMeta): + @abstractmethod + def my_abstract_method(self, ...): + ... + """ + funcobj.__isabstractmethod__ = True + return funcobj + + +class _Abstract(object): + + """Helper class inserted into the bases by ABCMeta (using _fix_bases()). + + You should never need to explicitly subclass this class. + """ + + def __new__(cls, *args, **kwds): + am = cls.__dict__.get("__abstractmethods__") + if am: + raise TypeError("can't instantiate abstract class %s " + "with abstract methods %s" % + (cls.__name__, ", ".join(sorted(am)))) + return super(_Abstract, cls).__new__(cls, *args, **kwds) + + +def _fix_bases(bases): + """Helper method that inserts _Abstract in the bases if needed.""" + for base in bases: + if issubclass(base, _Abstract): + # _Abstract is already a base (maybe indirectly) + return bases + if object in bases: + # Replace object with _Abstract + return tuple([_Abstract if base is object else base + for base in bases]) + # Append _Abstract to the end + return bases + (_Abstract,) + + class ABCMeta(type): """Metaclass for defining Abstract Base Classes (ABCs). @@ -28,7 +78,19 @@ __invalidation_counter = 0 def __new__(mcls, name, bases, namespace): + bases = _fix_bases(bases) cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace) + # Compute set of abstract method names + abstracts = {name + for name, value in namespace.items() + if getattr(value, "__isabstractmethod__", False)} + for base in bases: + for name in getattr(base, "__abstractmethods__", set()): + value = getattr(cls, name, None) + if getattr(value, "__isabstractmethod__", False): + abstracts.add(name) + cls.__abstractmethods__ = abstracts + # Set up inheritance registry cls.__abc_registry__ = set() cls.__abc_cache__ = set() cls.__abc_negative_cache__ = set() @@ -37,8 +99,13 @@ def register(cls, subclass): """Register a virtual subclass of an ABC.""" + if not isinstance(cls, type): + raise TypeError("Can only register classes") if issubclass(subclass, cls): return # Already a subclass + if issubclass(cls, subclass): + # This would create a cycle, which is bad for the algorithm below + raise RuntimeError("Refusing to create an inheritance cycle") cls.__abc_registry__.add(subclass) ABCMeta.__invalidation_counter += 1 # Invalidate negative cache @@ -159,6 +226,20 @@ show(abc) abc._dump_registry() + class A(metaclass=ABCMeta): + @abstractmethod + def foo(self): pass + class C(A): + def foo(self): pass + + try: + A() + except TypeError as err: + print("as expected:", err) + else: + assert False + C() + if __name__ == "__main__": _demo() From nnorwitz at gmail.com Fri May 11 23:07:24 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 11 May 2007 17:07:24 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20070511210724.GA32564@python.psfb.org> test_popen2 leaked [-26, 0, 0] references, sum=-26 From python-checkins at python.org Sat May 12 01:36:50 2007 From: python-checkins at python.org (guido.van.rossum) Date: Sat, 12 May 2007 01:36:50 +0200 (CEST) Subject: [Python-checkins] r55278 - peps/trunk/pep-3119.txt Message-ID: <20070511233650.8BE641E4005@bag.python.org> Author: guido.van.rossum Date: Sat May 12 01:36:47 2007 New Revision: 55278 Modified: peps/trunk/pep-3119.txt Log: Streamlined the containers section. Modified: peps/trunk/pep-3119.txt ============================================================================== --- peps/trunk/pep-3119.txt (original) +++ peps/trunk/pep-3119.txt Sat May 12 01:36:47 2007 @@ -7,7 +7,7 @@ Type: Standards Track Content-Type: text/x-rst Created: 18-Apr-2007 -Post-History: 26-Apr-2007 +Post-History: 26-Apr-2007, 11-May-2007 Abstract @@ -30,6 +30,9 @@ Functions (GFs), but about clarifying philosophical issues like "what makes a set", "what makes a mapping" and "what makes a sequence". +There's also a companion PEP 3141, which defines ABCs for numeric +types. + Acknowledgements ---------------- @@ -329,7 +332,7 @@ C() # works -**Notes:** The ``@abstractmethod`` decorator should only be used +**Note:** The ``@abstractmethod`` decorator should only be used inside a class body, and only for classes whose metaclass is (derived from) ``ABCMeta``. Dynamically adding abstract methods to a class, or attempting to modify the abstraction status of a method or class once @@ -337,6 +340,11 @@ affects subclasses derived using regular inheritance; "virtual subclasses" registered with the ``register()`` method are not affected. +It has been suggested that we should also provide a way to define +abstract data attributes. As it is easy to add these in a later +stage, and as the use case is considerably less common (apart from +pure documentation), we punt on this for now. + **Implementation:** The ``@abstractmethod`` decorator sets the function attribute ``__isabstractmethod__`` to the value ``True``. The ``ABCMeta.__new__`` method computes the type attribute @@ -358,19 +366,14 @@ useful as an end-point for a super-call in framework using a cooperative multiple-inheritance [7]_, [8]_. -**Open issues:** Should we also provide a standard way to declare -abstract data attributes? If so, how should these be spelled? -Perhaps place ``@abstractattribute`` decorators on properties? Or use -an ``@attributes(name1, name2, ...)`` class decorator? Strawman: -let's back off on this; it's easy enough to add this later. - ABCs for Containers and Iterators --------------------------------- The ``collections`` module will define ABCs necessary and sufficient to work with sets, mappings, sequences, and some helper types such as -iterators and dictionary views. +iterators and dictionary views. All ABCs have the above-mentioned +``ABCMeta`` as their metaclass. The ABCs provide implementations of their abstract methods that are technically valid but fairly useless; e.g. ``__hash__`` returns 0, and @@ -381,7 +384,8 @@ Some ABCs also provide concrete (i.e. non-abstract) methods; for example, the ``Iterator`` class has an ``__iter__`` method returning itself, fulfilling an important invariant of iterators (which in -Python 2 has to be implemented anew by each iterator class). +Python 2 has to be implemented anew by each iterator class). These +ABCs can be considered "mix-in" classes. No ABCs defined in the PEP override ``__init__``, ``__new__``, ``__str__`` or ``__repr__``. Defining a standard constructor @@ -390,27 +394,19 @@ representation for a collection is similarly left up to individual implementations. - -Ordering ABCs -''''''''''''' - -These ABCs are closer to ``object`` in the ABC hierarchy. - -``PartiallyOrdered`` - This ABC defines the 4 inequality operations ``<``, ``<=``, ``>=``, - ``>``. (Note that ``==`` and ``!=`` are defined by ``object``.) - Classes deriving from this ABC should implement a partial order - as defined in mathematics. [9]_ - -``TotallyOrdered`` - This ABC derives from ``PartiallyOrdered``. It adds no new - operations but implies a promise of stronger invariants. - Classes deriving from this ABC should implement a total order - as defined in mathematics. [10]_ - -**Open issues:** Where should these live? The ``collections`` module -doesn't seem right, but making them built-ins seems a slippery slope -too. +**Note:** There are no ABCs for ordering operations (``__lt__``, +``__le__``, ``__ge__``, ``__gt__``). Defining these in a base class +(abstract or not) runs into problems with the accepted type for the +second operand. For example, if class ``Ordering`` defined +``__lt__``, one would assume that for any ``Ordering`` instances ``x`` +and ``y``, ``x < y`` would be defined (even if it just defines a +partial ordering). But this cannot be the case: If both ``list`` and +``str`` derived from ``Ordering``, this would imply that ``[1, 2] < +(1, 2)`` should be defined (and presumably return False), while in +fact (in Python 3000!) such "mixed-mode comparisons" operations are +explicitly forbidden and raise ``TypeError``. See PEP 3100 and [14]_ +for more information. (This is a special case of a more general issue +with operations that take another argument of the same type: One Trick Ponies @@ -418,23 +414,22 @@ These abstract classes represent single methods like ``__iter__`` or ``__len__``. - + ``Hashable`` The base class for classes defining ``__hash__``. The - ``__hash__`` method should return an ``Integer`` (see "Numbers" - below). The abstract ``__hash__`` method always returns 0, which - is a valid (albeit inefficient) implementation. **Invariant:** If - classes ``C1`` and ``C2`` both derive from ``Hashable``, the - condition ``o1 == o2`` must imply ``hash(o1) == hash(o2)`` for all - instances ``o1`` of ``C1`` and all instances ``o2`` of ``C2``. - IOW, two objects shouldn't compare equal but have different hash - values. + ``__hash__`` method should return an integer. The abstract + ``__hash__`` method always returns 0, which is a valid (albeit + inefficient) implementation. **Invariant:** If classes ``C1`` and + ``C2`` both derive from ``Hashable``, the condition ``o1 == o2`` + must imply ``hash(o1) == hash(o2)`` for all instances ``o1`` of + ``C1`` and all instances ``o2`` of ``C2``. IOW, two objects + should never compare equal but have different hash values. Another constraint is that hashable objects, once created, should never change their value (as compared by ``==``) or their hash value. If a class cannot guarantee this, it should not derive from ``Hashable``; if it cannot guarantee this for certain - instances only, ``__hash__`` for those instances should raise a + instances, ``__hash__`` for those instances should raise a ``TypeError`` exception. **Note:** being an instance of this class does not imply that an @@ -453,7 +448,11 @@ The base class for classes defining ``__next__``. This derives from ``Iterable``. The abstract ``__next__`` method raises ``StopIteration``. The concrete ``__iter__`` method returns - ``self``. + ``self``. Note the distinction between ``Iterable`` and + ``Iterator``: an ``Iterable`` can be iterated over, i.e. supports + the ``__iter__`` methods; an ``Iterator`` is what the built-in + function ``iter()`` returns, i.e. supports the ``__next__`` + method. ``Sized`` The base class for classes defining ``__len__``. The ``__len__`` @@ -471,57 +470,54 @@ ``Iterable``, then ``(x in o for x in o)`` should be a generator yielding only True values for any instance ``o`` of ``C``. - **Open issues:** strictly speaking, there are three variants of - this method's semantics. The first one is for sets and mappings, - which is fast: O(1) or O(log N). The second one is for membership - checking on sequences, which is slow: O(N). The third one is for - subsequence checking on (character or byte) strings, which is also - slow: O(N). Would it make sense to distinguish these? The - signature of the third variant is different, since it takes a - sequence (typically of the same type as the method's target) - intead of an element. For now, I'm using the same type for all - three. This means that is is possible for ``x in o`` to be True - even though ``x`` is never yielded by ``iter(o)``. A suggested - name for the third form is ``Searchable`` (though people have - objected against this name on the grounds that it has the wrong - association). +**Open issues:** Conceivably, instead of using the ABCMeta metaclass, +these classes could override ``__instancecheck__`` and +``__subclasscheck__`` to check for the presence of the applicable +special method; for example:: + + class Sized(metaclass=ABCMeta): + @abstractmethod + def __hash__(self): + return 0 + @classmethod + def __instancecheck__(cls, x): + return hasattr(x, "__len__") + @classmethod + def __subclasscheck__(cls, C): + return hasattr(C, "__bases__") and hasattr(C, "__len__") + +This has the advantage of not requiring explicit registration. +However, the semantics hard to get exactly right given the confusing +semantics of instance attributes vs. class attributes, and that a +class is an instance of its metaclass; the check for ``__bases__`` is +only an approximation of the desired semantics. **Strawman:** Let's +do it, but let's arrange it in such a way that the registration API +also works. Sets '''' -These abstract classes represent various stages of "set-ness". The +These abstract classes represent read-only sets and mutable sets. The most fundamental set operation is the membership test, written as ``x -in s`` and implemented by ``s.__contains__(x)``. This is already -taken care of by the `Container`` class defined above. Therefore, we -define a set as a sized, iterable container for which certain +in s`` and implemented by ``s.__contains__(x)``. This operation is +already defined by the `Container`` class defined above. Therefore, +we define a set as a sized, iterable container for which certain invariants from mathematical set theory hold. The built-in type ``set`` derives from ``MutableSet``. The built-in -type ``frozenset`` derives from ``HashableSet``. - -You might wonder why we require a set to be sized -- surely certain -infinite sets can be represented just fine in Python. For example, -the set of even integers could be defined like this:: - - class EvenIntegers(Container): - def __contains__(self, x): - return x % 2 == 0 - -However, such sets have rather limited practical value, and deciding -whether one such set is a subset of another would be difficult in -general without using a symbolic algebra package. So I consider this -out of the scope of a pragmatic proposal like this. +type ``frozenset`` derives from ``Set`` and ``Hashable``. ``Set`` - This is a sized, iterable, partially ordered container, i.e. a - subclass of ``Sized``, ``Iterable``, ``Container`` and - ``PartiallyOrdered``. Not every subset of those three classes is - a set though! Sets have the additional invariant that each - element occurs only once (as can be determined by iteration), and - in addition sets define concrete operators that implement the - inequality operations as subclass/superclass tests. In general, - the invariants for finite sets in mathematics hold. [11]_ + + This is a sized, iterable container, i.e., a subclass of + ``Sized``, ``Iterable`` and ``Container``. Not every subclass of + those three classes is a set though! Sets have the additional + invariant that each element occurs only once (as can be determined + by iteration), and in addition sets define concrete operators that + implement the inequality operations as subclass/superclass tests. + In general, the invariants for finite sets in mathematics + hold. [11]_ Sets with different implementations can be compared safely, (usually) efficiently and correctly using the mathematical @@ -539,57 +535,33 @@ can be compared to those for equality (and then they always compare unequal). + This class also defines concrete operators to compute union, + intersection, symmetric and asymmetric difference, respectively + ``__or__``, ``__and__``, ``__xor__`` and ``__sub__``. These + operators should return instances of ``Set``. The default + implementations call the overridable class method + ``_from_iterable()`` with an iterable argument. This factory + method's default implementation returns a ``frozenset`` instance; + it may be overridden to return another appropriate ``Set`` + subclass. + + Finally, this class defines a concrete method ``_hash`` which + computes the hash value from the elements. Hashable subclasses of + ``Set`` can implement ``__hash__`` by calling ``_hash`` or they + can reimplement the same algorithm more efficiently; but the + algorithm implemented should be the same. Currently the algorithm + is fully specified only by the source code [15]_. + **Note:** the ``issubset`` and ``issuperset`` methods found on the set type in Python 2 are not supported, as these are mostly just aliases for ``__le__`` and ``__ge__``. - **Open issues:** should we define comparison of instances of - different concrete set types this way? - -``ComposableSet`` - This is a subclass of ``Set`` that defines abstract operators to - compute union, intersection, symmetric and asymmetric difference, - respectively ``__or__``, ``__and__``, ``__xor__`` and ``__sub__``. - These operators should return instances of ``ComposableSet``. The - abstract implementations return no meaningful values but raise - ``NotImplementedError``; this is because any generic - implementation would have to create new instances but the ABCs - don't (and shouldn't, IMO) provide an API for creating new - instances. The implementations of these operators should ensure - that the results match the mathematical definition of set - composition. [11]_ - - **Open issues:** Should ``__or__`` and friends be abstract or - concrete methods? Making them abstract means that every - ComposableSet implementation must reimplement all of them. But - making them concrete begs the question of the actual return type: - since the ABC doesn't (and IMO shouldn't) define the constructor - signature for subclasses, the concrete implementations in the ABC - don't have an API to construct a new instance given an iterable. - Perhaps the right choice is to have a static concrete factory - function ``fromiterable`` which takes an iterable and returns - a ``ComposableSet`` instance. Subclasses can override this and - benefit from the default implementations of ``__or__`` etc.; or - they can override ``__or__`` if they want to. - -``HashableSet`` - This is a subclass of both ``ComposableSet`` and ``Hashable``. It - implements a concrete ``__hash__`` method that subclasses should - not override; or if they do, the subclass should compute the same - hash value. This is so that sets with different implementations - still hash to the same value, so they can be used interchangeably - as dictionary keys. (A similar constraint exists on the hash - values for different types of numbers and strings.) - - **Open issues:** Spell out the hash algorithm. Should there be - another ABC that derives from Set and Hashable, but not from - Composable? - ``MutableSet`` - This is a subclass of ``ComposableSet`` implementing additional - operations to add and remove elements. The supported methods have - the semantics known from the ``set`` type in Python 2 (except - for ``discard``, which is modeled after Java): + + This is a subclass of ``Set`` implementing additional operations + to add and remove elements. The supported methods have the + semantics known from the ``set`` type in Python 2 (except for + ``discard``, which is modeled after Java): ``.add(x)`` Abstract method returning a ``bool`` that adds the element @@ -635,21 +607,18 @@ Mappings '''''''' -These abstract classes represent various stages of mapping-ness. The -``Mapping`` class represents the most common read-only mapping API. -However, code *accepting* a mapping is encouraged to check for the -``BasicMapping`` ABC when iteration is not used. This allows for -certain "black-box" implementations that can look up values by key but -don't provide a convenient iteration API. A hypothetical example -would be an interface to a hierarchical filesystem, where keys are -pathnames relative to some root directory. Iterating over all -pathnames would presumably take forever, as would counting the number -of valid pathnames. +These abstract classes represent read-only mappings and mutable +mappings. The ``Mapping`` class represents the most common read-only +mapping API. The built-in type ``dict`` derives from ``MutableMapping``. -``BasicMapping`` - A subclass of ``Container`` defining the following methods: +``Mapping`` + + A subclass of ``Container``, ``Iterable`` and ``Sized``. The keys + of a mapping naturally form a set. The (key, value) pairs (which + must be tuples) are also referred to as items. The items also + form a set. Methods: ``.__getitem__(key)`` Abstract method that returns the value corresponding to @@ -664,25 +633,13 @@ Concrete method returning ``True`` if ``self[key]`` does not raise ``KeyError``, and ``False`` if it does. -``Mapping`` - A subclass of ``BasicMapping``, ``Iterable`` and ``Sized``. The - keys of a mapping naturally form a set. The (key, value) pairs - are also referred to as items. The items also form a set. - Methods: - ``.__len__()`` - Abstract method returning the length of the key set. + Abstract method returning the number of distinct keys (i.e., + the length of the key set). ``.__iter__()`` Abstract method returning each key in the key set exactly once. - ``.__eq__(obj)`` - Concrete method for comparing mappings. Two mappings, even - with different implementations, can be compared for equality, - and are considered equal if and only if their item sets are - equal. **Open issues:** should we define comparison of - instances of different concrete mapping types this way? - ``.keys()`` Concrete method returning the key set as a ``Set``. The default concrete implementation returns a "view" on the key @@ -712,11 +669,6 @@ i.e. iterating over the items, keys and values should return results in the same order. -``HashableMapping`` - A subclass of ``Mapping`` and ``Hashable``. The values should be - instances of ``Hashable``. The concrete ``__hash__`` method - should be equal to ``hash(m.items())``. - ``MutableMapping`` A subclass of ``Mapping`` that also implements some standard mutating methods. Abstract methods include ``__setitem__``, @@ -728,13 +680,15 @@ Sequences ''''''''' -These abstract classes represent various stages of sequence-ness. +These abstract classes represent read-only sequences and mutable +sequences. The built-in ``list`` and ``bytes`` types derive from ``MutableSequence``. The built-in ``tuple`` and ``str`` types derive -from ``HashableSequence``. +from ``Sequence`` and ``Hashable``. ``Sequence`` + A subclass of ``Iterable``, ``Sized``, ``Container``. It defines a new abstract method ``__getitem__`` that has a somewhat complicated signature: when called with an integer, it returns an @@ -747,15 +701,11 @@ **Open issues:** Other candidate methods, which can all have default concrete implementations that only depend on ``__len__`` - and ``__getitem__`` with an integer argument: __reversed__, index, - count, __add__, __mul__, __eq__, __lt__, __le__. - -``HashableSequence`` - A subclass of ``Sequence`` and ``Hashable``. The concrete - ``__hash__`` method should implements the hashing algorithms used - by tuples in Python 2. + and ``__getitem__`` with an integer argument: ``__reversed__``, + ``index``, ``count``, ``__add__``, ``__mul__``. ``MutableSequence`` + A subclass of ``Sequence`` adding some standard mutating methods. Abstract mutating methods: ``__setitem__`` (for integer indices as well as slices), ``__delitem__`` (ditto), ``insert``, ``append``, @@ -765,24 +715,14 @@ ``sort()`` -- that is only required to exist on genuine ``list`` instances. -**Open issues:** If all the elements of a sequence are totally -ordered, the sequence itself can be totally ordered with respect to -other sequences containing corresponding items of the same type. -Should we reflect this by making ``Sequence`` derive from -``TotallyOrdered``? Or ``Partiallyordered``? Also, we could easily -define comparison of sequences of different types, so that e.g. -``(1, 2, 3) == [1, 2, 3]`` and ``(1, 2) < [1, 2, 3]``. Should we? -(It might imply ``["a", "b"] == "ab"`` and ``[1, 2] == b"\1\2"``.) - Strings ------- -Python 3000 has two built-in string types: byte strings (``bytes``), -deriving from ``MutableSequence``, and (Unicode) character strings -(``str``), deriving from ``HashableSequence``. They also derive from -``TotallyOrdered``. If we were to introduce ``Searchable``, they -would also derive from that. +Python 3000 will likely have at least two built-in string types: byte +strings (``bytes``), deriving from ``MutableSequence``, and (Unicode) +character strings (``str``), deriving from ``Sequence`` and +``Hashable``. **Open issues:** define the base interfaces for these so alternative implementations and subclasses know what they are in for. This may be @@ -790,29 +730,6 @@ ``bytes`` type). -Numbers -------- - -ABCs for numerical types are defined in PEP 3141. - - -Guidelines for Writing ABCs ---------------------------- - -Some suggestions for writing ABCs: - -* Use the ``@abstractmethod`` decorator. - -* Define abstract methods that could be useful as an end point when - called via a super chain. - -* Define concrete methods that are very simple permutations of - abstract methods (e.g. ``Mapping.get``). - -* Keep abstract classes small, one per use case instead of one per - concept. - - ABCs vs. Alternatives ===================== @@ -940,6 +857,12 @@ .. [13] ABCMeta sample implementation (http://svn.python.org/view/sandbox/trunk/abc/xyz.py) +.. [14] python-dev email ("Comparing heterogeneous types") + http://mail.python.org/pipermail/python-dev/2004-June/045111.html + +.. [15] Function ``frozenset_hash()`` in Object/setobject.c + (http://svn.python.org/view/python/trunk/Objects/setobject.c) + Copyright ========= From python-checkins at python.org Sat May 12 01:42:48 2007 From: python-checkins at python.org (guido.van.rossum) Date: Sat, 12 May 2007 01:42:48 +0200 (CEST) Subject: [Python-checkins] r55279 - sandbox/trunk/abc/abc.py sandbox/trunk/abc/xyz.py Message-ID: <20070511234248.E04EC1E4005@bag.python.org> Author: guido.van.rossum Date: Sat May 12 01:42:40 2007 New Revision: 55279 Modified: sandbox/trunk/abc/abc.py sandbox/trunk/abc/xyz.py Log: Checkpoint. Modified: sandbox/trunk/abc/abc.py ============================================================================== --- sandbox/trunk/abc/abc.py (original) +++ sandbox/trunk/abc/abc.py Sat May 12 01:42:40 2007 @@ -208,17 +208,16 @@ ### SETS ### -class Set(Sized, Iterable, Container, PartiallyOrdered): +class Set(Sized, Iterable, Container): """A plain set is a finite, iterable container. - This enables a generic implementation of equality and ordering based - on set inclusion. + This class provides concrete generic implementations of all + methods except for __len__, __iter__ and __contains__. - I don't see a use case for a non-iterable set that has a size. - - The idea here is that all you have to do is redefine __le__ and then - the other operations will automatically follow suit. + To override the comparisons (presumably for speed, as the + semantics are fixed), all you have to do is redefine __le__ and + then the other operations will automatically follow suit. """ def __le__(self, other): @@ -241,64 +240,46 @@ return NotImplemented return len(self) == len(other) and self.__le__(other) - -class ComposableSet(Set): - - # XXX The following implementations of &, |, ^, - return frozen - # sets because we have to pick a concrete type. They are allowed - # to return any subclass of Set (but Set is not a concrete - # implementation). We return frozen sets because returning set - # may mislead callers from assuming that these operations always - # return mutable sets. - - # XXX Alternatively, we might make these abstract. - - @staticmethod - def fromiterable(it): + @classmethod + def _from_iterable(cls, it): return frozenset(it) def __and__(self, other): if not isinstance(other, Iterable): return NotImplemented - return self.fromiterable(value for value in other if value in self) + return self._from_iterable(value for value in other if value in self) def __or__(self, other): - return self.fromiterable(itertools.chain(self, other)) + if not isinstance(other, Iterable): + return NotImplemented + return self._from_iterable(itertools.chain(self, other)) - def __xor__(self, other): + def __sub__(self, other): if not isinstance(other, Set): if not isinstance(other, Iterable): return NotImplemented - other = self.fromiterable(other) - return self.fromiterable(itertool.chain( - (value for value in self if value not in other), - (other for value in other if value not in self))) + other = self._from_iterable(other) + return self._from_iterable(value for value in self + if value not in other) - def __sub__(self, other): + def __xor__(self, other): if not isinstance(other, Set): if not isinstance(other, Iterable): return NotImplemented - other = self.fromiterable(other) - return self.fromiterable(value for value in self if value not in other) - + other = self._from_iterable(other) + return (self - other) | (other - self) -# XXX Should this derive from Set instead of from ComposableSet? -class HashableSet(ComposableSet, Hashable): - - def __hash__(self): + def _hash(self): """The hash value must match __eq__. - All sets ought to compare equal if they contain the same elements, - regardless of how they are implemented, and regardless of the - order of the elements; so there's not much freedom for __eq__ or - __hash__. We just XOR the hash of the elements. - - XXX This should match frozenset_hash() in Objects/setobject.c. + All sets ought to compare equal if they contain the same + elements, regardless of how they are implemented, and + regardless of the order of the elements; so there's not much + freedom for __eq__ or __hash__. We match the algorithm used + by the built-in frozenset type. """ - h = 0 - for elem in self: - h ^= hash(elem) - return h + # XXX This is not a very efficient implementation + return hash(frozenset(self)) # XXX Should this derive from Set instead of from ComposableSet? @@ -365,10 +346,6 @@ return self -# class set(Set) -# class frozenset(HashableSet) - - ### MAPPINGS ### Modified: sandbox/trunk/abc/xyz.py ============================================================================== --- sandbox/trunk/abc/xyz.py (original) +++ sandbox/trunk/abc/xyz.py Sat May 12 01:42:40 2007 @@ -103,6 +103,8 @@ raise TypeError("Can only register classes") if issubclass(subclass, cls): return # Already a subclass + # Subtle: test for cycles *after* testing for "already a subclass"; + # this means we allow X.register(X) and interpret it as a no-op. if issubclass(cls, subclass): # This would create a cycle, which is bad for the algorithm below raise RuntimeError("Refusing to create an inheritance cycle") @@ -158,6 +160,8 @@ def _demo(): + # Set up a bunch of trivial ABCs + class Sequence(metaclass=ABCMeta): """A sequence without any behavior implementation.""" @@ -199,6 +203,8 @@ Sequence.register(MutableSequence) + # Test them + SAMPLES = [0, b"", "", u"", [], (), {}, set(), frozenset()] def show(abc): @@ -214,6 +220,8 @@ Set, ImmutableSet, MutableSet]: show(abc) + # Add another one at the bottom + class Collection(metaclass=ABCMeta): """A collection.""" @@ -222,24 +230,67 @@ Collection.register(Mapping) Collection.register(Collection) + # And test it + for abc in [Collection]: show(abc) abc._dump_registry() + # Set up some tests for @abstractmethod + class A(metaclass=ABCMeta): @abstractmethod def foo(self): pass - class C(A): + @abstractmethod + def bar(self): pass + class B(A): def foo(self): pass + class C(B): + def bar(self): pass try: A() + assert False except TypeError as err: print("as expected:", err) - else: + try: + B() assert False + except TypeError as err: + print("as expected:", err) C() + # Test a special Hashable + + class Hashable: + @classmethod + def __instancecheck__(self, x): + return getattr(x, "__hash__", None) is not None + @classmethod + def __subclasscheck__(self, C): + if not hasattr(C, "__bases__"): + raise TypeError( + "%.100s object %.100r is not a class" % + (C.__class__.__name__, C)) + return getattr(C, "__hash__", None) is not None + + assert isinstance(42, Hashable) + assert not isinstance([], Hashable) + assert issubclass(tuple, Hashable) + assert issubclass(type, Hashable) + assert not issubclass(dict, Hashable) + + assert isinstance(tuple, Hashable) # types are hashable + + x = ([], {}) # Unhashable tuple + assert isinstance(x, Hashable) # Even though it raises TypeError + + try: + issubclass(42, Hashable) + assert False + except TypeError as err: + print("as expected:", err) + if __name__ == "__main__": _demo() From python-checkins at python.org Sat May 12 04:20:38 2007 From: python-checkins at python.org (guido.van.rossum) Date: Sat, 12 May 2007 04:20:38 +0200 (CEST) Subject: [Python-checkins] r55281 - sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Message-ID: <20070512022038.AE88E1E4009@bag.python.org> Author: guido.van.rossum Date: Sat May 12 04:20:38 2007 New Revision: 55281 Modified: sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Log: Remove a leftover reference to a deleted class. Fix assumptions in the tests about what range() returns. Modified: sandbox/trunk/abc/abc.py ============================================================================== --- sandbox/trunk/abc/abc.py (original) +++ sandbox/trunk/abc/abc.py Sat May 12 04:20:38 2007 @@ -283,7 +283,7 @@ # XXX Should this derive from Set instead of from ComposableSet? -class MutableSet(ComposableSet): +class MutableSet(Set): @abstractmethod def add(self, value): Modified: sandbox/trunk/abc/test_abc.py ============================================================================== --- sandbox/trunk/abc/test_abc.py (original) +++ sandbox/trunk/abc/test_abc.py Sat May 12 04:20:38 2007 @@ -44,11 +44,11 @@ self.assertEqual(a[0], 0) self.assertEqual(a[9], 9) self.assertEqual(a[-1], 9) - self.assertEqual(list(a), range(10)) + self.assertEqual(list(a), list(range(10))) #self.assertEqual(a, range(10)) b = a[1:-1] self.assertEqual(b.__class__, abc.AdaptToSequence) - self.assertEqual(list(b), range(1, 9)) + self.assertEqual(list(b), list(range(1, 9))) def test_adapt_to_mapping(self): a = abc.AdaptToMapping({1: 10, 2: 20}) From python-checkins at python.org Sat May 12 23:06:47 2007 From: python-checkins at python.org (georg.brandl) Date: Sat, 12 May 2007 23:06:47 +0200 (CEST) Subject: [Python-checkins] r55287 - python/trunk/Doc/dist/dist.tex Message-ID: <20070512210647.6F5D91E4005@bag.python.org> Author: georg.brandl Date: Sat May 12 23:06:41 2007 New Revision: 55287 Modified: python/trunk/Doc/dist/dist.tex Log: Bug #1046945: document SWIG options of distutils. Modified: python/trunk/Doc/dist/dist.tex ============================================================================== --- python/trunk/Doc/dist/dist.tex (original) +++ python/trunk/Doc/dist/dist.tex Sat May 12 23:06:41 2007 @@ -486,9 +486,24 @@ extensions: it will run SWIG on the interface file and compile the resulting C/\Cpp{} file into your extension. -\XXX{SWIG support is rough around the edges and largely untested; - especially SWIG support for \Cpp{} extensions! Explain in more detail - here when the interface firms up.} +\XXX{SWIG support is rough around the edges and largely untested!} + +This warning notwithstanding, options to SWIG can be currently passed +like this: + +\begin{verbatim} +setup(... + ext_modules=[Extension('_foo', ['foo.i'], + swig_opts=['-modern', '-I../include'])], + py_modules=['foo'], + ) +\end{verbatim} + +Or on the commandline like this: + +\begin{verbatim} +> python setup.py build_ext --swig-opts="-modern -I../include" +\end{verbatim} On some platforms, you can include non-source files that are processed by the compiler and included in your extension. Currently, this just @@ -1017,6 +1032,7 @@ --include-dirs (-I) list of directories to search for header files --define (-D) C preprocessor macros to define --undef (-U) C preprocessor macros to undefine + --swig-opts list of SWIG command line options [...] \end{verbatim} From python-checkins at python.org Sat May 12 23:06:53 2007 From: python-checkins at python.org (georg.brandl) Date: Sat, 12 May 2007 23:06:53 +0200 (CEST) Subject: [Python-checkins] r55288 - python/branches/release25-maint/Doc/dist/dist.tex Message-ID: <20070512210653.A0F441E4006@bag.python.org> Author: georg.brandl Date: Sat May 12 23:06:51 2007 New Revision: 55288 Modified: python/branches/release25-maint/Doc/dist/dist.tex Log: Bug #1046945: document SWIG options of distutils. (backport from rev. 55287) Modified: python/branches/release25-maint/Doc/dist/dist.tex ============================================================================== --- python/branches/release25-maint/Doc/dist/dist.tex (original) +++ python/branches/release25-maint/Doc/dist/dist.tex Sat May 12 23:06:51 2007 @@ -486,9 +486,24 @@ extensions: it will run SWIG on the interface file and compile the resulting C/\Cpp{} file into your extension. -\XXX{SWIG support is rough around the edges and largely untested; - especially SWIG support for \Cpp{} extensions! Explain in more detail - here when the interface firms up.} +\XXX{SWIG support is rough around the edges and largely untested!} + +This warning notwithstanding, options to SWIG can be currently passed +like this: + +\begin{verbatim} +setup(... + ext_modules=[Extension('_foo', ['foo.i'], + swig_opts=['-modern', '-I../include'])], + py_modules=['foo'], + ) +\end{verbatim} + +Or on the commandline like this: + +\begin{verbatim} +> python setup.py build_ext --swig-opts="-modern -I../include" +\end{verbatim} On some platforms, you can include non-source files that are processed by the compiler and included in your extension. Currently, this just @@ -1017,6 +1032,7 @@ --include-dirs (-I) list of directories to search for header files --define (-D) C preprocessor macros to define --undef (-U) C preprocessor macros to undefine + --swig-opts list of SWIG command line options [...] \end{verbatim} From python-checkins at python.org Sun May 13 00:10:19 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 13 May 2007 00:10:19 +0200 (CEST) Subject: [Python-checkins] r55289 - peps/trunk/pep-3119.txt Message-ID: <20070512221019.997921E4005@bag.python.org> Author: brett.cannon Date: Sun May 13 00:10:13 2007 New Revision: 55289 Modified: peps/trunk/pep-3119.txt Log: Add a reference to mod_python's use of multiple interpreters and fix two typos. Modified: peps/trunk/pep-3119.txt ============================================================================== --- peps/trunk/pep-3119.txt (original) +++ peps/trunk/pep-3119.txt Sun May 13 00:10:13 2007 @@ -159,7 +159,7 @@ for that purpose, but there are some good reasons to keep the built-in types immutable (for one, they are shared between all Python interpreters running in the same address space, as is used by -mod_python). +mod_python [16]_). Another example would be someone who wants to define a generic function (PEP 3124) for any sequences that has an ``append()`` method. @@ -310,7 +310,7 @@ The ``abc`` module also defines a new decorator, ``@abstractmethod``, to be used to declare abstract methods. A class containing at least one method declared with this decorator that hasn't been overridden -yet cannot be instantiated. Such a methods may be called from the +yet cannot be instantiated. Such methods may be called from the overriding method in the subclass (using ``super`` or direct invocation). For example:: @@ -406,7 +406,7 @@ fact (in Python 3000!) such "mixed-mode comparisons" operations are explicitly forbidden and raise ``TypeError``. See PEP 3100 and [14]_ for more information. (This is a special case of a more general issue -with operations that take another argument of the same type: +with operations that take another argument of the same type). One Trick Ponies @@ -863,6 +863,9 @@ .. [15] Function ``frozenset_hash()`` in Object/setobject.c (http://svn.python.org/view/python/trunk/Objects/setobject.c) +.. [16] Multiple interpreters in mod_python + (http://www.modpython.org/live/current/doc-html/pyapi-interps.html) + Copyright ========= From python-checkins at python.org Sun May 13 10:04:08 2007 From: python-checkins at python.org (georg.brandl) Date: Sun, 13 May 2007 10:04:08 +0200 (CEST) Subject: [Python-checkins] r55290 - python/trunk/Lib/mimetypes.py Message-ID: <20070513080408.9DA8D1E4006@bag.python.org> Author: georg.brandl Date: Sun May 13 10:04:07 2007 New Revision: 55290 Modified: python/trunk/Lib/mimetypes.py Log: Add bz2 to content encodings. Modified: python/trunk/Lib/mimetypes.py ============================================================================== --- python/trunk/Lib/mimetypes.py (original) +++ python/trunk/Lib/mimetypes.py Sun May 13 10:04:07 2007 @@ -329,11 +329,13 @@ '.tgz': '.tar.gz', '.taz': '.tar.gz', '.tz': '.tar.gz', + '.tbz2': '.tar.bz2', } encodings_map = { '.gz': 'gzip', '.Z': 'compress', + '.bz2': 'bzip2', } # Before adding new types, make sure they are either registered with IANA, From python-checkins at python.org Sun May 13 14:01:34 2007 From: python-checkins at python.org (erik.forsberg) Date: Sun, 13 May 2007 14:01:34 +0200 (CEST) Subject: [Python-checkins] r55291 - tracker/instances/python-dev Message-ID: <20070513120134.6A1821E4006@bag.python.org> Author: erik.forsberg Date: Sun May 13 14:01:27 2007 New Revision: 55291 Modified: tracker/instances/python-dev/ (props changed) Log: Ignore db/ directory. From python-checkins at python.org Sun May 13 15:48:20 2007 From: python-checkins at python.org (erik.forsberg) Date: Sun, 13 May 2007 15:48:20 +0200 (CEST) Subject: [Python-checkins] r55292 - tracker/instances/python-dev/detectors Message-ID: <20070513134820.9249F1E4006@bag.python.org> Author: erik.forsberg Date: Sun May 13 15:48:19 2007 New Revision: 55292 Modified: tracker/instances/python-dev/detectors/ (props changed) Log: Ignore config.ini - example configuration is in config.ini.template. From python-checkins at python.org Sun May 13 15:49:01 2007 From: python-checkins at python.org (erik.forsberg) Date: Sun, 13 May 2007 15:49:01 +0200 (CEST) Subject: [Python-checkins] r55293 - tracker/instances/python-dev/detectors/config.ini tracker/instances/python-dev/detectors/config.ini.template Message-ID: <20070513134901.B24C41E4006@bag.python.org> Author: erik.forsberg Date: Sun May 13 15:49:01 2007 New Revision: 55293 Added: tracker/instances/python-dev/detectors/config.ini.template - copied, changed from r55291, tracker/instances/python-dev/detectors/config.ini Removed: tracker/instances/python-dev/detectors/config.ini Log: Remove config.ini from svn. Instead, provide a template file (config.ini.template). Deleted: /tracker/instances/python-dev/detectors/config.ini ============================================================================== --- /tracker/instances/python-dev/detectors/config.ini Sun May 13 15:49:01 2007 +++ (empty file) @@ -1,8 +0,0 @@ -# This configuration file controls the behavior of busybody.py and tellteam.py -# The two definitions can be comma-delimited lists of email addresses. -# Be sure these addresses will accept mail from the tracker's email address. -[main] -triage_email= new-bugs-announce at python.org,python-bugs-list at python.org -busybody_email= python-bugs-list at python.org - - Copied: tracker/instances/python-dev/detectors/config.ini.template (from r55291, tracker/instances/python-dev/detectors/config.ini) ============================================================================== --- tracker/instances/python-dev/detectors/config.ini (original) +++ tracker/instances/python-dev/detectors/config.ini.template Sun May 13 15:49:01 2007 @@ -1,8 +1,7 @@ -# This configuration file controls the behavior of busybody.py and tellteam.py -# The two definitions can be comma-delimited lists of email addresses. -# Be sure these addresses will accept mail from the tracker's email address. +#This configuration file controls the behavior of busybody.py and tellteam.py +#The two definitions can be comma-delimited lists of email addresses. +#Be sure these addresses will accept mail from the tracker's email address. [main] -triage_email= new-bugs-announce at python.org,python-bugs-list at python.org -busybody_email= python-bugs-list at python.org - +triage_email = triage at example.com +busybody_email= busybody at example.com From python-checkins at python.org Sun May 13 15:51:08 2007 From: python-checkins at python.org (erik.forsberg) Date: Sun, 13 May 2007 15:51:08 +0200 (CEST) Subject: [Python-checkins] r55294 - tracker/instances/python-dev/config.ini.template Message-ID: <20070513135108.D326D1E4006@bag.python.org> Author: erik.forsberg Date: Sun May 13 15:51:07 2007 New Revision: 55294 Added: tracker/instances/python-dev/config.ini.template Log: Provide a template for config.ini. Added: tracker/instances/python-dev/config.ini.template ============================================================================== --- (empty file) +++ tracker/instances/python-dev/config.ini.template Sun May 13 15:51:07 2007 @@ -0,0 +1,383 @@ +# Roundup issue tracker configuration file +# Autogenerated at Fri Nov 17 16:59:49 2006 + +# WARNING! Following options need adjustments: +# [mail]: domain, host +# [tracker]: web + +[main] + +# Database directory path. +# The path may be either absolute or relative +# to the directory containig this config file. +# Default: db +database = db + +# Path to the HTML templates directory. +# The path may be either absolute or relative +# to the directory containig this config file. +# Default: html +templates = html + +# Path to directory holding additional static files +# available via Web UI. This directory may contain +# sitewide images, CSS stylesheets etc. and is searched +# for these files prior to the TEMPLATES directory +# specified above. If this option is not set, all static +# files are taken from the TEMPLATES directory +# The path may be either absolute or relative +# to the directory containig this config file. +# Default: +static_files = + +# Email address that roundup will complain to if it runs into trouble. +# Default: roundup-admin +admin_email = roundup-admin + +# The 'dispatcher' is a role that can get notified +# of new items to the database. +# It is used by the ERROR_MESSAGES_TO config setting. +# Default: roundup-admin +dispatcher_email = roundup-admin + +# Additional text to include in the "name" part +# of the From: address used in nosy messages. +# If the sending user is "Foo Bar", the From: line +# is usually: "Foo Bar" +# the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so: +# "Foo Bar EMAIL_FROM_TAG" +# Default: +email_from_tag = + +# Roles that a user gets when they register with Web User Interface. +# This is a comma-separated string of role names (e.g. 'Admin,User'). +# Default: User +new_web_user_roles = User + +# Roles that a user gets when they register with Email Gateway. +# This is a comma-separated string of role names (e.g. 'Admin,User'). +# Default: User +new_email_user_roles = User + +# Send error message emails to the dispatcher, user, or both? +# The dispatcher is configured using the DISPATCHER_EMAIL setting. +# Default: user +error_messages_to = user + +# HTML version to generate. The templates are html4 by default. +# If you wish to make them xhtml, then you'll need to change this +# var to 'xhtml' too so all auto-generated HTML is compliant. +# Allowed values: html4, xhtml +# Default: html4 +html_version = xhtml + +# Default timezone offset, applied when user's timezone is not set. +# If pytz module is installed, value may be any valid +# timezone specification (e.g. EET or Europe/Warsaw). +# If pytz is not installed, value must be integer number +# giving local timezone offset from UTC in hours. +# Default: UTC +timezone = UTC + +# Register new users instantly, or require confirmation via +# email? +# Allowed values: yes, no +# Default: no +instant_registration = no + +# Offer registration confirmation by email or only through the web? +# Allowed values: yes, no +# Default: yes +email_registration_confirmation = yes + +# Additional stop-words for the full-text indexer specific to +# your tracker. See the indexer source for the default list of +# stop-words (eg. A,AND,ARE,AS,AT,BE,BUT,BY, ...) +# Allowed values: comma-separated list of words +# Default: +indexer_stopwords = + +# Defines the file creation mode mask. +# Default: 02 +umask = 02 + +[tracker] + +# A descriptive name for your roundup instance. +# Default: Roundup issue tracker +name = Tracker + +# The web address that the tracker is viewable at. +# This will be included in information sent to users of the tracker. +# The URL MUST include the cgi-bin part or anything else +# that is required to get to the home page of the tracker. +# You MUST include a trailing '/' in the URL. +# Default: NO DEFAULT +#web = NO DEFAULT +#web = http://psf.upfronthosting.co.za/roundup/tracker/ +web = http://localhost:9999/python-dev/ + +# Email address that mail to roundup should go to. +# Default: issue_tracker +email = issue_tracker + +# Default locale name for this tracker. +# If this option is not set, the language is determined +# by OS environment variable LANGUAGE, LC_ALL, LC_MESSAGES, +# or LANG, in that order of preference. +# Default: +language = + +[web] + +# Whether to use HTTP Basic Authentication, if present. +# Roundup will use either the REMOTE_USER or HTTP_AUTHORIZATION +# variables supplied by your web server (in that order). +# Set this option to 'no' if you do not wish to use HTTP Basic +# Authentication in your web interface. +# Allowed values: yes, no +# Default: yes +http_auth = yes + +# Whether to use HTTP Accept-Language, if present. +# Browsers send a language-region preference list. +# It's usually set in the client's browser or in their +# Operating System. +# Set this option to 'no' if you want to ignore it. +# Allowed values: yes, no +# Default: yes +use_browser_language = no + +# Setting this option makes Roundup display error tracebacks +# in the user's browser rather than emailing them to the +# tracker admin. +# Allowed values: yes, no +# Default: no +debug = no + +# Settings in this section are used by Postgresql and MySQL backends only +[rdbms] + +# Name of the database to use. +# Default: roundup +name = roundup + +# Database server host. +# Default: localhost +host = localhost + +# TCP port number of the database server. +# Postgresql usually resides on port 5432 (if any), +# for MySQL default port number is 3306. +# Leave this option empty to use backend default +# Default: +port = + +# Database user name that Roundup should use. +# Default: roundup +user = roundup + +# Database user password. +# Default: roundup +password = roundup + +# Name of the MySQL defaults file. +# Only used in MySQL connections. +# Default: ~/.my.cnf +read_default_file = ~/.my.cnf + +# Name of the group to use in the MySQL defaults file (.my.cnf). +# Only used in MySQL connections. +# Default: roundup +read_default_group = roundup + +[logging] + +# Path to configuration file for standard Python logging module. +# If this option is set, logging configuration is loaded +# from specified file; options 'filename' and 'level' +# in this section are ignored. +# The path may be either absolute or relative +# to the directory containig this config file. +# Default: +config = + +# Log file name for minimal logging facility built into Roundup. +# If no file name specified, log messages are written on stderr. +# If above 'config' option is set, this option has no effect. +# The path may be either absolute or relative +# to the directory containig this config file. +# Default: +filename = + +# Minimal severity level of messages written to log file. +# If above 'config' option is set, this option has no effect. +# Allowed values: DEBUG, INFO, WARNING, ERROR +# Default: ERROR +level = ERROR + +# Outgoing email options. +# Used for nozy messages and approval requests +[mail] + +# Domain name used for email addresses. +# Default: NO DEFAULT +#domain = NO DEFAULT + +# SMTP mail host that roundup will use to send mail +# Default: NO DEFAULT +#host = NO DEFAULT +host = localhost + +# SMTP login name. +# Set this if your mail host requires authenticated access. +# If username is not empty, password (below) MUST be set! +# Default: +username = + +# SMTP login password. +# Set this if your mail host requires authenticated access. +# Default: NO DEFAULT +#password = NO DEFAULT + +# If your SMTP mail host provides or requires TLS +# (Transport Layer Security) then set this option to 'yes'. +# Allowed values: yes, no +# Default: no +tls = no + +# If TLS is used, you may set this option to the name +# of a PEM formatted file that contains your private key. +# The path may be either absolute or relative +# to the directory containig this config file. +# Default: +tls_keyfile = + +# If TLS is used, you may set this option to the name +# of a PEM formatted certificate chain file. +# The path may be either absolute or relative +# to the directory containig this config file. +# Default: +tls_certfile = + +# Character set to encode email headers with. +# We use utf-8 by default, as it's the most flexible. +# Some mail readers (eg. Eudora) can't cope with that, +# so you might need to specify a more limited character set +# (eg. iso-8859-1). +# Default: utf-8 +charset = utf-8 + +# Setting this option makes Roundup to write all outgoing email +# messages to this file *instead* of sending them. +# This option has the same effect as environment variable SENDMAILDEBUG. +# Environment variable takes precedence. +# The path may be either absolute or relative +# to the directory containig this config file. +# Default: +debug = + +# Roundup Mail Gateway options +[mailgw] + +# Keep email citations when accepting messages. +# Setting this to "no" strips out "quoted" text from the message. +# Signatures are also stripped. +# Allowed values: yes, no +# Default: yes +keep_quoted_text = yes + +# Preserve the email body as is - that is, +# keep the citations _and_ signatures. +# Allowed values: yes, no +# Default: no +leave_body_unchanged = no + +# Default class to use in the mailgw +# if one isn't supplied in email subjects. +# To disable, leave the value blank. +# Default: issue +default_class = issue + +# Default locale name for the tracker mail gateway. +# If this option is not set, mail gateway will use +# the language of the tracker instance. +# Default: +language = + +# Controls the parsing of the [prefix] on subject +# lines in incoming emails. "strict" will return an +# error to the sender if the [prefix] is not recognised. +# "loose" will attempt to parse the [prefix] but just +# pass it through as part of the issue title if not +# recognised. "none" will always pass any [prefix] +# through as part of the issue title. +# Default: strict +subject_prefix_parsing = strict + +# Controls the parsing of the [suffix] on subject +# lines in incoming emails. "strict" will return an +# error to the sender if the [suffix] is not recognised. +# "loose" will attempt to parse the [suffix] but just +# pass it through as part of the issue title if not +# recognised. "none" will always pass any [suffix] +# through as part of the issue title. +# Default: strict +subject_suffix_parsing = strict + +# Defines the brackets used for delimiting the prefix and +# suffix in a subject line. The presence of "suffix" in +# the config option name is a historical artifact and may +# be ignored. +# Default: [] +subject_suffix_delimiters = [] + +# Controls matching of the incoming email subject line +# against issue titles in the case where there is no +# designator [prefix]. "never" turns off matching. +# "creation + interval" or "activity + interval" +# will match an issue for the interval after the issue's +# creation or last activity. The interval is a standard +# Roundup interval. +# Default: always +subject_content_match = always + +# Nosy messages sending +[nosy] + +# Send nosy messages to the author of the message. +# Allowed values: yes, no, new +# Default: no +messages_to_author = yes + +# Where to place the email signature. +# Allowed values: top, bottom, none +# Default: bottom +signature_position = bottom + +# Does the author of a message get placed on the nosy list +# automatically? If 'new' is used, then the author will +# only be added when a message creates a new issue. +# If 'yes', then the author will be added on followups too. +# If 'no', they're never added to the nosy. +# +# Allowed values: yes, no, new +# Default: new +add_author = yes + +# Do the recipients (To:, Cc:) of a message get placed on the +# nosy list? If 'new' is used, then the recipients will +# only be added when a message creates a new issue. +# If 'yes', then the recipients will be added on followups too. +# If 'no', they're never added to the nosy. +# +# Allowed values: yes, no, new +# Default: new +add_recipients = new + +# Controls the email sending from the nosy reactor. If +# "multiple" then a separate email is sent to each +# recipient. If "single" then a single email is sent with +# each recipient as a CC address. +# Default: single +email_sending = multiple From python-checkins at python.org Sun May 13 16:23:07 2007 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 13 May 2007 16:23:07 +0200 (CEST) Subject: [Python-checkins] r55295 - peps/trunk/pep-3123.txt Message-ID: <20070513142307.2ADA41E4006@bag.python.org> Author: martin.v.loewis Date: Sun May 13 16:23:03 2007 New Revision: 55295 Modified: peps/trunk/pep-3123.txt Log: Include implementation experience. Modified: peps/trunk/pep-3123.txt ============================================================================== --- peps/trunk/pep-3123.txt (original) +++ peps/trunk/pep-3123.txt Sun May 13 16:23:03 2007 @@ -106,11 +106,13 @@ accesses to ob_refcnt and ob_type MUST cast the object pointer to PyObject* (unless the pointer is already known to have that type), and SHOULD use the respective accessor macros. To simplify access to -ob_type, a macro:: +ob_type, ob_refcnt, and ob_size, macros:: - #define Py_Type(o) (((PyObject*)o)->ob_type) + #define Py_Type(o) (((PyObject*)(o))->ob_type) + #define Py_Refcnt(o) (((PyObject*)(o))->ob_refcnt) + #define Py_Size(o) (((PyVarObject*)(o))->ob_size) -is added. E.g. the code blocks:: +are added. E.g. the code blocks:: #define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type) @@ -121,13 +123,21 @@ #define PyList_CheckExact(op) (Py_Type(op) == &PyList_Type) return Py_Type(func)->tp_name; - + +For initialization of type objects, the current sequence:: + + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + +becomes incorrect, and must be replaced with + + PyVarObject_HEAD_INIT(NULL, 0) Compatibility with Python 2.6 ============================= To support modules that compile with both Python 2.6 and Python 3.0, -the Py_Type macro is added to Python 2.6. The macros Py_INCREF +the Py_* macros is added to Python 2.6. The macros Py_INCREF and Py_DECREF will be changed to cast their argument to PyObject\*, so that module authors can also explicitly declare the ob_base field in modules designed for Python 2.6. From python-checkins at python.org Sun May 13 22:45:09 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 13 May 2007 22:45:09 +0200 (CEST) Subject: [Python-checkins] r55297 - in python/trunk/Doc: lib/lib.tex lib/libamoeba.tex tut/tut.tex Message-ID: <20070513204509.A61641E4007@bag.python.org> Author: neal.norwitz Date: Sun May 13 22:45:05 2007 New Revision: 55297 Removed: python/trunk/Doc/lib/libamoeba.tex Modified: python/trunk/Doc/lib/lib.tex python/trunk/Doc/tut/tut.tex Log: Remove Amoeba doc which was removed in version 1.0! according to Misc/HISTORY. Hopefully Guido won't shed a tear. :-) Modified: python/trunk/Doc/lib/lib.tex ============================================================================== --- python/trunk/Doc/lib/lib.tex (original) +++ python/trunk/Doc/lib/lib.tex Sun May 13 22:45:05 2007 @@ -431,8 +431,6 @@ % OTHER PLATFORM-SPECIFIC STUFF % ============= -%\input{libamoeba} % AMOEBA ONLY - %\input{libstdwin} % STDWIN ONLY \input{libsgi} % SGI IRIX ONLY Deleted: /python/trunk/Doc/lib/libamoeba.tex ============================================================================== --- /python/trunk/Doc/lib/libamoeba.tex Sun May 13 22:45:05 2007 +++ (empty file) @@ -1,131 +0,0 @@ -\chapter{Amoeba Specific Services} - -\section{\module{amoeba} --- - Amoeba system support} - -\declaremodule{builtin}{amoeba} - \platform{Amoeba} -\modulesynopsis{Functions for the Amoeba operating system.} - - -This module provides some object types and operations useful for -Amoeba applications. It is only available on systems that support -Amoeba operations. RPC errors and other Amoeba errors are reported as -the exception \code{amoeba.error = 'amoeba.error'}. - -The module \module{amoeba} defines the following items: - -\begin{funcdesc}{name_append}{path, cap} -Stores a capability in the Amoeba directory tree. -Arguments are the pathname (a string) and the capability (a capability -object as returned by -\function{name_lookup()}). -\end{funcdesc} - -\begin{funcdesc}{name_delete}{path} -Deletes a capability from the Amoeba directory tree. -Argument is the pathname. -\end{funcdesc} - -\begin{funcdesc}{name_lookup}{path} -Looks up a capability. -Argument is the pathname. -Returns a -\dfn{capability} -object, to which various interesting operations apply, described below. -\end{funcdesc} - -\begin{funcdesc}{name_replace}{path, cap} -Replaces a capability in the Amoeba directory tree. -Arguments are the pathname and the new capability. -(This differs from -\function{name_append()} -in the behavior when the pathname already exists: -\function{name_append()} -finds this an error while -\function{name_replace()} -allows it, as its name suggests.) -\end{funcdesc} - -\begin{datadesc}{capv} -A table representing the capability environment at the time the -interpreter was started. -(Alas, modifying this table does not affect the capability environment -of the interpreter.) -For example, -\code{amoeba.capv['ROOT']} -is the capability of your root directory, similar to -\code{getcap("ROOT")} -in C. -\end{datadesc} - -\begin{excdesc}{error} -The exception raised when an Amoeba function returns an error. -The value accompanying this exception is a pair containing the numeric -error code and the corresponding string, as returned by the C function -\cfunction{err_why()}. -\end{excdesc} - -\begin{funcdesc}{timeout}{msecs} -Sets the transaction timeout, in milliseconds. -Returns the previous timeout. -Initially, the timeout is set to 2 seconds by the Python interpreter. -\end{funcdesc} - -\subsection{Capability Operations} - -Capabilities are written in a convenient \ASCII{} format, also used by the -Amoeba utilities -\emph{c2a}(U) -and -\emph{a2c}(U). -For example: - -\begin{verbatim} ->>> amoeba.name_lookup('/profile/cap') -aa:1c:95:52:6a:fa/14(ff)/8e:ba:5b:8:11:1a ->>> -\end{verbatim} -% -The following methods are defined for capability objects. - -\begin{methoddesc}[capability]{dir_list}{} -Returns a list of the names of the entries in an Amoeba directory. -\end{methoddesc} - -\begin{methoddesc}[capability]{b_read}{offset, maxsize} -Reads (at most) -\var{maxsize} -bytes from a bullet file at offset -\var{offset.} -The data is returned as a string. -EOF is reported as an empty string. -\end{methoddesc} - -\begin{methoddesc}[capability]{b_size}{} -Returns the size of a bullet file. -\end{methoddesc} - -\begin{methoddesc}[capability]{dir_append}{} -\funcline{dir_delete}{} -\funcline{dir_lookup}{} -\funcline{dir_replace}{} -Like the corresponding -\samp{name_}* -functions, but with a path relative to the capability. -(For paths beginning with a slash the capability is ignored, since this -is the defined semantics for Amoeba.) -\end{methoddesc} - -\begin{methoddesc}[capability]{std_info}{} -Returns the standard info string of the object. -\end{methoddesc} - -\begin{methoddesc}[capability]{tod_gettime}{} -Returns the time (in seconds since the Epoch, in UCT, as for \POSIX) from -a time server. -\end{methoddesc} - -\begin{methoddesc}[capability]{tod_settime}{t} -Sets the time kept by a time server. -\end{methoddesc} Modified: python/trunk/Doc/tut/tut.tex ============================================================================== --- python/trunk/Doc/tut/tut.tex (original) +++ python/trunk/Doc/tut/tut.tex Sun May 13 22:45:05 2007 @@ -2629,8 +2629,8 @@ efficiency or to provide access to operating system primitives such as system calls. The set of such modules is a configuration option which also depends on the underlying platform For example, -the \module{amoeba} module is only provided on systems that somehow -support Amoeba primitives. One particular module deserves some +the \module{winreg} module is only provided on Windows systems. +One particular module deserves some attention: \ulink{\module{sys}}{../lib/module-sys.html}% \refstmodindex{sys}, which is built into every Python interpreter. The variables \code{sys.ps1} and From python-checkins at python.org Sun May 13 22:54:28 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 13 May 2007 22:54:28 +0200 (CEST) Subject: [Python-checkins] r55298 - in python/trunk: Demo/threads/README Doc/Makefile.deps Doc/lib/lib.tex Doc/lib/libstdwin.tex Doc/tools/listmodules Misc/cheatsheet Message-ID: <20070513205428.0C9F21E4007@bag.python.org> Author: neal.norwitz Date: Sun May 13 22:54:19 2007 New Revision: 55298 Removed: python/trunk/Doc/lib/libstdwin.tex Modified: python/trunk/Demo/threads/README python/trunk/Doc/Makefile.deps python/trunk/Doc/lib/lib.tex python/trunk/Doc/tools/listmodules python/trunk/Misc/cheatsheet Log: Remove references to stdwin which was removed long ago. Modified: python/trunk/Demo/threads/README ============================================================================== --- python/trunk/Demo/threads/README (original) +++ python/trunk/Demo/threads/README Sun May 13 22:54:19 2007 @@ -3,10 +3,8 @@ These are mostly "proof of concept" type applications: Generator.py Generator class implemented with threads. -find.py Parallelized "find(1)" (looks for directories). sync.py Condition variables primitives by Tim Peters. telnet.py Version of ../sockets/telnet.py using threads. -wpi.py Version of ../scripts/pi.py using threads (needs stdwin). Coroutine.py Coroutines using threads, by Tim Peters (22 May 94) fcmp.py Example of above, by Tim Modified: python/trunk/Doc/Makefile.deps ============================================================================== --- python/trunk/Doc/Makefile.deps (original) +++ python/trunk/Doc/Makefile.deps Sun May 13 22:54:19 2007 @@ -209,7 +209,6 @@ lib/libmd5.tex \ lib/libsha.tex \ lib/libhmac.tex \ - lib/libstdwin.tex \ lib/libsgi.tex \ lib/libal.tex \ lib/libcd.tex \ Modified: python/trunk/Doc/lib/lib.tex ============================================================================== --- python/trunk/Doc/lib/lib.tex (original) +++ python/trunk/Doc/lib/lib.tex Sun May 13 22:54:19 2007 @@ -431,8 +431,6 @@ % OTHER PLATFORM-SPECIFIC STUFF % ============= -%\input{libstdwin} % STDWIN ONLY - \input{libsgi} % SGI IRIX ONLY \input{libal} \input{libcd} Deleted: /python/trunk/Doc/lib/libstdwin.tex ============================================================================== --- /python/trunk/Doc/lib/libstdwin.tex Sun May 13 22:54:19 2007 +++ (empty file) @@ -1,832 +0,0 @@ -\chapter{Standard Windowing Interface} - -The modules in this chapter are available only on those systems where -the STDWIN library is available. STDWIN runs on \UNIX{} under X11 and -on the Macintosh. See CWI report CS-R8817. - -\warning{Using STDWIN is not recommended for new -applications. It has never been ported to Microsoft Windows or -Windows NT, and for X11 or the Macintosh it lacks important -functionality --- in particular, it has no tools for the construction -of dialogs. For most platforms, alternative, native solutions exist -(though none are currently documented in this manual): Tkinter for -\UNIX{} under X11, native Xt with Motif or Athena widgets for \UNIX{} -under X11, Win32 for Windows and Windows NT, and a collection of -native toolkit interfaces for the Macintosh.} - - -\section{\module{stdwin} --- - Platform-independent Graphical User Interface System} - -\declaremodule{builtin}{stdwin} -\modulesynopsis{Older graphical user interface system for X11 and Macintosh.} - - -This module defines several new object types and functions that -provide access to the functionality of STDWIN. - -On \UNIX{} running X11, it can only be used if the \envvar{DISPLAY} -environment variable is set or an explicit -\programopt{-display} \var{displayname} argument is passed to the -Python interpreter. - -Functions have names that usually resemble their C STDWIN counterparts -with the initial `w' dropped. Points are represented by pairs of -integers; rectangles by pairs of points. For a complete description -of STDWIN please refer to the documentation of STDWIN for C -programmers (aforementioned CWI report). - -\subsection{Functions Defined in Module \module{stdwin}} -\nodename{STDWIN Functions} - -The following functions are defined in the \module{stdwin} module: - -\begin{funcdesc}{open}{title} -Open a new window whose initial title is given by the string argument. -Return a window object; window object methods are described -below.\footnote{ - The Python version of STDWIN does not support draw procedures; - all drawing requests are reported as draw events.} -\end{funcdesc} - -\begin{funcdesc}{getevent}{} -Wait for and return the next event. -An event is returned as a triple: the first element is the event -type, a small integer; the second element is the window object to which -the event applies, or -\code{None} -if it applies to no window in particular; -the third element is type-dependent. -Names for event types and command codes are defined in the standard -module \refmodule{stdwinevents}. -\end{funcdesc} - -\begin{funcdesc}{pollevent}{} -Return the next event, if one is immediately available. -If no event is available, return \code{()}. -\end{funcdesc} - -\begin{funcdesc}{getactive}{} -Return the window that is currently active, or \code{None} if no -window is currently active. (This can be emulated by monitoring -WE_ACTIVATE and WE_DEACTIVATE events.) -\end{funcdesc} - -\begin{funcdesc}{listfontnames}{pattern} -Return the list of font names in the system that match the pattern (a -string). The pattern should normally be \code{'*'}; returns all -available fonts. If the underlying window system is X11, other -patterns follow the standard X11 font selection syntax (as used e.g. -in resource definitions), i.e. the wildcard character \code{'*'} -matches any sequence of characters (including none) and \code{'?'} -matches any single character. -On the Macintosh this function currently returns an empty list. -\end{funcdesc} - -\begin{funcdesc}{setdefscrollbars}{hflag, vflag} -Set the flags controlling whether subsequently opened windows will -have horizontal and/or vertical scroll bars. -\end{funcdesc} - -\begin{funcdesc}{setdefwinpos}{h, v} -Set the default window position for windows opened subsequently. -\end{funcdesc} - -\begin{funcdesc}{setdefwinsize}{width, height} -Set the default window size for windows opened subsequently. -\end{funcdesc} - -\begin{funcdesc}{getdefscrollbars}{} -Return the flags controlling whether subsequently opened windows will -have horizontal and/or vertical scroll bars. -\end{funcdesc} - -\begin{funcdesc}{getdefwinpos}{} -Return the default window position for windows opened subsequently. -\end{funcdesc} - -\begin{funcdesc}{getdefwinsize}{} -Return the default window size for windows opened subsequently. -\end{funcdesc} - -\begin{funcdesc}{getscrsize}{} -Return the screen size in pixels. -\end{funcdesc} - -\begin{funcdesc}{getscrmm}{} -Return the screen size in millimetres. -\end{funcdesc} - -\begin{funcdesc}{fetchcolor}{colorname} -Return the pixel value corresponding to the given color name. -Return the default foreground color for unknown color names. -Hint: the following code tests whether you are on a machine that -supports more than two colors: -\begin{verbatim} -if stdwin.fetchcolor('black') <> \ - stdwin.fetchcolor('red') <> \ - stdwin.fetchcolor('white'): - print 'color machine' -else: - print 'monochrome machine' -\end{verbatim} -\end{funcdesc} - -\begin{funcdesc}{setfgcolor}{pixel} -Set the default foreground color. -This will become the default foreground color of windows opened -subsequently, including dialogs. -\end{funcdesc} - -\begin{funcdesc}{setbgcolor}{pixel} -Set the default background color. -This will become the default background color of windows opened -subsequently, including dialogs. -\end{funcdesc} - -\begin{funcdesc}{getfgcolor}{} -Return the pixel value of the current default foreground color. -\end{funcdesc} - -\begin{funcdesc}{getbgcolor}{} -Return the pixel value of the current default background color. -\end{funcdesc} - -\begin{funcdesc}{setfont}{fontname} -Set the current default font. -This will become the default font for windows opened subsequently, -and is also used by the text measuring functions \function{textwidth()}, -\function{textbreak()}, \function{lineheight()} and -\function{baseline()} below. This accepts two more optional -parameters, size and style: Size is the font size (in `points'). -Style is a single character specifying the style, as follows: -\code{'b'} = bold, -\code{'i'} = italic, -\code{'o'} = bold + italic, -\code{'u'} = underline; -default style is roman. -Size and style are ignored under X11 but used on the Macintosh. -(Sorry for all this complexity --- a more uniform interface is being designed.) -\end{funcdesc} - -\begin{funcdesc}{menucreate}{title} -Create a menu object referring to a global menu (a menu that appears in -all windows). -Methods of menu objects are described below. -Note: normally, menus are created locally; see the window method -\method{menucreate()} below. -\warning{The menu only appears in a window as long as the object -returned by this call exists.} -\end{funcdesc} - -\begin{funcdesc}{newbitmap}{width, height} -Create a new bitmap object of the given dimensions. -Methods of bitmap objects are described below. -Not available on the Macintosh. -\end{funcdesc} - -\begin{funcdesc}{fleep}{} -Cause a beep or bell (or perhaps a `visual bell' or flash, hence the -name). -\end{funcdesc} - -\begin{funcdesc}{message}{string} -Display a dialog box containing the string. -The user must click OK before the function returns. -\end{funcdesc} - -\begin{funcdesc}{askync}{prompt, default} -Display a dialog that prompts the user to answer a question with yes or -no. Return 0 for no, 1 for yes. If the user hits the Return key, the -default (which must be 0 or 1) is returned. If the user cancels the -dialog, \exception{KeyboardInterrupt} is raised. -\end{funcdesc} - -\begin{funcdesc}{askstr}{prompt, default} -Display a dialog that prompts the user for a string. -If the user hits the Return key, the default string is returned. -If the user cancels the dialog, \exception{KeyboardInterrupt} is -raised. -\end{funcdesc} - -\begin{funcdesc}{askfile}{prompt, default, new} -Ask the user to specify a filename. If \var{new} is zero it must be -an existing file; otherwise, it must be a new file. If the user -cancels the dialog, \exception{KeyboardInterrupt} is raised. -\end{funcdesc} - -\begin{funcdesc}{setcutbuffer}{i, string} -Store the string in the system's cut buffer number \var{i}, where it -can be found (for pasting) by other applications. On X11, there are 8 -cut buffers (numbered 0..7). Cut buffer number 0 is the `clipboard' -on the Macintosh. -\end{funcdesc} - -\begin{funcdesc}{getcutbuffer}{i} -Return the contents of the system's cut buffer number \var{i}. -\end{funcdesc} - -\begin{funcdesc}{rotatecutbuffers}{n} -On X11, rotate the 8 cut buffers by \var{n}. Ignored on the -Macintosh. -\end{funcdesc} - -\begin{funcdesc}{getselection}{i} -Return X11 selection number \var{i.} Selections are not cut buffers. -Selection numbers are defined in module \refmodule{stdwinevents}. -Selection \constant{WS_PRIMARY} is the \dfn{primary} selection (used -by \program{xterm}, for instance); selection \constant{WS_SECONDARY} -is the \dfn{secondary} selection; selection \constant{WS_CLIPBOARD} is -the \dfn{clipboard} selection (used by \program{xclipboard}). On the -Macintosh, this always returns an empty string. -\end{funcdesc} - -\begin{funcdesc}{resetselection}{i} -Reset selection number \var{i}, if this process owns it. (See window -method \method{setselection()}). -\end{funcdesc} - -\begin{funcdesc}{baseline}{} -Return the baseline of the current font (defined by STDWIN as the -vertical distance between the baseline and the top of the -characters). -\end{funcdesc} - -\begin{funcdesc}{lineheight}{} -Return the total line height of the current font. -\end{funcdesc} - -\begin{funcdesc}{textbreak}{str, width} -Return the number of characters of the string that fit into a space of -\var{width} -bits wide when drawn in the current font. -\end{funcdesc} - -\begin{funcdesc}{textwidth}{str} -Return the width in bits of the string when drawn in the current font. -\end{funcdesc} - -\begin{funcdesc}{connectionnumber}{} -\funcline{fileno}{} -(X11 under \UNIX{} only) Return the ``connection number'' used by the -underlying X11 implementation. (This is normally the file number of -the socket.) Both functions return the same value; -\method{connectionnumber()} is named after the corresponding function in -X11 and STDWIN, while \method{fileno()} makes it possible to use the -\module{stdwin} module as a ``file'' object parameter to -\function{select.select()}. Note that if \constant{select()} implies that -input is possible on \module{stdwin}, this does not guarantee that an -event is ready --- it may be some internal communication going on -between the X server and the client library. Thus, you should call -\function{stdwin.pollevent()} until it returns \code{None} to check for -events if you don't want your program to block. Because of internal -buffering in X11, it is also possible that \function{stdwin.pollevent()} -returns an event while \function{select()} does not find \module{stdwin} to -be ready, so you should read any pending events with -\function{stdwin.pollevent()} until it returns \code{None} before entering -a blocking \function{select()} call. -\withsubitem{(in module select)}{\ttindex{select()}} -\end{funcdesc} - -\subsection{Window Objects} -\nodename{STDWIN Window Objects} - -Window objects are created by \function{stdwin.open()}. They are closed -by their \method{close()} method or when they are garbage-collected. -Window objects have the following methods: - -\begin{methoddesc}[window]{begindrawing}{} -Return a drawing object, whose methods (described below) allow drawing -in the window. -\end{methoddesc} - -\begin{methoddesc}[window]{change}{rect} -Invalidate the given rectangle; this may cause a draw event. -\end{methoddesc} - -\begin{methoddesc}[window]{gettitle}{} -Returns the window's title string. -\end{methoddesc} - -\begin{methoddesc}[window]{getdocsize}{} -\begin{sloppypar} -Return a pair of integers giving the size of the document as set by -\method{setdocsize()}. -\end{sloppypar} -\end{methoddesc} - -\begin{methoddesc}[window]{getorigin}{} -Return a pair of integers giving the origin of the window with respect -to the document. -\end{methoddesc} - -\begin{methoddesc}[window]{gettitle}{} -Return the window's title string. -\end{methoddesc} - -\begin{methoddesc}[window]{getwinsize}{} -Return a pair of integers giving the size of the window. -\end{methoddesc} - -\begin{methoddesc}[window]{getwinpos}{} -Return a pair of integers giving the position of the window's upper -left corner (relative to the upper left corner of the screen). -\end{methoddesc} - -\begin{methoddesc}[window]{menucreate}{title} -Create a menu object referring to a local menu (a menu that appears -only in this window). -Methods of menu objects are described below. -\warning{The menu only appears as long as the object -returned by this call exists.} -\end{methoddesc} - -\begin{methoddesc}[window]{scroll}{rect, point} -Scroll the given rectangle by the vector given by the point. -\end{methoddesc} - -\begin{methoddesc}[window]{setdocsize}{point} -Set the size of the drawing document. -\end{methoddesc} - -\begin{methoddesc}[window]{setorigin}{point} -Move the origin of the window (its upper left corner) -to the given point in the document. -\end{methoddesc} - -\begin{methoddesc}[window]{setselection}{i, str} -Attempt to set X11 selection number \var{i} to the string \var{str}. -(See \module{stdwin} function \function{getselection()} for the -meaning of \var{i}.) Return true if it succeeds. -If succeeds, the window ``owns'' the selection until -(a) another application takes ownership of the selection; or -(b) the window is deleted; or -(c) the application clears ownership by calling -\function{stdwin.resetselection(\var{i})}. When another application -takes ownership of the selection, a \constant{WE_LOST_SEL} event is -received for no particular window and with the selection number as -detail. Ignored on the Macintosh. -\end{methoddesc} - -\begin{methoddesc}[window]{settimer}{dsecs} -Schedule a timer event for the window in \code{\var{dsecs}/10} -seconds. -\end{methoddesc} - -\begin{methoddesc}[window]{settitle}{title} -Set the window's title string. -\end{methoddesc} - -\begin{methoddesc}[window]{setwincursor}{name} -\begin{sloppypar} -Set the window cursor to a cursor of the given name. It raises -\exception{RuntimeError} if no cursor of the given name exists. -Suitable names include -\code{'ibeam'}, -\code{'arrow'}, -\code{'cross'}, -\code{'watch'} -and -\code{'plus'}. -On X11, there are many more (see \code{}). -\end{sloppypar} -\end{methoddesc} - -\begin{methoddesc}[window]{setwinpos}{h, v} -Set the position of the window's upper left corner (relative to -the upper left corner of the screen). -\end{methoddesc} - -\begin{methoddesc}[window]{setwinsize}{width, height} -Set the window's size. -\end{methoddesc} - -\begin{methoddesc}[window]{show}{rect} -Try to ensure that the given rectangle of the document is visible in -the window. -\end{methoddesc} - -\begin{methoddesc}[window]{textcreate}{rect} -Create a text-edit object in the document at the given rectangle. -Methods of text-edit objects are described below. -\end{methoddesc} - -\begin{methoddesc}[window]{setactive}{} -Attempt to make this window the active window. If successful, this -will generate a WE_ACTIVATE event (and a WE_DEACTIVATE event in case -another window in this application became inactive). -\end{methoddesc} - -\begin{methoddesc}[window]{close}{} -Discard the window object. It should not be used again. -\end{methoddesc} - -\subsection{Drawing Objects} - -Drawing objects are created exclusively by the window method -\method{begindrawing()}. Only one drawing object can exist at any -given time; the drawing object must be deleted to finish drawing. No -drawing object may exist when \function{stdwin.getevent()} is called. -Drawing objects have the following methods: - -\begin{methoddesc}[drawing]{box}{rect} -Draw a box just inside a rectangle. -\end{methoddesc} - -\begin{methoddesc}[drawing]{circle}{center, radius} -Draw a circle with given center point and radius. -\end{methoddesc} - -\begin{methoddesc}[drawing]{elarc}{center, (rh, rv), (a1, a2)} -Draw an elliptical arc with given center point. -\code{(\var{rh}, \var{rv})} -gives the half sizes of the horizontal and vertical radii. -\code{(\var{a1}, \var{a2})} -gives the angles (in degrees) of the begin and end points. -0 degrees is at 3 o'clock, 90 degrees is at 12 o'clock. -\end{methoddesc} - -\begin{methoddesc}[drawing]{erase}{rect} -Erase a rectangle. -\end{methoddesc} - -\begin{methoddesc}[drawing]{fillcircle}{center, radius} -Draw a filled circle with given center point and radius. -\end{methoddesc} - -\begin{methoddesc}[drawing]{fillelarc}{center, (rh, rv), (a1, a2)} -Draw a filled elliptical arc; arguments as for \method{elarc()}. -\end{methoddesc} - -\begin{methoddesc}[drawing]{fillpoly}{points} -Draw a filled polygon given by a list (or tuple) of points. -\end{methoddesc} - -\begin{methoddesc}[drawing]{invert}{rect} -Invert a rectangle. -\end{methoddesc} - -\begin{methoddesc}[drawing]{line}{p1, p2} -Draw a line from point -\var{p1} -to -\var{p2}. -\end{methoddesc} - -\begin{methoddesc}[drawing]{paint}{rect} -Fill a rectangle. -\end{methoddesc} - -\begin{methoddesc}[drawing]{poly}{points} -Draw the lines connecting the given list (or tuple) of points. -\end{methoddesc} - -\begin{methoddesc}[drawing]{shade}{rect, percent} -Fill a rectangle with a shading pattern that is about -\var{percent} -percent filled. -\end{methoddesc} - -\begin{methoddesc}[drawing]{text}{p, str} -Draw a string starting at point p (the point specifies the -top left coordinate of the string). -\end{methoddesc} - -\begin{methoddesc}[drawing]{xorcircle}{center, radius} -\funcline{xorelarc}{center, (rh, rv), (a1, a2)} -\funcline{xorline}{p1, p2} -\funcline{xorpoly}{points} -Draw a circle, an elliptical arc, a line or a polygon, respectively, -in XOR mode. -\end{methoddesc} - -\begin{methoddesc}[drawing]{setfgcolor}{} -\funcline{setbgcolor}{} -\funcline{getfgcolor}{} -\funcline{getbgcolor}{} -These functions are similar to the corresponding functions described -above for the \module{stdwin} -module, but affect or return the colors currently used for drawing -instead of the global default colors. -When a drawing object is created, its colors are set to the window's -default colors, which are in turn initialized from the global default -colors when the window is created. -\end{methoddesc} - -\begin{methoddesc}[drawing]{setfont}{} -\funcline{baseline}{} -\funcline{lineheight}{} -\funcline{textbreak}{} -\funcline{textwidth}{} -These functions are similar to the corresponding functions described -above for the \module{stdwin} -module, but affect or use the current drawing font instead of -the global default font. -When a drawing object is created, its font is set to the window's -default font, which is in turn initialized from the global default -font when the window is created. -\end{methoddesc} - -\begin{methoddesc}[drawing]{bitmap}{point, bitmap, mask} -Draw the \var{bitmap} with its top left corner at \var{point}. -If the optional \var{mask} argument is present, it should be either -the same object as \var{bitmap}, to draw only those bits that are set -in the bitmap, in the foreground color, or \code{None}, to draw all -bits (ones are drawn in the foreground color, zeros in the background -color). -Not available on the Macintosh. -\end{methoddesc} - -\begin{methoddesc}[drawing]{cliprect}{rect} -Set the ``clipping region'' to a rectangle. -The clipping region limits the effect of all drawing operations, until -it is changed again or until the drawing object is closed. When a -drawing object is created the clipping region is set to the entire -window. When an object to be drawn falls partly outside the clipping -region, the set of pixels drawn is the intersection of the clipping -region and the set of pixels that would be drawn by the same operation -in the absence of a clipping region. -\end{methoddesc} - -\begin{methoddesc}[drawing]{noclip}{} -Reset the clipping region to the entire window. -\end{methoddesc} - -\begin{methoddesc}[drawing]{close}{} -\funcline{enddrawing}{} -Discard the drawing object. It should not be used again. -\end{methoddesc} - -\subsection{Menu Objects} - -A menu object represents a menu. -The menu is destroyed when the menu object is deleted. -The following methods are defined: - - -\begin{methoddesc}[menu]{additem}{text, shortcut} -Add a menu item with given text. -The shortcut must be a string of length 1, or omitted (to specify no -shortcut). -\end{methoddesc} - -\begin{methoddesc}[menu]{setitem}{i, text} -Set the text of item number \var{i}. -\end{methoddesc} - -\begin{methoddesc}[menu]{enable}{i, flag} -Enable or disables item \var{i}. -\end{methoddesc} - -\begin{methoddesc}[menu]{check}{i, flag} -Set or clear the \dfn{check mark} for item \var{i}. -\end{methoddesc} - -\begin{methoddesc}[menu]{close}{} -Discard the menu object. It should not be used again. -\end{methoddesc} - -\subsection{Bitmap Objects} - -A bitmap represents a rectangular array of bits. -The top left bit has coordinate (0, 0). -A bitmap can be drawn with the \method{bitmap()} method of a drawing object. -Bitmaps are currently not available on the Macintosh. - -The following methods are defined: - - -\begin{methoddesc}[bitmap]{getsize}{} -Return a tuple representing the width and height of the bitmap. -(This returns the values that have been passed to the -\function{newbitmap()} function.) -\end{methoddesc} - -\begin{methoddesc}[bitmap]{setbit}{point, bit} -Set the value of the bit indicated by \var{point} to \var{bit}. -\end{methoddesc} - -\begin{methoddesc}[bitmap]{getbit}{point} -Return the value of the bit indicated by \var{point}. -\end{methoddesc} - -\begin{methoddesc}[bitmap]{close}{} -Discard the bitmap object. It should not be used again. -\end{methoddesc} - -\subsection{Text-edit Objects} - -A text-edit object represents a text-edit block. -For semantics, see the STDWIN documentation for \C{} programmers. -The following methods exist: - - -\begin{methoddesc}[text-edit]{arrow}{code} -Pass an arrow event to the text-edit block. -The \var{code} must be one of \constant{WC_LEFT}, \constant{WC_RIGHT}, -\constant{WC_UP} or \constant{WC_DOWN} (see module -\refmodule{stdwinevents}). -\end{methoddesc} - -\begin{methoddesc}[text-edit]{draw}{rect} -Pass a draw event to the text-edit block. -The rectangle specifies the redraw area. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{event}{type, window, detail} -Pass an event gotten from -\function{stdwin.getevent()} -to the text-edit block. -Return true if the event was handled. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{getfocus}{} -Return 2 integers representing the start and end positions of the -focus, usable as slice indices on the string returned by -\method{gettext()}. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{getfocustext}{} -Return the text in the focus. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{getrect}{} -Return a rectangle giving the actual position of the text-edit block. -(The bottom coordinate may differ from the initial position because -the block automatically shrinks or grows to fit.) -\end{methoddesc} - -\begin{methoddesc}[text-edit]{gettext}{} -Return the entire text buffer. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{move}{rect} -Specify a new position for the text-edit block in the document. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{replace}{str} -Replace the text in the focus by the given string. -The new focus is an insert point at the end of the string. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{setfocus}{i, j} -Specify the new focus. -Out-of-bounds values are silently clipped. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{settext}{str} -Replace the entire text buffer by the given string and set the focus -to \code{(0, 0)}. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{setview}{rect} -Set the view rectangle to \var{rect}. If \var{rect} is \code{None}, -viewing mode is reset. In viewing mode, all output from the text-edit -object is clipped to the viewing rectangle. This may be useful to -implement your own scrolling text subwindow. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{close}{} -Discard the text-edit object. It should not be used again. -\end{methoddesc} - -\subsection{Example} -\nodename{STDWIN Example} - -Here is a minimal example of using STDWIN in Python. -It creates a window and draws the string ``Hello world'' in the top -left corner of the window. -The window will be correctly redrawn when covered and re-exposed. -The program quits when the close icon or menu item is requested. - -\begin{verbatim} -import stdwin -from stdwinevents import * - -def main(): - mywin = stdwin.open('Hello') - # - while 1: - (type, win, detail) = stdwin.getevent() - if type == WE_DRAW: - draw = win.begindrawing() - draw.text((0, 0), 'Hello, world') - del draw - elif type == WE_CLOSE: - break - -main() -\end{verbatim} - - -\section{\module{stdwinevents} --- - Constants for use with \module{stdwin}} - -\declaremodule{standard}{stdwinevents} -\modulesynopsis{Constant definitions for use with \module{stdwin}} - - -This module defines constants used by STDWIN for event types -(\constant{WE_ACTIVATE} etc.), command codes (\constant{WC_LEFT} etc.) -and selection types (\constant{WS_PRIMARY} etc.). -Read the file for details. -Suggested usage is - -\begin{verbatim} ->>> from stdwinevents import * ->>> -\end{verbatim} - - -\section{\module{rect} --- - Functions for use with \module{stdwin}} - -\declaremodule{standard}{rect} -\modulesynopsis{Geometry-related utility function for use with - \module{stdwin}.} - - -This module contains useful operations on rectangles. -A rectangle is defined as in module \refmodule{stdwin}: -a pair of points, where a point is a pair of integers. -For example, the rectangle - -\begin{verbatim} -(10, 20), (90, 80) -\end{verbatim} - -is a rectangle whose left, top, right and bottom edges are 10, 20, 90 -and 80, respectively. Note that the positive vertical axis points -down (as in \refmodule{stdwin}). - -The module defines the following objects: - -\begin{excdesc}{error} -The exception raised by functions in this module when they detect an -error. The exception argument is a string describing the problem in -more detail. -\end{excdesc} - -\begin{datadesc}{empty} -The rectangle returned when some operations return an empty result. -This makes it possible to quickly check whether a result is empty: - -\begin{verbatim} ->>> import rect ->>> r1 = (10, 20), (90, 80) ->>> r2 = (0, 0), (10, 20) ->>> r3 = rect.intersect([r1, r2]) ->>> if r3 is rect.empty: print 'Empty intersection' -Empty intersection ->>> -\end{verbatim} -\end{datadesc} - -\begin{funcdesc}{is_empty}{r} -Returns true if the given rectangle is empty. -A rectangle -\code{(\var{left}, \var{top}), (\var{right}, \var{bottom})} -is empty if -\begin{math}\var{left} \geq \var{right}\end{math} or -\begin{math}\var{top} \geq \var{bottom}\end{math}. -\end{funcdesc} - -\begin{funcdesc}{intersect}{list} -Returns the intersection of all rectangles in the list argument. -It may also be called with a tuple argument. Raises -\exception{rect.error} if the list is empty. Returns -\constant{rect.empty} if the intersection of the rectangles is empty. -\end{funcdesc} - -\begin{funcdesc}{union}{list} -Returns the smallest rectangle that contains all non-empty rectangles in -the list argument. It may also be called with a tuple argument or -with two or more rectangles as arguments. Returns -\constant{rect.empty} if the list is empty or all its rectangles are -empty. -\end{funcdesc} - -\begin{funcdesc}{pointinrect}{point, rect} -Returns true if the point is inside the rectangle. By definition, a -point \code{(\var{h}, \var{v})} is inside a rectangle -\code{(\var{left}, \var{top}), (\var{right}, \var{bottom})} if -\begin{math}\var{left} \leq \var{h} < \var{right}\end{math} and -\begin{math}\var{top} \leq \var{v} < \var{bottom}\end{math}. -\end{funcdesc} - -\begin{funcdesc}{inset}{rect, (dh, dv)} -Returns a rectangle that lies inside the \var{rect} argument by -\var{dh} pixels horizontally and \var{dv} pixels vertically. If -\var{dh} or \var{dv} is negative, the result lies outside \var{rect}. -\end{funcdesc} - -\begin{funcdesc}{rect2geom}{rect} -Converts a rectangle to geometry representation: -\code{(\var{left}, \var{top}), (\var{width}, \var{height})}. -\end{funcdesc} - -\begin{funcdesc}{geom2rect}{geom} -Converts a rectangle given in geometry representation back to the -standard rectangle representation -\code{(\var{left}, \var{top}), (\var{right}, \var{bottom})}. -\end{funcdesc} Modified: python/trunk/Doc/tools/listmodules ============================================================================== --- python/trunk/Doc/tools/listmodules (original) +++ python/trunk/Doc/tools/listmodules Sun May 13 22:54:19 2007 @@ -34,12 +34,11 @@ import glob import os import re -import string import sys -REMOVE_DIRS = ["dos-8x3", "encodings", "distutils", - "lib-old", "lib-stdwin", "test"] +REMOVE_DIRS = ["encodings", "distutils", + "lib-old", ""test"] def main(): @@ -156,17 +155,17 @@ else: modules = modules_by_name.keys() modules.sort() - print string.join(modules, "\n") + print "\n".join(modules) def ignore_from_modulelist(data, ignore_dict): - for name in string.split(data): + for name in data.split(): ignore_dict[name] = name def ignore_from_idx(data, ignore_dict): - data = string.replace(data, r"\hackscore {}", "_") + data = data.replace(r"\hackscore {}", "_") rx = re.compile(r"\\indexentry\s*{([^@]*)@") - for line in string.split(data, "\n"): + for line in data.split("\n"): m = rx.match(line) if m: name = m.group(1) Modified: python/trunk/Misc/cheatsheet ============================================================================== --- python/trunk/Misc/cheatsheet (original) +++ python/trunk/Misc/cheatsheet Sun May 13 22:54:19 2007 @@ -2072,12 +2072,6 @@ sha Interface to the SHA message digest algorithm HMAC Keyed-Hashing for Message Authentication -- RFC 2104. -* Stdwin * Standard Window System - - stdwin Standard Window System interface - stdwinevents Stdwin event, command, and selection constants - rect Rectangle manipulation operations - * SGI IRIX * (4 & 5) al SGI audio facilities From python-checkins at python.org Sun May 13 23:13:49 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 13 May 2007 23:13:49 +0200 (CEST) Subject: [Python-checkins] r55299 - in python/trunk/Lib: plat-freebsd2 plat-freebsd3 Message-ID: <20070513211349.248AC1E4018@bag.python.org> Author: neal.norwitz Date: Sun May 13 23:13:42 2007 New Revision: 55299 Removed: python/trunk/Lib/plat-freebsd2/ python/trunk/Lib/plat-freebsd3/ Log: Remove support for freebsd[23] which haven't been released since 2000 or earlier. http://www.freebsd.org/releases/index.html From python-checkins at python.org Sun May 13 23:16:48 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 13 May 2007 23:16:48 +0200 (CEST) Subject: [Python-checkins] r55300 - peps/trunk/pep-0011.txt Message-ID: <20070513211648.E0A4A1E4009@bag.python.org> Author: neal.norwitz Date: Sun May 13 23:16:45 2007 New Revision: 55300 Modified: peps/trunk/pep-0011.txt Log: Remove support for freebsd[23] which were last released in 2000. In 2.7 remove support for freebsd4 and 5. 4 is already not supported, but the last version was released in 2005. 5 will be EOL around the same time as 2.6 is released. http://www.freebsd.org/releases/index.html http://security.freebsd.org/ Modified: peps/trunk/pep-0011.txt ============================================================================== --- peps/trunk/pep-0011.txt (original) +++ peps/trunk/pep-0011.txt Sun May 13 23:16:45 2007 @@ -133,6 +133,14 @@ Unsupported in: Python 2.6 (warning in 2.5 installer) Code removed in: Python 2.6 + Name: FreeBSD 2 and 3 + Unsupported in: Python 2.6 + Code removed in: Python 2.6 + + Name: FreeBSD 4 and 5 + Unsupported in: Python 2.7 + Code removed in: Python 2.7 + Copyright This document has been placed in the public domain. From python-checkins at python.org Mon May 14 02:55:37 2007 From: python-checkins at python.org (neal.norwitz) Date: Mon, 14 May 2007 02:55:37 +0200 (CEST) Subject: [Python-checkins] r55302 - peps/trunk/pep-3108.txt Message-ID: <20070514005537.2E4F21E4009@bag.python.org> Author: neal.norwitz Date: Mon May 14 02:55:29 2007 New Revision: 55302 Modified: peps/trunk/pep-3108.txt Log: Update status Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Mon May 14 02:55:29 2007 @@ -89,44 +89,44 @@ * IRIX (which is no longer produced [#irix-retirement]_) - + AL/al + + AL/al [done] - Provides sound support on Indy and Indigo workstations. - Both workstations are no longer available. - Code has not been uniquely edited in three years. - + cd + + cd [done] - CD drive control for SGI systems. - SGI no longer sells machines with IRIX on them. - Code has not been uniquely edited in 14 years. - + DEVICE/GL/gl/cgen/cgensuport + + DEVICE/GL/gl/cgen/cgensuport [done] - OpenGL access. - Has not been edited in at least eight years. - Third-party libraries provide better support (PyOpenGL [#pyopengl]_). - + FL/fl/flp + + FL/fl/flp [done] - Wrapper for the FORMS library [#irix-forms]_ - FORMS has not been edited in 12 years. - Library is not widely used. - First eight hits on Google are for Python docs for fl. - + fm + + fm [done] - Wrapper to the IRIS Font Manager library. - Only available on SGI machines which no longer come with IRIX. - + imgfile + + imgfile [done] - Wrapper for SGI libimage library for imglib image files (``.rgb`` files). - Python Imaging Library provdes read-only support [#pil]_. - Not uniquely edited in 13 years. - + jpeg + + jpeg [done] - Wrapper for JPEG (de)compressor. - Code not uniquely edited in nine years. @@ -220,7 +220,7 @@ + String slicing and string interpolation can do similar work. + Used by pdb, but do not need to expose API. -* stringold +* stringold [done] + Function versions of the methods on string objects. + Obsolete since Python 1.6. @@ -261,20 +261,20 @@ or a widely distributed third-party library provides a better solution for what the module is meant for. -* Bastion/rexec +* Bastion/rexec [done] + Restricted execution / security. + Turned off in Python 2.3. + Modules deemed unsafe. -* bsddb185 +* bsddb185 [done] + Superceded by bsddb3 + Not built by default. + Documentation specifies that the "module should never be used directly in new code". -* commands/popen2 +* commands [only getstatus(), does whole module go?]/popen2 [done] + subprocess module replaces them [#pep-0324]_. From python-checkins at python.org Mon May 14 04:24:01 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 14 May 2007 04:24:01 +0200 (CEST) Subject: [Python-checkins] r55304 - peps/trunk/pep-3108.txt Message-ID: <20070514022401.B3E0F1E4007@bag.python.org> Author: brett.cannon Date: Mon May 14 04:24:01 2007 New Revision: 55304 Modified: peps/trunk/pep-3108.txt Log: md5 and sha are now gone. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Mon May 14 04:24:01 2007 @@ -71,8 +71,8 @@ buildtools 2.3 cfmfile 2.4 macfs 2.3 -md5 2.5 -sha 2.5 +md5 2.5 [done] +sha 2.5 [done] strop unknown xmllib unknown ============== ========== From martin at v.loewis.de Mon May 14 07:19:09 2007 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Mon, 14 May 2007 07:19:09 +0200 Subject: [Python-checkins] r55300 - peps/trunk/pep-0011.txt In-Reply-To: <20070513211648.E0A4A1E4009@bag.python.org> References: <20070513211648.E0A4A1E4009@bag.python.org> Message-ID: <4647F14D.2070808@v.loewis.de> > In 2.7 remove support for freebsd4 and 5. 4 is already not supported, > but the last version was released in 2005. > 5 will be EOL around the same time as 2.6 is released. That's actually not the way PEP 11 is meant to work. If some platform support is to be removed, there should be one major release in which the code is disabled, and then it should be removed only in the next version. So if FreeBSD 4 and 5 should not be supported anymore, we should "break" them in 2.6, and remove the code in 2.7. Regards, Martin From python-checkins at python.org Mon May 14 07:36:05 2007 From: python-checkins at python.org (collin.winter) Date: Mon, 14 May 2007 07:36:05 +0200 (CEST) Subject: [Python-checkins] r55308 - peps/trunk/pep-0000.txt peps/trunk/pep-3133.txt Message-ID: <20070514053605.43B5E1E4009@bag.python.org> Author: collin.winter Date: Mon May 14 07:36:02 2007 New Revision: 55308 Added: peps/trunk/pep-3133.txt Modified: peps/trunk/pep-0000.txt Log: Add PEP 3133, Introducing Roles. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Mon May 14 07:36:02 2007 @@ -122,6 +122,7 @@ S 3119 Introducing Abstract Base Classes GvR, Talin S 3124 Overloading, Generic Functions, Interfaces Eby S 3131 Supporting Non-ASCII Identifiers von L?wis + S 3133 Introducing Roles Winter S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -502,6 +503,7 @@ SR 3130 Access to Current Module/Class/Function Jewett S 3131 Supporting Non-ASCII Identifiers von L?wis SF 3132 Extended Iterable Unpacking Brandl + S 3133 Introducing Roles Winter S 3141 A Type Hierarchy for Numbers Yasskin Added: peps/trunk/pep-3133.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-3133.txt Mon May 14 07:36:02 2007 @@ -0,0 +1,556 @@ +PEP: 3133 +Title: Introducing Roles +Version: $Revision$ +Last-Modified: $Date$ +Author: Collin Winter +Status: Draft +Type: Standards Track +Requires: 3115, 3129 +Content-Type: text/x-rst +Created: 1-May-2007 +Python-Version: 3.0 +Post-History: 13-May-2007 + + +Abstract +======== + +Python's existing object model organizes objects according to their +implementation. It is often desirable -- especially in +duck typing-based language like Python -- to organize objects by +the part they play in a larger system (their intent), rather than by +how they fulfill that part (their implementation). This PEP +introduces the concept of roles, a mechanism for organizing +objects according to their intent rather than their implementation. + + +Rationale +========= + +In the beginning were objects. They allowed programmers to marry +function and state, and to increase code reusability through concepts +like polymorphism and inheritance, and lo, it was good. There came +a time, however, when inheritance and polymorphism weren't enough. +With the invention of both dogs and trees, we were no longer able to +be content with knowing merely, "Does it understand 'bark'?" +We now needed to know what a given object thought that "bark" meant. + +One solution, the one detailed here, is that of roles, a mechanism +orthogonal and complementary to the traditional class/instance system. +Whereas classes concern themselves with state and implementation, the +roles mechanism deals exclusively with the behaviours embodied in a +given class. + +This system was originally called "traits" and implemented for Squeak +Smalltalk [#traits-paper]_. It has since been adapted for use in +Perl 6 [#perl6-s12]_ where it is called "roles", and it is primarily +from there that the concept is now being interpreted for Python 3. +Python 3 will preserve the name "roles". + +In a nutshell: roles tell you *what* an object does, classes tell you +*how* an object does it. + +In this PEP, I will outline a system for Python 3 that will make it +possible to easily determine whether a given object's understanding +of "bark" is tree-like or dog-like. (There might also be more +serious examples.) + + +A Note on Syntax +---------------- + +A syntax proposals in this PEP are tentative and should be +considered to be strawmen. The necessary bits that this PEP depends +on -- namely PEP 3115's class definition syntax and PEP 3129's class +decorators -- are still being formalized and may change. Function +names will, of course, be subject to lengthy bikeshedding debates. + + +Performing Your Role +==================== + +Static Role Assignment +---------------------- + +Let's start out by defining ``Tree`` and ``Dog`` classes :: + + class Tree(Vegetable): + + def bark(self): + return self.is_rough() + + + class Dog(Animal): + + def bark(self): + return self.goes_ruff() + +While both implement a ``bark()`` method with the same signature, +they do wildly different things. We need some way of differentiating +what we're expecting. Relying on inheritance and a simple +``isinstance()`` test will limit code reuse and/or force any dog-like +classes to inherit from ``Dog``, whether or not that makes sense. +Let's see if roles can help. :: + + @perform_role(Doglike) + class Dog(Animal): + ... + + @perform_role(Treelike) + class Tree(Vegetable): + ... + + @perform_role(SitThere) + class Rock(Mineral): + ... + +We use class decorators from PEP 3129 to associate a particular role +or roles with a class. Client code can now verify that an incoming +object performs the ``Doglike`` role, allowing it to handle ``Wolf``, +``LaughingHyena`` and ``Aibo`` [#aibo]_ instances, too. + +Roles can be composed via normal inheritance: :: + + @perform_role(Guard, MummysLittleDarling) + class GermanShepherd(Dog): + + def guard(self, the_precious): + while True: + if intruder_near(the_precious): + self.growl() + + def get_petted(self): + self.swallow_pride() + +Here, ``GermanShepherd`` instances perform three roles: ``Guard`` and +``MummysLittleDarling`` are applied directly, whereas ``Doglike`` +is inherited from ``Dog``. + + +Assigning Roles at Runtime +-------------------------- + +Roles can be assigned at runtime, too, by unpacking the syntactic +sugar provided by decorators. + +Say we import a ``Robot`` class from another module, and since we +know that ``Robot`` already implements our ``Guard`` interface, +we'd like it to play nicely with guard-related code, too. :: + + >>> perform(Guard)(Robot) + +This takes effect immediately and impacts all instances of ``Robot``. + + +Asking Questions About Roles +---------------------------- + +Just because we've told our robot army that they're guards, we'd +like to check in on them occasionally and make sure they're still at +their task. :: + + >>> performs(our_robot, Guard) + True + +What about that one robot over there? :: + + >>> performs(that_robot_over_there, Guard) + True + +The ``performs()`` function is used to ask if a given object +fulfills a given role. It cannot be used, however, to ask a +class if its instances fulfill a role: :: + + >>> performs(Robot, Guard) + False + +This is because the ``Robot`` class is not interchangeable +with a ``Robot`` instance. + + +Defining New Roles +================== + +Empty Roles +----------- + +Roles are defined like a normal class, but use the ``Role`` +metaclass. :: + + class Doglike(metaclass=Role): + ... + +Metaclasses are used to indicate that ``Doglike`` is a ``Role`` in +the same way 5 is an ``int`` and ``tuple`` is a ``type``. + + +Composing Roles via Inheritance +------------------------------- + +Roles may inherit from other roles; this has the effect of composing +them. Here, instances of ``Dog`` will perform both the +``Doglike`` and ``FourLegs`` roles. :: + + class FourLegs(metaclass=Role): + pass + + class Doglike(FourLegs, Carnivor): + pass + + @perform_role(Doglike) + class Dog(Mammal): + pass + + +Requiring Concrete Methods +-------------------------- + +So far we've only defined empty roles -- not very useful things. +Let's now require that all classes that claim to fulfill the +``Doglike`` role define a ``bark()`` method: :: + + class Doglike(FourLegs): + + def bark(self): + pass + +No decorators are required to flag the method as "abstract", and the +method will never be called, meaning whatever code it contains (if any) +is irrelevant. Roles provide *only* abstract methods; concrete +default implementations are left to other, better-suited mechanisms +like mixins. + +Once you have defined a role, and a class has claimed to perform that +role, it is essential that that claim be verified. Here, the +programmer has misspelled one of the methods required by the role. :: + + @perform_role(FourLegs) + class Horse(Mammal): + + def run_like_teh_wind(self) + ... + +This will cause the role system to raise an exception, complaining +that you're missing a ``run_like_the_wind()`` method. The role +system carries out these checks as soon as a class is flagged as +performing a given role. + +Concrete methods are required to match exactly the signature demanded +by the role. Here, we've attempted to fulfill our role by defining a +concrete version of ``bark()``, but we've missed the mark a bit. :: + + @perform_role(Doglike) + class Coyote(Mammal): + + def bark(self, target=moon): + pass + +This method's signature doesn't match exactly with what the +``Doglike`` role was expecting, so the role system will throw a bit +of a tantrum. + + +Mechanism +========= + +The following are strawman proposals for how roles might be expressed +in Python. The examples here are phrased in a way that the roles +mechanism may be implemented without changing the Python interpreter. +(Examples adapted from an article on Perl 6 roles by Curtis Poe +[#roles-examples]_.) + +1. Static class role assignment :: + + @perform_role(Thieving) + class Elf(Character): + ... + + ``perform_role()`` accepts multiple arguments, such that this is + also legal: :: + + @perform_role(Thieving, Spying, Archer) + class Elf(Character): + ... + + The ``Elf`` class now performs both the ``Thieving``, ``Spying``, + and ``Archer`` roles. + +2. Querying instances :: + + if performs(my_elf, Thieving): + ... + + The second argument to ``performs()`` may also be anything with a + ``__contains__()`` method, meaning the following is legal: :: + + if performs(my_elf, set([Thieving, Spying, BoyScout])): + ... + + Like ``isinstance()``, the object needs only to perform a single + role out of the set in order for the expression to be true. + + +Relationship to Abstract Base Classes +===================================== + +Early drafts of this PEP [#proposal]_ envisioned roles as competing +with the abstract base classes proposed in PEP 3119. After further +discussion and deliberation, a compromise and a delegation of +responsibilities and use-cases has been worked out as follows: + +* Roles provide a way of indicating a object's semantics and abstract + capabilities. A role may define abstract methods, but only as a + way of delineating an interface through which a particular set of + semantics are accessed. An ``Ordering`` role might require that + some set of ordering operators be defined. :: + + class Ordering(metaclass=Role): + def __ge__(self, other): + pass + + def __le__(self, other): + pass + + def __ne__(self, other): + pass + + # ...and so on + + In this way, we're able to indicate an object's role or function + within a larger system without constraining or concerning ourselves + with a particular implementation. + +* Abstract base classes, by contrast, are a way of reusing common, + discrete units of implementation. For example, one might define an + ``OrderingMixin`` that implements several ordering operators in + terms of other operators. :: + + class OrderingMixin: + def __ge__(self, other): + return self > other or self == other + + def __le__(self, other): + return self < other or self == other + + def __ne__(self, other): + return not self == other + + # ...and so on + + Using this abstract base class - more properly, a concrete + mixin - allows a programmer to define a limited set of operators + and let the mixin in effect "derive" the others. + +By combining these two orthogonal systems, we're able to both +a) provide functionality, and b) alert consumer systems to the +presence and availability of this functionality. For example, +since the ``OrderingMixin`` class above satisfies the interface +and semantics expressed in the ``Ordering`` role, we say the mixin +performs the role: :: + + @perform_role(Ordering) + class OrderingMixin: + def __ge__(self, other): + return self > other or self == other + + def __le__(self, other): + return self < other or self == other + + def __ne__(self, other): + return not self == other + + # ...and so on + +Now, any class that uses the mixin will automatically -- that is, +without further programmer effort -- be tagged as performing the +``Ordering`` role. + +The separation of concerns into two distinct, orthogonal systems +is desirable because it allows us to use each one separately. +Take, for example, a third-party package providing a +``RecursiveHash`` role that indicates a container takes its +contents into account when determining its hash value. Since +Python's built-in ``tuple`` and ``frozenset`` classes follow this +semantic, the ``RecursiveHash`` role can be applied to them. :: + + >>> perform_role(RecursiveHash)(tuple) + >>> perform_role(RecursiveHash)(frozenset) + +Now, any code that consumes ``RecursiveHash`` objects will now be +able to consume tuples and frozensets. + + +Open Issues +=========== + +Allowing Instances to Perform Different Roles Than Their Class +-------------------------------------------------------------- + +Perl 6 allows instances to perform different roles than their class. +These changes are local to the single instance and do not affect +other instances of the class. For example: :: + + my_elf = Elf() + my_elf.goes_on_quest() + my_elf.becomes_evil() + now_performs(my_elf, Thieving) # Only this one elf is a thief + my_elf.steals(["purses", "candy", "kisses"]) + +In Perl 6, this is done by creating an anonymous class that +inherits from the instance's original parent and performs the +additional role(s). This is possible in Python 3, though whether it +is desirable is still is another matter. + +Inclusion of this feature would, of course, make it much easier to +express the works of Charles Dickens in Python: :: + + >>> from literature import role, BildungsRoman + >>> from dickens import Urchin, Gentleman + >>> + >>> with BildungsRoman() as OliverTwist: + ... mr_brownlow = Gentleman() + ... oliver, artful_dodger = Urchin(), Urchin() + ... now_performs(artful_dodger, [role.Thief, role.Scoundrel]) + ... + ... oliver.has_adventures_with(ArtfulDodger) + ... mr_brownlow.adopt_orphan(oliver) + ... now_performs(oliver, role.RichWard) + + +Requiring Attributes +-------------------- + +Neal Norwitz has requested the ability to make assertions about +the presence of attributes using the same mechanism used to require +methods. Since roles take effect at class definition-time, and +since the vast majority of attributes are defined at runtime by a +class's ``__init__()`` method, there doesn't seem to be a good way +to check for attributes at the same time as methods. + +It may still be desirable to include non-enforced attributes in the +role definition, if only for documentation purposes. + + +Roles of Roles +-------------- + +Under the proposed semantics, it is possible for roles to +have roles of their own. :: + + @perform_role(Y) + class X(metaclass=Role): + ... + +While this is possible, it is meaningless, since roles +are generally not instantiated. There has been some +off-line discussion about giving meaning to this expression, but so +far no good ideas have emerged. + + +class_performs() +---------------- + +It is currently not possible to ask a class if its instances perform +a given role. It may be desirable to provide an analogue to +``performs()`` such that :: + + >>> isinstance(my_dwarf, Dwarf) + True + >>> performs(my_dwarf, Surly) + True + >>> performs(Dwarf, Surly) + False + >>> class_performs(Dwarf, Surly) + True + + +Prettier Dynamic Role Assignment +-------------------------------- + +An early draft of this PEP included a separate mechanism for +dynamically assigning a role to a class. This was spelled :: + + >>> now_perform(Dwarf, GoldMiner) + +This same functionality already exists by unpacking the syntactic +sugar provided by decorators: :: + + >>> perform_role(GoldMiner)(Dwarf) + +At issue is whether dynamic role assignment is sufficiently important +to warrant a dedicated spelling. + + +Syntax Support +-------------- + +Though the phrasings laid out in this PEP are designed so that the +roles system could be shipped as a stand-alone package, it may be +desirable to add special syntax for defining, assigning and +querying roles. One example might be a role keyword, which would +translate :: + + class MyRole(metaclass=Role): + ... + +into :: + + role MyRole: + ... + +Assigning a role could take advantage of the class definition +arguments proposed in PEP 3115: :: + + class MyClass(performs=MyRole): + ... + + +Implementation +============== + +A reference implementation is forthcoming. + + +Acknowledgements +================ + +Thanks to Jeffery Yasskin, Talin and Guido van Rossum for several +hours of in-person discussion to iron out the differences, overlap +and finer points of roles and abstract base classes. + + +References +========== + +.. [#aibo] + http://en.wikipedia.org/wiki/AIBO + +.. [#roles-examples] + http://www.perlmonks.org/?node_id=384858 + +.. [#perl6-s12] + http://dev.perl.org/perl6/doc/design/syn/S12.html + +.. [#traits-paper] + http://www.iam.unibe.ch/~scg/Archive/Papers/Scha03aTraits.pdf + +.. [#proposal] + http://mail.python.org/pipermail/python-3000/2007-April/007026.html + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: + From python-checkins at python.org Mon May 14 16:09:18 2007 From: python-checkins at python.org (david.goodger) Date: Mon, 14 May 2007 16:09:18 +0200 (CEST) Subject: [Python-checkins] r55309 - peps/trunk/pep-3119.txt Message-ID: <20070514140918.70C3D1E4009@bag.python.org> Author: david.goodger Date: Mon May 14 16:09:14 2007 New Revision: 55309 Modified: peps/trunk/pep-3119.txt Log: fixed definition list markup (removed blank lines); removed whitespace Modified: peps/trunk/pep-3119.txt ============================================================================== --- peps/trunk/pep-3119.txt (original) +++ peps/trunk/pep-3119.txt Mon May 14 16:09:14 2007 @@ -414,7 +414,7 @@ These abstract classes represent single methods like ``__iter__`` or ``__len__``. - + ``Hashable`` The base class for classes defining ``__hash__``. The ``__hash__`` method should return an integer. The abstract @@ -509,7 +509,6 @@ type ``frozenset`` derives from ``Set`` and ``Hashable``. ``Set`` - This is a sized, iterable container, i.e., a subclass of ``Sized``, ``Iterable`` and ``Container``. Not every subclass of those three classes is a set though! Sets have the additional @@ -557,7 +556,6 @@ aliases for ``__le__`` and ``__ge__``. ``MutableSet`` - This is a subclass of ``Set`` implementing additional operations to add and remove elements. The supported methods have the semantics known from the ``set`` type in Python 2 (except for @@ -614,7 +612,6 @@ The built-in type ``dict`` derives from ``MutableMapping``. ``Mapping`` - A subclass of ``Container``, ``Iterable`` and ``Sized``. The keys of a mapping naturally form a set. The (key, value) pairs (which must be tuples) are also referred to as items. The items also @@ -688,7 +685,6 @@ from ``Sequence`` and ``Hashable``. ``Sequence`` - A subclass of ``Iterable``, ``Sized``, ``Container``. It defines a new abstract method ``__getitem__`` that has a somewhat complicated signature: when called with an integer, it returns an @@ -705,7 +701,6 @@ ``index``, ``count``, ``__add__``, ``__mul__``. ``MutableSequence`` - A subclass of ``Sequence`` adding some standard mutating methods. Abstract mutating methods: ``__setitem__`` (for integer indices as well as slices), ``__delitem__`` (ditto), ``insert``, ``append``, From python-checkins at python.org Mon May 14 16:11:05 2007 From: python-checkins at python.org (david.goodger) Date: Mon, 14 May 2007 16:11:05 +0200 (CEST) Subject: [Python-checkins] r55310 - peps/trunk/pep-3133.txt Message-ID: <20070514141105.F1F2A1E400E@bag.python.org> Author: david.goodger Date: Mon May 14 16:11:03 2007 New Revision: 55310 Modified: peps/trunk/pep-3133.txt (props changed) Log: svn property fixes From python-checkins at python.org Mon May 14 20:56:16 2007 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 14 May 2007 20:56:16 +0200 (CEST) Subject: [Python-checkins] r55315 - sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Message-ID: <20070514185616.E318F1E400C@bag.python.org> Author: guido.van.rossum Date: Mon May 14 20:56:14 2007 New Revision: 55315 Modified: sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Log: Move to the new ABCMeta metaclass machinery. Specify the hash function for sets. Modified: sandbox/trunk/abc/abc.py ============================================================================== --- sandbox/trunk/abc/abc.py (original) +++ sandbox/trunk/abc/abc.py Mon May 14 20:56:14 2007 @@ -1,15 +1,9 @@ #!/usr/bin/env python3.0 -"""Abstract Base Classes experiment. See PEP 3119. +"""Abstract Base Classes (ABCs) experiment. See PEP 3119. -Note: this depends on the brand new Py3k feature that object.__ne__() -is implemented by calling __eq__() and reversing the outcome (unless -NotImplemented). - -XXX Should we use argument annotations here? - -XXX How to decide the order in which orthogonal base classes are -listed? For now, I'm putting the smaller API second. +Note: this code depends on an unsubmitted patch: +http://python.org/sf/1708353. """ __author__ = "Guido van Rossum " @@ -21,66 +15,31 @@ ### ABC SUPPORT FRAMEWORK ### -# Note: @abstractmethod will become a built-in; Abstract and -# AbstractClass will disappear (the functionality will be subsumed in -# object and type, respectively). - - def abstractmethod(funcobj): """A decorator indicating abstract methods. - Requires that the class (directly or indirectly) derives from - Abstract, and that the metaclass is AbstractClass or derived from it - (deriving from Abstract ensure this). A class deriving from - Abstract cannot be instantiated unless all of its abstract methods - are overridden. The abstract methods can be called using any of the - the normal 'super' call mechanisms. + Requires that the metaclass is ABCMeta or derived from it. A + class that has a metaclass derived from ABCMeta cannot be + instantiated unless all of its abstract methods are overridden. + The abstract methods can be called using any of the the normal + 'super' call mechanisms. Usage: - class C(Abstract): + class C(metaclass=ABCMeta): @abstractmethod def my_abstract_method(self, ...): ... - - When combining this with other decorators, this should come last: - - class C(Abstract): - @classmethod - @abstractmethod - def my_abstract_class_method(self, ...): - ... - - XXX This example doesn't currently work, since classmethod doesn't - pass through function attributes! I think it should though. """ funcobj.__isabstractmethod__ = True return funcobj -class AbstractClass(type): - - """Metaclass to support the abstractmethod decorator.""" - - def __new__(mcls, name, bases, namespace): - cls = super(AbstractClass, mcls).__new__(mcls, name, bases, namespace) - abstracts = {name - for name, value in namespace.items() - if getattr(value, "__isabstractmethod__", False)} - for base in bases: - for name in getattr(base, "__abstractmethods__", set()): - value = getattr(cls, name, None) - if getattr(value, "__isabstractmethod__", False): - abstracts.add(name) - cls.__abstractmethods__ = abstracts - return cls - - -class Abstract(metaclass=AbstractClass): +class _Abstract(object): - """Base class to support the abstractmethod decorator. + """Helper class inserted into the bases by ABCMeta (using _fix_bases()). - This implicitly sets the metaclass to AbstractClass. + You should never need to explicitly subclass this class. """ def __new__(cls, *args, **kwds): @@ -89,52 +48,129 @@ raise TypeError("can't instantiate abstract class %s " "with abstract methods %s" % (cls.__name__, ", ".join(sorted(am)))) - return super(Abstract, cls).__new__(cls, *args, **kwds) - - -### ORDERING ABCS ### - + return super(_Abstract, cls).__new__(cls, *args, **kwds) -class PartiallyOrdered(Abstract): - """Partial orderings define a consistent but incomplete < operator. +def _fix_bases(bases): + """Helper method that inserts _Abstract in the bases if needed.""" + for base in bases: + if issubclass(base, _Abstract): + # _Abstract is already a base (maybe indirectly) + return bases + if object in bases: + # Replace object with _Abstract + return tuple([_Abstract if base is object else base + for base in bases]) + # Append _Abstract to the end + return bases + (_Abstract,) + + +class ABCMeta(type): + + """Metaclass for defining Abstract Base Classes (ABCs). + + Use this metaclass to create an ABC. An ABC can be subclassed + directly, and then acts as a mix-in class. You can also register + unrelated concrete classes (even built-in classes) and unrelated + ABCs as 'virtual subclasses' -- these and their descendants will + be considered subclasses of the registering ABC by the built-in + issubclass() function, but the registering ABC won't show up in + their MRO (Method Resolution Order) nor will method + implementations defined by the registering ABC be callable (not + even via super()). - Invariant: a < b < c => a < c - - It is possible that none of a < b, a == b, a > b hold. """ - @abstractmethod - def __lt__(self, other): - return NotImplemented - - def __le__(self, other): - if not isinstance(other, PartiallyOrdered): - return NotImplemented - # Note that bool(NotImplemented) is True! - return self == other or self.__lt__(other) - - # It's not necessary to define __gt__ and __ge__; these will - # automatically be translated to __lt__ and __le__ calls with - # swapped arguments by the rich comparisons framework. - - -class TotallyOrdered(PartiallyOrdered): + # A global counter that is incremented each time a class is + # registered as a virtual subclass of anything. It forces the + # negative cache to be cleared before its next use. + __invalidation_counter = 0 - """Total orderings guarantee that all values are ordered. - - E.g. for any two a and b, exactly one of a < b, a == b, a > b holds. + def __new__(mcls, name, bases, namespace): + bases = _fix_bases(bases) + cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace) + # Compute set of abstract method names + abstracts = {name + for name, value in namespace.items() + if getattr(value, "__isabstractmethod__", False)} + for base in bases: + for name in getattr(base, "__abstractmethods__", set()): + value = getattr(cls, name, None) + if getattr(value, "__isabstractmethod__", False): + abstracts.add(name) + cls.__abstractmethods__ = abstracts + # Set up inheritance registry + cls.__abc_registry__ = set() + cls.__abc_cache__ = set() + cls.__abc_negative_cache__ = set() + cls.__abc_negative_cache_version__ = ABCMeta.__invalidation_counter + return cls - XXX What about float? The properties of NaN make it strictly - PartiallyOrdered. But having it TotallyOrdered makes more sense - for most practical purposes. - """ + def register(cls, subclass): + """Register a virtual subclass of an ABC.""" + if not isinstance(cls, type): + raise TypeError("Can only register classes") + if issubclass(subclass, cls): + return # Already a subclass + # Subtle: test for cycles *after* testing for "already a subclass"; + # this means we allow X.register(X) and interpret it as a no-op. + if issubclass(cls, subclass): + # This would create a cycle, which is bad for the algorithm below + raise RuntimeError("Refusing to create an inheritance cycle") + cls.__abc_registry__.add(subclass) + ABCMeta.__invalidation_counter += 1 # Invalidate negative cache + + def _dump_registry(cls, file=None): + """Debug helper to print the ABC registry.""" + if file is None: + file = sys.stdout + print("Class: %s.%s" % (cls.__module__, cls.__name__), file=file) + print("Inv.counter: %s" % ABCMeta.__invalidation_counter, file=file) + for name in sorted(cls.__dict__.keys()): + if name.startswith("__abc_"): + value = getattr(cls, name) + print("%s: %r" % (name, value), file=file) + + def __instancecheck__(cls, instance): + """Override for isinstance(instance, cls).""" + return any(cls.__subclasscheck__(c) + for c in {instance.__class__, type(instance)}) + + def __subclasscheck__(cls, subclass): + """Override for issubclass(subclass, cls).""" + # Check cache + if subclass in cls.__abc_cache__: + return True + # Check negative cache; may have to invalidate + if cls.__abc_negative_cache_version__ < ABCMeta.__invalidation_counter: + # Invalidate the negative cache + cls.__abc_negative_cache_version__ = ABCMeta.__invalidation_counter + cls.__abc_negative_cache__ = set() + elif subclass in cls.__abc_negative_cache__: + return False + # Check if it's a direct subclass + if cls in subclass.mro(): + cls.__abc_cache__.add(subclass) + return True + # Check if it's a subclass of a registered class (recursive) + for rcls in cls.__abc_registry__: + if issubclass(subclass, rcls): + cls.__abc_registry__.add(subclass) + return True + # Check if it's a subclass of a subclass (recursive) + for scls in cls.__subclasses__(): + if issubclass(subclass, scls): + cls.__abc_registry__.add(subclass) + return True + # No dice; update negative cache + cls.__abc_negative_cache__.add(subclass) + return False ### ONE TRICK PONIES ### -class Hashable(Abstract): +class Hashable(metaclass=ABCMeta): """A hashable has one method, __hash__().""" @@ -143,7 +179,7 @@ return 0 -class Iterable(Abstract): +class Iterable(metaclass=ABCMeta): """An iterable has one method, __iter__().""" @@ -175,14 +211,14 @@ # Or: raise StopIteration -class Sized(Abstract): +class Sized(metaclass=ABCMeta): @abstractmethod def __len__(self): return 0 -class Container(Abstract): +class Container(metaclass=ABCMeta): """A container has a __contains__() method.""" @@ -198,7 +234,7 @@ # Perhaps later, when we have type annotations so you can write # Container[T], we can do this: # - # class Container(Abstract): + # class Container(metaclass=ABCMeta): # def __contains__(self, val: T) -> bool: ... # # class Searchable(Container): @@ -278,8 +314,22 @@ freedom for __eq__ or __hash__. We match the algorithm used by the built-in frozenset type. """ - # XXX This is not a very efficient implementation - return hash(frozenset(self)) + MAX = sys.maxint + MASK = 2 * MAX + 1 + n = len(self) + h = 1927868237 * (n + 1) + h &= MASK + for x in self: + hx = hash(x) + h ^= (hx ^ (hx << 16) ^ 89869747) * 3644798167 + h &= MASK + h = h * 69069 + 907133923 + h &= MASK + if h > MAX: + h -= MASK + 1 + if h == -1: + h = 590923713 + return h # XXX Should this derive from Set instead of from ComposableSet? @@ -505,10 +555,6 @@ return False -# XXX HashableMapping -# XXX MutableMapping - - ### SEQUENCES ### @@ -662,31 +708,6 @@ return len(self) <= len(other) -class HashableSequence(Sequence, Hashable): - - def __hash__(self): - """The hash value must match __eq__. - - Since we want sequences to be equal iff their elements are equal - (regardless of the sequence type), this algorithm is (XXX - hopefully) identical to tuple.__hash__(). - """ - mask = sys.maxint*2 + 1 - mult = 1000003 - h = 0x345678 - n = len(self) - for i, elem in enumerate(self): - h = ((h ^ hash(elem)) * mult) & mask - mult = (mult + (82520 - 2 + 2*(n-i))) & mask - h += 97531 - h &= mask - if h > sys.maxint: - h -= mask + 1 - if h == -1: - h = -2 - return h - - ### ADAPTERS ### Modified: sandbox/trunk/abc/test_abc.py ============================================================================== --- sandbox/trunk/abc/test_abc.py (original) +++ sandbox/trunk/abc/test_abc.py Mon May 14 20:56:14 2007 @@ -9,7 +9,7 @@ class ABCTestCase(unittest.TestCase): def test_abstract_method_machinery(self): - class C(abc.Abstract): + class C(metaclass=abc.ABCMeta): @abc.abstractmethod def foo(self): pass def bar(self): pass @@ -21,22 +21,25 @@ def foo(self): pass E() - def test_hashable_sequence_hash_matches_tuple_hash(self): - class C(abc.HashableSequence): + def test_hashable_set_hash_matches_frozenset_hash(self): + class C(abc.Set): def __new__(cls, values): obj = super(C, cls).__new__(cls) - obj.__values = list(values) + obj.__values = set(values) return obj def __len__(self): return len(self.__values) - def __getitem__(self, i): - return self.__values[i] + def __contains__(self, x): + return x in self.__values + def __iter__(self): + return iter(self.__values) for l in ([], [0], [1], [0, 1], list(range(-sys.maxint, sys.maxint, 100000)), "The quick brown fox jumps over the lazy dog".split()): - hcl = hash(C(l)) - htl = hash(tuple(l)) - self.assertEqual(hcl, htl, repr((l, hcl, htl))) + hc = C(l)._hash() + hfs = hash(frozenset(l)) + self.assertEqual(hc, hfs, repr((l, hc, hfs))) + def test_adapt_to_sequence(self): a = abc.AdaptToSequence(range(10)) @@ -45,7 +48,6 @@ self.assertEqual(a[9], 9) self.assertEqual(a[-1], 9) self.assertEqual(list(a), list(range(10))) - #self.assertEqual(a, range(10)) b = a[1:-1] self.assertEqual(b.__class__, abc.AdaptToSequence) self.assertEqual(list(b), list(range(1, 9))) From python-checkins at python.org Mon May 14 21:08:03 2007 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 14 May 2007 21:08:03 +0200 (CEST) Subject: [Python-checkins] r55316 - sandbox/trunk/abc/crash.py Message-ID: <20070514190803.8D1A91E4009@bag.python.org> Author: guido.van.rossum Date: Mon May 14 21:07:56 2007 New Revision: 55316 Added: sandbox/trunk/abc/crash.py (contents, props changed) Log: Adding a crashing example (see sf/1708353). Added: sandbox/trunk/abc/crash.py ============================================================================== --- (empty file) +++ sandbox/trunk/abc/crash.py Mon May 14 21:07:56 2007 @@ -0,0 +1,3 @@ +class C: + def __instancecheck__(self, arg): return False +isinstance(42, C) From python-checkins at python.org Mon May 14 21:08:34 2007 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 14 May 2007 21:08:34 +0200 (CEST) Subject: [Python-checkins] r55317 - sandbox/trunk/abc/struct.py Message-ID: <20070514190834.5C9D11E4009@bag.python.org> Author: guido.van.rossum Date: Mon May 14 21:08:31 2007 New Revision: 55317 Added: sandbox/trunk/abc/struct.py (contents, props changed) Log: Checkpoint. Non-working code for now. Added: sandbox/trunk/abc/struct.py ============================================================================== --- (empty file) +++ sandbox/trunk/abc/struct.py Mon May 14 21:08:31 2007 @@ -0,0 +1,119 @@ +#!/usr/bin/env python3.0 + +"""Define a structure using a class. + +Structures have some properties that normal classes don't: + +(a) instance attributes are typed +(b) only pre-defined instance attributes are allowed +(c) instance variables have a well-defined order (i.e., declaration order) + +Example: + + class C(Structure): + + '''A class with two fields, an int and a string.''' + + a = Field(int) + b = Field(str) + + x = C() + x.a = 42 + x.b = "hello" + print(x.a) # 42 + print(x.b) # hello + +The following assignments are now all disallowed: + + x.a = "hello" + x.b = 42 + x.c = 0 + +""" + +class _FieldDict(dict): + + __slots__ = ["_order"] + + def __init__(self, initial=()): + if hasattr(initial, "keys"): + initial = [(key, initial[key]) for key in initial.keys()] + self._order = list(initial) + dict.__init__(self, initial) + + def __setitem__(self, key, value): + self._order.append((key, value)) + dict.__setitem__(self, key, value) + +class Field: + + def __init__(self, type=object): + self._type = type + self._get = None + self._set = None + self._delete = None + self._name = "?" + + def __get__(self, obj, cls=None): + return self._get(obj, cls) + + def __set__(self, obj, value): + if not isinstance(value, self._type): + raise TypeError("can't set %s to %.100r; %s required" % + (self._name, value, self._type.__name__)) + self._set(obj, value) + + def __delete__(self, obj): + self._delete(obj) + +class _StructureClass(type): + + @classmethod + def __prepare__(mcls, *args): + return _FieldDict() + + def __new__(mcls, classname, bases, namespace): + if "__slots__" in namespace: + raise TypeError("You can't define __slots__ in a Structure") + slots = [] + fields = {} + for name, value in namespace._order: + if isinstance(value, Field): + if namespace.get(name) is value and name not in fields: + value._name = name + slots.append(name) + fields[name] = value + del namespace[name] + namespace = dict(namespace) + namespace["__slots__"] = slots + cls = type.__new__(mcls, classname, bases, namespace) + for name in slots: + field = fields[name] + descr = getattr(cls, name) + field._get = descr.__get__ + field._set = descr.__set__ + field._delete = descr.__delete__ + setattr(cls, name, field) + return cls + +class Structure(metaclass=_StructureClass): + + pass + +# Example + +class C(Structure): + + a = Field(int) + b = Field(str) + + def f(self): + print(self.a, self.b) + +x = C() +x.a = 42 +x.b = "hello" +assert not hasattr(x, "__dict__") +print(x.__slots__) +x.f() +x.a = "hello" From python-checkins at python.org Mon May 14 22:06:39 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 14 May 2007 22:06:39 +0200 (CEST) Subject: [Python-checkins] r55318 - peps/trunk/pep-3108.txt Message-ID: <20070514200639.9C4D01E4009@bag.python.org> Author: brett.cannon Date: Mon May 14 22:06:30 2007 New Revision: 55318 Modified: peps/trunk/pep-3108.txt Log: List the steps needed to properly remove a module. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Mon May 14 22:06:30 2007 @@ -50,6 +50,18 @@ denoted as "unique" then it is the last time the file was edited, period. +The procedure to thoroughly remove a module is: + +#. Remove the module. +#. Remove the tests. +#. Change all references to the removed module in the standard + library. +#. Remove the docs. +#. Delete the reference to the removed docs in ``Doc/Makefile.deps`` + and ``Doc/lib/lib.tex``. +#. Run the regression test suite; watch out for tests that are skipped + because an import failed for the removed module. + Previously deprecated --------------------- From python-checkins at python.org Mon May 14 22:18:59 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 14 May 2007 22:18:59 +0200 (CEST) Subject: [Python-checkins] r55319 - peps/trunk/pep-3108.txt Message-ID: <20070514201859.8C4231E4009@bag.python.org> Author: brett.cannon Date: Mon May 14 22:18:53 2007 New Revision: 55319 Modified: peps/trunk/pep-3108.txt Log: List the compiler package for removal. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Mon May 14 22:18:53 2007 @@ -290,6 +290,13 @@ + subprocess module replaces them [#pep-0324]_. +* compiler + + + Having to maintain both the built-in compiler and the stdlib + package is redundant [#ast-removal]_. + + The AST created by the compiler is available [#ast]_. + + Mechanism to compile from an AST needs to be added. + * dl + ctypes provides better support for same functionality. @@ -628,6 +635,12 @@ .. [#appscript] appscript (http://appscript.sourceforge.net/) +.. [#ast] _ast module + (http://docs.python.org/lib/ast.html) + +.. [#ast-removal] python-dev email: getting compiler package failures + (http://mail.python.org/pipermail/python-3000/2007-May/007615.html) + Copyright ========= From python-checkins at python.org Mon May 14 22:52:36 2007 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 14 May 2007 22:52:36 +0200 (CEST) Subject: [Python-checkins] r55320 - python/trunk/Lib/genericpath.py Message-ID: <20070514205236.5D08C1E401F@bag.python.org> Author: raymond.hettinger Date: Mon May 14 22:52:31 2007 New Revision: 55320 Modified: python/trunk/Lib/genericpath.py Log: Small speedup. Modified: python/trunk/Lib/genericpath.py ============================================================================== --- python/trunk/Lib/genericpath.py (original) +++ python/trunk/Lib/genericpath.py Mon May 14 22:52:31 2007 @@ -70,11 +70,10 @@ if not m: return '' s1 = min(m) s2 = max(m) - n = min(len(s1), len(s2)) - for i in xrange(n): - if s1[i] != s2[i]: + for i, c in enumerate(s1): + if c != s2[i]: return s1[:i] - return s1[:n] + return s1 # Split a path in root and extension. # The extension is everything starting at the last dot in the last From python-checkins at python.org Mon May 14 23:04:01 2007 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 14 May 2007 23:04:01 +0200 (CEST) Subject: [Python-checkins] r55321 - sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Message-ID: <20070514210401.092AF1E4009@bag.python.org> Author: guido.van.rossum Date: Mon May 14 23:03:55 2007 New Revision: 55321 Modified: sandbox/trunk/abc/abc.py sandbox/trunk/abc/test_abc.py Log: Add overloading example that works across ABC registrations. Add mutable sequence and mapping. Register some built-in types. Modified: sandbox/trunk/abc/abc.py ============================================================================== --- sandbox/trunk/abc/abc.py (original) +++ sandbox/trunk/abc/abc.py Mon May 14 23:03:55 2007 @@ -9,6 +9,7 @@ __author__ = "Guido van Rossum " import sys +import inspect import itertools @@ -149,7 +150,7 @@ elif subclass in cls.__abc_negative_cache__: return False # Check if it's a direct subclass - if cls in subclass.mro(): + if cls in subclass.__mro__: cls.__abc_cache__.add(subclass) return True # Check if it's a subclass of a registered class (recursive) @@ -398,15 +399,9 @@ ### MAPPINGS ### +# XXX Get rid of _BasicMapping and view types -class BasicMapping(Container): - - """A basic mapping has __getitem__(), __contains__() and get(). - - The idea is that you only need to override __getitem__(). - - Other dict methods are not supported. - """ +class _BasicMapping(Container, Iterable): @abstractmethod def __getitem__(self, key): @@ -425,9 +420,6 @@ except KeyError: return False - -class IterableMapping(BasicMapping, Iterable): - def keys(self): return KeysView(self) @@ -484,7 +476,7 @@ yield self._mapping[key] -class Mapping(IterableMapping, Sized): +class Mapping(_BasicMapping, Sized): def keys(self): return KeysView(self) @@ -555,6 +547,59 @@ return False +class MutableMapping(Mapping): + + @abstractmethod + def __setitem__(self, key): + raise NotImplementedError + + @abstractmethod + def __delitem__(self, key): + raise NotImplementedError + + __marker = object() + + def pop(self, key, default=__marker): + try: + value = self[key] + except KeyError: + if default is self.__marker: + raise + return default + else: + del self[key] + return value + + def popitem(self): + try: + key = next(iter(self)) + except StopIteration: + raise KeyError + value = self[key] + del self[key] + return key, value + + def clear(self): + try: + while True: + self.popitem() + except KeyError: + pass + + def update(self, other=(), **kwds): + if isinstance(other, Mapping): + for key in other: + self[key] = other[key] + elif hasattr(other, "keys"): + for key in other.keys(): + self[key] = other[key] + else: + for key, value in other: + self[key] = value + for key, value in kwds.items(): + self[key] = value + + ### SEQUENCES ### @@ -708,8 +753,74 @@ return len(self) <= len(other) +class MutableSequence(Sequence): + + @abstractmethod + def __setitem__(self, i, value): + raise NotImplementedError + + @abstractmethod + def __delitem__(self, i, value): + raise NotImplementedError + + @abstractmethod + def insert(self, i, value): + raise NotImplementedError + + def append(self, value): + self.insert(len(self), value) + + def reverse(self): + n = len(self) + for i in range(n//2): + j = n-i-1 + self[i], self[j] = self[j], self[i] + + def extend(self, it): + for x in it: + self.append(x) + + def pop(self, i=None): + if i is None: + i = len(self) - 1 + value = self[i] + del self[i] + return value + + def remove(self, value): + for i in range(len(self)): + if self[i] == value: + del self[i] + return + raise ValueError + + + +### PRE-DEFINED REGISTRATIONS ### + +Hashable.register(int) +Hashable.register(float) +Hashable.register(complex) +Hashable.register(basestring) +Hashable.register(tuple) +Hashable.register(frozenset) +Hashable.register(type) + +Set.register(frozenset) +MutableSet.register(set) + +MutableMapping.register(dict) + +Sequence.register(tuple) +Sequence.register(basestring) +MutableSequence.register(list) +MutableSequence.register(bytes) + + ### ADAPTERS ### +# This is just an example, not something to go into the stdlib + class AdaptToSequence(Sequence): @@ -762,3 +873,130 @@ def __len__(self): return len(self.adaptee) + + +### OVERLOADING ### + +# This is a modest alternative proposal to PEP 3124. It uses +# issubclass() exclusively meaning that any issubclass() overloading +# automatically works. If accepted it probably ought to go into a +# separate module (overloading.py?) as it has nothing to do directly +# with ABCs. The code here is an evolution from my earlier attempt in +# sandbox/overload/overloading.py. + + +class overloadable: + + """An implementation of overloadable functions. + + Usage example: + + @overloadable + def flatten(x): + yield x + + @flatten.overload + def _(it: Iterable): + for x in it: + yield x + + @flatten.overload + def _(x: basestring): + yield x + + """ + + def __init__(self, default_func): + # Decorator to declare new overloaded function. + self.registry = {} + self.cache = {} + self.default_func = default_func + + def __get__(self, obj, cls=None): + if obj is None: + return self + return new.instancemethod(self, obj) + + def overload(self, func): + """Decorator to overload a function using its argument annotations.""" + self.register_func(self.extract_types(func), func) + if func.__name__ == self.default_func.__name__: + return self + else: + return func + + def extract_types(self, func): + """Helper to extract argument annotations as a tuple of types.""" + args, varargs, varkw, defaults, kwonlyargs, kwdefaults, annotations = \ + inspect.getfullargspec(func) + return tuple(annotations.get(arg, object) for arg in args) + + def register_func(self, types, func): + """Helper to register an implementation.""" + self.registry[types] = func + self.cache = {} # Clear the cache (later we might optimize this). + + def __call__(self, *args): + """Call the overloaded function.""" + types = tuple(arg.__class__ for arg in args) + funcs = self.cache.get(types) + if funcs is None: + self.cache[types] = funcs = list(self.find_funcs(types)) + return funcs[0](*args) + + def find_funcs(self, types): + """Yield the appropriate overloaded functions, in order.""" + func = self.registry.get(types) + if func is not None: + # Easy case -- direct hit in registry. + yield func + return + + candidates = [cand + for cand in self.registry + if self.implies(types, cand)] + + if not candidates: + # Easy case -- return the default function + yield self.default_func + return + + if len(candidates) == 1: + # Easy case -- return this and the default function + yield self.registry[candidates[0]] + yield self.default_func + return + +## # Perhaps all candidates have the same implementation? +## # XXX What do we care? +## funcs = set(self.registry[cand] for cand in candidates) +## if len(funcs) == 1: +## yield funcs.pop() +## yield self.default_func +## return + + candidates.sort(self.comparator) # Sort on a partial ordering! + while candidates: + cand = candidates.pop(0) + if all(self.implies(cand, c) for c in candidates): + yield self.registry[cand] + else: + yield self.raise_ambiguity + break + else: + yield self.default_func + + def comparator(self, xs, ys): + return self.implies(ys, xs) - self.implies(xs, ys) + + def implies(self, xs, ys): + return len(xs) == len(ys) and all(issubclass(x, y) + for x, y in zip(xs, ys)) + + def raise_ambiguity(self, *args): + # XXX Should be more specific + raise TypeError("ambiguous signature of overloadable function") + + def raise_exhausted(self, *args): + # XXX Should be more specific + raise TypeError("no remaining candidates for overloadable function") Modified: sandbox/trunk/abc/test_abc.py ============================================================================== --- sandbox/trunk/abc/test_abc.py (original) +++ sandbox/trunk/abc/test_abc.py Mon May 14 23:03:55 2007 @@ -76,6 +76,40 @@ self.assertEqual(42 in a, False) self.assertEqual(len(a), 3) + def test_overloading(self): + # Basic 'flatten' example + @abc.overloadable + def flatten(x): + yield x + @flatten.overload + def _(x: abc.Iterable): + for a in x: + for b in flatten(a): + yield b + @flatten.overload + def _(x: basestring): + yield x + self.assertEqual(list(flatten([1, 2, 3])), [1, 2, 3]) + self.assertEqual(list(flatten([1,[2],3])), [1, 2, 3]) + self.assertEqual(list(flatten([1,[2,3]])), [1, 2, 3]) + self.assertEqual(list(flatten([1,[2,3]])), [1, 2, 3]) + self.assertEqual(list(flatten([1,"abc",3])), [1, "abc", 3]) + + # Add 2-arg version + @flatten.overload + def _(t: type, x): + return t(flatten(x)) + self.assertEqual(flatten(tuple, [1, 2, 3]), (1, 2, 3)) + self.assertEqual(flatten(tuple, [1,[2],3]), (1, 2, 3)) + self.assertEqual(flatten(tuple, [1,"abc",3]), (1, "abc", 3)) + + # Change an overload + @flatten.overload + def flatten(x: basestring): + for c in x: + yield c + self.assertEqual(list(flatten([1, "abc", 3])), [1, "a", "b", "c", 3]) + if __name__ == "__main__": unittest.main() From python-checkins at python.org Mon May 14 23:13:03 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 14 May 2007 23:13:03 +0200 (CEST) Subject: [Python-checkins] r55323 - peps/trunk/pep-3108.txt Message-ID: <20070514211303.D0AF61E4009@bag.python.org> Author: brett.cannon Date: Mon May 14 23:12:58 2007 New Revision: 55323 Modified: peps/trunk/pep-3108.txt Log: Note that compiler package has been removed. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Mon May 14 23:12:58 2007 @@ -290,7 +290,7 @@ + subprocess module replaces them [#pep-0324]_. -* compiler +* compiler (need to add AST -> bytecode mechanism) [done - removal] + Having to maintain both the built-in compiler and the stdlib package is redundant [#ast-removal]_. From python-checkins at python.org Tue May 15 01:39:22 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 15 May 2007 01:39:22 +0200 (CEST) Subject: [Python-checkins] r55330 - peps/trunk/pep-0000.txt peps/trunk/pep-3113.txt Message-ID: <20070514233922.36B911E4009@bag.python.org> Author: brett.cannon Date: Tue May 15 01:39:19 2007 New Revision: 55330 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3113.txt Log: Mark PEP 3113 as final. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue May 15 01:39:19 2007 @@ -79,7 +79,6 @@ SA 3110 Catching Exceptions in Python 3000 Winter SA 3111 Simple input built-in in Python 3000 Roberge SA 3112 Bytes literals in Python 3000 Orendorff - SA 3113 Removal of Tuple Parameter Unpacking Cannon SA 3115 Metaclasses in Python 3000 Talin SA 3120 Using UTF-8 as the default source encoding von L?wis SA 3121 Extension Module Initialization & Finalization von L?wis @@ -188,6 +187,7 @@ SF 3104 Access to Names in Outer Scopes Yee SF 3105 Make print a function Brandl SF 3107 Function Annotations Winter, Lownds + SF 3113 Removal of Tuple Parameter Unpacking Cannon SF 3114 Renaming iterator.next() to .__next__() Yee SF 3132 Extended Iterable Unpacking Brandl @@ -483,7 +483,7 @@ SA 3110 Catching Exceptions in Python 3000 Winter SA 3111 Simple input built-in in Python 3000 Roberge SA 3112 Bytes literals in Python 3000 Orendorff - SA 3113 Removal of Tuple Parameter Unpacking Cannon + SF 3113 Removal of Tuple Parameter Unpacking Cannon SF 3114 Renaming iterator.next() to .__next__() Yee SA 3115 Metaclasses in Python 3000 Talin S 3116 New I/O Stutzbach, Verdone, GvR Modified: peps/trunk/pep-3113.txt ============================================================================== --- peps/trunk/pep-3113.txt (original) +++ peps/trunk/pep-3113.txt Tue May 15 01:39:19 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Brett Cannon -Status: Accepted +Status: Final Type: Standards Track Python-version: 3.0 Content-Type: text/x-rst From python-checkins at python.org Tue May 15 01:45:37 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 15 May 2007 01:45:37 +0200 (CEST) Subject: [Python-checkins] r55329 - svn:log Message-ID: <20070514234537.89A531E400F@bag.python.org> Author: brett.cannon Revision: 55329 Property Name: svn:log New Property Value: Implement the removal of tuple parameter unpacking (PEP 3113). Thanks, Tony Lownds for the patch. From python-checkins at python.org Tue May 15 22:19:35 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 15 May 2007 22:19:35 +0200 (CEST) Subject: [Python-checkins] r55348 - in python/trunk: Lib/cgitb.py Misc/NEWS Message-ID: <20070515201935.DF9C91E4002@bag.python.org> Author: georg.brandl Date: Tue May 15 22:19:34 2007 New Revision: 55348 Modified: python/trunk/Lib/cgitb.py python/trunk/Misc/NEWS Log: HTML-escape the plain traceback in cgitb's HTML output, to prevent the traceback inadvertently or maliciously closing the comment and injecting HTML into the error page. Modified: python/trunk/Lib/cgitb.py ============================================================================== --- python/trunk/Lib/cgitb.py (original) +++ python/trunk/Lib/cgitb.py Tue May 15 22:19:34 2007 @@ -183,7 +183,8 @@ %s --> -''' % ''.join(traceback.format_exception(etype, evalue, etb)) +''' % pydoc.html.escape( + ''.join(traceback.format_exception(etype, evalue, etb))) def text((etype, evalue, etb), context=5): """Return a plain text document describing a given traceback.""" Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue May 15 22:19:34 2007 @@ -207,6 +207,10 @@ Library ------- +- HTML-escape the plain traceback in cgitb's HTML output, to prevent + the traceback inadvertently or maliciously closing the comment and + injecting HTML into the error page. + - The popen2 module and os.popen* are deprecated. Use the subprocess module. - Added an optional credentials argument to SMTPHandler, for use with SMTP From python-checkins at python.org Tue May 15 22:19:40 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 15 May 2007 22:19:40 +0200 (CEST) Subject: [Python-checkins] r55349 - in python/branches/release25-maint: Lib/cgitb.py Misc/NEWS Message-ID: <20070515201940.2C9EA1E4002@bag.python.org> Author: georg.brandl Date: Tue May 15 22:19:39 2007 New Revision: 55349 Modified: python/branches/release25-maint/Lib/cgitb.py python/branches/release25-maint/Misc/NEWS Log: HTML-escape the plain traceback in cgitb's HTML output, to prevent the traceback inadvertently or maliciously closing the comment and injecting HTML into the error page. (backport from rev. 55348) Modified: python/branches/release25-maint/Lib/cgitb.py ============================================================================== --- python/branches/release25-maint/Lib/cgitb.py (original) +++ python/branches/release25-maint/Lib/cgitb.py Tue May 15 22:19:39 2007 @@ -183,7 +183,8 @@ %s --> -''' % ''.join(traceback.format_exception(etype, evalue, etb)) +''' % pydoc.html.escape( + ''.join(traceback.format_exception(etype, evalue, etb))) def text((etype, evalue, etb), context=5): """Return a plain text document describing a given traceback.""" Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Tue May 15 22:19:39 2007 @@ -12,6 +12,10 @@ Library ------- +- HTML-escape the plain traceback in cgitb's HTML output, to prevent + the traceback inadvertently or maliciously closing the comment and + injecting HTML into the error page. + - Bug #1290505: Properly clear time.strptime's locale cache when the locale changes between calls. Backport of r54646 and r54647. From python-checkins at python.org Tue May 15 22:19:44 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 15 May 2007 22:19:44 +0200 (CEST) Subject: [Python-checkins] r55350 - in python/branches/release24-maint: Lib/cgitb.py Misc/NEWS Message-ID: <20070515201944.05F931E4002@bag.python.org> Author: georg.brandl Date: Tue May 15 22:19:42 2007 New Revision: 55350 Modified: python/branches/release24-maint/Lib/cgitb.py python/branches/release24-maint/Misc/NEWS Log: HTML-escape the plain traceback in cgitb's HTML output, to prevent the traceback inadvertently or maliciously closing the comment and injecting HTML into the error page. (backport from rev. 55348) Modified: python/branches/release24-maint/Lib/cgitb.py ============================================================================== --- python/branches/release24-maint/Lib/cgitb.py (original) +++ python/branches/release24-maint/Lib/cgitb.py Tue May 15 22:19:42 2007 @@ -182,7 +182,8 @@ %s --> -''' % ''.join(traceback.format_exception(etype, evalue, etb)) +''' % pydoc.html.escape( + ''.join(traceback.format_exception(etype, evalue, etb))) def text((etype, evalue, etb), context=5): """Return a plain text document describing a given traceback.""" Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue May 15 22:19:42 2007 @@ -26,6 +26,10 @@ Library ------- +- HTML-escape the plain traceback in cgitb's HTML output, to prevent + the traceback inadvertently or maliciously closing the comment and + injecting HTML into the error page. + - idle: Honor the "Cancel" action in the save dialog (Debian bug #299092). Tests From nnorwitz at gmail.com Tue May 15 23:16:50 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 15 May 2007 17:16:50 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20070515211650.GA8434@python.psfb.org> test_popen2 leaked [-26, 0, 0] references, sum=-26 From python-checkins at python.org Wed May 16 00:00:16 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 16 May 2007 00:00:16 +0200 (CEST) Subject: [Python-checkins] r55362 - peps/trunk/pep-3100.txt Message-ID: <20070515220016.A8B2A1E400B@bag.python.org> Author: guido.van.rossum Date: Wed May 16 00:00:14 2007 New Revision: 55362 Modified: peps/trunk/pep-3100.txt Log: strop is gone. several other modules were already gone (e.g. pcre, xmllib). Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Wed May 16 00:00:14 2007 @@ -206,8 +206,9 @@ * The sets module. [done] * stdlib modules to be removed + see docstrings and comments in the source - - ``macfs``, ``new``, ``reconvert``, ``stringold``, ``xmllib``, - ``pcre``, ``pypcre``, ``strop`` + - ``macfs``, ``new`` [to do] + - ``reconvert``, ``stringold``, ``xmllib``, + ``pcre``, ``pypcre``, ``strop`` [all done] + see PEP 4 [#pep4]_ - ``posixfile``, ``pre``, ``regsub``, ``rfc822``, ``statcache``, ``string``, ``TERMIOS``, ``mimetools``, From python-checkins at python.org Wed May 16 06:02:21 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 16 May 2007 06:02:21 +0200 (CEST) Subject: [Python-checkins] r55365 - peps/trunk/pep-3108.txt Message-ID: <20070516040221.0E3901E4002@bag.python.org> Author: brett.cannon Date: Wed May 16 06:02:15 2007 New Revision: 55365 Modified: peps/trunk/pep-3108.txt Log: Mention to edit Setup.dist and setup.py when a module is removed. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Wed May 16 06:02:15 2007 @@ -54,6 +54,7 @@ #. Remove the module. #. Remove the tests. +#. Edit ``Modules/Setup.dist`` and ``setup.py`` if needed. #. Change all references to the removed module in the standard library. #. Remove the docs. From python-checkins at python.org Wed May 16 06:06:09 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 16 May 2007 06:06:09 +0200 (CEST) Subject: [Python-checkins] r55366 - peps/trunk/pep-3108.txt Message-ID: <20070516040609.732901E4002@bag.python.org> Author: brett.cannon Date: Wed May 16 06:06:05 2007 New Revision: 55366 Modified: peps/trunk/pep-3108.txt Log: Update deprected module removals. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Wed May 16 06:06:05 2007 @@ -86,8 +86,8 @@ macfs 2.3 md5 2.5 [done] sha 2.5 [done] -strop unknown -xmllib unknown +strop unknown [done] +xmllib unknown [done] ============== ========== From python-checkins at python.org Wed May 16 06:06:55 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 16 May 2007 06:06:55 +0200 (CEST) Subject: [Python-checkins] r55368 - peps/trunk/pep-3108.txt Message-ID: <20070516040655.460F91E4002@bag.python.org> Author: brett.cannon Date: Wed May 16 06:06:53 2007 New Revision: 55368 Modified: peps/trunk/pep-3108.txt Log: Document the removal of the 'pure' module. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Wed May 16 06:06:53 2007 @@ -261,7 +261,7 @@ + Docstring states the module is no longer useful as of revision 27241 (2002-06-15). -* pure +* pure [done] + Written before Pure Atria was bought by Rational which was then bought by IBM (in other words, very old). From python-checkins at python.org Wed May 16 06:31:56 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 16 May 2007 06:31:56 +0200 (CEST) Subject: [Python-checkins] r55371 - peps/trunk/pep-0004.txt peps/trunk/pep-3100.txt peps/trunk/pep-3108.txt Message-ID: <20070516043156.8E87A1E4002@bag.python.org> Author: brett.cannon Date: Wed May 16 06:31:51 2007 New Revision: 55371 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-3100.txt peps/trunk/pep-3108.txt Log: Clean up listing of what modules are deprecated and thus should go from Py3K. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Wed May 16 06:31:51 2007 @@ -188,6 +188,36 @@ Date: 12-Jan-2007 Documentation: Documented as deprecated as of Python 2.6. + Module name: buildtools + Rationale: Unknown. + Date: 15-May-2007 + Documentation: Documented as deprecated as of Python 2.3, but + listing in this PEP was neglected. + + Module name: cfmfile + Rationale: Unknown. + Date: 15-May-2007 + Documentation: Documented as deprecated as of Python 2.4, but + listing in this PEP was neglected. + + Module name: macfs + Rationale: Unknown. + Date: 15-May-2007 + Documentation: Documented as deprecated as of Python 2.3, but + listing in this PEP was neglected. + + Module name: md5 + Rationale: Replaced by the 'hashlib' module. + Date: 15-May-2007 + Documentation: Documented as deprecated as of Python 2.5, but + listing in this PEP was neglected. + + Module name: sha + Rationale: Replaced by the 'hashlib' module. + Date: 15-May-2007 + Documentation: Documented as deprecated as of Python 2.5, but + listing in this PEP was neglected. + Undeprecated modules Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Wed May 16 06:31:51 2007 @@ -210,10 +210,16 @@ - ``reconvert``, ``stringold``, ``xmllib``, ``pcre``, ``pypcre``, ``strop`` [all done] + see PEP 4 [#pep4]_ - - ``posixfile``, ``pre``, ``regsub``, ``rfc822``, - ``statcache``, ``string``, ``TERMIOS``, ``mimetools``, - ``MimeWriter``, ``mimify``, ``mpz``, ``rgbimage`` - + Everything in lib-old [#pep4]_ + - ``cl``, + ``gopherlib``, + ``mimetools``, ``MimeWriter``, ``mimify``, ``mpz``, + ``multifile``, + ``posixfile``, + ``pre``, ``regsub``, ``rfc822``, ``rgbimage``, + ``statcache``, ``string``, ``sv``, ``TERMIOS``, + ``timing`` [to do] + - ``sets``, ``xreadlines``, ``rotor``, ``whrandom`` [done] + + Everything in lib-old [#pep4]_ [done] - ``Para``, ``addpack``, ``cmp``, ``cmpcache``, ``codehack``, ``dircmp``, ``dump``, ``find``, ``fmt``, ``grep``, ``lockfile``, ``newdir``, ``ni``, ``packmail``, ``poly``, Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Wed May 16 06:31:51 2007 @@ -71,25 +71,10 @@ [#pep-0004]_. All modules listed in the PEP at the time of the first alpha release of Python 3.0 will be removed. -The entire contents of libold will also be removed. These modules +The entire contents of lib-old will also be removed. These modules have already been removed from being imported but are kept in the distribution for Python for users that rely upon the code. -On top of the modules listed in PEP 4, other modules have been -documented as deprecated but have yet to be added to PEP 4. - -============== ========== -Module Deprecated -============== ========== -buildtools 2.3 -cfmfile 2.4 -macfs 2.3 -md5 2.5 [done] -sha 2.5 [done] -strop unknown [done] -xmllib unknown [done] -============== ========== - Platform-specific with minimal use ---------------------------------- From python-checkins at python.org Wed May 16 06:33:52 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 16 May 2007 06:33:52 +0200 (CEST) Subject: [Python-checkins] r55372 - python/trunk/Objects/intobject.c Message-ID: <20070516043352.8067A1E4002@bag.python.org> Author: neal.norwitz Date: Wed May 16 06:33:50 2007 New Revision: 55372 Modified: python/trunk/Objects/intobject.c Log: Port rev 55353 from Guido: Add what looks like a necessary call to PyErr_NoMemory() when PyMem_MALLOC() fails. Will backport. Modified: python/trunk/Objects/intobject.c ============================================================================== --- python/trunk/Objects/intobject.c (original) +++ python/trunk/Objects/intobject.c Wed May 16 06:33:50 2007 @@ -393,7 +393,7 @@ char *buffer = (char *)PyMem_MALLOC(length+1); if (buffer == NULL) - return NULL; + return PyErr_NoMemory(); if (PyUnicode_EncodeDecimal(s, length, buffer, NULL)) { PyMem_FREE(buffer); From python-checkins at python.org Wed May 16 06:35:13 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 16 May 2007 06:35:13 +0200 (CEST) Subject: [Python-checkins] r55373 - python/branches/release25-maint/Objects/intobject.c Message-ID: <20070516043513.551001E4009@bag.python.org> Author: neal.norwitz Date: Wed May 16 06:35:11 2007 New Revision: 55373 Modified: python/branches/release25-maint/Objects/intobject.c Log: Add what looks like a necessary call to PyErr_NoMemory() when PyMem_MALLOC() fails. Modified: python/branches/release25-maint/Objects/intobject.c ============================================================================== --- python/branches/release25-maint/Objects/intobject.c (original) +++ python/branches/release25-maint/Objects/intobject.c Wed May 16 06:35:11 2007 @@ -394,7 +394,7 @@ char *buffer = (char *)PyMem_MALLOC(length+1); if (buffer == NULL) - return NULL; + return PyErr_NoMemory(); if (PyUnicode_EncodeDecimal(s, length, buffer, NULL)) { PyMem_FREE(buffer); From python-checkins at python.org Wed May 16 06:44:28 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 16 May 2007 06:44:28 +0200 (CEST) Subject: [Python-checkins] r55375 - peps/trunk/pep-3100.txt Message-ID: <20070516044428.3B9141E4002@bag.python.org> Author: brett.cannon Date: Wed May 16 06:44:21 2007 New Revision: 55375 Modified: peps/trunk/pep-3100.txt Log: Reformat PEP 4 modules to remove and move cl as removed. Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Wed May 16 06:44:21 2007 @@ -210,15 +210,24 @@ - ``reconvert``, ``stringold``, ``xmllib``, ``pcre``, ``pypcre``, ``strop`` [all done] + see PEP 4 [#pep4]_ - - ``cl``, - ``gopherlib``, - ``mimetools``, ``MimeWriter``, ``mimify``, ``mpz``, + - ``gopherlib``, + ``mimetools``, + ``MimeWriter``, + ``mimify``, + ``mpz``, ``multifile``, ``posixfile``, - ``pre``, ``regsub``, ``rfc822``, ``rgbimage``, - ``statcache``, ``string``, ``sv``, ``TERMIOS``, - ``timing`` [to do] - - ``sets``, ``xreadlines``, ``rotor``, ``whrandom`` [done] + ``pre``, + ``regsub``, + ``rfc822``, + ``rgbimage``, + ``statcache``, + ``string``, + ``sv``, + ``TERMIOS``, + ``timing`` + [to do] + - ``cl``, ``sets``, ``xreadlines``, ``rotor``, ``whrandom`` [done] + Everything in lib-old [#pep4]_ [done] - ``Para``, ``addpack``, ``cmp``, ``cmpcache``, ``codehack``, ``dircmp``, ``dump``, ``find``, ``fmt``, ``grep``, From nnorwitz at gmail.com Wed May 16 06:49:01 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 15 May 2007 21:49:01 -0700 Subject: [Python-checkins] r55300 - peps/trunk/pep-0011.txt In-Reply-To: <4647F14D.2070808@v.loewis.de> References: <20070513211648.E0A4A1E4009@bag.python.org> <4647F14D.2070808@v.loewis.de> Message-ID: On 5/13/07, "Martin v. L?wis" wrote: > > In 2.7 remove support for freebsd4 and 5. 4 is already not supported, > > but the last version was released in 2005. > > 5 will be EOL around the same time as 2.6 is released. > > That's actually not the way PEP 11 is meant to work. If some platform > support is to be removed, there should be one major release in which > the code is disabled, and then it should be removed only in the next > version. So if FreeBSD 4 and 5 should not be supported anymore, we > should "break" them in 2.6, and remove the code in 2.7. My intent was not really to break the support for the platform, but rather just remove the IN.py module in the Lib/plat-freebsd* directories. I don't know that we have any code specific to these platforms other than trivial stuff I don't care about (e.g., simple stuff in configure.in, or references in tests). Brett's checkin reminded me that we have a PEP (4) for modules which is more appropriate for my intent. Your mail reminded me that I forgot to include a Misc/NEWS entry. :-) I will remove the entry in PEP 11 and add one to PEP 4 and update Misc/NEWS. n From python-checkins at python.org Wed May 16 07:04:37 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 16 May 2007 07:04:37 +0200 (CEST) Subject: [Python-checkins] r55376 - peps/trunk/pep-0004.txt peps/trunk/pep-0011.txt Message-ID: <20070516050437.6399A1E4002@bag.python.org> Author: neal.norwitz Date: Wed May 16 07:04:32 2007 New Revision: 55376 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0011.txt Log: Move doc about supporting old versions of FreeBSD from PEP 11 to 4. We are just not supporting the platform-specific modules, not the platform. Here is the original checkin comment for PEP 11: Remove support for freebsd[23] which were last released in 2000. In 2.7 remove support for freebsd4 and 5. 4 is already not supported, but the last version was released in 2005. 5 will be EOL around the same time as 2.6 is released. http://www.freebsd.org/releases/index.html http://security.freebsd.org/ Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Wed May 16 07:04:32 2007 @@ -218,6 +218,18 @@ Documentation: Documented as deprecated as of Python 2.5, but listing in this PEP was neglected. + Module name: plat-freebsd2/IN and plat-freebsd3/IN + Rationale: Platforms are obsolete (last released in 2000) + Removed from 2.6 + Date: 15-May-2007 + Documentation: None + + Module name: plat-freebsd4/IN and possibly plat-freebsd5/IN + Rationale: Platforms are obsolete/unsupported + Date: 15-May-2007 + Remove from 2.7 + Documentation: None + Undeprecated modules Modified: peps/trunk/pep-0011.txt ============================================================================== --- peps/trunk/pep-0011.txt (original) +++ peps/trunk/pep-0011.txt Wed May 16 07:04:32 2007 @@ -133,14 +133,6 @@ Unsupported in: Python 2.6 (warning in 2.5 installer) Code removed in: Python 2.6 - Name: FreeBSD 2 and 3 - Unsupported in: Python 2.6 - Code removed in: Python 2.6 - - Name: FreeBSD 4 and 5 - Unsupported in: Python 2.7 - Code removed in: Python 2.7 - Copyright This document has been placed in the public domain. From python-checkins at python.org Wed May 16 07:06:39 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 16 May 2007 07:06:39 +0200 (CEST) Subject: [Python-checkins] r55377 - python/trunk/Misc/NEWS Message-ID: <20070516050639.6DF211E4002@bag.python.org> Author: neal.norwitz Date: Wed May 16 07:06:33 2007 New Revision: 55377 Modified: python/trunk/Misc/NEWS Log: Mention removal of some directories for obsolete platforms Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed May 16 07:06:33 2007 @@ -207,6 +207,9 @@ Library ------- +- Removed plat-freebsd2 and plat-freebsd3 directories (and IN.py in + the directories). + - HTML-escape the plain traceback in cgitb's HTML output, to prevent the traceback inadvertently or maliciously closing the comment and injecting HTML into the error page. From python-checkins at python.org Wed May 16 07:27:47 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 16 May 2007 07:27:47 +0200 (CEST) Subject: [Python-checkins] r55378 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt peps/trunk/pep-3100.txt Message-ID: <20070516052747.81F8D1E4002@bag.python.org> Author: brett.cannon Date: Wed May 16 07:27:37 2007 New Revision: 55378 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt peps/trunk/pep-3100.txt Log: More clearly specify what modules should be removed in Python 2.6 along with what deprecated modules currently lack a DeprecationWarning. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Wed May 16 07:27:37 2007 @@ -78,6 +78,11 @@ rand, reconvert, regex, regsub, statcache, tb, tzparse, util, whatsound, whrandom, zmod + The following modules currently lack a DeprecationWarning: + + posixfile, rfc822, mimetools, MimeWriter, mimify, + multifile, md5, sha + Deprecated modules Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Wed May 16 07:27:37 2007 @@ -59,6 +59,10 @@ None + Deprecated modules in the standard library: + + - sets + Python 3.0 compatability: None @@ -100,6 +104,26 @@ PJE's withdrawal from 2.5 for inclusion in 2.6: http://mail.python.org/pipermail/python-dev/2006-April/064145.html + Modules to be removed according to PEP 4: + + - gopherlib + - rgbimg + - buildtools [if DeprecationWarning raised in 2.5] + - cfmfile [if DeprecationWarning raised in 2.5] + - macfs [if DeprecationWarning raised in 2.5] + + Module to gain a DeprecationWarning (as specified for Python 2.6 + or through negligence): + + - posixfile + - rfc822 + - mimetools + - MimeWriter + - mimify + - multifile + - md5 + - sha + - warnings module implemented in C * Convert Parser/*.c to use warnings module rather than printf @@ -124,7 +148,7 @@ * function attributes that start with func_* (should use __*__) * softspace removal for print() function * the L suffix for long literals - * removal of the sets and exceptions module + * removal of modules because of PEP 4/3100/3108 * renaming of __nonzero__ to __bool__ * multiple inheritance with classic classes? (MRO might change) * properties and classic classes? (instance attrs shadow property) Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Wed May 16 07:27:37 2007 @@ -217,7 +217,6 @@ ``mpz``, ``multifile``, ``posixfile``, - ``pre``, ``regsub``, ``rfc822``, ``rgbimage``, From python-checkins at python.org Wed May 16 07:50:06 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 16 May 2007 07:50:06 +0200 (CEST) Subject: [Python-checkins] r55380 - python/trunk/Misc/BeOS-NOTES Message-ID: <20070516055006.67F461E4002@bag.python.org> Author: brett.cannon Date: Wed May 16 07:50:03 2007 New Revision: 55380 Modified: python/trunk/Misc/BeOS-NOTES Log: Change the maintainer of the BeOS port. Modified: python/trunk/Misc/BeOS-NOTES ============================================================================== --- python/trunk/Misc/BeOS-NOTES (original) +++ python/trunk/Misc/BeOS-NOTES Wed May 16 07:50:03 2007 @@ -39,5 +39,4 @@ make install -- Donn Cave (donn at oz.net) - October 4, 2000 +Maintainer: Mikael Jansson (mail at mikael.jansson.be) From buildbot at python.org Wed May 16 07:51:21 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 16 May 2007 05:51:21 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20070516055121.8C5B11E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/265 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== FAIL: testInterruptedTimeout (test.test_socket.TCPTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/net/taipan/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socket.py", line 879, in testInterruptedTimeout self.fail("got Alarm in wrong place") AssertionError: got Alarm in wrong place sincerely, -The Buildbot From python-checkins at python.org Wed May 16 15:44:21 2007 From: python-checkins at python.org (georg.brandl) Date: Wed, 16 May 2007 15:44:21 +0200 (CEST) Subject: [Python-checkins] r55383 - python/trunk/Doc/lib/libsets.tex Message-ID: <20070516134421.7AC001E4002@bag.python.org> Author: georg.brandl Date: Wed May 16 15:44:18 2007 New Revision: 55383 Modified: python/trunk/Doc/lib/libsets.tex Log: Bug #1719995: don't use deprecated method in sets example. Modified: python/trunk/Doc/lib/libsets.tex ============================================================================== --- python/trunk/Doc/lib/libsets.tex (original) +++ python/trunk/Doc/lib/libsets.tex Wed May 16 15:44:18 2007 @@ -189,13 +189,13 @@ >>> engineers.add('Marvin') # add element >>> print engineers Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) ->>> employees.issuperset(engineers) # superset test +>>> employees.issuperset(engineers) # superset test False ->>> employees.union_update(engineers) # update from another set +>>> employees.update(engineers) # update from another set >>> employees.issuperset(engineers) True >>> for group in [engineers, programmers, managers, employees]: -... group.discard('Susan') # unconditionally remove element +... group.discard('Susan') # unconditionally remove element ... print group ... Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) From python-checkins at python.org Wed May 16 15:44:27 2007 From: python-checkins at python.org (georg.brandl) Date: Wed, 16 May 2007 15:44:27 +0200 (CEST) Subject: [Python-checkins] r55384 - python/branches/release25-maint/Doc/lib/libsets.tex Message-ID: <20070516134427.AD6FD1E4002@bag.python.org> Author: georg.brandl Date: Wed May 16 15:44:25 2007 New Revision: 55384 Modified: python/branches/release25-maint/Doc/lib/libsets.tex Log: Bug #1719995: don't use deprecated method in sets example. (backport from rev. 55383) Modified: python/branches/release25-maint/Doc/lib/libsets.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libsets.tex (original) +++ python/branches/release25-maint/Doc/lib/libsets.tex Wed May 16 15:44:25 2007 @@ -187,13 +187,13 @@ >>> engineers.add('Marvin') # add element >>> print engineers Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) ->>> employees.issuperset(engineers) # superset test +>>> employees.issuperset(engineers) # superset test False ->>> employees.union_update(engineers) # update from another set +>>> employees.update(engineers) # update from another set >>> employees.issuperset(engineers) True >>> for group in [engineers, programmers, managers, employees]: -... group.discard('Susan') # unconditionally remove element +... group.discard('Susan') # unconditionally remove element ... print group ... Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) From python-checkins at python.org Wed May 16 20:59:17 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 16 May 2007 20:59:17 +0200 (CEST) Subject: [Python-checkins] r55385 - python/branches/bcannon-objcap/BRANCH_NOTES python/branches/bcannon-objcap/secure_python.c Message-ID: <20070516185917.518A71E4009@bag.python.org> Author: brett.cannon Date: Wed May 16 20:59:12 2007 New Revision: 55385 Modified: python/branches/bcannon-objcap/BRANCH_NOTES python/branches/bcannon-objcap/secure_python.c Log: Dirty hack to make imports work as 'open' is needed by importlib. Better fix in controlled_importlib but that has not yet been tested. Also flesh out what should probably be tested. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Wed May 16 20:59:12 2007 @@ -12,9 +12,20 @@ ====== Status ====== -* Decide how to squirrel away and access 'open'. * Turn on whitelisting. + - Verify injecting 'open' into importlib works. * Write tests. + - Import + + Delegate protects importlib. + + Whitelisting works. + * Name fall-through to alternate implementation. + + '.hidden' cannot be imported. + + Removed modules cannot be imported (unless whitelisted). + - Built-in namespace properly cleansed. + + Nothing exposed through __builtin__ or __builtins__. + - Types crippled. + + file + + code ========== References Modified: python/branches/bcannon-objcap/secure_python.c ============================================================================== --- python/branches/bcannon-objcap/secure_python.c (original) +++ python/branches/bcannon-objcap/secure_python.c Wed May 16 20:59:12 2007 @@ -26,6 +26,11 @@ import_module = PyImport_ImportModule("importlib"); + /* XXX Hack to make importlib work w/o 'open' in the built-in namespace. + Fixed in controlled_importlib. */ + PyDict_SetItemString(PyModule_GetDict(import_module), "open", + PyDict_GetItemString(interp->builtins, "open")); + import_callable = PyObject_CallMethod(import_module, "Import", ""); /* Store import machinery somewhere so that a reference is held as From python-checkins at python.org Wed May 16 22:05:18 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 16 May 2007 22:05:18 +0200 (CEST) Subject: [Python-checkins] r55386 - in python/trunk: Lib/test/test_marshal.py Misc/ACKS Misc/NEWS Python/marshal.c Message-ID: <20070516200518.1E6671E4002@bag.python.org> Author: neal.norwitz Date: Wed May 16 22:05:11 2007 New Revision: 55386 Modified: python/trunk/Lib/test/test_marshal.py python/trunk/Misc/ACKS python/trunk/Misc/NEWS python/trunk/Python/marshal.c Log: Fix bug in marshal where bad data would cause a segfault due to lack of an infinite recursion check. Contributed by Damien Miller at Google. Modified: python/trunk/Lib/test/test_marshal.py ============================================================================== --- python/trunk/Lib/test/test_marshal.py (original) +++ python/trunk/Lib/test/test_marshal.py Wed May 16 22:05:11 2007 @@ -220,6 +220,10 @@ except Exception: pass + def test_recursion(self): + s = 'c' + ('X' * 4*4) + '{' * 2**20 + self.assertRaises(ValueError, marshal.loads, s) + def test_main(): test_support.run_unittest(IntTestCase, FloatTestCase, Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Wed May 16 22:05:11 2007 @@ -429,6 +429,7 @@ Greg McFarlane Michael McLay Gordon McMillan +Damien Miller Jay T. Miller Chris McDonough Andrew McNamara Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed May 16 22:05:11 2007 @@ -207,6 +207,9 @@ Library ------- +- Fix bug in marshal where bad data would cause a segfault due to + lack of an infinite recursion check. + - Removed plat-freebsd2 and plat-freebsd3 directories (and IN.py in the directories). Modified: python/trunk/Python/marshal.c ============================================================================== --- python/trunk/Python/marshal.c (original) +++ python/trunk/Python/marshal.c Wed May 16 22:05:11 2007 @@ -246,9 +246,16 @@ goto exit; } else { + int ok; o = PyInt_FromSsize_t(PyDict_Size(p->strings)); - PyDict_SetItem(p->strings, v, o); - Py_DECREF(o); + ok = o && + PyDict_SetItem(p->strings, v, o) >= 0; + Py_XDECREF(o); + if (!ok) { + p->depth--; + p->error = 1; + return; + } w_byte(TYPE_INTERNED, p); } } @@ -413,7 +420,7 @@ typedef WFILE RFILE; /* Same struct with different invariants */ -#define rs_byte(p) (((p)->ptr != (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) +#define rs_byte(p) (((p)->ptr < (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) #define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p)) @@ -504,42 +511,60 @@ PyObject *v, *v2, *v3; long i, n; int type = r_byte(p); + PyObject *retval; + + p->depth++; + + if (p->depth > MAX_MARSHAL_STACK_DEPTH) { + p->depth--; + PyErr_SetString(PyExc_ValueError, "recursion limit exceeded"); + return NULL; + } switch (type) { case EOF: PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; case TYPE_NULL: - return NULL; + retval = NULL; + break; case TYPE_NONE: Py_INCREF(Py_None); - return Py_None; + retval = Py_None; + break; case TYPE_STOPITER: Py_INCREF(PyExc_StopIteration); - return PyExc_StopIteration; + retval = PyExc_StopIteration; + break; case TYPE_ELLIPSIS: Py_INCREF(Py_Ellipsis); - return Py_Ellipsis; + retval = Py_Ellipsis; + break; case TYPE_FALSE: Py_INCREF(Py_False); - return Py_False; + retval = Py_False; + break; case TYPE_TRUE: Py_INCREF(Py_True); - return Py_True; + retval = Py_True; + break; case TYPE_INT: - return PyInt_FromLong(r_long(p)); + retval = PyInt_FromLong(r_long(p)); + break; case TYPE_INT64: - return r_long64(p); + retval = r_long64(p); + break; case TYPE_LONG: { @@ -549,12 +574,15 @@ if (n < -INT_MAX || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } size = n<0 ? -n : n; ob = _PyLong_New(size); - if (ob == NULL) - return NULL; + if (ob == NULL) { + retval = NULL; + break; + } ob->ob_size = n; for (i = 0; i < size; i++) { int digit = r_short(p); @@ -562,11 +590,14 @@ Py_DECREF(ob); PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + ob = NULL; + break; } - ob->ob_digit[i] = digit; + if (ob != NULL) + ob->ob_digit[i] = digit; } - return (PyObject *)ob; + retval = (PyObject *)ob; + break; } case TYPE_FLOAT: @@ -577,13 +608,16 @@ if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } buf[n] = '\0'; - PyFPE_START_PROTECT("atof", return 0) + retval = NULL; + PyFPE_START_PROTECT("atof", break) dx = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(dx) - return PyFloat_FromDouble(dx); + retval = PyFloat_FromDouble(dx); + break; } case TYPE_BINARY_FLOAT: @@ -593,13 +627,16 @@ if (r_string((char*)buf, 8, p) != 8) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } x = _PyFloat_Unpack8(buf, 1); if (x == -1.0 && PyErr_Occurred()) { - return NULL; + retval = NULL; + break; } - return PyFloat_FromDouble(x); + retval = PyFloat_FromDouble(x); + break; } #ifndef WITHOUT_COMPLEX @@ -611,23 +648,27 @@ if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } buf[n] = '\0'; - PyFPE_START_PROTECT("atof", return 0) + retval = NULL; + PyFPE_START_PROTECT("atof", break;) c.real = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(c) n = r_byte(p); if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } buf[n] = '\0'; - PyFPE_START_PROTECT("atof", return 0) + PyFPE_START_PROTECT("atof", break) c.imag = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(c) - return PyComplex_FromCComplex(c); + retval = PyComplex_FromCComplex(c); + break; } case TYPE_BINARY_COMPLEX: @@ -637,22 +678,27 @@ if (r_string((char*)buf, 8, p) != 8) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } c.real = _PyFloat_Unpack8(buf, 1); if (c.real == -1.0 && PyErr_Occurred()) { - return NULL; + retval = NULL; + break; } if (r_string((char*)buf, 8, p) != 8) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } c.imag = _PyFloat_Unpack8(buf, 1); if (c.imag == -1.0 && PyErr_Occurred()) { - return NULL; + retval = NULL; + break; } - return PyComplex_FromCComplex(c); + retval = PyComplex_FromCComplex(c); + break; } #endif @@ -661,32 +707,42 @@ n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyString_FromStringAndSize((char *)NULL, n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { Py_DECREF(v); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } if (type == TYPE_INTERNED) { PyString_InternInPlace(&v); - PyList_Append(p->strings, v); + if (PyList_Append(p->strings, v) < 0) { + retval = NULL; + break; + } } - return v; + retval = v; + break; case TYPE_STRINGREF: n = r_long(p); if (n < 0 || n >= PyList_GET_SIZE(p->strings)) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyList_GET_ITEM(p->strings, n); Py_INCREF(v); - return v; + retval = v; + break; #ifdef Py_USING_UNICODE case TYPE_UNICODE: @@ -696,20 +752,25 @@ n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } buffer = PyMem_NEW(char, n); - if (buffer == NULL) - return PyErr_NoMemory(); + if (buffer == NULL) { + retval = PyErr_NoMemory(); + break; + } if (r_string(buffer, (int)n, p) != n) { PyMem_DEL(buffer); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } v = PyUnicode_DecodeUTF8(buffer, n, NULL); PyMem_DEL(buffer); - return v; + retval = v; + break; } #endif @@ -717,11 +778,14 @@ n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyTuple_New((int)n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } for (i = 0; i < n; i++) { v2 = r_object(p); if ( v2 == NULL ) { @@ -734,17 +798,21 @@ } PyTuple_SET_ITEM(v, (int)i, v2); } - return v; + retval = v; + break; case TYPE_LIST: n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyList_New((int)n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } for (i = 0; i < n; i++) { v2 = r_object(p); if ( v2 == NULL ) { @@ -755,14 +823,17 @@ v = NULL; break; } - PyList_SetItem(v, (int)i, v2); + PyList_SET_ITEM(v, (int)i, v2); } - return v; + retval = v; + break; case TYPE_DICT: v = PyDict_New(); - if (v == NULL) - return NULL; + if (v == NULL) { + retval = NULL; + break; + } for (;;) { PyObject *key, *val; key = r_object(p); @@ -778,18 +849,22 @@ Py_DECREF(v); v = NULL; } - return v; + retval = v; + break; case TYPE_SET: case TYPE_FROZENSET: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyTuple_New((int)n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } for (i = 0; i < n; i++) { v2 = r_object(p); if ( v2 == NULL ) { @@ -802,21 +877,25 @@ } PyTuple_SET_ITEM(v, (int)i, v2); } - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } if (type == TYPE_SET) v3 = PySet_New(v); else v3 = PyFrozenSet_New(v); Py_DECREF(v); - return v3; + retval = v3; + break; case TYPE_CODE: if (PyEval_GetRestricted()) { PyErr_SetString(PyExc_RuntimeError, "cannot unmarshal code objects in " "restricted execution mode"); - return NULL; + retval = NULL; + break; } else { int argcount; @@ -888,15 +967,19 @@ Py_XDECREF(lnotab); } - return v; + retval = v; + break; default: /* Bogus data got written, which isn't ideal. This will let you keep working and recover. */ PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } + p->depth--; + return retval; } static PyObject * @@ -1002,6 +1085,7 @@ PyObject *result; rf.fp = fp; rf.strings = PyList_New(0); + rf.depth = 0; result = r_object(&rf); Py_DECREF(rf.strings); return result; @@ -1016,6 +1100,7 @@ rf.ptr = str; rf.end = str + len; rf.strings = PyList_New(0); + rf.depth = 0; result = r_object(&rf); Py_DECREF(rf.strings); return result; @@ -1104,6 +1189,7 @@ } rf.fp = PyFile_AsFile(f); rf.strings = PyList_New(0); + rf.depth = 0; result = read_object(&rf); Py_DECREF(rf.strings); return result; @@ -1132,6 +1218,7 @@ rf.ptr = s; rf.end = s + n; rf.strings = PyList_New(0); + rf.depth = 0; result = read_object(&rf); Py_DECREF(rf.strings); return result; From python-checkins at python.org Wed May 16 22:09:38 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 16 May 2007 22:09:38 +0200 (CEST) Subject: [Python-checkins] r55387 - in python/branches/release25-maint: Lib/test/test_marshal.py Misc/ACKS Misc/NEWS Python/marshal.c Message-ID: <20070516200938.A40A81E4003@bag.python.org> Author: neal.norwitz Date: Wed May 16 22:09:36 2007 New Revision: 55387 Modified: python/branches/release25-maint/Lib/test/test_marshal.py python/branches/release25-maint/Misc/ACKS python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Python/marshal.c Log: Fix bug in marshal where bad data would cause a segfault due to lack of an infinite recursion check. Contributed by Damien Miller at Google. Modified: python/branches/release25-maint/Lib/test/test_marshal.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_marshal.py (original) +++ python/branches/release25-maint/Lib/test/test_marshal.py Wed May 16 22:09:36 2007 @@ -220,6 +220,10 @@ except Exception: pass + def test_recursion(self): + s = 'c' + ('X' * 4*4) + '{' * 2**20 + self.assertRaises(ValueError, marshal.loads, s) + def test_main(): test_support.run_unittest(IntTestCase, FloatTestCase, Modified: python/branches/release25-maint/Misc/ACKS ============================================================================== --- python/branches/release25-maint/Misc/ACKS (original) +++ python/branches/release25-maint/Misc/ACKS Wed May 16 22:09:36 2007 @@ -413,6 +413,7 @@ Greg McFarlane Michael McLay Gordon McMillan +Damien Miller Jay T. Miller Chris McDonough Andrew McNamara Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Wed May 16 22:09:36 2007 @@ -12,6 +12,9 @@ Library ------- +- Fix bug in marshal where bad data would cause a segfault due to + lack of an infinite recursion check. + - HTML-escape the plain traceback in cgitb's HTML output, to prevent the traceback inadvertently or maliciously closing the comment and injecting HTML into the error page. Modified: python/branches/release25-maint/Python/marshal.c ============================================================================== --- python/branches/release25-maint/Python/marshal.c (original) +++ python/branches/release25-maint/Python/marshal.c Wed May 16 22:09:36 2007 @@ -246,9 +246,16 @@ goto exit; } else { + int ok; o = PyInt_FromSsize_t(PyDict_Size(p->strings)); - PyDict_SetItem(p->strings, v, o); - Py_DECREF(o); + ok = o && + PyDict_SetItem(p->strings, v, o) >= 0; + Py_XDECREF(o); + if (!ok) { + p->depth--; + p->error = 1; + return; + } w_byte(TYPE_INTERNED, p); } } @@ -413,7 +420,7 @@ typedef WFILE RFILE; /* Same struct with different invariants */ -#define rs_byte(p) (((p)->ptr != (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) +#define rs_byte(p) (((p)->ptr < (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) #define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p)) @@ -504,42 +511,60 @@ PyObject *v, *v2, *v3; long i, n; int type = r_byte(p); + PyObject *retval; + + p->depth++; + + if (p->depth > MAX_MARSHAL_STACK_DEPTH) { + p->depth--; + PyErr_SetString(PyExc_ValueError, "recursion limit exceeded"); + return NULL; + } switch (type) { case EOF: PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; case TYPE_NULL: - return NULL; + retval = NULL; + break; case TYPE_NONE: Py_INCREF(Py_None); - return Py_None; + retval = Py_None; + break; case TYPE_STOPITER: Py_INCREF(PyExc_StopIteration); - return PyExc_StopIteration; + retval = PyExc_StopIteration; + break; case TYPE_ELLIPSIS: Py_INCREF(Py_Ellipsis); - return Py_Ellipsis; + retval = Py_Ellipsis; + break; case TYPE_FALSE: Py_INCREF(Py_False); - return Py_False; + retval = Py_False; + break; case TYPE_TRUE: Py_INCREF(Py_True); - return Py_True; + retval = Py_True; + break; case TYPE_INT: - return PyInt_FromLong(r_long(p)); + retval = PyInt_FromLong(r_long(p)); + break; case TYPE_INT64: - return r_long64(p); + retval = r_long64(p); + break; case TYPE_LONG: { @@ -549,12 +574,15 @@ if (n < -INT_MAX || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } size = n<0 ? -n : n; ob = _PyLong_New(size); - if (ob == NULL) - return NULL; + if (ob == NULL) { + retval = NULL; + break; + } ob->ob_size = n; for (i = 0; i < size; i++) { int digit = r_short(p); @@ -562,11 +590,14 @@ Py_DECREF(ob); PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + ob = NULL; + break; } - ob->ob_digit[i] = digit; + if (ob != NULL) + ob->ob_digit[i] = digit; } - return (PyObject *)ob; + retval = (PyObject *)ob; + break; } case TYPE_FLOAT: @@ -577,13 +608,16 @@ if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } buf[n] = '\0'; - PyFPE_START_PROTECT("atof", return 0) + retval = NULL; + PyFPE_START_PROTECT("atof", break) dx = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(dx) - return PyFloat_FromDouble(dx); + retval = PyFloat_FromDouble(dx); + break; } case TYPE_BINARY_FLOAT: @@ -593,13 +627,16 @@ if (r_string((char*)buf, 8, p) != 8) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } x = _PyFloat_Unpack8(buf, 1); if (x == -1.0 && PyErr_Occurred()) { - return NULL; + retval = NULL; + break; } - return PyFloat_FromDouble(x); + retval = PyFloat_FromDouble(x); + break; } #ifndef WITHOUT_COMPLEX @@ -611,23 +648,27 @@ if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } buf[n] = '\0'; - PyFPE_START_PROTECT("atof", return 0) + retval = NULL; + PyFPE_START_PROTECT("atof", break;) c.real = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(c) n = r_byte(p); if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } buf[n] = '\0'; - PyFPE_START_PROTECT("atof", return 0) + PyFPE_START_PROTECT("atof", break) c.imag = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(c) - return PyComplex_FromCComplex(c); + retval = PyComplex_FromCComplex(c); + break; } case TYPE_BINARY_COMPLEX: @@ -637,22 +678,27 @@ if (r_string((char*)buf, 8, p) != 8) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } c.real = _PyFloat_Unpack8(buf, 1); if (c.real == -1.0 && PyErr_Occurred()) { - return NULL; + retval = NULL; + break; } if (r_string((char*)buf, 8, p) != 8) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } c.imag = _PyFloat_Unpack8(buf, 1); if (c.imag == -1.0 && PyErr_Occurred()) { - return NULL; + retval = NULL; + break; } - return PyComplex_FromCComplex(c); + retval = PyComplex_FromCComplex(c); + break; } #endif @@ -661,32 +707,42 @@ n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyString_FromStringAndSize((char *)NULL, n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { Py_DECREF(v); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } if (type == TYPE_INTERNED) { PyString_InternInPlace(&v); - PyList_Append(p->strings, v); + if (PyList_Append(p->strings, v) < 0) { + retval = NULL; + break; + } } - return v; + retval = v; + break; case TYPE_STRINGREF: n = r_long(p); if (n < 0 || n >= PyList_GET_SIZE(p->strings)) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyList_GET_ITEM(p->strings, n); Py_INCREF(v); - return v; + retval = v; + break; #ifdef Py_USING_UNICODE case TYPE_UNICODE: @@ -696,20 +752,25 @@ n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } buffer = PyMem_NEW(char, n); - if (buffer == NULL) - return PyErr_NoMemory(); + if (buffer == NULL) { + retval = PyErr_NoMemory(); + break; + } if (r_string(buffer, (int)n, p) != n) { PyMem_DEL(buffer); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } v = PyUnicode_DecodeUTF8(buffer, n, NULL); PyMem_DEL(buffer); - return v; + retval = v; + break; } #endif @@ -717,11 +778,14 @@ n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyTuple_New((int)n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } for (i = 0; i < n; i++) { v2 = r_object(p); if ( v2 == NULL ) { @@ -734,17 +798,21 @@ } PyTuple_SET_ITEM(v, (int)i, v2); } - return v; + retval = v; + break; case TYPE_LIST: n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyList_New((int)n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } for (i = 0; i < n; i++) { v2 = r_object(p); if ( v2 == NULL ) { @@ -755,14 +823,17 @@ v = NULL; break; } - PyList_SetItem(v, (int)i, v2); + PyList_SET_ITEM(v, (int)i, v2); } - return v; + retval = v; + break; case TYPE_DICT: v = PyDict_New(); - if (v == NULL) - return NULL; + if (v == NULL) { + retval = NULL; + break; + } for (;;) { PyObject *key, *val; key = r_object(p); @@ -778,18 +849,22 @@ Py_DECREF(v); v = NULL; } - return v; + retval = v; + break; case TYPE_SET: case TYPE_FROZENSET: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyTuple_New((int)n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } for (i = 0; i < n; i++) { v2 = r_object(p); if ( v2 == NULL ) { @@ -802,21 +877,25 @@ } PyTuple_SET_ITEM(v, (int)i, v2); } - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } if (type == TYPE_SET) v3 = PySet_New(v); else v3 = PyFrozenSet_New(v); Py_DECREF(v); - return v3; + retval = v3; + break; case TYPE_CODE: if (PyEval_GetRestricted()) { PyErr_SetString(PyExc_RuntimeError, "cannot unmarshal code objects in " "restricted execution mode"); - return NULL; + retval = NULL; + break; } else { int argcount; @@ -888,15 +967,19 @@ Py_XDECREF(lnotab); } - return v; + retval = v; + break; default: /* Bogus data got written, which isn't ideal. This will let you keep working and recover. */ PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } + p->depth--; + return retval; } static PyObject * @@ -1002,6 +1085,7 @@ PyObject *result; rf.fp = fp; rf.strings = PyList_New(0); + rf.depth = 0; result = r_object(&rf); Py_DECREF(rf.strings); return result; @@ -1016,6 +1100,7 @@ rf.ptr = str; rf.end = str + len; rf.strings = PyList_New(0); + rf.depth = 0; result = r_object(&rf); Py_DECREF(rf.strings); return result; @@ -1104,6 +1189,7 @@ } rf.fp = PyFile_AsFile(f); rf.strings = PyList_New(0); + rf.depth = 0; result = read_object(&rf); Py_DECREF(rf.strings); return result; @@ -1132,6 +1218,7 @@ rf.ptr = s; rf.end = s + n; rf.strings = PyList_New(0); + rf.depth = 0; result = read_object(&rf); Py_DECREF(rf.strings); return result; From buildbot at python.org Wed May 16 22:15:58 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 16 May 2007 20:15:58 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070516201558.E205E1E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/436 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon,georg.brandl,neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Wed May 16 22:31:23 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 16 May 2007 20:31:23 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian trunk Message-ID: <20070516203123.3E8BD1E4002@bag.python.org> The Buildbot has detected a new failure of MIPS Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%2520trunk/builds/810 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon,georg.brandl,neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: make: *** [buildbottest] Segmentation fault sincerely, -The Buildbot From buildbot at python.org Wed May 16 22:54:05 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 16 May 2007 20:54:05 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP 2.5 Message-ID: <20070516205405.6590F1E4002@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/231 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu May 17 00:00:49 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 16 May 2007 22:00:49 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian 2.5 Message-ID: <20070516220049.7E4551E400F@bag.python.org> The Buildbot has detected a new failure of MIPS Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%25202.5/builds/230 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: make: *** [buildbottest] Segmentation fault sincerely, -The Buildbot From python-checkins at python.org Thu May 17 00:42:39 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 17 May 2007 00:42:39 +0200 (CEST) Subject: [Python-checkins] r55389 - in python/trunk: Doc/Makefile.deps Doc/lib/lib.tex Doc/lib/libgopherlib.tex Doc/lib/liburllib.tex Doc/lib/liburllib2.tex Lib/gopherlib.py Lib/test/test___all__.py Lib/test/test_sundry.py Lib/test/test_urllib2net.py Lib/urllib.py Lib/urllib2.py Misc/NEWS Message-ID: <20070516224239.A2EBA1E400E@bag.python.org> Author: brett.cannon Date: Thu May 17 00:42:29 2007 New Revision: 55389 Removed: python/trunk/Doc/lib/libgopherlib.tex python/trunk/Lib/gopherlib.py Modified: python/trunk/Doc/Makefile.deps python/trunk/Doc/lib/lib.tex python/trunk/Doc/lib/liburllib.tex python/trunk/Doc/lib/liburllib2.tex python/trunk/Lib/test/test___all__.py python/trunk/Lib/test/test_sundry.py python/trunk/Lib/test/test_urllib2net.py python/trunk/Lib/urllib.py python/trunk/Lib/urllib2.py python/trunk/Misc/NEWS Log: Remove the gopherlib module. It has been raising a DeprecationWarning since Python 2.5. Also remove gopher support from urllib/urllib2. As both imported gopherlib the usage of the support would have raised a DeprecationWarning. Modified: python/trunk/Doc/Makefile.deps ============================================================================== --- python/trunk/Doc/Makefile.deps (original) +++ python/trunk/Doc/Makefile.deps Thu May 17 00:42:29 2007 @@ -187,7 +187,6 @@ lib/liburllib2.tex \ lib/libhttplib.tex \ lib/libftplib.tex \ - lib/libgopherlib.tex \ lib/libnntplib.tex \ lib/liburlparse.tex \ lib/libhtmlparser.tex \ Modified: python/trunk/Doc/lib/lib.tex ============================================================================== --- python/trunk/Doc/lib/lib.tex (original) +++ python/trunk/Doc/lib/lib.tex Thu May 17 00:42:29 2007 @@ -297,7 +297,6 @@ \input{liburllib2} \input{libhttplib} \input{libftplib} -\input{libgopherlib} \input{libpoplib} \input{libimaplib} \input{libnntplib} Deleted: /python/trunk/Doc/lib/libgopherlib.tex ============================================================================== --- /python/trunk/Doc/lib/libgopherlib.tex Thu May 17 00:42:29 2007 +++ (empty file) @@ -1,36 +0,0 @@ -\section{\module{gopherlib} --- - Gopher protocol client} - -\declaremodule{standard}{gopherlib} -\modulesynopsis{Gopher protocol client (requires sockets).} - -\deprecated{2.5}{The \code{gopher} protocol is not in active use - anymore.} - -\indexii{Gopher}{protocol} - -This module provides a minimal implementation of client side of the -Gopher protocol. It is used by the module \refmodule{urllib} to -handle URLs that use the Gopher protocol. - -The module defines the following functions: - -\begin{funcdesc}{send_selector}{selector, host\optional{, port}} -Send a \var{selector} string to the gopher server at \var{host} and -\var{port} (default \code{70}). Returns an open file object from -which the returned document can be read. -\end{funcdesc} - -\begin{funcdesc}{send_query}{selector, query, host\optional{, port}} -Send a \var{selector} string and a \var{query} string to a gopher -server at \var{host} and \var{port} (default \code{70}). Returns an -open file object from which the returned document can be read. -\end{funcdesc} - -Note that the data returned by the Gopher server can be of any type, -depending on the first character of the selector string. If the data -is text (first character of the selector is \samp{0}), lines are -terminated by CRLF, and the data is terminated by a line consisting of -a single \samp{.}, and a leading \samp{.} should be stripped from -lines that begin with \samp{..}. Directory listings (first character -of the selector is \samp{1}) are transferred using the same protocol. Modified: python/trunk/Doc/lib/liburllib.tex ============================================================================== --- python/trunk/Doc/lib/liburllib.tex (original) +++ python/trunk/Doc/lib/liburllib.tex Thu May 17 00:42:29 2007 @@ -70,8 +70,8 @@ The \function{urlopen()} function works transparently with proxies which do not require authentication. In a \UNIX{} or Windows -environment, set the \envvar{http_proxy}, \envvar{ftp_proxy} or -\envvar{gopher_proxy} environment variables to a URL that identifies +environment, set the \envvar{http_proxy}, or \envvar{ftp_proxy} +environment variables to a URL that identifies the proxy server before starting the Python interpreter. For example (the \character{\%} is the command prompt): @@ -253,7 +253,7 @@ \begin{classdesc}{URLopener}{\optional{proxies\optional{, **x509}}} Base class for opening and reading URLs. Unless you need to support opening objects using schemes other than \file{http:}, \file{ftp:}, -\file{gopher:} or \file{file:}, you probably want to use +or \file{file:}, you probably want to use \class{FancyURLopener}. By default, the \class{URLopener} class sends a @@ -324,9 +324,8 @@ \item Currently, only the following protocols are supported: HTTP, (versions -0.9 and 1.0), Gopher (but not Gopher-+), FTP, and local files. +0.9 and 1.0), FTP, and local files. \indexii{HTTP}{protocol} -\indexii{Gopher}{protocol} \indexii{FTP}{protocol} \item @@ -355,9 +354,7 @@ (such as an image), plain text or (for example) HTML\index{HTML}. The HTTP\indexii{HTTP}{protocol} protocol provides type information in the reply header, which can be inspected by looking at the -\mailheader{Content-Type} header. For the -Gopher\indexii{Gopher}{protocol} protocol, type information is encoded -in the URL; there is currently no easy way to extract it. If the +\mailheader{Content-Type} header. If the returned data is HTML, you can use the module \refmodule{htmllib}\refstmodindex{htmllib} to parse it. Modified: python/trunk/Doc/lib/liburllib2.tex ============================================================================== --- python/trunk/Doc/lib/liburllib2.tex (original) +++ python/trunk/Doc/lib/liburllib2.tex Thu May 17 00:42:29 2007 @@ -86,11 +86,6 @@ HTTP errors, such as requests for authentication. \end{excdesc} -\begin{excdesc}{GopherError} -A subclass of \exception{URLError}, this is the error raised by the -Gopher handler. -\end{excdesc} - The following classes are provided: @@ -241,10 +236,6 @@ delays. \end{classdesc} -\begin{classdesc}{GopherHandler}{} -Open gopher URLs. -\end{classdesc} - \begin{classdesc}{UnknownHandler}{} A catch-all class to handle unknown URLs. \end{classdesc} @@ -744,13 +735,6 @@ \end{methoddesc} -\subsection{GopherHandler Objects \label{gopher-handler}} - -\begin{methoddesc}[GopherHandler]{gopher_open}{req} -Open the gopher resource indicated by \var{req}. -\end{methoddesc} - - \subsection{UnknownHandler Objects \label{unknown-handler-objects}} \begin{methoddesc}[UnknownHandler]{unknown_open}{} Deleted: /python/trunk/Lib/gopherlib.py ============================================================================== --- /python/trunk/Lib/gopherlib.py Thu May 17 00:42:29 2007 +++ (empty file) @@ -1,209 +0,0 @@ -"""Gopher protocol client interface.""" - -__all__ = ["send_selector","send_query"] - -import warnings -warnings.warn("the gopherlib module is deprecated", DeprecationWarning, - stacklevel=2) - -# Default selector, host and port -DEF_SELECTOR = '1/' -DEF_HOST = 'gopher.micro.umn.edu' -DEF_PORT = 70 - -# Recognized file types -A_TEXT = '0' -A_MENU = '1' -A_CSO = '2' -A_ERROR = '3' -A_MACBINHEX = '4' -A_PCBINHEX = '5' -A_UUENCODED = '6' -A_INDEX = '7' -A_TELNET = '8' -A_BINARY = '9' -A_DUPLICATE = '+' -A_SOUND = 's' -A_EVENT = 'e' -A_CALENDAR = 'c' -A_HTML = 'h' -A_TN3270 = 'T' -A_MIME = 'M' -A_IMAGE = 'I' -A_WHOIS = 'w' -A_QUERY = 'q' -A_GIF = 'g' -A_HTML = 'h' # HTML file -A_WWW = 'w' # WWW address -A_PLUS_IMAGE = ':' -A_PLUS_MOVIE = ';' -A_PLUS_SOUND = '<' - - -_names = dir() -_type_to_name_map = {} -def type_to_name(gtype): - """Map all file types to strings; unknown types become TYPE='x'.""" - global _type_to_name_map - if _type_to_name_map=={}: - for name in _names: - if name[:2] == 'A_': - _type_to_name_map[eval(name)] = name[2:] - if gtype in _type_to_name_map: - return _type_to_name_map[gtype] - return 'TYPE=%r' % (gtype,) - -# Names for characters and strings -CRLF = '\r\n' -TAB = '\t' - -def send_selector(selector, host, port = 0): - """Send a selector to a given host and port, return a file with the reply.""" - import socket - if not port: - i = host.find(':') - if i >= 0: - host, port = host[:i], int(host[i+1:]) - if not port: - port = DEF_PORT - elif type(port) == type(''): - port = int(port) - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.connect((host, port)) - s.sendall(selector + CRLF) - s.shutdown(1) - return s.makefile('rb') - -def send_query(selector, query, host, port = 0): - """Send a selector and a query string.""" - return send_selector(selector + '\t' + query, host, port) - -def path_to_selector(path): - """Takes a path as returned by urlparse and returns the appropriate selector.""" - if path=="/": - return "/" - else: - return path[2:] # Cuts initial slash and data type identifier - -def path_to_datatype_name(path): - """Takes a path as returned by urlparse and maps it to a string. - See section 3.4 of RFC 1738 for details.""" - if path=="/": - # No way to tell, although "INDEX" is likely - return "TYPE='unknown'" - else: - return type_to_name(path[1]) - -# The following functions interpret the data returned by the gopher -# server according to the expected type, e.g. textfile or directory - -def get_directory(f): - """Get a directory in the form of a list of entries.""" - entries = [] - while 1: - line = f.readline() - if not line: - print '(Unexpected EOF from server)' - break - if line[-2:] == CRLF: - line = line[:-2] - elif line[-1:] in CRLF: - line = line[:-1] - if line == '.': - break - if not line: - print '(Empty line from server)' - continue - gtype = line[0] - parts = line[1:].split(TAB) - if len(parts) < 4: - print '(Bad line from server: %r)' % (line,) - continue - if len(parts) > 4: - if parts[4:] != ['+']: - print '(Extra info from server:', - print parts[4:], ')' - else: - parts.append('') - parts.insert(0, gtype) - entries.append(parts) - return entries - -def get_textfile(f): - """Get a text file as a list of lines, with trailing CRLF stripped.""" - lines = [] - get_alt_textfile(f, lines.append) - return lines - -def get_alt_textfile(f, func): - """Get a text file and pass each line to a function, with trailing CRLF stripped.""" - while 1: - line = f.readline() - if not line: - print '(Unexpected EOF from server)' - break - if line[-2:] == CRLF: - line = line[:-2] - elif line[-1:] in CRLF: - line = line[:-1] - if line == '.': - break - if line[:2] == '..': - line = line[1:] - func(line) - -def get_binary(f): - """Get a binary file as one solid data block.""" - data = f.read() - return data - -def get_alt_binary(f, func, blocksize): - """Get a binary file and pass each block to a function.""" - while 1: - data = f.read(blocksize) - if not data: - break - func(data) - -def test(): - """Trivial test program.""" - import sys - import getopt - opts, args = getopt.getopt(sys.argv[1:], '') - selector = DEF_SELECTOR - type = selector[0] - host = DEF_HOST - if args: - host = args[0] - args = args[1:] - if args: - type = args[0] - args = args[1:] - if len(type) > 1: - type, selector = type[0], type - else: - selector = '' - if args: - selector = args[0] - args = args[1:] - query = '' - if args: - query = args[0] - args = args[1:] - if type == A_INDEX: - f = send_query(selector, query, host) - else: - f = send_selector(selector, host) - if type == A_TEXT: - lines = get_textfile(f) - for item in lines: print item - elif type in (A_MENU, A_INDEX): - entries = get_directory(f) - for item in entries: print item - else: - data = get_binary(f) - print 'binary data:', len(data), 'bytes:', repr(data[:100])[:40] - -# Run the test when run as script -if __name__ == '__main__': - test() Modified: python/trunk/Lib/test/test___all__.py ============================================================================== --- python/trunk/Lib/test/test___all__.py (original) +++ python/trunk/Lib/test/test___all__.py Thu May 17 00:42:29 2007 @@ -3,10 +3,6 @@ import sys import warnings -warnings.filterwarnings("ignore", - "the gopherlib module is deprecated", - DeprecationWarning, - "") warnings.filterwarnings("ignore", "the sets module is deprecated", DeprecationWarning, "") warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*", @@ -84,7 +80,6 @@ self.check_all("getpass") self.check_all("gettext") self.check_all("glob") - self.check_all("gopherlib") self.check_all("gzip") self.check_all("heapq") self.check_all("htmllib") Modified: python/trunk/Lib/test/test_sundry.py ============================================================================== --- python/trunk/Lib/test/test_sundry.py (original) +++ python/trunk/Lib/test/test_sundry.py Thu May 17 00:42:29 2007 @@ -4,11 +4,6 @@ warnings.filterwarnings('ignore', r".*posixfile module", DeprecationWarning, 'posixfile$') -warnings.filterwarnings("ignore", - "the gopherlib module is deprecated", - DeprecationWarning, - ".*test_sundry") - from test.test_support import verbose import BaseHTTPServer @@ -27,7 +22,6 @@ import formatter import ftplib import getpass -import gopherlib import htmlentitydefs import ihooks import imghdr Modified: python/trunk/Lib/test/test_urllib2net.py ============================================================================== --- python/trunk/Lib/test/test_urllib2net.py (original) +++ python/trunk/Lib/test/test_urllib2net.py Thu May 17 00:42:29 2007 @@ -173,19 +173,6 @@ ] self._test_urls(urls, self._extra_handlers()) - def test_gopher(self): - import warnings - warnings.filterwarnings("ignore", - "the gopherlib module is deprecated", - DeprecationWarning, - "urllib2$") - urls = [ - # Thanks to Fred for finding these! - 'gopher://gopher.lib.ncsu.edu./11/library/stacks/Alex', - 'gopher://gopher.vt.edu.:10010/10/33', - ] - self._test_urls(urls, self._extra_handlers()) - def test_file(self): TESTFN = test_support.TESTFN f = open(TESTFN, 'w') @@ -274,8 +261,6 @@ def _extra_handlers(self): handlers = [] - handlers.append(urllib2.GopherHandler) - cfh = urllib2.CacheFTPHandler() cfh.setTimeout(1) handlers.append(cfh) Modified: python/trunk/Lib/urllib.py ============================================================================== --- python/trunk/Lib/urllib.py (original) +++ python/trunk/Lib/urllib.py Thu May 17 00:42:29 2007 @@ -35,7 +35,7 @@ "localhost", "thishost", "ftperrors", "basejoin", "unwrap", "splittype", "splithost", "splituser", "splitpasswd", "splitport", "splitnport", "splitquery", "splitattr", "splitvalue", - "splitgophertype", "getproxies"] + "getproxies"] __version__ = '1.17' # XXX This version is not always updated :-( @@ -433,24 +433,6 @@ return self.http_error(url, fp, errcode, errmsg, headers, data) - def open_gopher(self, url): - """Use Gopher protocol.""" - if not isinstance(url, str): - raise IOError, ('gopher error', 'proxy support for gopher protocol currently not implemented') - import gopherlib - host, selector = splithost(url) - if not host: raise IOError, ('gopher error', 'no host given') - host = unquote(host) - type, selector = splitgophertype(selector) - selector, query = splitquery(selector) - selector = unquote(selector) - if query: - query = unquote(query) - fp = gopherlib.send_query(selector, query, host) - else: - fp = gopherlib.send_selector(selector, host) - return addinfourl(fp, noheaders(), "gopher:" + url) - def open_file(self, url): """Use local file or FTP depending on form of URL.""" if not isinstance(url, str): @@ -981,7 +963,6 @@ # splitattr('/path;attr1=value1;attr2=value2;...') -> # '/path', ['attr1=value1', 'attr2=value2', ...] # splitvalue('attr=value') --> 'attr', 'value' -# splitgophertype('/Xselector') --> 'X', 'selector' # unquote('abc%20def') -> 'abc def' # quote('abc def') -> 'abc%20def') @@ -1141,12 +1122,6 @@ if match: return match.group(1, 2) return attr, None -def splitgophertype(selector): - """splitgophertype('/Xselector') --> 'X', 'selector'.""" - if selector[:1] == '/' and selector[1:2]: - return selector[1], selector[2:] - return None, selector - _hextochr = dict(('%02x' % i, chr(i)) for i in range(256)) _hextochr.update(('%02X' % i, chr(i)) for i in range(256)) @@ -1482,7 +1457,6 @@ 'file:/etc/passwd', 'file://localhost/etc/passwd', 'ftp://ftp.gnu.org/pub/README', -## 'gopher://gopher.micro.umn.edu/1/', 'http://www.python.org/index.html', ] if hasattr(URLopener, "open_https"): Modified: python/trunk/Lib/urllib2.py ============================================================================== --- python/trunk/Lib/urllib2.py (original) +++ python/trunk/Lib/urllib2.py Thu May 17 00:42:29 2007 @@ -107,7 +107,7 @@ from StringIO import StringIO from urllib import (unwrap, unquote, splittype, splithost, quote, - addinfourl, splitport, splitgophertype, splitquery, + addinfourl, splitport, splitquery, splitattr, ftpwrapper, noheaders, splituser, splitpasswd, splitvalue) # support for FileHandler, proxies via environment variables @@ -164,9 +164,6 @@ def __str__(self): return 'HTTP Error %s: %s' % (self.code, self.msg) -class GopherError(URLError): - pass - # copied from cookielib.py _cut_port_re = re.compile(r":\d+$") def request_host(request): @@ -1342,22 +1339,3 @@ del self.timeout[k] break self.soonest = min(self.timeout.values()) - -class GopherHandler(BaseHandler): - def gopher_open(self, req): - # XXX can raise socket.error - import gopherlib # this raises DeprecationWarning in 2.5 - host = req.get_host() - if not host: - raise GopherError('no host given') - host = unquote(host) - selector = req.get_selector() - type, selector = splitgophertype(selector) - selector, query = splitquery(selector) - selector = unquote(selector) - if query: - query = unquote(query) - fp = gopherlib.send_query(selector, query, host) - else: - fp = gopherlib.send_selector(selector, host) - return addinfourl(fp, noheaders(), req.get_full_url()) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu May 17 00:42:29 2007 @@ -207,6 +207,9 @@ Library ------- +- Remove the gopherlib module. This also leads to the removal of gopher + support in urllib/urllib2. + - Fix bug in marshal where bad data would cause a segfault due to lack of an infinite recursion check. From python-checkins at python.org Thu May 17 00:46:19 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 17 May 2007 00:46:19 +0200 (CEST) Subject: [Python-checkins] r55390 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt peps/trunk/pep-3100.txt Message-ID: <20070516224619.C8D8C1E400E@bag.python.org> Author: brett.cannon Date: Thu May 17 00:46:19 2007 New Revision: 55390 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt peps/trunk/pep-3100.txt Log: Document the removal of gopherlib. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Thu May 17 00:46:19 2007 @@ -78,6 +78,10 @@ rand, reconvert, regex, regsub, statcache, tb, tzparse, util, whatsound, whrandom, zmod + The following modules were removed in Python 2.6: + + gopherlib + The following modules currently lack a DeprecationWarning: posixfile, rfc822, mimetools, MimeWriter, mimify, @@ -94,7 +98,8 @@ Module name: gopherlib Rationale: The gopher protocol is not in active use anymore. Date: 1-Oct-2000. - Documentation: Documented as deprecated since Python 2.5. + Documentation: Documented as deprecated since Python 2.5. Removed + in Python 2.6. Module name: rgbimgmodule Rationale: In a 2001-04-24 c.l.py post, Jason Petrone mentions Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Thu May 17 00:46:19 2007 @@ -63,6 +63,10 @@ - sets + Modules removed from the standard library: + + - gopherlib + Python 3.0 compatability: None @@ -106,7 +110,6 @@ Modules to be removed according to PEP 4: - - gopherlib - rgbimg - buildtools [if DeprecationWarning raised in 2.5] - cfmfile [if DeprecationWarning raised in 2.5] Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Thu May 17 00:46:19 2007 @@ -210,8 +210,7 @@ - ``reconvert``, ``stringold``, ``xmllib``, ``pcre``, ``pypcre``, ``strop`` [all done] + see PEP 4 [#pep4]_ - - ``gopherlib``, - ``mimetools``, + - ``mimetools``, ``MimeWriter``, ``mimify``, ``mpz``, @@ -226,6 +225,7 @@ ``TERMIOS``, ``timing`` [to do] + - ``gopherlib`` [done] - ``cl``, ``sets``, ``xreadlines``, ``rotor``, ``whrandom`` [done] + Everything in lib-old [#pep4]_ [done] - ``Para``, ``addpack``, ``cmp``, ``cmpcache``, ``codehack``, From python-checkins at python.org Thu May 17 02:20:07 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 17 May 2007 02:20:07 +0200 (CEST) Subject: [Python-checkins] r55391 - peps/trunk/pep-3119.txt Message-ID: <20070517002007.99E5F1E4015@bag.python.org> Author: guido.van.rossum Date: Thu May 17 02:20:06 2007 New Revision: 55391 Modified: peps/trunk/pep-3119.txt Log: Make append and reverse concrete methods of mutable sequences. Modified: peps/trunk/pep-3119.txt ============================================================================== --- peps/trunk/pep-3119.txt (original) +++ peps/trunk/pep-3119.txt Thu May 17 02:20:06 2007 @@ -703,8 +703,8 @@ ``MutableSequence`` A subclass of ``Sequence`` adding some standard mutating methods. Abstract mutating methods: ``__setitem__`` (for integer indices as - well as slices), ``__delitem__`` (ditto), ``insert``, ``append``, - ``reverse``. Concrete mutating methods: ``extend``, ``pop``, + well as slices), ``__delitem__`` (ditto), ``insert``. Concrete + mutating methods: ``append``, ``reverse``, ``extend``, ``pop``, ``remove``. Concrete mutating operators: ``+=``, ``*=`` (these mutate the object in place). **Note:** this does not define ``sort()`` -- that is only required to exist on genuine ``list`` From python-checkins at python.org Thu May 17 02:23:45 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 17 May 2007 02:23:45 +0200 (CEST) Subject: [Python-checkins] r55392 - peps/trunk/pep-3141.txt Message-ID: <20070517002345.1D0B01E4002@bag.python.org> Author: guido.van.rossum Date: Thu May 17 02:23:41 2007 New Revision: 55392 Modified: peps/trunk/pep-3141.txt Log: Totally new version of the Numbers ABC PEP, received fresh from Jeffrey. Modified: peps/trunk/pep-3141.txt ============================================================================== --- peps/trunk/pep-3141.txt (original) +++ peps/trunk/pep-3141.txt Thu May 17 02:23:41 2007 @@ -1,5 +1,5 @@ PEP: 3141 -Title: A Type Hierarchy for Numbers (and other algebraic entities) +Title: A Type Hierarchy for Numbers Version: $Revision$ Last-Modified: $Date$ Author: Jeffrey Yasskin @@ -13,18 +13,13 @@ Abstract ======== -This proposal defines a hierarchy of Abstract Base Classes (ABCs) (see -PEP 3119) to represent numbers and other algebraic entities similar to -numbers. It proposes: - -* A hierarchy of algebraic concepts, including monoids, groups, rings, - and fields with successively more operators and constraints on their - operators. This will be added as a new library module named - "algebra". - -* A hierarchy of specifically numeric types, which can be converted to - and from the native Python types. This will be added as a new - library module named "numbers". +This proposal defines a hierarchy of Abstract Base Classes (ABCs) (PEP +3119) to represent number-like classes. It proposes a hierarchy of +``Number :> Complex :> Real :> Rational :> Integer`` where ``A :> B`` +means "A is a supertype of B", and a pair of ``Exact``/``Inexact`` +classes to capture the difference between ``floats`` and +``ints``. These types are significantly inspired by Scheme's numeric +tower [#schemetower]_. Rationale ========= @@ -32,439 +27,337 @@ Functions that take numbers as arguments should be able to determine the properties of those numbers, and if and when overloading based on types is added to the language, should be overloadable based on the -types of the arguments. This PEP defines some abstract base classes -that are useful in numerical calculations. A function can check that -variable is an instance of one of these classes and then rely on the -properties specified for them. Of course, the language cannot check -these properties, so where I say something is "guaranteed", I really -just mean that it's one of those properties a user should be able to -rely on. - -This PEP tries to find a balance between providing fine-grained -distinctions and specifying types that few people will ever use. +types of the arguments. For example, slicing requires its arguments to +be ``Integers``, and the functions in the ``math`` module require +their arguments to be ``Real``. Specification ============= -Although this PEP uses terminology from PEP 3119, the hierarchy is -meaningful for any systematic method of defining sets of -classes. **Todo:** link to the Interfaces PEP when it's ready. I'm -also using the extra notation from PEP 3107 (annotations) to specify -some types. - -Object oriented systems have a general problem in constraining -functions that take two arguments. To take addition as an example, -``int(3) + int(4)`` is defined, and ``vector(1,2,3) + vector(3,4,5)`` -is defined, but ``int(3) + vector(3,4,5)`` doesn't make much sense. So -``a + b`` is not guaranteed to be defined for any two instances of -``AdditiveGroup``, but it is guaranteed to be defined when ``type(a) -== type(b)``. On the other hand, ``+`` does make sense for any sorts -of numbers, so the ``Complex`` ABC refines the properties for plus so -that ``a + b`` is defined whenever ``isinstance(a,Complex) and -isinstance(b,Complex)``, even if ``type(a) != type(b)``. - - -Monoids (http://en.wikipedia.org/wiki/Monoid) consist of a set with an -associative operation, and an identity element under that -operation. **Open issue**: Is a @classmethod the best way to define -constants that depend only on the type?:: - - class MonoidUnderPlus(Abstract): - """+ is associative but not necessarily commutative and has an - identity given by plus_identity(). - - Subclasses follow the laws: - - a + (b + c) === (a + b) + c - a.plus_identity() + a === a === a + a.plus_identity() - - Sequences are monoids under plus (in Python) but are not - AdditiveGroups. - """ - @abstractmethod - def __add__(self, other): - raise NotImplementedError - - @classmethod - @abstractmethod - def plus_identity(cls): - raise NotImplementedError - -I skip ordinary non-commutative groups here because I don't have any -common examples of groups that use ``+`` as their operator but aren't -commutative. If we find some, the class can be added later.:: - - class AdditiveGroup(MonoidUnderPlus): - """Defines a commutative group whose operator is +, and whose inverses - are produced by -x. - See http://en.wikipedia.org/wiki/Abelian_group. - - Where a, b, and c are instances of the same subclass of - AdditiveGroup, the operations should follow these laws, where - 'zero' is a.__class__.zero(). - - a + b === b + a - (a + b) + c === a + (b + c) - zero + a === a - a + (-a) === zero - a - b === a + -b - - Some abstract subclasses, such as Complex, may extend the - definition of + to heterogenous subclasses, but AdditiveGroup only - guarantees it's defined on arguments of exactly the same types. - - Vectors are AdditiveGroups but are not Rings. - """ - @abstractmethod - def __add__(self, other): - """Associative commutative operation, whose inverse is negation.""" - raise NotImplementedError - -**Open issue:** Do we want to give people a choice of which of the -following to define, or should we pick one arbitrarily?:: - - # AdditiveGroup, continued - - def __neg__(self): - """Must define this or __sub__().""" - return self.zero() - self - - def __sub__(self, other): - """Must define this or __neg__().""" - return self + -other - - @classmethod - @abstractmethod - def zero(cls): - """A better name for +'s identity as we move into more mathematical - domains.""" - raise NotImplementedError - - @classmethod - def plus_identity(cls): - return cls.zero() - -Including Semiring (http://en.wikipedia.org/wiki/Semiring) would help -a little with defining a type for the natural numbers. That can be -split out once someone needs it (see ``IntegralDomain`` for how).:: - - class Ring(AdditiveGroup): - """A mathematical ring over the operations + and *. - See http://en.wikipedia.org/wiki/Ring_%28mathematics%29. - - In addition to the requirements of the AdditiveGroup superclass, a - Ring has an associative but not necessarily commutative - multiplication operation with identity (one) that distributes over - addition. A Ring can be constructed from any integer 'i' by adding - 'one' to itself 'i' times. When R is a subclass of Ring, the - additive identity is R(0), and the multiplicative identity is - R(1). - - Matrices are Rings but not Commutative Rings or Division - Rings. The quaternions are a Division Ring but not a - Field. The integers are a Commutative Ring but not a Field. - """ - @abstractmethod - def __init__(self, i:int): - """An instance of a Ring may be constructed from an integer. - - This may be a lossy conversion, as in the case of the integers - modulo N.""" - pass - - @abstractmethod - def __mul__(self, other): - """Satisfies: - a * (b * c) === (a * b) * c - one * a === a - a * one === a - a * (b + c) === a * b + a * c +This PEP specifies a set of Abstract Base Classes with default +implementations. If the reader prefers to think in terms of Roles (PEP +3133), the default implementations for (for example) the Real ABC +would be moved to a RealDefault class, with Real keeping just the +method declarations. - where one == a.__class__(1) - """ - raise NotImplementedError - - @classmethod - def zero(cls): - return cls(0) - - @classmethod - def one(cls): - return cls(1) - -I'm skipping both CommutativeRing and DivisionRing here.:: - - class Field(Ring): - """The class Field adds to Ring the requirement that * be a - commutative group operation except that zero does not have an - inverse. - See http://en.wikipedia.org/wiki/Field_%28mathematics%29. - - Practically, that means we can define division on a Field. The - additional laws are: - - a * b === b * a - a / a === a.__class_(1) # when a != a.__class__(0) - - Division lets us construct a Field from any Python float, - although the conversion is likely to be lossy. Some Fields - include the real numbers, rationals, and integers mod a - prime. Python's ``float`` resembles a Field closely. - """ - def __init__(self, f:float): - """A Field should be constructible from any rational number, which - includes Python floats.""" - pass - - @abstractmethod - def __div__(self, divisor): - raise NotImplementedError +Although this PEP uses terminology from PEP 3119, the hierarchy is +intended to be meaningful for any systematic method of defining sets +of classes, including Interfaces. I'm also using the extra notation +from PEP 3107 (Function Annotations) to specify some types. -Division is somewhat complicated in Python. You have both __floordiv__ -and __div__, and ints produce floats when they're divided. For the -purposes of this hierarchy, ``__floordiv__(a, b)`` is defined by -``floor(__div__(a, b))``, and, since int is not a subclass of Field, -it's allowed to do whatever it wants with __div__. - -There are four more reasonable classes that I'm skipping here in the -interest of keeping the initial library simple. They are: - -``Algebraic`` - Rational powers of its elements are defined (and maybe a few other - operations) - (http://en.wikipedia.org/wiki/Algebraic_number). Complex numbers - are the most well-known algebraic set. Real numbers are _not_ - algebraic, but Python does define these operations on floats, - which makes defining this class somewhat difficult. - -``Transcendental`` - The elementary functions - (http://en.wikipedia.org/wiki/Elementary_function) are - defined. These are basically arbitrary powers, trig functions, and - logs, the contents of ``cmath``. - -The following two classes can be reasonably combined with ``Integral`` -for now. - -``IntegralDomain`` - Defines __divmod__. - (http://darcs.haskell.org/numericprelude/docs/html/Algebra-IntegralDomain.html#t%3AC) - -``PrincipalIdealDomain`` - Defines gcd and lcm. - (http://darcs.haskell.org/numericprelude/docs/html/Algebra-PrincipalIdealDomain.html#t%3AC) - -If someone needs to split them later, they can use code like:: - import numbers - class IntegralDomain(Ring): ... - numbers.Integral.__bases__ = (IntegralDomain,) + numbers.Integral.__bases__ - - -Finally, we get to numbers. This is where we switch from the "algebra" -module to the "numbers" module.:: - - class Complex(Ring, Hashable): - """The ``Complex`` ABC indicates that the value lies somewhere - on the complex plane, not that it in fact has a complex - component: ``int`` is a subclass of ``Complex``. Because these - actually represent complex numbers, they can be converted to - the ``complex`` type. - - ``Complex`` finally gets around to requiring its subtypes to - be immutable so they can be hashed in a standard way. - - ``Complex`` also requires its operations to accept - heterogenous arguments. Subclasses should override the - operators to be more accurate when they can, but should fall - back on the default definitions to handle arguments of - different (Complex) types. - - **Open issue:** __abs__ doesn't fit here because it doesn't - exist for the Gaussian integers - (http://en.wikipedia.org/wiki/Gaussian_integer). In fact, it - only exists for algebraic complex numbers and real numbers. We - could define it in both places, or leave it out of the - ``Complex`` classes entirely and let it be a custom extention - of the ``complex`` type. - The Gaussian integers are ``Complex`` but not a ``Field``. - """ - @abstractmethod - def __complex__(self): - """Any Complex can be converted to a native complex object.""" - raise NotImplementedError +Exact vs. Inexact Classes +------------------------- - def __hash__(self): +Floating point values may not exactly obey several of the properties +you would expect. For example, it is possible for ``(X + -X) + 3 == +3``, but ``X + (-X + 3) == 0``. On the range of values that most +functions deal with this isn't a problem, but it is something to be +aware of. + +Therefore, I define ``Exact`` and ``Inexact`` ABCs to mark whether +types have this problem. Every instance of ``Integer`` and +``Rational`` should be Exact, but ``Reals`` and ``Complexes`` may or +may not be. (Do we really only need one of these, and the other is +defined as ``not`` the first?):: + + class Exact(metaclass=MetaABC): pass + class Inexact(metaclass=MetaABC): pass + + +Numeric Classes +--------------- + +We begin with a Number class to make it easy for people to be fuzzy +about what kind of number they expect. This class only helps with +overloading; it doesn't provide any operations. **Open question:** +Should it specify ``__add__``, ``__sub__``, ``__neg__``, ``__mul__``, +and ``__abs__`` like Haskell's ``Num`` class?:: + + class Number(metaclass=MetaABC): pass + + +Some types (primarily ``float``) define "Not a Number" (NaN) values +that return false for any comparison, including equality with +themselves, and are maintained through operations. Because this +doesn't work well with the Reals (which are otherwise totally ordered +by ``<``), Guido suggested we might put NaN in its own type. It is +conceivable that this can still be represented by C doubles but be +included in a different ABC at runtime. **Open issue:** Is this a good +idea?:: + + class NotANumber(Number): + """Implement IEEE 754 semantics.""" + def __lt__(self, other): return false + def __eq__(self, other): return false + ... + def __add__(self, other): return self + def __radd__(self, other): return self + ... + +Complex numbers are immutable and hashable. Implementors should be +careful that they make equal numbers equal and hash them to the same +values. This may be subtle if there are two different extensions of +the real numbers:: + + class Complex(Hashable, Number): + """A ``Complex`` should define the operations that work on the + Python ``complex`` type. If it is given heterogenous + arguments, it may fall back on this class's definition of the + operations.addition, subtraction, negation, and + multiplication. These operators should never return a + TypeError as long as both arguments are instances of Complex + (or even just implement __complex__). + """ + @abstractmethod + def __complex__(self): + """This operation gives the arithmetic operations a fallback. + """ + return complex(self.real, self.imag) + @property + def real(self): + return complex(self).real + @property + def imag(self): + return complex(self).imag + +I define the reversed operations here so that they serve as the final +fallback for operations involving instances of Complex. **Open +issue:** Should Complex's operations check for ``isinstance(other, +Complex)``? Duck typing seems to imply that we should just try +__complex__ and succeed if it works, but stronger typing might be +justified for the operators. TODO: analyze the combinations of normal +and reversed operations with real and virtual subclasses of Complex:: + + def __radd__(self, other): + """Should this catch any type errors and return + NotImplemented instead?""" + return complex(other) + complex(self) + def __rsub__(self, other): + return complex(other) - complex(self) + def __neg__(self): + return -complex(self) + def __rmul__(self, other): + return complex(other) * complex(self) + def __rdiv__(self, other): + return complex(other) / complex(self) + + def __abs__(self): + return abs(complex(self)) + + def conjugate(self): + return complex(self).conjugate() + + def __hash__(self): + """Two "equal" values of different complex types should + hash in the same way.""" return hash(complex(self)) - @abstractmethod - def real(self) => Real: - raise NotImplementedError - @abstractmethod - def imag(self) => Real: - raise NotImplementedError +The ``Real`` ABC indicates that the value is on the real line, and +supports the operations of the ``float`` builtin. Real numbers are +totally ordered. (NaNs were handled above.):: - @abstractmethod - def __add__(self, other): - """The other Ring operations should be implemented similarly.""" - if isinstance(other, Complex): - return complex(self) + complex(other) - else: - return NotImplemented - -``FractionalComplex(Complex, Field)`` might fit here, except that it -wouldn't give us any new operations.:: - - class Real(Complex, TotallyOrdered): - """Numbers along the real line. Some subclasses of this class - may contain NaNs that are not ordered with the rest of the - instances of that type. Oh well. **Open issue:** what problems - will that cause? Is it worth it in order to get a - straightforward type hierarchy? - """ - @abstractmethod + class Real(Complex, metaclass=TotallyOrderedABC): + @abstractmethod def __float__(self): + """Any Real can be converted to a native float object.""" raise NotImplementedError - def __complex__(self): - return complex(float(self)) - def real(self) => self.__class__: - return self - def imag(self) => self.__class__: - return self.__class__(0) - def __abs__(self) => self.__class__: - if self < 0: return -self - else: return self - - - class FractionalReal(Real, Field): - """Rationals and floats. This class provides concrete - definitions of the other four methods from properfraction and - allows you to convert fractional reals to integers in a - disciplined way. - """ - @abstractmethod - def properfraction(self) => (int, self.__class__): - """Returns a pair (n,f) such that self == n+f, and: - * n is an integral number with the same sign as self; and - * f is a fraction with the same type and sign as self, and with - absolute value less than 1. - """ - raise NotImplementedError - def floor(self) => int: - n, r = self.properfraction() - if r < 0 then n - 1 else n - def ceiling(self) => int: ... - def __trunc__(self) => int: ... - def round(self) => int: ... + def __complex__(self): + """Which gives us an easy way to define the conversion to + complex.""" + return complex(float(self)) + @property + def real(self): return self + @property + def imag(self): return 0 + + def __radd__(self, other): + if isinstance(other, Real): + return float(other) + float(self) + else: + return super(Real, self).__radd__(other) + def __rsub__(self, other): + if isinstance(other, Real): + return float(other) - float(self) + else: + return super(Real, self).__rsub__(other) + def __neg__(self): + return -float(self) + def __rmul__(self, other): + if isinstance(other, Real): + return float(other) * float(self) + else: + return super(Real, self).__rmul__(other) + def __rdiv__(self, other): + if isinstance(other, Real): + return float(other) / float(self) + else: + return super(Real, self).__rdiv__(other) + def __rdivmod__(self, other): + """Implementing divmod() for your type is sufficient to + get floordiv and mod too. + """ + if isinstance(other, Real): + return divmod(float(other), float(self)) + else: + return super(Real, self).__rdivmod__(other) + def __rfloordiv__(self, other): + return divmod(other, self)[0] + def __rmod__(self, other): + return divmod(other, self)[1] + + def __trunc__(self): + """Do we want properfraction, floor, ceiling, and round?""" + return trunc(float(self)) + + def __abs__(self): + return abs(float(self)) + +There is no way to define only the reversed comparison operators, so +these operations take precedence over any defined in the other +type. :( :: + + def __lt__(self, other): + """The comparison operators in Python seem to be more + strict about their input types than other functions. I'm + guessing here that we want types to be incompatible even + if they define a __float__ operation, unless they also + declare themselves to be Real numbers. + """ + if isinstance(other, Real): + return float(self) < float(other) + else: + return NotImplemented + + def __le__(self, other): + if isinstance(other, Real): + return float(self) <= float(other) + else: + return NotImplemented + + def __eq__(self, other): + if isinstance(other, Real): + return float(self) == float(other) + else: + return NotImplemented + + +There is no built-in rational type, but it's straightforward to write, +so we provide an ABC for it:: + + class Rational(Real, Exact): + """rational.numerator and rational.denominator should be in + lowest terms. + """ + @abstractmethod + @property + def numerator(self): + raise NotImplementedError + @abstractmethod + @property + def denominator(self): + raise NotImplementedError + def __float__(self): + return self.numerator / self.denominator -**Open issue:** What's the best name for this class? RealIntegral? Integer?:: - class Integral(Real): - """Integers!""" + class Integer(Rational): @abstractmethod def __int__(self): raise NotImplementedError def __float__(self): return float(int(self)) - - @abstractmethod - def __or__(self, other): - raise NotImplementedError - @abstractmethod - def __xor__(self, other): - raise NotImplementedError - @abstractmethod - def __and__(self, other): - raise NotImplementedError - @abstractmethod - def __lshift__(self, other): - raise NotImplementedError - @abstractmethod - def __rshift__(self, other): - raise NotImplementedError - @abstractmethod + @property + def numerator(self): return self + @property + def denominator(self): return 1 + + def __ror__(self, other): + return int(other) | int(self) + def __rxor__(self, other): + return int(other) ^ int(self) + def __rand__(self, other): + return int(other) & int(self) + def __rlshift__(self, other): + return int(other) << int(self) + def __rrshift__(self, other): + return int(other) >> int(self) def __invert__(self): - raise NotImplementedError + return ~int(self) - -Floating point values may not exactly obey several of the properties -you would expect from their superclasses. For example, it is possible -for ``(large_val + -large_val) + 3 == 3``, but ``large_val + -(-large_val + 3) == 0``. On the values most functions deal with this -isn't a problem, but it is something to be aware of. Types like this -inherit from ``FloatingReal`` so that functions that care can know to -use a numerically stable algorithm on them. **Open issue:** Is this -the proper way to handle floating types?:: - - class FloatingReal: - """A "floating" number is one that is represented as - ``mantissa * radix**exponent`` where mantissa, radix, and - exponent are all integers. Subclasses of FloatingReal don't - follow all the rules you'd expect numbers to follow. If you - really care about the answer, you have to use numerically - stable algorithms, whatever those are. - - **Open issue:** What other operations would be useful here? - - These include floats and Decimals. - """ - @classmethod - @abstractmethod - def radix(cls) => int: - raise NotImplementedError - - @classmethod - @abstractmethod - def digits(cls) => int: - """The number of significant digits of base cls.radix().""" - raise NotImplementedError - - @classmethod - @abstractmethod - def exponentRange(cls) => (int, int): - """A pair of the (lowest,highest) values possible in the exponent.""" - raise NotImplementedError - - @abstractmethod - def decode(self) => (int, int): - """Returns a pair (mantissa, exponent) such that - mantissa*self.radix()**exponent == self.""" - raise NotImplementedError - - - -Inspiration -=========== -http://hackage.haskell.org/trac/haskell-prime/wiki/StandardClasses -http://repetae.net/john/recent/out/classalias.html + def __radd__(self, other): + """All of the Real methods need to be overridden here too + in order to get a more exact type for their results. + """ + if isinstance(other, Integer): + return int(other) + int(self) + else: + return super(Integer, self).__radd__(other) + ... + + def __hash__(self): + """Surprisingly, hash() needs to be overridden too, since + there are integers that float can't represent.""" + return hash(int(self)) + + +Adding More Numeric ABCs +------------------------ + +There are, of course, more possible ABCs for numbers, and this would +be a poor hierarchy if it precluded the possibility of adding +those. You can add ``MyFoo`` between ``Complex`` and ``Real`` with:: + + class MyFoo(Complex): ... + MyFoo.register(Real) + +TODO(jyasskin): Check this. + + +Rejected Alternatives +===================== + +The initial version of this PEP defined an algebraic hierarchy +inspired by a Haskell Numeric Prelude [#numericprelude]_ including +MonoidUnderPlus, AdditiveGroup, Ring, and Field, and mentioned several +other possible algebraic types before getting to the numbers. I had +expected this to be useful to people using vectors and matrices, but +the NumPy community really wasn't interested. The numbers then had a +much more branching structure to include things like the Gaussian +Integers and Z/nZ, which could be Complex but wouldn't necessarily +support things like division. The community decided that this was too +much complication for Python, so the proposal has been scaled back to +resemble the Scheme numeric tower much more closely. References ========== -.. [1] Introducing Abstract Base Classes +.. [#pep3119] Introducing Abstract Base Classes (http://www.python.org/dev/peps/pep-3119/) -.. [2] Function Annotations +.. [#pep3107] Function Annotations (http://www.python.org/dev/peps/pep-3107/) .. [3] Possible Python 3K Class Tree?, wiki page created by Bill Janssen (http://wiki.python.org/moin/AbstractBaseClasses) -.. [4] NumericPrelude: An experimental alternative - hierarchy of numeric type classes +.. [#numericprelude] NumericPrelude: An experimental alternative hierarchy of numeric type classes (http://darcs.haskell.org/numericprelude/docs/html/index.html) +.. [#schemetower] The Scheme numerical tower + (http://www.swiss.ai.mit.edu/ftpdir/scheme-reports/r5rs-html/r5rs_8.html#SEC50) -Acknowledgements ----------------- -Thanks to Neal Norwitz for helping me through the PEP process. +Acknowledgements +================ -The Haskell Numeric Prelude [4]_ nicely condensed a lot -of experience with the Haskell numeric hierarchy into a form that was -relatively easily adaptable to Python. +Thanks to Neil Norwitz for encouraging me to write this PEP in the +first place, to Travis Oliphant for pointing out that the numpy people +didn't really care about the algebraic concepts, and to Guido van +Rossum, Collin Winter, and lots of other people on the mailing list +for refining the concept. Copyright ========= From python-checkins at python.org Thu May 17 02:37:14 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 17 May 2007 02:37:14 +0200 (CEST) Subject: [Python-checkins] r55393 - peps/trunk/pep-3141.txt Message-ID: <20070517003714.9A6D81E4002@bag.python.org> Author: guido.van.rossum Date: Thu May 17 02:37:09 2007 New Revision: 55393 Modified: peps/trunk/pep-3141.txt Log: Update post-history. Modified: peps/trunk/pep-3141.txt ============================================================================== --- peps/trunk/pep-3141.txt (original) +++ peps/trunk/pep-3141.txt Thu May 17 02:37:09 2007 @@ -7,7 +7,7 @@ Type: Standards Track Content-Type: text/x-rst Created: 23-Apr-2007 -Post-History: Not yet posted +Post-History: 25-Apr-2007, 16-May-2007 Abstract From python-checkins at python.org Thu May 17 03:08:09 2007 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 17 May 2007 03:08:09 +0200 (CEST) Subject: [Python-checkins] r55394 - python/trunk/Lib/calendar.py Message-ID: <20070517010809.584F31E4002@bag.python.org> Author: raymond.hettinger Date: Thu May 17 03:08:04 2007 New Revision: 55394 Modified: python/trunk/Lib/calendar.py Log: calendar.py gets no benefit from xrange() instead of range() Modified: python/trunk/Lib/calendar.py ============================================================================== --- python/trunk/Lib/calendar.py (original) +++ python/trunk/Lib/calendar.py Thu May 17 03:08:04 2007 @@ -45,7 +45,7 @@ class _localized_month: - _months = [datetime.date(2001, i+1, 1).strftime for i in xrange(12)] + _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)] _months.insert(0, lambda x: "") def __init__(self, format): @@ -65,7 +65,7 @@ class _localized_day: # January 1, 2001, was a Monday. - _days = [datetime.date(2001, 1, i+1).strftime for i in xrange(7)] + _days = [datetime.date(2001, 1, i+1).strftime for i in range(7)] def __init__(self, format): self.format = format @@ -144,7 +144,7 @@ Return a iterator for one week of weekday numbers starting with the configured first one. """ - for i in xrange(self.firstweekday, self.firstweekday + 7): + for i in range(self.firstweekday, self.firstweekday + 7): yield i%7 def itermonthdates(self, year, month): @@ -192,7 +192,7 @@ Each row represents a week; week entries are datetime.date values. """ dates = list(self.itermonthdates(year, month)) - return [ dates[i:i+7] for i in xrange(0, len(dates), 7) ] + return [ dates[i:i+7] for i in range(0, len(dates), 7) ] def monthdays2calendar(self, year, month): """ @@ -202,7 +202,7 @@ are zero. """ days = list(self.itermonthdays2(year, month)) - return [ days[i:i+7] for i in xrange(0, len(days), 7) ] + return [ days[i:i+7] for i in range(0, len(days), 7) ] def monthdayscalendar(self, year, month): """ @@ -210,7 +210,7 @@ Each row represents a week; days outside this month are zero. """ days = list(self.itermonthdays(year, month)) - return [ days[i:i+7] for i in xrange(0, len(days), 7) ] + return [ days[i:i+7] for i in range(0, len(days), 7) ] def yeardatescalendar(self, year, width=3): """ @@ -221,9 +221,9 @@ """ months = [ self.monthdatescalendar(year, i) - for i in xrange(January, January+12) + for i in range(January, January+12) ] - return [months[i:i+width] for i in xrange(0, len(months), width) ] + return [months[i:i+width] for i in range(0, len(months), width) ] def yeardays2calendar(self, year, width=3): """ @@ -234,9 +234,9 @@ """ months = [ self.monthdays2calendar(year, i) - for i in xrange(January, January+12) + for i in range(January, January+12) ] - return [months[i:i+width] for i in xrange(0, len(months), width) ] + return [months[i:i+width] for i in range(0, len(months), width) ] def yeardayscalendar(self, year, width=3): """ @@ -246,9 +246,9 @@ """ months = [ self.monthdayscalendar(year, i) - for i in xrange(January, January+12) + for i in range(January, January+12) ] - return [months[i:i+width] for i in xrange(0, len(months), width) ] + return [months[i:i+width] for i in range(0, len(months), width) ] class TextCalendar(Calendar): @@ -341,7 +341,7 @@ header = self.formatweekheader(w) for (i, row) in enumerate(self.yeardays2calendar(theyear, m)): # months in this row - months = xrange(m*i+1, min(m*(i+1)+1, 13)) + months = range(m*i+1, min(m*(i+1)+1, 13)) a('\n'*l) names = (self.formatmonthname(theyear, k, colwidth, False) for k in months) @@ -352,7 +352,7 @@ a('\n'*l) # max number of weeks for this row height = max(len(cal) for cal in row) - for j in xrange(height): + for j in range(height): weeks = [] for cal in row: if j >= len(cal): @@ -444,9 +444,9 @@ a('') a('\n') a('' % (width, theyear)) - for i in xrange(January, January+12, width): + for i in range(January, January+12, width): # months in this row - months = xrange(i, min(i+width, 13)) + months = range(i, min(i+width, 13)) a('') for m in months: a('
%s
') From python-checkins at python.org Thu May 17 04:03:02 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 17 May 2007 04:03:02 +0200 (CEST) Subject: [Python-checkins] r55395 - python/trunk/Objects/exceptions.c Message-ID: <20070517020302.214B21E4002@bag.python.org> Author: brett.cannon Date: Thu May 17 04:02:56 2007 New Revision: 55395 Modified: python/trunk/Objects/exceptions.c Log: Complete deprecation of BaseException.message. Some subclasses were directly accessing the message attribute instead of using the descriptor. Modified: python/trunk/Objects/exceptions.c ============================================================================== --- python/trunk/Objects/exceptions.c (original) +++ python/trunk/Objects/exceptions.c Thu May 17 04:02:56 2007 @@ -489,8 +489,6 @@ } static PyMemberDef SystemExit_members[] = { - {"message", T_OBJECT, offsetof(PySystemExitObject, message), 0, - PyDoc_STR("exception message")}, {"code", T_OBJECT, offsetof(PySystemExitObject, code), 0, PyDoc_STR("exception code")}, {NULL} /* Sentinel */ @@ -691,8 +689,6 @@ } static PyMemberDef EnvironmentError_members[] = { - {"message", T_OBJECT, offsetof(PyEnvironmentErrorObject, message), 0, - PyDoc_STR("exception message")}, {"errno", T_OBJECT, offsetof(PyEnvironmentErrorObject, myerrno), 0, PyDoc_STR("exception errno")}, {"strerror", T_OBJECT, offsetof(PyEnvironmentErrorObject, strerror), 0, @@ -924,8 +920,6 @@ } static PyMemberDef WindowsError_members[] = { - {"message", T_OBJECT, offsetof(PyWindowsErrorObject, message), 0, - PyDoc_STR("exception message")}, {"errno", T_OBJECT, offsetof(PyWindowsErrorObject, myerrno), 0, PyDoc_STR("POSIX exception code")}, {"strerror", T_OBJECT, offsetof(PyWindowsErrorObject, strerror), 0, @@ -1156,8 +1150,6 @@ } static PyMemberDef SyntaxError_members[] = { - {"message", T_OBJECT, offsetof(PySyntaxErrorObject, message), 0, - PyDoc_STR("exception message")}, {"msg", T_OBJECT, offsetof(PySyntaxErrorObject, msg), 0, PyDoc_STR("exception msg")}, {"filename", T_OBJECT, offsetof(PySyntaxErrorObject, filename), 0, @@ -1592,8 +1584,6 @@ } static PyMemberDef UnicodeError_members[] = { - {"message", T_OBJECT, offsetof(PyUnicodeErrorObject, message), 0, - PyDoc_STR("exception message")}, {"encoding", T_OBJECT, offsetof(PyUnicodeErrorObject, encoding), 0, PyDoc_STR("exception encoding")}, {"object", T_OBJECT, offsetof(PyUnicodeErrorObject, object), 0, From python-checkins at python.org Thu May 17 08:11:36 2007 From: python-checkins at python.org (neal.norwitz) Date: Thu, 17 May 2007 08:11:36 +0200 (CEST) Subject: [Python-checkins] r55396 - python/trunk/Python/marshal.c Message-ID: <20070517061136.EA6B21E4002@bag.python.org> Author: neal.norwitz Date: Thu May 17 08:11:36 2007 New Revision: 55396 Modified: python/trunk/Python/marshal.c Log: Reduce the max stack depth to see if this fixes the segfaults on Windows and some other boxes. If this is successful, this rev should be backported. I'm not sure how close to the limit we should push this. Modified: python/trunk/Python/marshal.c ============================================================================== --- python/trunk/Python/marshal.c (original) +++ python/trunk/Python/marshal.c Thu May 17 08:11:36 2007 @@ -15,7 +15,7 @@ * and risks coring the interpreter. When the object stack gets this deep, * raise an exception instead of continuing. */ -#define MAX_MARSHAL_STACK_DEPTH 5000 +#define MAX_MARSHAL_STACK_DEPTH 4000 #define TYPE_NULL '0' #define TYPE_NONE 'N' From python-checkins at python.org Thu May 17 08:23:52 2007 From: python-checkins at python.org (neal.norwitz) Date: Thu, 17 May 2007 08:23:52 +0200 (CEST) Subject: [Python-checkins] r55397 - python/trunk/Python/marshal.c Message-ID: <20070517062352.C7A0B1E4002@bag.python.org> Author: neal.norwitz Date: Thu May 17 08:23:50 2007 New Revision: 55397 Modified: python/trunk/Python/marshal.c Log: Set the depth to something very small to try to determine if the crashes on Windows are really due to the stack size or possibly some other problem. Modified: python/trunk/Python/marshal.c ============================================================================== --- python/trunk/Python/marshal.c (original) +++ python/trunk/Python/marshal.c Thu May 17 08:23:50 2007 @@ -15,7 +15,7 @@ * and risks coring the interpreter. When the object stack gets this deep, * raise an exception instead of continuing. */ -#define MAX_MARSHAL_STACK_DEPTH 4000 +#define MAX_MARSHAL_STACK_DEPTH 1000 #define TYPE_NULL '0' #define TYPE_NONE 'N' From python-checkins at python.org Thu May 17 09:04:48 2007 From: python-checkins at python.org (neal.norwitz) Date: Thu, 17 May 2007 09:04:48 +0200 (CEST) Subject: [Python-checkins] r55398 - python/trunk/Python/marshal.c Message-ID: <20070517070448.DC3761E4002@bag.python.org> Author: neal.norwitz Date: Thu May 17 09:04:46 2007 New Revision: 55398 Modified: python/trunk/Python/marshal.c Log: Last try for tweaking the max stack depth. 5000 was the original value, 4000 didn't work either. 1000 does work on Windows. If 2000 works, that will hopefully be a reasonable balance. Modified: python/trunk/Python/marshal.c ============================================================================== --- python/trunk/Python/marshal.c (original) +++ python/trunk/Python/marshal.c Thu May 17 09:04:46 2007 @@ -15,7 +15,7 @@ * and risks coring the interpreter. When the object stack gets this deep, * raise an exception instead of continuing. */ -#define MAX_MARSHAL_STACK_DEPTH 1000 +#define MAX_MARSHAL_STACK_DEPTH 2000 #define TYPE_NULL '0' #define TYPE_NONE 'N' From buildbot at python.org Thu May 17 09:29:10 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 17 May 2007 07:29:10 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070517072910.49BFC1E4002@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/535 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu May 17 11:01:44 2007 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 17 May 2007 11:01:44 +0200 (CEST) Subject: [Python-checkins] r55399 - peps/trunk/pep-3131.txt Message-ID: <20070517090144.78C281E4002@bag.python.org> Author: martin.v.loewis Date: Thu May 17 11:01:43 2007 New Revision: 55399 Modified: peps/trunk/pep-3131.txt Log: Include Other_ID_{Start|Continue}. Modified: peps/trunk/pep-3131.txt ============================================================================== --- peps/trunk/pep-3131.txt (original) +++ peps/trunk/pep-3131.txt Thu May 17 11:01:43 2007 @@ -68,17 +68,19 @@ The identifier syntax is `` *``. -``ID_Start`` is defined as all characters having one of the general categories -uppercase letters (Lu), lowercase letters (Ll), titlecase letters (Lt), modifier -letters (Lm), other letters (Lo), letter numbers (Nl), plus the underscore (XXX -what are "stability extensions" listed in UAX 31). - -``ID_Continue`` is defined as all characters in ``ID_Start``, plus nonspacing -marks (Mn), spacing combining marks (Mc), decimal number (Nd), and connector -punctuations (Pc). +``ID_Start`` is defined as all characters having one of the general +categories uppercase letters (Lu), lowercase letters (Ll), titlecase +letters (Lt), modifier letters (Lm), other letters (Lo), letter +numbers (Nl), the underscore, and characters carrying the +Other_ID_Start property. + +``ID_Continue`` is defined as all characters in ``ID_Start``, plus +nonspacing marks (Mn), spacing combining marks (Mc), decimal number +(Nd), connector punctuations (Pc), and characters carryig the +Other_ID_Continue property. -All identifiers are converted into the normal form NFC while parsing; comparison -of identifiers is based on NFC. +All identifiers are converted into the normal form NFC while parsing; +comparison of identifiers is based on NFC. Policy Specification ==================== @@ -97,18 +99,19 @@ The following changes will need to be made to the parser: -1. If a non-ASCII character is found in the UTF-8 representation of the source - code, a forward scan is made to find the first ASCII non-identifier character - (e.g. a space or punctuation character) - -2. The entire UTF-8 string is passed to a function to normalize the string to - NFC, and then verify that it follows the identifier syntax. No such callout - is made for pure-ASCII identifiers, which continue to be parsed the way they - are today. - -3. If this specification is implemented for 2.x, reflective libraries (such as - pydoc) must be verified to continue to work when Unicode strings appear in - ``__dict__`` slots as keys. +1. If a non-ASCII character is found in the UTF-8 representation of + the source code, a forward scan is made to find the first ASCII + non-identifier character (e.g. a space or punctuation character) + +2. The entire UTF-8 string is passed to a function to normalize the + string to NFC, and then verify that it follows the identifier + syntax. No such callout is made for pure-ASCII identifiers, which + continue to be parsed the way they are today. The Unicode database + must start including the Other_ID_{Start|Continue} property. + +3. If this specification is implemented for 2.x, reflective libraries + (such as pydoc) must be verified to continue to work when Unicode + strings appear in ``__dict__`` slots as keys. References ========== From python-checkins at python.org Thu May 17 12:40:39 2007 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 17 May 2007 12:40:39 +0200 (CEST) Subject: [Python-checkins] r55400 - peps/trunk/pep-3131.txt Message-ID: <20070517104039.2D6A91E4017@bag.python.org> Author: martin.v.loewis Date: Thu May 17 12:40:36 2007 New Revision: 55400 Modified: peps/trunk/pep-3131.txt Log: Add reference to HTML file with all valid characters. Modified: peps/trunk/pep-3131.txt ============================================================================== --- peps/trunk/pep-3131.txt (original) +++ peps/trunk/pep-3131.txt Thu May 17 12:40:36 2007 @@ -82,6 +82,10 @@ All identifiers are converted into the normal form NFC while parsing; comparison of identifiers is based on NFC. +A non-normative HTML file listing all valid identifier characters for +Unicode 4.1 can be found at +http://www.dcl.hpi.uni-potsdam.de/home/loewis/table-331.html. + Policy Specification ==================== From python-checkins at python.org Thu May 17 14:10:46 2007 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 17 May 2007 14:10:46 +0200 (CEST) Subject: [Python-checkins] r55401 - peps/trunk/pep-3131.txt Message-ID: <20070517121046.AA0231E4002@bag.python.org> Author: martin.v.loewis Date: Thu May 17 14:10:44 2007 New Revision: 55401 Modified: peps/trunk/pep-3131.txt Log: Explain that using native language identifiers improves code clarity and maintainability. Modified: peps/trunk/pep-3131.txt ============================================================================== --- peps/trunk/pep-3131.txt (original) +++ peps/trunk/pep-3131.txt Thu May 17 14:10:44 2007 @@ -20,11 +20,14 @@ Rationale ========= -Python code is written by many people in the world who are not familiar with the -English language, or even well-acquainted with the Latin writing system. Such -developers often desire to define classes and functions with names in their -native languages, rather than having to come up with an (often incorrect) -English translation of the concept they want to name. +Python code is written by many people in the world who are not +familiar with the English language, or even well-acquainted with the +Latin writing system. Such developers often desire to define classes +and functions with names in their native languages, rather than having +to come up with an (often incorrect) English translation of the +concept they want to name. By using identifiers in their native +language, code clarity and maintainability of the code among +speakers of that language improves. For some languages, common transliteration systems exist (in particular, for the Latin-based writing systems). For other languages, users have larger From python-checkins at python.org Thu May 17 17:11:35 2007 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 17 May 2007 17:11:35 +0200 (CEST) Subject: [Python-checkins] r55402 - peps/trunk/pep-3131.txt Message-ID: <20070517151135.F24E01E4004@bag.python.org> Author: martin.v.loewis Date: Thu May 17 17:11:31 2007 New Revision: 55402 Modified: peps/trunk/pep-3131.txt Log: Add UTR#39 discussion. Modified: peps/trunk/pep-3131.txt ============================================================================== --- peps/trunk/pep-3131.txt (original) +++ peps/trunk/pep-3131.txt Thu May 17 17:11:31 2007 @@ -120,10 +120,30 @@ (such as pydoc) must be verified to continue to work when Unicode strings appear in ``__dict__`` slots as keys. +Open Issues +=========== + +John Nagle suggested consideration of Unicode Technical Standard #39, +[2]_, which discusses security mechanisms for Unicode identifiers. +It's not clear how that can precisely apply to this PEP; possible +consequences are + + * warn about characters listed as "restricted" in xidmodifications.txt + * warn about identifiers using mixed scripts + * somehow perform Confusable Detection + +In the latter two approaches, it's not clear how precisely the +algorithm should work. For mixed scripts, certain kinds of mixing +should probably allowed - are these the "Common" and "Inherited" +scripts mentioned in section 5? For Confusable Detection, it seems one +needs two identifiers to compare them for confusion - is it possible +to somehow apply it to a single identifier only, and warn? + References ========== .. [1] http://www.unicode.org/reports/tr31/ +.. [2] http://www.unicode.org/reports/tr39/ Copyright From python-checkins at python.org Thu May 17 17:37:32 2007 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 17 May 2007 17:37:32 +0200 (CEST) Subject: [Python-checkins] r55403 - peps/trunk/pep-3131.txt Message-ID: <20070517153732.3CB081E4002@bag.python.org> Author: martin.v.loewis Date: Thu May 17 17:37:31 2007 New Revision: 55403 Modified: peps/trunk/pep-3131.txt Log: Require comments and string literals to be ASCII only. Modified: peps/trunk/pep-3131.txt ============================================================================== --- peps/trunk/pep-3131.txt (original) +++ peps/trunk/pep-3131.txt Thu May 17 17:37:31 2007 @@ -92,14 +92,20 @@ Policy Specification ==================== -As an addition to the Python Coding style, the following policy is prescribed: -All identifiers in the Python standard library MUST use ASCII-only identifiers, -and SHOULD use English words wherever feasible. - -As an option, this specification can be applied to Python 2.x. In that case, -ASCII-only identifiers would continue to be represented as byte string objects -in namespace dictionaries; identifiers with non-ASCII characters would be -represented as Unicode strings. +As an addition to the Python Coding style, the following policy is +prescribed: All identifiers in the Python standard library MUST use +ASCII-only identifiers, and SHOULD use English words wherever feasible +(in many cases, abbreviations and technical terms are used which +aren't English). In addition, string literals and comments must also +be in ASCII. The only exceptions are (a) test cases testing the +non-ASCII features, and (b) names of authors. Authors whose names are +not based on the latin alphabet MUST provide a latin transliteration +of their names. + +As an option, this specification can be applied to Python 2.x. In +that case, ASCII-only identifiers would continue to be represented as +byte string objects in namespace dictionaries; identifiers with +non-ASCII characters would be represented as Unicode strings. Implementation ============== From python-checkins at python.org Thu May 17 18:38:10 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 17 May 2007 18:38:10 +0200 (CEST) Subject: [Python-checkins] r55404 - peps/trunk/pep-0000.txt peps/trunk/pep-3131.txt Message-ID: <20070517163810.ED7EE1E4002@bag.python.org> Author: guido.van.rossum Date: Thu May 17 18:38:10 2007 New Revision: 55404 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3131.txt Log: Accept PEP 3131. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Thu May 17 18:38:10 2007 @@ -85,6 +85,7 @@ SA 3123 Making PyObject_HEAD conform to standard C von L?wis SA 3127 Integer Literal Support and Syntax Maupin SA 3129 Class Decorators Winter + SA 3131 Supporting Non-ASCII Identifiers von L?wis Open PEPs (under consideration) @@ -120,7 +121,6 @@ S 3118 Revising the buffer protocol Oliphant, Banks S 3119 Introducing Abstract Base Classes GvR, Talin S 3124 Overloading, Generic Functions, Interfaces Eby - S 3131 Supporting Non-ASCII Identifiers von L?wis S 3133 Introducing Roles Winter S 3141 A Type Hierarchy for Numbers Yasskin @@ -501,7 +501,7 @@ SR 3128 BList: A Faster List-like Type Stutzbach SA 3129 Class Decorators Winter SR 3130 Access to Current Module/Class/Function Jewett - S 3131 Supporting Non-ASCII Identifiers von L?wis + SA 3131 Supporting Non-ASCII Identifiers von L?wis SF 3132 Extended Iterable Unpacking Brandl S 3133 Introducing Roles Winter S 3141 A Type Hierarchy for Numbers Yasskin Modified: peps/trunk/pep-3131.txt ============================================================================== --- peps/trunk/pep-3131.txt (original) +++ peps/trunk/pep-3131.txt Thu May 17 18:38:10 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Martin v. L?wis -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 1-May-2007 From python-checkins at python.org Thu May 17 18:48:14 2007 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 17 May 2007 18:48:14 +0200 (CEST) Subject: [Python-checkins] r55405 - peps/trunk/pep-0008.txt Message-ID: <20070517164814.5B27B1E4002@bag.python.org> Author: guido.van.rossum Date: Thu May 17 18:48:09 2007 New Revision: 55405 Modified: peps/trunk/pep-0008.txt Log: Add policy about non-ASCII names to coding standard. Modified: peps/trunk/pep-0008.txt ============================================================================== --- peps/trunk/pep-0008.txt (original) +++ peps/trunk/pep-0008.txt Thu May 17 18:48:09 2007 @@ -120,13 +120,29 @@ Encodings (PEP 263) - Code in the core Python distribution should aways use the ASCII or Latin-1 - encoding (a.k.a. ISO-8859-1). + Code in the core Python distribution should aways use the ASCII or + Latin-1 encoding (a.k.a. ISO-8859-1). For Python 3.0 and beyond, + UTF-8 is preferred over Latin-1, see PEP 3120. + + Files using ASCII (or UTF-8, for Python 3.0) should not have a + coding cookie. Latin-1 (or UTF-8) should only be used when a + comment or docstring needs to mention an author name that requires + Latin-1; otherwise, using \x, \u or \U escapes is the preferred + way to include non-ASCII data in string literals. + + For Python 3.0 and beyond, the following policy is prescribed for + the standard library (see PEP 3131): All identifiers in the Python + standard library MUST use ASCII-only identifiers, and SHOULD use + English words wherever feasible (in many cases, abbreviations and + technical terms are used which aren't English). In addition, + string literals and comments must also be in ASCII. The only + exceptions are (a) test cases testing the non-ASCII features, and + (b) names of authors. Authors whose names are not based on the + latin alphabet MUST provide a latin transliteration of their + names. - Files using ASCII should not have a coding cookie. Latin-1 should only be - used when a comment or docstring needs to mention an author name that - requires Latin-1; otherwise, using \x escapes is the preferred way to - include non-ASCII data in string literals. + Open source projects with a global audience are encouraged to + adopt a similar policy. Imports From python-checkins at python.org Thu May 17 20:30:10 2007 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 17 May 2007 20:30:10 +0200 (CEST) Subject: [Python-checkins] r55408 - peps/trunk/pep-3131.txt Message-ID: <20070517183010.302921E4002@bag.python.org> Author: martin.v.loewis Date: Thu May 17 20:30:09 2007 New Revision: 55408 Modified: peps/trunk/pep-3131.txt Log: Add UTR#36 and discuss Cf. Modified: peps/trunk/pep-3131.txt ============================================================================== --- peps/trunk/pep-3131.txt (original) +++ peps/trunk/pep-3131.txt Thu May 17 20:30:09 2007 @@ -145,12 +145,22 @@ needs two identifiers to compare them for confusion - is it possible to somehow apply it to a single identifier only, and warn? +In follow-up discussion, it turns out that John Nagle actually +meant to suggest UTR#36, level "Highly Restrictive", [3]_. + +Several people suggested to allow and ignore formatting control +characters (general category Cf), as is done in Java, JavaScript, and +C#. It's not clear whether this would improve things (it might +for RTL languages); if there is a need, these can be added +later. + + References ========== .. [1] http://www.unicode.org/reports/tr31/ .. [2] http://www.unicode.org/reports/tr39/ - +.. [3] http://www.unicode.org/reports/tr36/ Copyright ========= From python-checkins at python.org Thu May 17 21:29:47 2007 From: python-checkins at python.org (fred.drake) Date: Thu, 17 May 2007 21:29:47 +0200 (CEST) Subject: [Python-checkins] r55411 - python/branches/release25-maint/Doc/lib/liboptparse.tex Message-ID: <20070517192947.92D0B1E4002@bag.python.org> Author: fred.drake Date: Thu May 17 21:29:43 2007 New Revision: 55411 Modified: python/branches/release25-maint/Doc/lib/liboptparse.tex Log: fix argument name in documentation; match the implementation Modified: python/branches/release25-maint/Doc/lib/liboptparse.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/liboptparse.tex (original) +++ python/branches/release25-maint/Doc/lib/liboptparse.tex Thu May 17 21:29:43 2007 @@ -1191,14 +1191,14 @@ The whole point of creating and populating an OptionParser is to call its \method{parse{\_}args()} method: \begin{verbatim} -(options, args) = parser.parse_args(args=None, options=None) +(options, args) = parser.parse_args(args=None, values=None) \end{verbatim} where the input parameters are \begin{description} \item[\code{args}] the list of arguments to process (default: \code{sys.argv{[}1:]}) -\item[\code{options}] +\item[\code{values}] object to store option arguments in (default: a new instance of optparse.Values) \end{description} From python-checkins at python.org Thu May 17 21:30:00 2007 From: python-checkins at python.org (fred.drake) Date: Thu, 17 May 2007 21:30:00 +0200 (CEST) Subject: [Python-checkins] r55412 - python/trunk/Doc/lib/liboptparse.tex Message-ID: <20070517193000.5153D1E4002@bag.python.org> Author: fred.drake Date: Thu May 17 21:29:58 2007 New Revision: 55412 Modified: python/trunk/Doc/lib/liboptparse.tex Log: fix argument name in documentation; match the implementation Modified: python/trunk/Doc/lib/liboptparse.tex ============================================================================== --- python/trunk/Doc/lib/liboptparse.tex (original) +++ python/trunk/Doc/lib/liboptparse.tex Thu May 17 21:29:58 2007 @@ -1191,14 +1191,14 @@ The whole point of creating and populating an OptionParser is to call its \method{parse{\_}args()} method: \begin{verbatim} -(options, args) = parser.parse_args(args=None, options=None) +(options, args) = parser.parse_args(args=None, values=None) \end{verbatim} where the input parameters are \begin{description} \item[\code{args}] the list of arguments to process (default: \code{sys.argv{[}1:]}) -\item[\code{options}] +\item[\code{values}] object to store option arguments in (default: a new instance of optparse.Values) \end{description} From python-checkins at python.org Thu May 17 21:54:55 2007 From: python-checkins at python.org (facundo.batista) Date: Thu, 17 May 2007 21:54:55 +0200 (CEST) Subject: [Python-checkins] r55414 - python/branches/decimal-branch/Lib/decimal.py Message-ID: <20070517195455.28ACD1E4002@bag.python.org> Author: facundo.batista Date: Thu May 17 21:54:47 2007 New Revision: 55414 Modified: python/branches/decimal-branch/Lib/decimal.py Log: Coded the rest of the logical operations, all tests ok with them. Modified: python/branches/decimal-branch/Lib/decimal.py ============================================================================== --- python/branches/decimal-branch/Lib/decimal.py (original) +++ python/branches/decimal-branch/Lib/decimal.py Thu May 17 21:54:47 2007 @@ -2443,45 +2443,90 @@ return 0 return 1 + def _fill_logical(self, context, opa, opb): + dif = context.prec - len(opa) + if dif > 0: + opa = (0,)*dif + opa + elif dif < 0: + opa = opa[-context.prec:] + dif = context.prec - len(opb) + if dif > 0: + opb = (0,)*dif + opb + elif dif < 0: + opb = opb[-context.prec:] + return opa, opb + def logical_and(self, other, context=None): """Applies an 'and' operation between self and other's digits.""" + if context is None: + context = getcontext() + if not self._islogical() or not other._islogical(): + return context._raise_error(InvalidOperation) + + # fill to context.prec + (opa, opb) = self._fill_logical(context, self._int, other._int) + + # make the operation, and clean starting zeroes + result = [a&b for a,b in zip(opa,opb)] + for i,d in enumerate(result): + if d == 1: + break + result = tuple(result[i:]) + + # if empty, we must have at least a zero + if not result: + result = (0,) + return Decimal((0, result, 0)) def logical_invert(self, context=None): """Invert all its digits.""" if context is None: context = getcontext() + return self.logical_xor(Decimal((0,(1,)*context.prec,0)), context) - if not self._islogical(): + def logical_or(self, other, context=None): + """Applies an 'or' operation between self and other's digits.""" + if context is None: + context = getcontext() + if not self._islogical() or not other._islogical(): return context._raise_error(InvalidOperation) # fill to context.prec - dif = context.prec - len(self._int) - if dif: - self._int = (0,)*dif + self._int - - # invert, only starting after the first resulting 1 - result = [] - started = False - for dig in self._int: - if dig == 1 and not started: - continue - if dig == 1: - result.append(0) - else: - result.append(1) - started = True - result = tuple(result) + (opa, opb) = self._fill_logical(context, self._int, other._int) + + # make the operation, and clean starting zeroes + result = [a|b for a,b in zip(opa,opb)] + for i,d in enumerate(result): + if d == 1: + break + result = tuple(result[i:]) # if empty, we must have at least a zero if not result: result = (0,) return Decimal((0, result, 0)) - def logical_or(self, other, context=None): - """Applies an 'or' operation between self and other's digits.""" - def logical_xor(self, other, context=None): """Applies an 'xor' operation between self and other's digits.""" + if context is None: + context = getcontext() + if not self._islogical() or not other._islogical(): + return context._raise_error(InvalidOperation) + + # fill to context.prec + (opa, opb) = self._fill_logical(context, self._int, other._int) + + # make the operation, and clean starting zeroes + result = [a^b for a,b in zip(opa,opb)] + for i,d in enumerate(result): + if d == 1: + break + result = tuple(result[i:]) + + # if empty, we must have at least a zero + if not result: + result = (0,) + return Decimal((0, result, 0)) def max_mag(self, other, context=None): """Compares the values numerically with their sign ignored.""" From nnorwitz at gmail.com Thu May 17 22:44:43 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 17 May 2007 13:44:43 -0700 Subject: [Python-checkins] r55412 - python/trunk/Doc/lib/liboptparse.tex In-Reply-To: <20070517193000.5153D1E4002@bag.python.org> References: <20070517193000.5153D1E4002@bag.python.org> Message-ID: Note the first two lines of this file: % THIS FILE IS AUTO-GENERATED! DO NOT EDIT! % (Your changes will be lost the next time it is generated.) n -- On 5/17/07, fred.drake wrote: > Author: fred.drake > Date: Thu May 17 21:29:58 2007 > New Revision: 55412 > > Modified: > python/trunk/Doc/lib/liboptparse.tex > Log: > fix argument name in documentation; match the implementation > > Modified: python/trunk/Doc/lib/liboptparse.tex > ============================================================================== > --- python/trunk/Doc/lib/liboptparse.tex (original) > +++ python/trunk/Doc/lib/liboptparse.tex Thu May 17 21:29:58 2007 > @@ -1191,14 +1191,14 @@ > The whole point of creating and populating an OptionParser is to call > its \method{parse{\_}args()} method: > \begin{verbatim} > -(options, args) = parser.parse_args(args=None, options=None) > +(options, args) = parser.parse_args(args=None, values=None) > \end{verbatim} > > where the input parameters are > \begin{description} > \item[\code{args}] > the list of arguments to process (default: \code{sys.argv{[}1:]}) > -\item[\code{options}] > +\item[\code{values}] > object to store option arguments in (default: a new instance of > optparse.Values) > \end{description} > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > From fdrake at acm.org Thu May 17 22:54:11 2007 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 17 May 2007 16:54:11 -0400 Subject: [Python-checkins] r55412 - python/trunk/Doc/lib/liboptparse.tex In-Reply-To: References: <20070517193000.5153D1E4002@bag.python.org> Message-ID: <200705171654.11452.fdrake@acm.org> On Thursday 17 May 2007, Neal Norwitz wrote: > Note the first two lines of this file: > > % THIS FILE IS AUTO-GENERATED! DO NOT EDIT! > % (Your changes will be lost the next time it is generated.) Yeah, I've gotta file a bug report against Optik or something. :-( That blurb should also point to the right place to file bug reports. I'll see what I can figure out tonight. -Fred -- Fred L. Drake, Jr. From fdrake at acm.org Thu May 17 23:14:39 2007 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 17 May 2007 17:14:39 -0400 Subject: [Python-checkins] r55412 - python/trunk/Doc/lib/liboptparse.tex In-Reply-To: <200705171654.11452.fdrake@acm.org> References: <20070517193000.5153D1E4002@bag.python.org> <200705171654.11452.fdrake@acm.org> Message-ID: <200705171714.40014.fdrake@acm.org> On Thursday 17 May 2007, Fred L. Drake, Jr. wrote: > Yeah, I've gotta file a bug report against Optik or something. :-( That > blurb should also point to the right place to file bug reports. I'll see > what I can figure out tonight. http://www.python.org/sf/1720985 Doesn't look like there have been in commits to the Optik repository on SF for 14 months (a translation), and nothing before that for two and a half years. Is optparse still getting updated based on Optik at all? -Fred -- Fred L. Drake, Jr. From brett at python.org Thu May 17 23:41:26 2007 From: brett at python.org (Brett Cannon) Date: Thu, 17 May 2007 14:41:26 -0700 Subject: [Python-checkins] r55412 - python/trunk/Doc/lib/liboptparse.tex In-Reply-To: <200705171714.40014.fdrake@acm.org> References: <20070517193000.5153D1E4002@bag.python.org> <200705171654.11452.fdrake@acm.org> <200705171714.40014.fdrake@acm.org> Message-ID: On 5/17/07, Fred L. Drake, Jr. wrote: > > On Thursday 17 May 2007, Fred L. Drake, Jr. wrote: > > Yeah, I've gotta file a bug report against Optik or > something. :-( That > > blurb should also point to the right place to file bug reports. I'll > see > > what I can figure out tonight. > > http://www.python.org/sf/1720985 > > Doesn't look like there have been in commits to the Optik repository on SF > for > 14 months (a translation), and nothing before that for two and a half > years. > > Is optparse still getting updated based on Optik at all? According to PEP 360 (http://www.python.org/dev/peps/pep-0360/) there was an update to 1.5.1 for 2.5. -Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20070517/ff615a60/attachment.htm From python-checkins at python.org Thu May 17 23:49:38 2007 From: python-checkins at python.org (neal.norwitz) Date: Thu, 17 May 2007 23:49:38 +0200 (CEST) Subject: [Python-checkins] r55418 - peps/trunk/pep-3108.txt Message-ID: <20070517214938.79CFC1E400C@bag.python.org> Author: neal.norwitz Date: Thu May 17 23:49:32 2007 New Revision: 55418 Modified: peps/trunk/pep-3108.txt Log: Add a note about a new database package. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Thu May 17 23:49:32 2007 @@ -495,6 +495,10 @@ to bind in the module namespace to the old name while importing based on the new name. +All the database related modules will be moved to a database package. +These modules include: bsddb, dbm, gdbm, sqlite, +anydbm, dbhash, dumbdbm, whichdb. + Open Issues =========== From python-checkins at python.org Thu May 17 23:52:14 2007 From: python-checkins at python.org (neal.norwitz) Date: Thu, 17 May 2007 23:52:14 +0200 (CEST) Subject: [Python-checkins] r55419 - peps/trunk/pep-3108.txt Message-ID: <20070517215214.7ED821E400B@bag.python.org> Author: neal.norwitz Date: Thu May 17 23:52:13 2007 New Revision: 55419 Modified: peps/trunk/pep-3108.txt Log: Add some additional info about removing a module. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Thu May 17 23:52:13 2007 @@ -60,9 +60,14 @@ #. Remove the docs. #. Delete the reference to the removed docs in ``Doc/Makefile.deps`` and ``Doc/lib/lib.tex``. +#. If possible, build the docs. (cd Doc ; make) #. Run the regression test suite; watch out for tests that are skipped because an import failed for the removed module. +If a deprecation warning is added to 2.6, it would be better to make +all the changes to 2.6, merge the changes into the 3k branch, then +perform the procedure above. This will avoid some merge conflicts. + Previously deprecated --------------------- From python-checkins at python.org Fri May 18 03:30:17 2007 From: python-checkins at python.org (george.yoshida) Date: Fri, 18 May 2007 03:30:17 +0200 (CEST) Subject: [Python-checkins] r55424 - peps/trunk/pep-3113.txt Message-ID: <20070518013017.6A6401E4012@bag.python.org> Author: george.yoshida Date: Fri May 18 03:30:16 2007 New Revision: 55424 Modified: peps/trunk/pep-3113.txt Log: fix typos Modified: peps/trunk/pep-3113.txt ============================================================================== --- peps/trunk/pep-3113.txt (original) +++ peps/trunk/pep-3113.txt Fri May 18 03:30:16 2007 @@ -87,7 +87,7 @@ As mentioned in `Introspection Issues`_, to handle tuple parameters the function's bytecode starts with the bytecode required to unpack -the argument into the proper parameter names. This means that their +the argument into the proper parameter names. This means that there is no special support required to implement tuple parameters and thus there is no loss of abilities if they were to be removed, only a possible convenience (which is addressed in @@ -170,7 +170,7 @@ ------------- In certain instances tuple parameters can be useful. A common example -is code that expect a two-item tuple that reperesents a Cartesian +is code that expect a two-item tuple that represents a Cartesian point. While true it is nice to be able to have the unpacking of the x and y coordinates for you, the argument is that this small amount of practical usefulness is heavily outweighed by other issues pertaining From fdrake at acm.org Fri May 18 05:02:19 2007 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Thu, 17 May 2007 23:02:19 -0400 Subject: [Python-checkins] r55412 - python/trunk/Doc/lib/liboptparse.tex In-Reply-To: References: <20070517193000.5153D1E4002@bag.python.org> <200705171714.40014.fdrake@acm.org> Message-ID: <200705172302.19604.fdrake@acm.org> On Thursday 17 May 2007, Brett Cannon wrote: > According to PEP 360 (http://www.python.org/dev/peps/pep-0360/) there was > an update to 1.5.1 for 2.5. Interesting that 1.5.1 was used when 1.5.3 was available at that time. Hopefully future updates of Optik will include the doc fix; if not, hopefully we'll notice and fix it in Python. -Fred -- Fred L. Drake, Jr. From buildbot at python.org Fri May 18 06:40:08 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 18 May 2007 04:40:08 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20070518044008.943B01E4002@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2206 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon,georg.brandl,neal.norwitz,raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib2net make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri May 18 06:54:22 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 18 May 2007 04:54:22 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo 2.5 Message-ID: <20070518045422.8E4B81E4005@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%25202.5/builds/354 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/unittest.py", line 334, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '0002-0002-0002-0002-0002' Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/unittest.py", line 334, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '2000-2000-2000-2000-2000' Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/unittest.py", line 334, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '1001-1001-1001-1001-1001' make: *** [buildbottest] Segmentation fault sincerely, -The Buildbot From python-checkins at python.org Fri May 18 07:12:27 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 18 May 2007 07:12:27 +0200 (CEST) Subject: [Python-checkins] r55425 - python/branches/release25-maint/Python/marshal.c Message-ID: <20070518051227.39C0C1E4002@bag.python.org> Author: neal.norwitz Date: Fri May 18 07:12:22 2007 New Revision: 55425 Modified: python/branches/release25-maint/Python/marshal.c Log: Drop the max stack depth to something that works in 2.6 Modified: python/branches/release25-maint/Python/marshal.c ============================================================================== --- python/branches/release25-maint/Python/marshal.c (original) +++ python/branches/release25-maint/Python/marshal.c Fri May 18 07:12:22 2007 @@ -15,7 +15,7 @@ * and risks coring the interpreter. When the object stack gets this deep, * raise an exception instead of continuing. */ -#define MAX_MARSHAL_STACK_DEPTH 5000 +#define MAX_MARSHAL_STACK_DEPTH 2000 #define TYPE_NULL '0' #define TYPE_NONE 'N' From python-checkins at python.org Fri May 18 07:45:37 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 18 May 2007 07:45:37 +0200 (CEST) Subject: [Python-checkins] r55426 - python/branches/release25-maint/Lib/test/test_marshal.py Message-ID: <20070518054537.42A2F1E4005@bag.python.org> Author: neal.norwitz Date: Fri May 18 07:45:33 2007 New Revision: 55426 Modified: python/branches/release25-maint/Lib/test/test_marshal.py Log: Verify neither dumps or loads overflow the stack and segfault. Modified: python/branches/release25-maint/Lib/test/test_marshal.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_marshal.py (original) +++ python/branches/release25-maint/Lib/test/test_marshal.py Fri May 18 07:45:33 2007 @@ -220,10 +220,30 @@ except Exception: pass - def test_recursion(self): + def test_loads_recursion(self): s = 'c' + ('X' * 4*4) + '{' * 2**20 self.assertRaises(ValueError, marshal.loads, s) + def test_recursion_limit(self): + # Create a deeply nested structure. + head = last = [] + # The max stack depth should match the value in Python/marshal.c. + MAX_MARSHAL_STACK_DEPTH = 2000 + for i in range(MAX_MARSHAL_STACK_DEPTH - 2): + last.append([0]) + last = last[-1] + + # Verify we don't blow out the stack with dumps/load. + data = marshal.dumps(head) + new_head = marshal.loads(data) + # Don't use == to compare objects, it can exceed the recursion limit. + self.assertEqual(len(new_head), len(head)) + self.assertEqual(len(new_head[0]), len(head[0])) + self.assertEqual(len(new_head[-1]), len(head[-1])) + + last.append([0]) + self.assertRaises(ValueError, marshal.dumps, head) + def test_main(): test_support.run_unittest(IntTestCase, FloatTestCase, From python-checkins at python.org Fri May 18 07:47:18 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 18 May 2007 07:47:18 +0200 (CEST) Subject: [Python-checkins] r55427 - python/trunk/Lib/test/test_marshal.py Message-ID: <20070518054718.EB0321E4002@bag.python.org> Author: neal.norwitz Date: Fri May 18 07:47:16 2007 New Revision: 55427 Modified: python/trunk/Lib/test/test_marshal.py Log: Verify neither dumps or loads overflow the stack and segfault. Modified: python/trunk/Lib/test/test_marshal.py ============================================================================== --- python/trunk/Lib/test/test_marshal.py (original) +++ python/trunk/Lib/test/test_marshal.py Fri May 18 07:47:16 2007 @@ -220,10 +220,30 @@ except Exception: pass - def test_recursion(self): + def test_loads_recursion(self): s = 'c' + ('X' * 4*4) + '{' * 2**20 self.assertRaises(ValueError, marshal.loads, s) + def test_recursion_limit(self): + # Create a deeply nested structure. + head = last = [] + # The max stack depth should match the value in Python/marshal.c. + MAX_MARSHAL_STACK_DEPTH = 2000 + for i in range(MAX_MARSHAL_STACK_DEPTH - 2): + last.append([0]) + last = last[-1] + + # Verify we don't blow out the stack with dumps/load. + data = marshal.dumps(head) + new_head = marshal.loads(data) + # Don't use == to compare objects, it can exceed the recursion limit. + self.assertEqual(len(new_head), len(head)) + self.assertEqual(len(new_head[0]), len(head[0])) + self.assertEqual(len(new_head[-1]), len(head[-1])) + + last.append([0]) + self.assertRaises(ValueError, marshal.dumps, head) + def test_main(): test_support.run_unittest(IntTestCase, FloatTestCase, From buildbot at python.org Fri May 18 08:05:18 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 18 May 2007 06:05:18 +0000 Subject: [Python-checkins] buildbot failure in x86 XP trunk Message-ID: <20070518060518.A4BC91E4010@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/443 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: fred.drake,neal.norwitz BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Fri May 18 08:25:40 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 18 May 2007 06:25:40 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20070518062540.54E951E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/267 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: fred.drake,neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Fri May 18 16:45:00 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 18 May 2007 16:45:00 +0200 (CEST) Subject: [Python-checkins] r55431 - peps/trunk/pep-3100.txt Message-ID: <20070518144500.A08CA1E4002@bag.python.org> Author: guido.van.rossum Date: Fri May 18 16:44:56 2007 New Revision: 55431 Modified: peps/trunk/pep-3100.txt Log: Clarify that filter and map stay but will return iterators. Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Fri May 18 16:44:56 2007 @@ -167,7 +167,7 @@ ================== * Make built-ins return an iterator where appropriate (e.g. ``range()``, - ``zip()``, etc.) [zip is done; Neal Norwitz has a patch for range()] + ``zip()``, ``map()``, ``filter()``, etc.) [zip and range: done] * Relevant functions should consume iterators (e.g. ``min()``, ``max()``) [They already do, since 2.2.] * Remove ``input()`` and rename ``raw_input()`` to ``input()``. @@ -186,8 +186,6 @@ * ``coerce()``: no longer needed [2]_ * ``execfile()``, ``reload()``: use ``exec()`` [2]_ * ``intern()``: put in ``sys`` [2]_, [22]_ [done] -* ``map()``, ``filter()``: use list comprehensions instead??? [1]_, [9]_ - (Actually these can stay.) * ``reduce()``: write a loop instead [2]_, [9]_ [done] * ``xrange()``: use ``range()`` instead [1]_ [See range() above] From python-checkins at python.org Fri May 18 19:09:44 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 18 May 2007 19:09:44 +0200 (CEST) Subject: [Python-checkins] r55437 - peps/trunk/pep-0000.txt peps/trunk/pep-3129.txt Message-ID: <20070518170944.5C49E1E4002@bag.python.org> Author: georg.brandl Date: Fri May 18 19:09:42 2007 New Revision: 55437 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3129.txt Log: Add an acceptance note and mark PEP 3129 (class decorators) as final. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 18 19:09:42 2007 @@ -84,7 +84,6 @@ SA 3121 Extension Module Initialization & Finalization von L?wis SA 3123 Making PyObject_HEAD conform to standard C von L?wis SA 3127 Integer Literal Support and Syntax Maupin - SA 3129 Class Decorators Winter SA 3131 Supporting Non-ASCII Identifiers von L?wis Open PEPs (under consideration) @@ -189,6 +188,7 @@ SF 3107 Function Annotations Winter, Lownds SF 3113 Removal of Tuple Parameter Unpacking Cannon SF 3114 Renaming iterator.next() to .__next__() Yee + SF 3129 Class Decorators Winter SF 3132 Extended Iterable Unpacking Brandl Empty PEPs (or containing only an abstract) @@ -499,7 +499,7 @@ SR 3126 Remove Implicit String Concatenation Jewett SA 3127 Integer Literal Support and Syntax Maupin SR 3128 BList: A Faster List-like Type Stutzbach - SA 3129 Class Decorators Winter + SF 3129 Class Decorators Winter SR 3130 Access to Current Module/Class/Function Jewett SA 3131 Supporting Non-ASCII Identifiers von L?wis SF 3132 Extended Iterable Unpacking Brandl Modified: peps/trunk/pep-3129.txt ============================================================================== --- peps/trunk/pep-3129.txt (original) +++ peps/trunk/pep-3129.txt Fri May 18 19:09:42 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Collin Winter -Status: Accepted +Status: Final Type: Standards Track Content-Type: text/x-rst Created: 1-May-2007 @@ -47,7 +47,7 @@ The semantics and design goals of class decorators are the same as for function decorators ([#semantics]_, [#goals]_); the only difference is that you're decorating a class instead of a function. -The following two snippets are semantically identical: :: +The following two snippets are semantically identical:: class A: pass @@ -66,7 +66,7 @@ ============== Adapating Python's grammar to support class decorators requires -modifying two rules and adding a new rule :: +modifying two rules and adding a new rule:: funcdef: [decorators] 'def' NAME parameters ['->' test] ':' suite @@ -91,6 +91,15 @@ Jack Diederich. +Acceptance +========== + +There was virtually no discussion following the posting of this PEP, +meaning that everyone agreed it should be accepted. + +The patch was committed to Subversion as revision 55430. + + References ========== From python-checkins at python.org Fri May 18 19:41:45 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 18 May 2007 19:41:45 +0200 (CEST) Subject: [Python-checkins] r55439 - peps/trunk/pep-0000.txt peps/trunk/pep-0228.txt peps/trunk/pep-0237.txt peps/trunk/pep-0256.txt peps/trunk/pep-0258.txt peps/trunk/pep-0267.txt peps/trunk/pep-0268.txt peps/trunk/pep-0280.txt peps/trunk/pep-0287.txt peps/trunk/pep-0296.txt peps/trunk/pep-0297.txt peps/trunk/pep-0302.txt peps/trunk/pep-0323.txt peps/trunk/pep-0331.txt peps/trunk/pep-0350.txt peps/trunk/pep-0354.txt peps/trunk/pep-0355.txt peps/trunk/pep-0754.txt Message-ID: <20070518174145.3C9E61E4002@bag.python.org> Author: guido.van.rossum Date: Fri May 18 19:41:31 2007 New Revision: 55439 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-0228.txt peps/trunk/pep-0237.txt peps/trunk/pep-0256.txt peps/trunk/pep-0258.txt peps/trunk/pep-0267.txt peps/trunk/pep-0268.txt peps/trunk/pep-0280.txt peps/trunk/pep-0287.txt peps/trunk/pep-0296.txt peps/trunk/pep-0297.txt peps/trunk/pep-0302.txt peps/trunk/pep-0323.txt peps/trunk/pep-0331.txt peps/trunk/pep-0350.txt peps/trunk/pep-0354.txt peps/trunk/pep-0355.txt peps/trunk/pep-0754.txt Log: Change the status of a whole lotta PEPs. Some are marked final years after the work was completed and released; others are rejected after sitting idly for years. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 18 19:41:31 2007 @@ -60,6 +60,7 @@ I 257 Docstring Conventions Goodger, GvR IF 272 API for Block Encryption Algorithms v1.0 Kuchling IF 283 Python 2.3 Release Schedule GvR + I 287 reStructuredText Docstring Format Goodger I 290 Code Migration and Modernization Hettinger I 291 Backward Compatibility for Standard Library Norwitz I 306 How to Change Python's Grammar Hudson @@ -73,6 +74,7 @@ Accepted PEPs (accepted; may not be implemented yet) + SA 302 New Import Hooks JvR, Moore SA 358 The "bytes" Object Schemenauer, GvR SA 3106 Revamping dict.keys(), .values() & .items() GvR SA 3109 Raising Exceptions in Python 3000 Winter @@ -88,32 +90,16 @@ Open PEPs (under consideration) - S 228 Reworking Python's Numeric Model Zadka, GvR - S 237 Unifying Long Integers and Integers Zadka, GvR - S 256 Docstring Processing System Framework Goodger - S 258 Docutils Design Specification Goodger - S 267 Optimized Access to Module Namespaces Hylton - S 268 Extended HTTP functionality and WebDAV Stein - S 280 Optimizing access to globals GvR S 286 Enhanced Argument Tuples von Loewis - I 287 reStructuredText Docstring Format Goodger - S 297 Support for System Upgrades Lemburg - S 302 New Import Hooks JvR, Moore - S 323 Copyable Iterators Martelli - S 331 Locale-Independent Float/String Conversions Reis S 335 Overloadable Boolean Operators Ewing S 337 Logging Usage in the Standard Library Dubner S 344 Exception Chaining and Embedded Tracebacks Yee S 345 Metadata for Python Software Packages 1.2 Jones - I 350 Codetags Elliott - S 354 Enumerations in Python Finney - S 355 Path - Object oriented filesystem paths Lindqvist S 362 Function Signature Object Cannon, Seo S 364 Transitioning to the Py3K Standard Library Warsaw S 365 Adding the pkg_resources module Eby S 366 Main module explicit relative imports Coghlan S 367 New Super Spealman - S 754 IEEE 754 Floating Point Special Values Warnes S 3101 Advanced String Formatting Talin S 3108 Standard Library Reorganization Cannon S 3116 New I/O Stutzbach, Verdone, GvR @@ -129,7 +115,7 @@ SF 201 Lockstep Iteration Warsaw SF 202 List Comprehensions Warsaw SF 203 Augmented Assignments Wouters - S 205 Weak References Drake + SF 205 Weak References Drake SF 207 Rich Comparisons GvR, Ascher SF 208 Reworking the Coercion Model Schemenauer, Lemburg SF 214 Extended Print Statement Warsaw @@ -137,13 +123,14 @@ SF 218 Adding a Built-In Set Object Type Wilson, Hettinger SF 221 Import As Wouters SF 223 Change the Meaning of \x Escapes Peters - S 227 Statically Nested Scopes Hylton + SF 227 Statically Nested Scopes Hylton SF 229 Using Distutils to Build Python Kuchling SF 230 Warning Framework GvR SF 232 Function Attributes Warsaw SF 234 Iterators Yee, GvR SF 235 Import on Case-Insensitive Platforms Peters SF 236 Back to the __future__ Peters + SF 237 Unifying Long Integers and Integers Zadka, GvR SF 238 Changing the Division Operator Zadka, GvR SF 241 Metadata for Python Software Packages Kuchling SF 250 Using site-packages on Windows Moore @@ -175,6 +162,7 @@ SF 324 subprocess - New process module Astrand SF 327 Decimal Data Type Batista SF 328 Imports: Multi-Line and Absolute/Relative Aahz + SF 331 Locale-Independent Float/String Conversions Reis SF 338 Executing Modules as Scripts Coghlan SF 341 Unifying try-except and try-finally Brandl SF 342 Coroutines via Enhanced Generators GvR, Eby @@ -210,6 +198,7 @@ SD 222 Web Library Enhancements Kuchling SR 224 Attribute Docstrings Lemburg SD 225 Elementwise/Objectwise Operators Zhu, Lielens + SW 228 Reworking Python's Numeric Model Zadka, GvR SR 231 __findattr__() Warsaw SD 233 Python Online Help Prescod SR 239 Adding a Rational Type to Python Craig, Zadka @@ -220,22 +209,28 @@ SR 245 Python Interface Syntax Pelletier SR 246 Object Adaptation Evans SR 254 Making Classes Look More Like Types GvR + SR 256 Docstring Processing System Framework Goodger + SR 258 Docutils Design Specification Goodger SR 259 Omit printing newline after newline GvR SD 262 Database of Installed Python Packages Kuchling SR 265 Sorting Dictionaries by Value Griffin SW 266 Optimizing Global Variable/Attribute Access Montanaro + SD 267 Optimized Access to Module Namespaces Hylton + SR 268 Extended HTTP functionality and WebDAV Stein SD 269 Pgen Module for Python Riehl SR 270 uniq method for list objects Petrone SR 271 Prefixing sys.path by command line option Giacometti SW 274 Dict Comprehensions Warsaw SR 275 Switching on Multiple Values Lemburg SR 276 Simple Iterator for ints Althoff + SD 280 Optimizing access to globals GvR SR 281 Loop Counter Iteration with range & xrange Hetland SR 284 Integer for-loops Eppstein, Ewing SW 288 Generators Attributes and Exceptions Hettinger SR 294 Type Names in the types Module Tirosh SR 295 Interpretation of multiline string constants Koltsov - SR 296 Adding a bytes Object Type Gilbert + SW 296 Adding a bytes Object Type Gilbert + SR 297 Support for System Upgrades Lemburg SW 298 The Locked Buffer Interface Heller SR 299 Special __main__() function in modules Epler SR 303 Extend divmod() for Multiple Divisors Bellman @@ -248,6 +243,7 @@ SR 317 Eliminate Implicit Exception Instantiation Taschuk SR 319 Python Synchronize/Asynchronize Block Pelletier SW 321 Date/Time Parsing and Formatting Kuchling + SD 323 Copyable Iterators Martelli SR 325 Resource-Release Support for Generators Pedroni SR 326 A Case for Top and Bottom Values Carlson, Reedy SR 329 Treating Builtins as Constants in the StdLib Hettinger @@ -259,10 +255,14 @@ SW 346 User Defined ("with") Statements Coghlan SR 348 Exception Reorganization for Python 3.0 Cannon SD 349 Allow str() to return unicode strings Schemenauer + IR 350 Codetags Elliott SR 351 The freeze protocol Warsaw + SR 354 Enumerations in Python Finney + SR 355 Path - Object oriented filesystem paths Lindqvist SW 359 The "make" Statement Bethard SR 363 Syntax For Dynamic Attribute Access North SR 666 Reject Foolish Indentation Creighton + SR 754 IEEE 754 Floating Point Special Values Warnes SR 3103 A Switch/Case Statement GvR SR 3117 Postfix Type Declarations Brandl SR 3122 Delineation of the main module Cannon @@ -325,7 +325,7 @@ SD 225 Elementwise/Objectwise Operators Zhu, Lielens IF 226 Python 2.1 Release Schedule Hylton S 227 Statically Nested Scopes Hylton - S 228 Reworking Python's Numeric Model Zadka, GvR + SW 228 Reworking Python's Numeric Model Zadka, GvR SF 229 Using Distutils to Build Python Kuchling SF 230 Warning Framework GvR SR 231 __findattr__() Warsaw @@ -334,7 +334,7 @@ SF 234 Iterators Yee, GvR SF 235 Import on Case-Insensitive Platforms Peters SF 236 Back to the __future__ Peters - S 237 Unifying Long Integers and Integers Zadka, GvR + SF 237 Unifying Long Integers and Integers Zadka, GvR SF 238 Changing the Division Operator Zadka, GvR SR 239 Adding a Rational Type to Python Craig, Zadka SR 240 Adding a Rational Literal to Python Craig, Zadka @@ -355,7 +355,7 @@ SF 255 Simple Generators Schemenauer, et al S 256 Docstring Processing System Framework Goodger I 257 Docstring Conventions Goodger, GvR - S 258 Docutils Design Specification Goodger + SR 258 Docutils Design Specification Goodger SR 259 Omit printing newline after newline GvR SF 260 Simplify xrange() GvR SF 261 Support for "wide" Unicode characters Prescod @@ -364,9 +364,9 @@ SF 264 Future statements in simulated shells Hudson SR 265 Sorting Dictionaries by Value Griffin SW 266 Optimizing Global Variable/Attribute Access Montanaro - S 267 Optimized Access to Module Namespaces Hylton - S 268 Extended HTTP functionality and WebDAV Stein - S 269 Pgen Module for Python Riehl + SD 267 Optimized Access to Module Namespaces Hylton + SR 268 Extended HTTP functionality and WebDAV Stein + SD 269 Pgen Module for Python Riehl SR 270 uniq method for list objects Petrone SR 271 Prefixing sys.path by command line option Giacometti IF 272 API for Block Encryption Algorithms v1.0 Kuchling @@ -377,7 +377,7 @@ SF 277 Unicode file name support for Windows NT Hodgson SF 278 Universal Newline Support Jansen SF 279 The enumerate() built-in function Hettinger - S 280 Optimizing access to globals GvR + SD 280 Optimizing access to globals GvR SR 281 Loop Counter Iteration with range & xrange Hetland SF 282 A Logging System Sajip, Mick IF 283 Python 2.3 Release Schedule GvR @@ -393,12 +393,12 @@ SF 293 Codec Error Handling Callbacks D?rwald SR 294 Type Names in the types Module Tirosh SR 295 Interpretation of multiline string constants Koltsov - SR 296 Adding a bytes Object Type Gilbert - S 297 Support for System Upgrades Lemburg + SW 296 Adding a bytes Object Type Gilbert + SR 297 Support for System Upgrades Lemburg SW 298 The Locked Buffer Interface Heller SR 299 Special __main__() function in modules Epler SF 301 Package Index and Metadata for Distutils Jones - S 302 New Import Hooks JvR, Moore + SA 302 New Import Hooks JvR, Moore SR 303 Extend divmod() for Multiple Divisors Bellman SW 304 Controlling Generation of Bytecode Files Montanaro SF 305 CSV File API Montanaro, et al @@ -419,7 +419,7 @@ IF 320 Python 2.4 Release Schedule Warsaw, et al SW 321 Date/Time Parsing and Formatting Kuchling SF 322 Reverse Iteration Hettinger - S 323 Copyable Iterators Martelli + SD 323 Copyable Iterators Martelli SF 324 subprocess - New POSIX process module Astrand SR 325 Resource-Release Support for Generators Pedroni SR 326 A Case for Top and Bottom Values Carlson, Reedy @@ -427,7 +427,7 @@ SF 328 Imports: Multi-Line and Absolute/Relative Aahz SR 329 Treating Builtins as Constants in the StdLib Hettinger SR 330 Python Bytecode Verification Pelletier - S 331 Locale-Independent Float/String Conversions Reis + SF 331 Locale-Independent Float/String Conversions Reis SR 332 Byte vectors and String/Unicode Unification Montanaro I 333 Python Web Server Gateway Interface v1.0 Eby SW 334 Simple Coroutines via SuspendIteration Evans @@ -443,15 +443,15 @@ S 344 Exception Chaining and Embedded Tracebacks Yee S 345 Metadata for Python Software Packages 1.2 Jones SW 346 User Defined ("with") Statements Coghlan - P 347 Migrating the Python CVS to Subversion von L?wis + PA 347 Migrating the Python CVS to Subversion von L?wis SR 348 Exception Reorganization for Python 3.0 Cannon SD 349 Allow str() to return unicode strings Schemenauer - I 350 Codetags Elliott + IR 350 Codetags Elliott SR 351 The freeze protocol Warsaw SF 352 Required Superclass for Exceptions GvR, Cannon SA 353 Using ssize_t as the index type von Loewis - S 354 Enumerations in Python Finney - S 355 Path - Object oriented filesystem paths Lindqvist + SR 354 Enumerations in Python Finney + SR 355 Path - Object oriented filesystem paths Lindqvist IF 356 Python 2.5 Release Schedule Norwitz, et al SF 357 Allowing Any Object to be Used for Slicing Oliphant SA 358 The "bytes" Object Schemenauer, GvR @@ -465,7 +465,7 @@ S 366 Main module explicit relative imports Coghlan S 367 New Super Spealman SR 666 Reject Foolish Indentation Creighton - S 754 IEEE 754 Floating Point Special Values Warnes + SR 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR P 3001 Reviewing and improving stdlib modules Brandl P 3002 Procedure for Backwards-Incompatible Changes Bethard Modified: peps/trunk/pep-0228.txt ============================================================================== --- peps/trunk/pep-0228.txt (original) +++ peps/trunk/pep-0228.txt Fri May 18 19:41:31 2007 @@ -3,12 +3,18 @@ Version: $Revision$ Last-Modified: $Date$ Author: pep at zadka.site.co.il (Moshe Zadka), guido at python.org (Guido van Rossum) -Status: Draft +Status: Withdrawn Type: Standards Track Python-Version: ?? Created: 4-Nov-2000 Post-History: + +Withdrawal + + This PEP has been withdrawn in favor of PEP 3141. + + Abstract Today, Python's numerical model is similar to the C numeric model: Modified: peps/trunk/pep-0237.txt ============================================================================== --- peps/trunk/pep-0237.txt (original) +++ peps/trunk/pep-0237.txt Fri May 18 19:41:31 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Moshe Zadka, Guido van Rossum -Status: Draft +Status: Final Type: Standards Track Created: 11-Mar-2001 Python-Version: 2.2 Modified: peps/trunk/pep-0256.txt ============================================================================== --- peps/trunk/pep-0256.txt (original) +++ peps/trunk/pep-0256.txt Fri May 18 19:41:31 2007 @@ -4,13 +4,19 @@ Last-Modified: $Date$ Author: David Goodger Discussions-To: -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 01-Jun-2001 Post-History: 13-Jun-2001 +Rejection Notice +================ + +This proposal seems to have run out of steam. + + Abstract ======== Modified: peps/trunk/pep-0258.txt ============================================================================== --- peps/trunk/pep-0258.txt (original) +++ peps/trunk/pep-0258.txt Fri May 18 19:41:31 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: David Goodger Discussions-To: -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/x-rst Requires: 256, 257 @@ -12,6 +12,15 @@ Post-History: 13-Jun-2001 +================ +Rejection Notice +================ + +While this may serve as an interesting design document for the +now-independent docutils, it is no longer slated for inclusion in the +standard library. + + ========== Abstract ========== Modified: peps/trunk/pep-0267.txt ============================================================================== --- peps/trunk/pep-0267.txt (original) +++ peps/trunk/pep-0267.txt Fri May 18 19:41:31 2007 @@ -3,12 +3,19 @@ Version: $Revision$ Last-Modified: $Date$ Author: jeremy at zope.com (Jeremy Hylton) -Status: Draft +Status: Deferred Type: Standards Track Created: 23-May-2001 Python-Version: 2.2 Post-History: +Deferral + + While this PEP is a nice idea, no-one has yet emerged to do the work of + hashing out the differences between this PEP, PEP 266 and PEP 280. + Hence, it is being deferred. + + Abstract This PEP proposes a new implementation of global module namespaces Modified: peps/trunk/pep-0268.txt ============================================================================== --- peps/trunk/pep-0268.txt (original) +++ peps/trunk/pep-0268.txt Fri May 18 19:41:31 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: gstein at lyra.org (Greg Stein) -Status: Draft +Status: Rejected Type: Standards Track Created: 20-Aug-2001 Python-Version: 2.x @@ -11,6 +11,13 @@ Content-Type: text/x-rst +Rejection Notice +================ + +This PEP has been rejected. It has failed to generate sufficient +community support in the six years since its proposal. + + Abstract ======== Modified: peps/trunk/pep-0280.txt ============================================================================== --- peps/trunk/pep-0280.txt (original) +++ peps/trunk/pep-0280.txt Fri May 18 19:41:31 2007 @@ -3,13 +3,20 @@ Version: $Revision$ Last-Modified: $Date$ Author: guido at python.org (Guido van Rossum) -Status: Draft +Status: Deferred Type: Standards Track Created: 10-Feb-2002 Python-Version: 2.3 Post-History: +Deferral + + While this PEP is a nice idea, no-one has yet emerged to do the work of + hashing out the differences between this PEP, PEP 267 and PEP 280. + Hence, it is being deferred. + + Abstract This PEP describes yet another approach to optimizing access to Modified: peps/trunk/pep-0287.txt ============================================================================== --- peps/trunk/pep-0287.txt (original) +++ peps/trunk/pep-0287.txt Fri May 18 19:41:31 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: David Goodger Discussions-To: -Status: Draft +Status: Active Type: Informational Content-Type: text/x-rst Created: 25-Mar-2002 Modified: peps/trunk/pep-0296.txt ============================================================================== --- peps/trunk/pep-0296.txt (original) +++ peps/trunk/pep-0296.txt Fri May 18 19:41:31 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: xscottg at yahoo.com (Scott Gilbert) -Status: Rejected +Status: Withdrawn Type: Standards Track Created: 12-Jul-2002 Python-Version: 2.3 @@ -12,7 +12,7 @@ Notice - This PEP is withdrawn by the author. + This PEP is withdrawn by the author (in favor of PEP 358). Abstract Modified: peps/trunk/pep-0297.txt ============================================================================== --- peps/trunk/pep-0297.txt (original) +++ peps/trunk/pep-0297.txt Fri May 18 19:41:31 2007 @@ -3,12 +3,17 @@ Version: $Revision$ Last-Modified: $Date$ Author: mal at lemburg.com (Marc-Andr? Lemburg) -Status: Draft +Status: Rejected Type: Standards Track Python-Version: 2.6 Created: 19-Jul-2001 Post-History: +Rejection Notice + + This PEP is rejected for failure to generate significant interest. + + Abstract This PEP proposes strategies to allow the Python standard library Modified: peps/trunk/pep-0302.txt ============================================================================== --- peps/trunk/pep-0302.txt (original) +++ peps/trunk/pep-0302.txt Fri May 18 19:41:31 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Just van Rossum , Paul Moore -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/plain Created: 19-Dec-2002 @@ -12,6 +12,12 @@ Post-History: 19-Dec-2002 +Status Inquiry + + Is this PEP ready to be marked as final? Are there any parts left + unimplemented? + + Abstract This PEP proposes to add a new set of import hooks that offer better Modified: peps/trunk/pep-0323.txt ============================================================================== --- peps/trunk/pep-0323.txt (original) +++ peps/trunk/pep-0323.txt Fri May 18 19:41:31 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Alex Martelli -Status: Draft +Status: Deferred Type: Standards Track Content-Type: text/plain Created: 25-Oct-2003 @@ -11,6 +11,12 @@ Post-History: 29-Oct-2003 +Deferral + + This PEP has been deferred. Copyable iterators are a nice idea, but after + four years, no implementation or widespread interest has emerged. + + Abstract This PEP suggests that some iterator types should support shallow Modified: peps/trunk/pep-0331.txt ============================================================================== --- peps/trunk/pep-0331.txt (original) +++ peps/trunk/pep-0331.txt Fri May 18 19:41:31 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Christian R. Reis -Status: Draft +Status: Final Type: Standards Track Content-Type: text/plain Created: 19-Jul-2003 Modified: peps/trunk/pep-0350.txt ============================================================================== --- peps/trunk/pep-0350.txt (original) +++ peps/trunk/pep-0350.txt Fri May 18 19:41:31 2007 @@ -3,13 +3,20 @@ Version: $Revision$ Last-Modified: $Date$ Author: Micah Elliott -Status: Draft +Status: Rejected Type: Informational Content-Type: text/x-rst Created: 27-Jun-2005 Post-History: 10-Aug-2005, 26-Sep-2005 +Rejection Notice +================ + +This PEP has been rejected. While the community may be interested, +there is no desire to make the standard library conform to this standard. + + Abstract ======== Modified: peps/trunk/pep-0354.txt ============================================================================== --- peps/trunk/pep-0354.txt (original) +++ peps/trunk/pep-0354.txt Fri May 18 19:41:31 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Ben Finney -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 20-Dec-2005 @@ -11,6 +11,17 @@ Post-History: 20-Dec-2005 +Rejection Notice +================ + +This PEP has been rejected. This doesn't slot nicely into any of the +existing modules (like collections), and the Python standard library +eschews having lots of individual data strucutres in their own +modules. Also, the PEP has generated no widespread interest. For +those who need enumerations, there are cookbook recipes and PyPI +packages that meet these needs. + + Abstract ======== Modified: peps/trunk/pep-0355.txt ============================================================================== --- peps/trunk/pep-0355.txt (original) +++ peps/trunk/pep-0355.txt Fri May 18 19:41:31 2007 @@ -3,13 +3,26 @@ Version: $Revision$ Last-Modified: $Date$ Author: Bj?rn Lindqvist -Status: Draft +Status: Rejected Type: Standards Track Created: 24-Jan-2006 Content-Type: text/plain Python-Version: 2.5 +Rejection Notice + + This PEP has been rejected (in this form). The proposed path class + is the ultimate kitchen sink; but the notion that it's better to + implement *all* functionality that uses a path as a method on a single + class is an anti-pattern. (E.g.why not open()? Or execfile()?) + Subclassing from str is a particularly bad idea; many string + operations make no sense when applied to a path. This PEP has + lingered, and while the discussion flares up from time to time, + it's time to put this PEP out of its misery. A less far-fetched + proposal might be more palatable. + + Abstract This PEP describes a new class, Path, to be added to the os Modified: peps/trunk/pep-0754.txt ============================================================================== --- peps/trunk/pep-0754.txt (original) +++ peps/trunk/pep-0754.txt Fri May 18 19:41:31 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Gregory R. Warnes (Pfizer, Inc.) -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 28-Mar-2003 @@ -11,6 +11,13 @@ Post-History: +Rejection Notice +================ + +This PEP has been rejected. After sitting open for four years, it has +failed to generate sufficient community interest. + + Abstract ======== From python-checkins at python.org Fri May 18 20:05:13 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 18 May 2007 20:05:13 +0200 (CEST) Subject: [Python-checkins] r55440 - peps/trunk/pep-0000.txt peps/trunk/pep-0302.txt Message-ID: <20070518180513.720301E4002@bag.python.org> Author: guido.van.rossum Date: Fri May 18 20:05:05 2007 New Revision: 55440 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-0302.txt Log: Mark PEP 302 as final (despite the docs being incomplete). Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 18 20:05:05 2007 @@ -74,7 +74,6 @@ Accepted PEPs (accepted; may not be implemented yet) - SA 302 New Import Hooks JvR, Moore SA 358 The "bytes" Object Schemenauer, GvR SA 3106 Revamping dict.keys(), .values() & .items() GvR SA 3109 Raising Exceptions in Python 3000 Winter @@ -151,6 +150,7 @@ SF 292 Simpler String Substitutions Warsaw SF 293 Codec Error Handling Callbacks D?rwald SF 301 Package Index and Metadata for Distutils Jones + SF 302 New Import Hooks JvR, Moore SF 305 CSV File API Montanaro, et al SF 307 Extensions to the pickle protocol GvR, Peters SF 308 Conditional Expressions GvR, Hettinger @@ -398,7 +398,7 @@ SW 298 The Locked Buffer Interface Heller SR 299 Special __main__() function in modules Epler SF 301 Package Index and Metadata for Distutils Jones - SA 302 New Import Hooks JvR, Moore + SF 302 New Import Hooks JvR, Moore SR 303 Extend divmod() for Multiple Divisors Bellman SW 304 Controlling Generation of Bytecode Files Montanaro SF 305 CSV File API Montanaro, et al Modified: peps/trunk/pep-0302.txt ============================================================================== --- peps/trunk/pep-0302.txt (original) +++ peps/trunk/pep-0302.txt Fri May 18 20:05:05 2007 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Just van Rossum , Paul Moore -Status: Accepted +Status: Final Type: Standards Track Content-Type: text/plain Created: 19-Dec-2002 @@ -12,12 +12,6 @@ Post-History: 19-Dec-2002 -Status Inquiry - - Is this PEP ready to be marked as final? Are there any parts left - unimplemented? - - Abstract This PEP proposes to add a new set of import hooks that offer better From python-checkins at python.org Fri May 18 22:30:55 2007 From: python-checkins at python.org (collin.winter) Date: Fri, 18 May 2007 22:30:55 +0200 (CEST) Subject: [Python-checkins] r55442 - peps/trunk/pep-0000.txt peps/trunk/pep-3110.txt Message-ID: <20070518203055.512C51E4002@bag.python.org> Author: collin.winter Date: Fri May 18 22:30:49 2007 New Revision: 55442 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3110.txt Log: Mark PEP 3110 as final. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 18 22:30:49 2007 @@ -77,7 +77,6 @@ SA 358 The "bytes" Object Schemenauer, GvR SA 3106 Revamping dict.keys(), .values() & .items() GvR SA 3109 Raising Exceptions in Python 3000 Winter - SA 3110 Catching Exceptions in Python 3000 Winter SA 3111 Simple input built-in in Python 3000 Roberge SA 3112 Bytes literals in Python 3000 Orendorff SA 3115 Metaclasses in Python 3000 Talin @@ -174,6 +173,7 @@ SF 3104 Access to Names in Outer Scopes Yee SF 3105 Make print a function Brandl SF 3107 Function Annotations Winter, Lownds + SF 3110 Catching Exceptions in Python 3000 Winter SF 3113 Removal of Tuple Parameter Unpacking Cannon SF 3114 Renaming iterator.next() to .__next__() Yee SF 3129 Class Decorators Winter @@ -480,7 +480,7 @@ SF 3107 Function Annotations Winter, Lownds S 3108 Standard Library Reorganization Cannon SA 3109 Raising Exceptions in Python 3000 Winter - SA 3110 Catching Exceptions in Python 3000 Winter + SF 3110 Catching Exceptions in Python 3000 Winter SA 3111 Simple input built-in in Python 3000 Roberge SA 3112 Bytes literals in Python 3000 Orendorff SF 3113 Removal of Tuple Parameter Unpacking Cannon Modified: peps/trunk/pep-3110.txt ============================================================================== --- peps/trunk/pep-3110.txt (original) +++ peps/trunk/pep-3110.txt Fri May 18 22:30:49 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Collin Winter -Status: Accepted +Status: Final Type: Standards Track Content-Type: text/x-rst Created: 16-Jan-2006 @@ -185,29 +185,26 @@ ``sys.exc_info()[2]`` respectively, a transformation that can be performed by ``2to3``'s ``sysexcattrs`` fixer. +2.6 - 3.0 Compatibility +----------------------- -Open Issues -=========== - -"except" Statements in Python 2.x ------------------------------------ - -It has been proposed that the grammar for ``except`` statements be -changed to accommodate both Python 2's ``,`` and Python 3's ``as`` -between the statement's type and target portions. The grammar -would thus change from :: +In order to facilitate forwards compatibility between Python 2.6 and 3.0, +the ``except ... as ...:`` syntax will be backported to the 2.x series. The +grammar will thus change from:: except_clause: 'except' [test [',' test]] -to :: +to:: except_clause: 'except' [test [('as' | ',') test]] -It has not been decided whether the proposed end-of-suite cleanup -semantic for ``except`` statements should be included in the 2.x -series. +The end-of-suite cleanup semantic for ``except`` statements will not be +included in the 2.x series of releases. +Open Issues +=========== + Replacing or Dropping "sys.exc_info()" -------------------------------------- @@ -224,6 +221,13 @@ are defined in terms of ``sys.exc_info()``. +Implementation +============== + +This PEP was implemented in revisions 53342 [#r53342]_ and 53349 +[#r53349]_. + + References ========== @@ -268,6 +272,12 @@ .. [#replace-excinfo] http://mail.python.org/pipermail/python-3000/2007-January/005604.html + +.. [#r53342] + http://svn.python.org/view/python/branches/p3yk/?view=rev&rev=53342 + +.. [#r53349] + http://svn.python.org/view/python/branches/p3yk/?view=rev&rev=53349 Copyright From python-checkins at python.org Sat May 19 00:07:28 2007 From: python-checkins at python.org (jim.fulton) Date: Sat, 19 May 2007 00:07:28 +0200 (CEST) Subject: [Python-checkins] r55444 - sandbox/branches/setuptools-jim-fix Message-ID: <20070518220728.6BE881E4004@bag.python.org> Author: jim.fulton Date: Sat May 19 00:07:25 2007 New Revision: 55444 Added: sandbox/branches/setuptools-jim-fix/ - copied from r55443, sandbox/branches/setuptools-0.6/ Log: branch to make setuptools more tolerant of some download failures From python-checkins at python.org Sat May 19 01:11:27 2007 From: python-checkins at python.org (collin.winter) Date: Sat, 19 May 2007 01:11:27 +0200 (CEST) Subject: [Python-checkins] r55446 - in python/trunk: Grammar/Grammar Lib/compiler/transformer.py Lib/test/test_grammar.py Misc/NEWS Python/ast.c Python/graminit.c Message-ID: <20070518231127.25E2C1E400F@bag.python.org> Author: collin.winter Date: Sat May 19 01:11:24 2007 New Revision: 55446 Modified: python/trunk/Grammar/Grammar python/trunk/Lib/compiler/transformer.py python/trunk/Lib/test/test_grammar.py python/trunk/Misc/NEWS python/trunk/Python/ast.c python/trunk/Python/graminit.c Log: Backport PEP 3110's new 'except' syntax to 2.6. Modified: python/trunk/Grammar/Grammar ============================================================================== --- python/trunk/Grammar/Grammar (original) +++ python/trunk/Grammar/Grammar Sat May 19 01:11:24 2007 @@ -85,7 +85,7 @@ with_stmt: 'with' test [ with_var ] ':' suite with_var: 'as' expr # NB compile.c makes sure that the default except clause is last -except_clause: 'except' [test [',' test]] +except_clause: 'except' [test [('as' | ',') test]] suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT # Backward compatibility cruft to support: Modified: python/trunk/Lib/compiler/transformer.py ============================================================================== --- python/trunk/Lib/compiler/transformer.py (original) +++ python/trunk/Lib/compiler/transformer.py Sat May 19 01:11:24 2007 @@ -930,7 +930,7 @@ for i in range(3, len(nodelist), 3): node = nodelist[i] if node[0] == symbol.except_clause: - # except_clause: 'except' [expr [',' expr]] */ + # except_clause: 'except' [expr [(',' | 'as') expr]] */ if len(node) > 2: expr1 = self.com_node(node[2]) if len(node) > 4: Modified: python/trunk/Lib/test/test_grammar.py ============================================================================== --- python/trunk/Lib/test/test_grammar.py (original) +++ python/trunk/Lib/test/test_grammar.py Sat May 19 01:11:24 2007 @@ -600,7 +600,7 @@ def testTry(self): ### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] ### | 'try' ':' suite 'finally' ':' suite - ### except_clause: 'except' [expr [',' expr]] + ### except_clause: 'except' [expr [('as' | ',') expr]] try: 1/0 except ZeroDivisionError: @@ -609,7 +609,7 @@ pass try: 1/0 except EOFError: pass - except TypeError, msg: pass + except TypeError as msg: pass except RuntimeError, msg: pass except: pass else: pass Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat May 19 01:11:24 2007 @@ -12,6 +12,10 @@ Core and builtins ----------------- +- except clauses may now be spelled either "except E, target:" or + "except E as target:". This is to provide forwards compatibility with + Python 3.0. + - Deprecate BaseException.message as per PEP 352. - Bug #1303614: don't expose object's __dict__ when the dict is Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sat May 19 01:11:24 2007 @@ -2765,7 +2765,7 @@ static excepthandler_ty ast_for_except_clause(struct compiling *c, const node *exc, node *body) { - /* except_clause: 'except' [test [',' test]] */ + /* except_clause: 'except' [test [(',' | 'as') test]] */ REQ(exc, except_clause); REQ(body, suite); Modified: python/trunk/Python/graminit.c ============================================================================== --- python/trunk/Python/graminit.c (original) +++ python/trunk/Python/graminit.c Sat May 19 01:11:24 2007 @@ -931,7 +931,8 @@ {26, 2}, {0, 1}, }; -static arc arcs_42_2[2] = { +static arc arcs_42_2[3] = { + {78, 3}, {27, 3}, {0, 2}, }; @@ -944,7 +945,7 @@ static state states_42[5] = { {1, arcs_42_0}, {2, arcs_42_1}, - {2, arcs_42_2}, + {3, arcs_42_2}, {1, arcs_42_3}, {1, arcs_42_4}, }; From python-checkins at python.org Sat May 19 01:14:42 2007 From: python-checkins at python.org (collin.winter) Date: Sat, 19 May 2007 01:14:42 +0200 (CEST) Subject: [Python-checkins] r55447 - peps/trunk/pep-3110.txt Message-ID: <20070518231442.341F91E4006@bag.python.org> Author: collin.winter Date: Sat May 19 01:14:38 2007 New Revision: 55447 Modified: peps/trunk/pep-3110.txt Log: Note the revision where 'except ... as ...:' was implemented for 2.6. Modified: peps/trunk/pep-3110.txt ============================================================================== --- peps/trunk/pep-3110.txt (original) +++ peps/trunk/pep-3110.txt Sat May 19 01:14:38 2007 @@ -225,7 +225,8 @@ ============== This PEP was implemented in revisions 53342 [#r53342]_ and 53349 -[#r53349]_. +[#r53349]_. Support for the new ``except`` syntax in 2.6 was +implemented in revision 55446 [#r55446]_. References @@ -278,6 +279,9 @@ .. [#r53349] http://svn.python.org/view/python/branches/p3yk/?view=rev&rev=53349 + +.. [#r55446] + http://svn.python.org/view/python/trunk/?view=rev&rev=55446 Copyright From python-checkins at python.org Sat May 19 03:11:22 2007 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 19 May 2007 03:11:22 +0200 (CEST) Subject: [Python-checkins] r55448 - in python/trunk: Doc/lib/libcollections.tex Lib/collections.py Lib/test/test_collections.py Message-ID: <20070519011122.6874E1E4004@bag.python.org> Author: raymond.hettinger Date: Sat May 19 03:11:16 2007 New Revision: 55448 Modified: python/trunk/Doc/lib/libcollections.tex python/trunk/Lib/collections.py python/trunk/Lib/test/test_collections.py Log: Improvements to NamedTuple's implementation, tests, and documentation Modified: python/trunk/Doc/lib/libcollections.tex ============================================================================== --- python/trunk/Doc/lib/libcollections.tex (original) +++ python/trunk/Doc/lib/libcollections.tex Sat May 19 03:11:16 2007 @@ -378,14 +378,25 @@ The use cases are the same as those for tuples. The named factories assign meaning to each tuple position and allow for more readable, self-documenting code. Named tuples can also be used to assign field names - to tuples - returned by the \module{csv} or \module{sqlite3} modules. For example: + to tuples returned by the \module{csv} or \module{sqlite3} modules. + For example: \begin{verbatim} +from itertools import starmap import csv EmployeeRecord = NamedTuple('EmployeeRecord', 'name age title department paygrade') -for tup in csv.reader(open("employees.csv", "rb")): - print EmployeeRecord(*tup) +for record in starmap(EmployeeRecord, csv.reader(open("employees.csv", "rb"))): + print record +\end{verbatim} + + To cast an individual record stored as \class{list}, \class{tuple}, or some other + iterable type, use the star-operator to unpack the values: + + \begin{verbatim} +>>> Color = NamedTuple('Color', 'name code') +>>> m = dict(red=1, green=2, blue=3) +>>> print Color(*m.popitem()) +Color(name='blue', code=3) \end{verbatim} \end{funcdesc} Modified: python/trunk/Lib/collections.py ============================================================================== --- python/trunk/Lib/collections.py (original) +++ python/trunk/Lib/collections.py Sat May 19 03:11:16 2007 @@ -24,30 +24,29 @@ """ field_names = s.split() - nargs = len(field_names) + assert ''.join(field_names).replace('_', '').isalpha() # protect against exec attacks + argtxt = ', '.join(field_names) + reprtxt = ', '.join('%s=%%r' % name for name in field_names) + template = '''class %(typename)s(tuple): + '%(typename)s(%(argtxt)s)' + __slots__ = () + def __new__(cls, %(argtxt)s): + return tuple.__new__(cls, (%(argtxt)s,)) + def __repr__(self): + return '%(typename)s(%(reprtxt)s)' %% self + ''' % locals() + for i, name in enumerate(field_names): + template += '\t%s = property(itemgetter(%d))\n' % (name, i) + m = dict(itemgetter=_itemgetter) + exec template in m + result = m[typename] + if hasattr(_sys, '_getframe'): + result.__module__ = _sys._getframe(1).f_globals['__name__'] + return result + + - def __new__(cls, *args, **kwds): - if kwds: - try: - args += tuple(kwds[name] for name in field_names[len(args):]) - except KeyError, name: - raise TypeError('%s missing required argument: %s' % (typename, name)) - if len(args) != nargs: - raise TypeError('%s takes exactly %d arguments (%d given)' % (typename, nargs, len(args))) - return tuple.__new__(cls, args) - - repr_template = '%s(%s)' % (typename, ', '.join('%s=%%r' % name for name in field_names)) - - m = dict(vars(tuple)) # pre-lookup superclass methods (for faster lookup) - m.update(__doc__= '%s(%s)' % (typename, ', '.join(field_names)), - __slots__ = (), # no per-instance dict (so instances are same size as tuples) - __new__ = __new__, - __repr__ = lambda self, _format=repr_template.__mod__: _format(self), - __module__ = _sys._getframe(1).f_globals['__name__'], - ) - m.update((name, property(_itemgetter(index))) for index, name in enumerate(field_names)) - return type(typename, (tuple,), m) if __name__ == '__main__': Modified: python/trunk/Lib/test/test_collections.py ============================================================================== --- python/trunk/Lib/test/test_collections.py (original) +++ python/trunk/Lib/test/test_collections.py Sat May 19 03:11:16 2007 @@ -11,7 +11,6 @@ self.assertEqual(Point.__slots__, ()) self.assertEqual(Point.__module__, __name__) self.assertEqual(Point.__getitem__, tuple.__getitem__) - self.assert_('__getitem__' in Point.__dict__) # superclass methods localized def test_instance(self): Point = NamedTuple('Point', 'x y') @@ -50,8 +49,10 @@ def test_main(verbose=None): + import collections as CollectionsModule test_classes = [TestNamedTuple] test_support.run_unittest(*test_classes) + test_support.run_doctest(CollectionsModule, verbose) if __name__ == "__main__": test_main(verbose=True) From buildbot at python.org Sat May 19 03:34:54 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 01:34:54 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20070519013454.CFDDA1E4008@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/2032 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_collections ====================================================================== ERROR: test_factory (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_collections.py", line 8, in test_factory Point = NamedTuple('Point', 'x y') File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_instance (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_collections.py", line 16, in test_instance Point = NamedTuple('Point', 'x y') File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_tupleness (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_collections.py", line 32, in test_tupleness Point = NamedTuple('Point', 'x y') File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 03:35:34 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 01:35:34 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070519013535.283B31E4004@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/538 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_collections ====================================================================== ERROR: test_factory (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_collections.py", line 8, in test_factory Point = NamedTuple('Point', 'x y') File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_instance (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_collections.py", line 16, in test_instance Point = NamedTuple('Point', 'x y') File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_tupleness (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_collections.py", line 32, in test_tupleness Point = NamedTuple('Point', 'x y') File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 03:40:47 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 01:40:47 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070519014047.E3C411E4005@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/445 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Sat May 19 03:42:13 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 01:42:13 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070519014213.44D501E400D@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/285 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_collections ====================================================================== ERROR: test_factory (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_collections.py", line 8, in test_factory Point = NamedTuple('Point', 'x y') File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_instance (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_collections.py", line 16, in test_instance Point = NamedTuple('Point', 'x y') File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_tupleness (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_collections.py", line 32, in test_tupleness Point = NamedTuple('Point', 'x y') File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ sincerely, -The Buildbot From python-checkins at python.org Sat May 19 03:50:18 2007 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 19 May 2007 03:50:18 +0200 (CEST) Subject: [Python-checkins] r55449 - python/trunk/Lib/collections.py Message-ID: <20070519015018.8ABD61E4004@bag.python.org> Author: raymond.hettinger Date: Sat May 19 03:50:11 2007 New Revision: 55449 Modified: python/trunk/Lib/collections.py Log: Fix beginner mistake -- don't mix spaces and tabs. Modified: python/trunk/Lib/collections.py ============================================================================== --- python/trunk/Lib/collections.py (original) +++ python/trunk/Lib/collections.py Sat May 19 03:50:11 2007 @@ -36,7 +36,7 @@ return '%(typename)s(%(reprtxt)s)' %% self ''' % locals() for i, name in enumerate(field_names): - template += '\t%s = property(itemgetter(%d))\n' % (name, i) + template += '\n %s = property(itemgetter(%d))\n' % (name, i) m = dict(itemgetter=_itemgetter) exec template in m result = m[typename] From buildbot at python.org Sat May 19 03:54:03 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 01:54:03 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070519015403.B7CB51E4004@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2017 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_collections ====================================================================== ERROR: test_factory (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_collections.py", line 8, in test_factory Point = NamedTuple('Point', 'x y') File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_instance (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_collections.py", line 16, in test_instance Point = NamedTuple('Point', 'x y') File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_tupleness (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_collections.py", line 32, in test_tupleness Point = NamedTuple('Point', 'x y') File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ sincerely, -The Buildbot From buildbot at python.org Sat May 19 03:56:37 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 01:56:37 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20070519015637.A73551E4004@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%2520osx.4%2520trunk/builds/2025 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_collections ====================================================================== ERROR: test_factory (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_collections.py", line 8, in test_factory Point = NamedTuple('Point', 'x y') File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_instance (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_collections.py", line 16, in test_instance Point = NamedTuple('Point', 'x y') File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_tupleness (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_collections.py", line 32, in test_tupleness Point = NamedTuple('Point', 'x y') File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 04:03:18 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 02:03:18 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20070519020318.B19381E4004@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/655 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_collections ====================================================================== ERROR: test_factory (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_collections.py", line 8, in test_factory Point = NamedTuple('Point', 'x y') File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_instance (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_collections.py", line 16, in test_instance Point = NamedTuple('Point', 'x y') File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_tupleness (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_collections.py", line 32, in test_tupleness Point = NamedTuple('Point', 'x y') File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 04:10:04 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 02:10:04 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20070519021004.CC4FB1E4004@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%2520trunk/builds/941 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_collections ====================================================================== ERROR: test_factory (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/test/test_collections.py", line 8, in test_factory Point = NamedTuple('Point', 'x y') File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_instance (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/test/test_collections.py", line 16, in test_instance Point = NamedTuple('Point', 'x y') File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ ====================================================================== ERROR: test_tupleness (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/test/test_collections.py", line 32, in test_tupleness Point = NamedTuple('Point', 'x y') File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/collections.py", line 41, in NamedTuple exec template in m File "", line 8 x = property(itemgetter(0)) ^ make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat May 19 05:48:56 2007 From: python-checkins at python.org (neal.norwitz) Date: Sat, 19 May 2007 05:48:56 +0200 (CEST) Subject: [Python-checkins] r55450 - in python/trunk: Misc/NEWS Modules/_bsddb.c Message-ID: <20070519034856.CACC91E4004@bag.python.org> Author: neal.norwitz Date: Sat May 19 05:48:47 2007 New Revision: 55450 Modified: python/trunk/Misc/NEWS python/trunk/Modules/_bsddb.c Log: Clear data so random memory does not get freed. Will backport. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat May 19 05:48:47 2007 @@ -636,6 +636,8 @@ Extension Modules ----------------- +- Bug #1721309: prevent bsddb module from freeing random memory. + - Bug #1686475: Support stat'ing open files on Windows again. - Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters Modified: python/trunk/Modules/_bsddb.c ============================================================================== --- python/trunk/Modules/_bsddb.c (original) +++ python/trunk/Modules/_bsddb.c Sat May 19 05:48:47 2007 @@ -1731,6 +1731,7 @@ return NULL; } + CLEAR_DBT(data); flags |= DB_GET_BOTH; if (CHECK_DBFLAG(self, DB_THREAD)) { From python-checkins at python.org Sat May 19 05:53:45 2007 From: python-checkins at python.org (neal.norwitz) Date: Sat, 19 May 2007 05:53:45 +0200 (CEST) Subject: [Python-checkins] r55451 - in python/branches/release25-maint: Misc/NEWS Modules/_bsddb.c Message-ID: <20070519035345.3A4271E4004@bag.python.org> Author: neal.norwitz Date: Sat May 19 05:53:33 2007 New Revision: 55451 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/_bsddb.c Log: Backport rev 55450: SF bug #1721309: Clear data so random memory does not get freed. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sat May 19 05:53:33 2007 @@ -35,6 +35,12 @@ run in verbose mode. +Extension Modules +----------------- + +- Bug #1721309: prevent bsddb module from freeing random memory. + + Documentation ------------- Modified: python/branches/release25-maint/Modules/_bsddb.c ============================================================================== --- python/branches/release25-maint/Modules/_bsddb.c (original) +++ python/branches/release25-maint/Modules/_bsddb.c Sat May 19 05:53:33 2007 @@ -1713,6 +1713,7 @@ return NULL; } + CLEAR_DBT(data); flags |= DB_GET_BOTH; if (CHECK_DBFLAG(self, DB_THREAD)) { From buildbot at python.org Sat May 19 06:16:33 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 04:16:33 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20070519041633.A8D7B1E4004@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/2034 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 06:20:35 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 04:20:35 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070519042035.E55121E4004@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/287 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\bsddb\test\test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError sincerely, -The Buildbot From buildbot at python.org Sat May 19 06:27:17 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 04:27:17 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070519042718.14F011E400D@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/540 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/bsddb/test/test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat May 19 06:35:05 2007 From: python-checkins at python.org (neal.norwitz) Date: Sat, 19 May 2007 06:35:05 +0200 (CEST) Subject: [Python-checkins] r55452 - python/trunk/Modules/_bsddb.c Message-ID: <20070519043505.C82F91E4004@bag.python.org> Author: neal.norwitz Date: Sat May 19 06:34:55 2007 New Revision: 55452 Modified: python/trunk/Modules/_bsddb.c Log: Whoops, need to pay attention to those test failures. Move the clear to *before* the first use, not after. Modified: python/trunk/Modules/_bsddb.c ============================================================================== --- python/trunk/Modules/_bsddb.c (original) +++ python/trunk/Modules/_bsddb.c Sat May 19 06:34:55 2007 @@ -1724,6 +1724,7 @@ CHECK_DB_NOT_CLOSED(self); if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; + CLEAR_DBT(data); if ( !make_dbt(dataobj, &data) || !checkTxnObj(txnobj, &txn) ) { @@ -1731,7 +1732,6 @@ return NULL; } - CLEAR_DBT(data); flags |= DB_GET_BOTH; if (CHECK_DBFLAG(self, DB_THREAD)) { From python-checkins at python.org Sat May 19 06:35:58 2007 From: python-checkins at python.org (neal.norwitz) Date: Sat, 19 May 2007 06:35:58 +0200 (CEST) Subject: [Python-checkins] r55453 - python/trunk/Lib/bsddb/test/test_recno.py Message-ID: <20070519043558.F21B21E4004@bag.python.org> Author: neal.norwitz Date: Sat May 19 06:35:52 2007 New Revision: 55453 Modified: python/trunk/Lib/bsddb/test/test_recno.py Log: Give some clue as to what happened if the test fails. Modified: python/trunk/Lib/bsddb/test/test_recno.py ============================================================================== --- python/trunk/Lib/bsddb/test/test_recno.py (original) +++ python/trunk/Lib/bsddb/test/test_recno.py Sat May 19 06:35:52 2007 @@ -118,7 +118,7 @@ assert not d.has_key(13) data = d.get_both(26, "z" * 60) - assert data == "z" * 60 + assert data == "z" * 60, 'was %r' % data if verbose: print data From python-checkins at python.org Sat May 19 06:37:37 2007 From: python-checkins at python.org (neal.norwitz) Date: Sat, 19 May 2007 06:37:37 +0200 (CEST) Subject: [Python-checkins] r55454 - python/branches/release25-maint/Modules/_bsddb.c Message-ID: <20070519043737.621081E4004@bag.python.org> Author: neal.norwitz Date: Sat May 19 06:37:31 2007 New Revision: 55454 Modified: python/branches/release25-maint/Modules/_bsddb.c Log: Backport rev 55452: Whoops, need to pay attention to those test failures. Move the clear to *before* the first use, not after. Modified: python/branches/release25-maint/Modules/_bsddb.c ============================================================================== --- python/branches/release25-maint/Modules/_bsddb.c (original) +++ python/branches/release25-maint/Modules/_bsddb.c Sat May 19 06:37:31 2007 @@ -1706,6 +1706,7 @@ CHECK_DB_NOT_CLOSED(self); if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; + CLEAR_DBT(data); if ( !make_dbt(dataobj, &data) || !checkTxnObj(txnobj, &txn) ) { @@ -1713,7 +1714,6 @@ return NULL; } - CLEAR_DBT(data); flags |= DB_GET_BOTH; if (CHECK_DBFLAG(self, DB_THREAD)) { From buildbot at python.org Sat May 19 06:38:32 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 04:38:32 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo 2.5 Message-ID: <20070519043833.4EF941E4004@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%25202.5/builds/315 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/2.5.norwitz-amd64/build/Lib/bsddb/test/test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 06:43:31 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 04:43:31 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20070519044332.342851E4004@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/657 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/bsddb/test/test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 06:45:48 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 04:45:48 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k 2.5 Message-ID: <20070519044548.D8A261E4004@bag.python.org> The Buildbot has detected a new failure of x86 W2k 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%25202.5/builds/113 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\2.5.mick-windows\build\lib\bsddb\test\test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError sincerely, -The Buildbot From buildbot at python.org Sat May 19 06:48:15 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 04:48:15 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc 2.5 Message-ID: <20070519044815.4F2E21E4004@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%25202.5/builds/234 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 Traceback (most recent call last): File "/home2/buildbot/slave/2.5.loewis-linux/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home2/buildbot/slave/2.5.loewis-linux/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home2/buildbot/slave/2.5.loewis-linux/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home2/buildbot/slave/2.5.loewis-linux/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home2/buildbot/slave/2.5.loewis-linux/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home2/buildbot/slave/2.5.loewis-linux/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home2/buildbot/slave/2.5.loewis-linux/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home2/buildbot/slave/2.5.loewis-linux/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/2.5.loewis-linux/build/Lib/bsddb/test/test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 06:50:40 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 04:50:40 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20070519045040.010081E4004@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%2520trunk/builds/943 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/test/test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 07:31:56 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 05:31:56 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk 2.5 Message-ID: <20070519053156.EED5C1E4004@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%25202.5/builds/303 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/2.5.klose-debian-ia64/build/Lib/bsddb/test/test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat May 19 07:45:37 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 05:45:37 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian 2.5 Message-ID: <20070519054537.D559F1E4004@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%25202.5/builds/290 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/2.5.klose-debian-s390/build/Lib/bsddb/test/test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From martin at v.loewis.de Sat May 19 09:02:22 2007 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat, 19 May 2007 09:02:22 +0200 Subject: [Python-checkins] r55452 - python/trunk/Modules/_bsddb.c In-Reply-To: <20070519043505.C82F91E4004@bag.python.org> References: <20070519043505.C82F91E4004@bag.python.org> Message-ID: <464EA0FE.6020904@v.loewis.de> > Author: neal.norwitz > Date: Sat May 19 06:34:55 2007 > New Revision: 55452 > > Whoops, need to pay attention to those test failures. > Move the clear to *before* the first use, not after. > > > Modified: python/trunk/Modules/_bsddb.c > ============================================================================== > --- python/trunk/Modules/_bsddb.c (original) > +++ python/trunk/Modules/_bsddb.c Sat May 19 06:34:55 2007 > @@ -1724,6 +1724,7 @@ > CHECK_DB_NOT_CLOSED(self); > if (!make_key_dbt(self, keyobj, &key, NULL)) > return NULL; > + CLEAR_DBT(data); > if ( !make_dbt(dataobj, &data) || Can you please explain what precise problem this fixes? make_dbt start with CLEAR_DBT(*dbt); so data gets cleared anyway. If there was a bug somewhere, I cannot imagine this change making it go away. Regards, Martin From buildbot at python.org Sat May 19 11:27:16 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 09:27:16 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian 2.5 Message-ID: <20070519092716.656D71E4004@bag.python.org> The Buildbot has detected a new failure of MIPS Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%25202.5/builds/233 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/2.5.klose-debian-mips/build/Lib/bsddb/test/test_recno.py", line 121, in test01_basic assert data == "z" * 60 AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat May 19 20:09:31 2007 From: python-checkins at python.org (georg.brandl) Date: Sat, 19 May 2007 20:09:31 +0200 (CEST) Subject: [Python-checkins] r55455 - python/trunk/Lib/site.py Message-ID: <20070519180931.B3F281E4004@bag.python.org> Author: georg.brandl Date: Sat May 19 20:09:26 2007 New Revision: 55455 Modified: python/trunk/Lib/site.py Log: Fix docstring for add_package in site.py. Modified: python/trunk/Lib/site.py ============================================================================== --- python/trunk/Lib/site.py (original) +++ python/trunk/Lib/site.py Sat May 19 20:09:26 2007 @@ -118,8 +118,10 @@ return d def addpackage(sitedir, name, known_paths): - """Add a new path to known_paths by combining sitedir and 'name' or execute - sitedir if it starts with 'import'""" + """Process a .pth file within the site-packages directory: + For each line in the file, either combine it with sitedir to a path + and add that to known_paths, or execute it if it starts with 'import '. + """ if known_paths is None: _init_pathinfo() reset = 1 From buildbot at python.org Sat May 19 20:17:35 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 18:17:35 +0000 Subject: [Python-checkins] buildbot failure in x86 XP trunk Message-ID: <20070519181735.CDFB21E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/450 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Sat May 19 20:34:32 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 19 May 2007 18:34:32 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070519183432.1C8591E4004@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/542 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun May 20 04:14:54 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 20 May 2007 04:14:54 +0200 (CEST) Subject: [Python-checkins] r55457 - python/branches/release25-maint/Modules/_bsddb.c Message-ID: <20070520021454.E4CCF1E4006@bag.python.org> Author: neal.norwitz Date: Sun May 20 04:14:48 2007 New Revision: 55457 Modified: python/branches/release25-maint/Modules/_bsddb.c Log: Backout the original 'fix' to 1721309 which had no effect. Different versions of Berkeley DB handle this differently. The comments and bug report should have the details. Memory is allocated in 4.4 (and presumably earlier), but not in 4.5. Thus 4.5 has the free error, but not earlier versions. Mostly update comments, plus make the free conditional. Modified: python/branches/release25-maint/Modules/_bsddb.c ============================================================================== --- python/branches/release25-maint/Modules/_bsddb.c (original) +++ python/branches/release25-maint/Modules/_bsddb.c Sun May 20 04:14:48 2007 @@ -1695,6 +1695,7 @@ PyObject* dataobj; PyObject* retval = NULL; DBT key, data; + void *orig_data; DB_TXN *txn = NULL; static char* kwnames[] = { "key", "data", "txn", "flags", NULL }; @@ -1706,7 +1707,6 @@ CHECK_DB_NOT_CLOSED(self); if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; - CLEAR_DBT(data); if ( !make_dbt(dataobj, &data) || !checkTxnObj(txnobj, &txn) ) { @@ -1715,13 +1715,12 @@ } flags |= DB_GET_BOTH; + orig_data = data.data; if (CHECK_DBFLAG(self, DB_THREAD)) { /* Tell BerkeleyDB to malloc the return value (thread safe) */ + /* XXX(nnorwitz): At least 4.4.20 and 4.5.20 require this flag. */ data.flags = DB_DBT_MALLOC; - /* TODO: Is this flag needed? We're passing a data object that should - match what's in the DB, so there should be no need to malloc. - We run the risk of freeing something twice! Check this. */ } MYDB_BEGIN_ALLOW_THREADS; @@ -1735,8 +1734,13 @@ retval = Py_None; } else if (!err) { + /* XXX(nnorwitz): can we do: retval = dataobj; Py_INCREF(retval); */ retval = PyString_FromStringAndSize((char*)data.data, data.size); - FREE_DBT(data); /* Only if retrieval was successful */ + + /* Even though the flags require DB_DBT_MALLOC, data is not always + allocated. 4.4: allocated, 4.5: *not* allocated. :-( */ + if (data.data != orig_data) + FREE_DBT(data); } FREE_DBT(key); From nnorwitz at gmail.com Sun May 20 04:17:07 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 19 May 2007 19:17:07 -0700 Subject: [Python-checkins] r55452 - python/trunk/Modules/_bsddb.c In-Reply-To: <464EA0FE.6020904@v.loewis.de> References: <20070519043505.C82F91E4004@bag.python.org> <464EA0FE.6020904@v.loewis.de> Message-ID: On 5/19/07, "Martin v. L?wis" wrote: > > Author: neal.norwitz > > Date: Sat May 19 06:34:55 2007 > > New Revision: 55452 > > > > Whoops, need to pay attention to those test failures. > > Move the clear to *before* the first use, not after. > > > > > > Modified: python/trunk/Modules/_bsddb.c > > ============================================================================== > > --- python/trunk/Modules/_bsddb.c (original) > > +++ python/trunk/Modules/_bsddb.c Sat May 19 06:34:55 2007 > > @@ -1724,6 +1724,7 @@ > > CHECK_DB_NOT_CLOSED(self); > > if (!make_key_dbt(self, keyobj, &key, NULL)) > > return NULL; > > + CLEAR_DBT(data); > > if ( !make_dbt(dataobj, &data) || > > Can you please explain what precise problem this fixes? > make_dbt start with > > CLEAR_DBT(*dbt); > > so data gets cleared anyway. If there was a bug somewhere, > I cannot imagine this change making it go away. Yeah, I botched this. See the bug report for more details. I think I fixed it for real now. The g4 buildbot will be good to watch since that now has Berkeley DB 4.5 installed on it. n From buildbot at python.org Sun May 20 04:35:21 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 20 May 2007 02:35:21 +0000 Subject: [Python-checkins] buildbot failure in x86 XP 2.5 Message-ID: <20070520023521.A188C1E4005@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/236 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Sun May 20 05:17:11 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 20 May 2007 03:17:11 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20070520031711.7C18A1E4004@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/271 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== FAIL: testInterruptedTimeout (test.test_socket.TCPTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/net/taipan/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socket.py", line 879, in testInterruptedTimeout self.fail("got Alarm in wrong place") AssertionError: got Alarm in wrong place sincerely, -The Buildbot From python-checkins at python.org Sun May 20 09:09:58 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 20 May 2007 09:09:58 +0200 (CEST) Subject: [Python-checkins] r55458 - in python/trunk: Doc/Makefile.deps Doc/lib/lib.tex Doc/lib/librgbimg.tex Lib/test/regrtest.py Lib/test/test_imageop.py Lib/test/test_rgbimg.py Misc/NEWS Modules/Setup.dist Modules/rgbimgmodule.c README setup.py Message-ID: <20070520070958.7D6181E4004@bag.python.org> Author: brett.cannon Date: Sun May 20 09:09:50 2007 New Revision: 55458 Removed: python/trunk/Doc/lib/librgbimg.tex python/trunk/Lib/test/test_rgbimg.py python/trunk/Modules/rgbimgmodule.c Modified: python/trunk/Doc/Makefile.deps python/trunk/Doc/lib/lib.tex python/trunk/Lib/test/regrtest.py python/trunk/Lib/test/test_imageop.py python/trunk/Misc/NEWS python/trunk/Modules/Setup.dist python/trunk/README python/trunk/setup.py Log: Remove the rgbimg module. It has been deprecated since Python 2.5. Modified: python/trunk/Doc/Makefile.deps ============================================================================== --- python/trunk/Doc/Makefile.deps (original) +++ python/trunk/Doc/Makefile.deps Sun May 20 09:09:50 2007 @@ -201,7 +201,6 @@ lib/libimageop.tex \ lib/libaifc.tex \ lib/libjpeg.tex \ - lib/librgbimg.tex \ lib/libossaudiodev.tex \ lib/libcrypto.tex \ lib/libhashlib.tex \ Modified: python/trunk/Doc/lib/lib.tex ============================================================================== --- python/trunk/Doc/lib/lib.tex (original) +++ python/trunk/Doc/lib/lib.tex Sun May 20 09:09:50 2007 @@ -327,7 +327,6 @@ \input{libwave} \input{libchunk} \input{libcolorsys} -\input{librgbimg} \input{libimghdr} \input{libsndhdr} \input{libossaudiodev} Deleted: /python/trunk/Doc/lib/librgbimg.tex ============================================================================== --- /python/trunk/Doc/lib/librgbimg.tex Sun May 20 09:09:50 2007 +++ (empty file) @@ -1,54 +0,0 @@ -\section{\module{rgbimg} --- - Read and write ``SGI RGB'' files} - -\declaremodule{builtin}{rgbimg} -\modulesynopsis{Read and write image files in ``SGI RGB'' format (the module - is \emph{not} SGI specific though!).} - -\deprecated{2.5}{This module is not maintained anymore and seems to be - unused.} - -The \module{rgbimg} module allows Python programs to access SGI imglib image -files (also known as \file{.rgb} files). The module is far from -complete, but is provided anyway since the functionality that there is -enough in some cases. Currently, colormap files are not supported. - -\note{This module is only built by default for 32-bit platforms; it is -not expected to work properly on other systems.} - -The module defines the following variables and functions: - -\begin{excdesc}{error} -This exception is raised on all errors, such as unsupported file type, etc. -\end{excdesc} - -\begin{funcdesc}{sizeofimage}{file} -This function returns a tuple \code{(\var{x}, \var{y})} where -\var{x} and \var{y} are the size of the image in pixels. -Only 4 byte RGBA pixels, 3 byte RGB pixels, and 1 byte greyscale pixels -are currently supported. -\end{funcdesc} - -\begin{funcdesc}{longimagedata}{file} -This function reads and decodes the image on the specified file, and -returns it as a Python string. The string has 4 byte RGBA pixels. -The bottom left pixel is the first in -the string. This format is suitable to pass to \function{gl.lrectwrite()}, -for instance. -\end{funcdesc} - -\begin{funcdesc}{longstoimage}{data, x, y, z, file} -This function writes the RGBA data in \var{data} to image -file \var{file}. \var{x} and \var{y} give the size of the image. -\var{z} is 1 if the saved image should be 1 byte greyscale, 3 if the -saved image should be 3 byte RGB data, or 4 if the saved images should -be 4 byte RGBA data. The input data always contains 4 bytes per pixel. -These are the formats returned by \function{gl.lrectread()}. -\end{funcdesc} - -\begin{funcdesc}{ttob}{flag} -This function sets a global flag which defines whether the scan lines -of the image are read or written from bottom to top (flag is zero, -compatible with SGI GL) or from top to bottom (flag is one, -compatible with X). The default is zero. -\end{funcdesc} Modified: python/trunk/Lib/test/regrtest.py ============================================================================== --- python/trunk/Lib/test/regrtest.py (original) +++ python/trunk/Lib/test/regrtest.py Sun May 20 09:09:50 2007 @@ -1337,7 +1337,6 @@ self.expected.add('test_timeout') if sys.maxint == 9223372036854775807L: - self.expected.add('test_rgbimg') self.expected.add('test_imageop') if not sys.platform in ("mac", "darwin"): @@ -1352,6 +1351,11 @@ for skip in WIN_ONLY: self.expected.add(skip) + if sys.platform != 'irix': + IRIX_ONLY =["test_imageop"] + for skip in IRIX_ONLY: + self.expected.add(skip) + self.valid = True def isvalid(self): Modified: python/trunk/Lib/test/test_imageop.py ============================================================================== --- python/trunk/Lib/test/test_imageop.py (original) +++ python/trunk/Lib/test/test_imageop.py Sun May 20 09:09:50 2007 @@ -10,20 +10,13 @@ import imageop, uu, os import warnings -warnings.filterwarnings("ignore", - "the rgbimg module is deprecated", - DeprecationWarning, - ".*test_imageop") -def main(use_rgbimg=1): +def main(): # Create binary test files uu.decode(get_qualified_path('testrgb'+os.extsep+'uue'), 'test'+os.extsep+'rgb') - if use_rgbimg: - image, width, height = getrgbimage('test'+os.extsep+'rgb') - else: - image, width, height = getimage('test'+os.extsep+'rgb') + image, width, height = getimage('test'+os.extsep+'rgb') # Return the selected part of image, which should by width by height # in size and consist of pixels of psize bytes. @@ -122,23 +115,6 @@ # Cleanup unlink('test'+os.extsep+'rgb') -def getrgbimage(name): - """return a tuple consisting of image (in 'imgfile' format but - using rgbimg instead) width and height""" - - import rgbimg - - try: - sizes = rgbimg.sizeofimage(name) - except rgbimg.error: - name = get_qualified_path(name) - sizes = rgbimg.sizeofimage(name) - if verbose: - print 'rgbimg opening test image: %s, sizes: %s' % (name, str(sizes)) - - image = rgbimg.longimagedata(name) - return (image, sizes[0], sizes[1]) - def getimage(name): """return a tuple consisting of image (in 'imgfile' format) width and height @@ -172,6 +148,4 @@ return fullname return name -# rgbimg (unlike imgfile) is portable to platforms other than SGI. -# So we prefer to use it. -main(use_rgbimg=1) +main() Deleted: /python/trunk/Lib/test/test_rgbimg.py ============================================================================== --- /python/trunk/Lib/test/test_rgbimg.py Sun May 20 09:09:50 2007 +++ (empty file) @@ -1,70 +0,0 @@ -# Testing rgbimg module - -import warnings -warnings.filterwarnings("ignore", - "the rgbimg module is deprecated", - DeprecationWarning, - ".*test_rgbimg$") -import rgbimg - -import os, uu - -from test.test_support import verbose, unlink, findfile - -class error(Exception): - pass - -print 'RGBimg test suite:' - -def testimg(rgb_file, raw_file): - rgb_file = findfile(rgb_file) - raw_file = findfile(raw_file) - width, height = rgbimg.sizeofimage(rgb_file) - rgb = rgbimg.longimagedata(rgb_file) - if len(rgb) != width * height * 4: - raise error, 'bad image length' - raw = open(raw_file, 'rb').read() - if rgb != raw: - raise error, \ - 'images don\'t match for '+rgb_file+' and '+raw_file - for depth in [1, 3, 4]: - rgbimg.longstoimage(rgb, width, height, depth, '@.rgb') - os.unlink('@.rgb') - -table = [ - ('testrgb'+os.extsep+'uue', 'test'+os.extsep+'rgb'), - ('testimg'+os.extsep+'uue', 'test'+os.extsep+'rawimg'), - ('testimgr'+os.extsep+'uue', 'test'+os.extsep+'rawimg'+os.extsep+'rev'), - ] -for source, target in table: - source = findfile(source) - target = findfile(target) - if verbose: - print "uudecoding", source, "->", target, "..." - uu.decode(source, target) - -if verbose: - print "testing..." - -ttob = rgbimg.ttob(0) -if ttob != 0: - raise error, 'ttob should start out as zero' - -testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg') - -ttob = rgbimg.ttob(1) -if ttob != 0: - raise error, 'ttob should be zero' - -testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg'+os.extsep+'rev') - -ttob = rgbimg.ttob(0) -if ttob != 1: - raise error, 'ttob should be one' - -ttob = rgbimg.ttob(0) -if ttob != 0: - raise error, 'ttob should be zero' - -for source, target in table: - unlink(findfile(target)) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun May 20 09:09:50 2007 @@ -636,6 +636,8 @@ Extension Modules ----------------- +- Removed the rgbimg module; been deprecated since Python 2.5. + - Bug #1721309: prevent bsddb module from freeing random memory. - Bug #1686475: Support stat'ing open files on Windows again. Modified: python/trunk/Modules/Setup.dist ============================================================================== --- python/trunk/Modules/Setup.dist (original) +++ python/trunk/Modules/Setup.dist Sun May 20 09:09:50 2007 @@ -231,7 +231,6 @@ #audioop audioop.c # Operations on audio samples #imageop imageop.c # Operations on images -#rgbimg rgbimgmodule.c # Read SGI RGB image files (but coded portably) # Note that the _md5 and _sha modules are normally only built if the Deleted: /python/trunk/Modules/rgbimgmodule.c ============================================================================== --- /python/trunk/Modules/rgbimgmodule.c Sun May 20 09:09:50 2007 +++ (empty file) @@ -1,780 +0,0 @@ -/* - * fastimg - - * Faster reading and writing of image files. - * - * This code should work on machines with any byte order. - * - * Could someone make this run real fast using multiple processors - * or how about using memory mapped files to speed it up? - * - * Paul Haeberli - 1991 - * - * Changed to return sizes. - * Sjoerd Mullender - 1993 - * Changed to incorporate into Python. - * Sjoerd Mullender - 1993 - */ -#include "Python.h" - -#if SIZEOF_INT == 4 -typedef int Py_Int32; -typedef unsigned int Py_UInt32; -#else -#if SIZEOF_LONG == 4 -typedef long Py_Int32; -typedef unsigned long Py_UInt32; -#else -#error "No 4-byte integral type" -#endif -#endif - -#include - -/* - * from image.h - * - */ -typedef struct { - unsigned short imagic; /* stuff saved on disk . . */ - unsigned short type; - unsigned short dim; - unsigned short xsize; - unsigned short ysize; - unsigned short zsize; - Py_UInt32 min; - Py_UInt32 max; - Py_UInt32 wastebytes; - char name[80]; - Py_UInt32 colormap; - - Py_Int32 file; /* stuff used in core only */ - unsigned short flags; - short dorev; - short x; - short y; - short z; - short cnt; - unsigned short *ptr; - unsigned short *base; - unsigned short *tmpbuf; - Py_UInt32 offset; - Py_UInt32 rleend; /* for rle images */ - Py_UInt32 *rowstart; /* for rle images */ - Py_Int32 *rowsize; /* for rle images */ -} IMAGE; - -#define IMAGIC 0732 - -#define TYPEMASK 0xff00 -#define BPPMASK 0x00ff -#define ITYPE_VERBATIM 0x0000 -#define ITYPE_RLE 0x0100 -#define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE) -#define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM) -#define BPP(type) ((type) & BPPMASK) -#define RLE(bpp) (ITYPE_RLE | (bpp)) -#define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp)) -/* - * end of image.h stuff - * - */ - -#define RINTLUM (79) -#define GINTLUM (156) -#define BINTLUM (21) - -#define ILUM(r,g,b) ((int)(RINTLUM*(r)+GINTLUM*(g)+BINTLUM*(b))>>8) - -#define OFFSET_R 3 /* this is byte order dependent */ -#define OFFSET_G 2 -#define OFFSET_B 1 -#define OFFSET_A 0 - -#define CHANOFFSET(z) (3-(z)) /* this is byte order dependent */ - -static void expandrow(unsigned char *, unsigned char *, int); -static void setalpha(unsigned char *, int); -static void copybw(Py_Int32 *, int); -static void interleaverow(unsigned char*, unsigned char*, int, int); -static int compressrow(unsigned char *, unsigned char *, int, int); -static void lumrow(unsigned char *, unsigned char *, int); - -#ifdef ADD_TAGS -#define TAGLEN (5) -#else -#define TAGLEN (0) -#endif - -static PyObject *ImgfileError; - -static int reverse_order; - -#ifdef ADD_TAGS -/* - * addlongimgtag - - * this is used to extract image data from core dumps. - * - */ -static void -addlongimgtag(Py_UInt32 *dptr, int xsize, int ysize) -{ - dptr = dptr + (xsize * ysize); - dptr[0] = 0x12345678; - dptr[1] = 0x59493333; - dptr[2] = 0x69434222; - dptr[3] = xsize; - dptr[4] = ysize; -} -#endif - -/* - * byte order independent read/write of shorts and longs. - * - */ -static unsigned short -getshort(FILE *inf) -{ - unsigned char buf[2]; - - fread(buf, 2, 1, inf); - return (buf[0] << 8) + (buf[1] << 0); -} - -static Py_UInt32 -getlong(FILE *inf) -{ - unsigned char buf[4]; - - fread(buf, 4, 1, inf); - return (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + (buf[3] << 0); -} - -static void -putshort(FILE *outf, unsigned short val) -{ - unsigned char buf[2]; - - buf[0] = (val >> 8); - buf[1] = (val >> 0); - fwrite(buf, 2, 1, outf); -} - -static int -putlong(FILE *outf, Py_UInt32 val) -{ - unsigned char buf[4]; - - buf[0] = (unsigned char) (val >> 24); - buf[1] = (unsigned char) (val >> 16); - buf[2] = (unsigned char) (val >> 8); - buf[3] = (unsigned char) (val >> 0); - return (int)fwrite(buf, 4, 1, outf); -} - -static void -readheader(FILE *inf, IMAGE *image) -{ - memset(image ,0, sizeof(IMAGE)); - image->imagic = getshort(inf); - image->type = getshort(inf); - image->dim = getshort(inf); - image->xsize = getshort(inf); - image->ysize = getshort(inf); - image->zsize = getshort(inf); -} - -static int -writeheader(FILE *outf, IMAGE *image) -{ - IMAGE t; - - memset(&t, 0, sizeof(IMAGE)); - fwrite(&t, sizeof(IMAGE), 1, outf); - fseek(outf, 0, SEEK_SET); - putshort(outf, image->imagic); - putshort(outf, image->type); - putshort(outf, image->dim); - putshort(outf, image->xsize); - putshort(outf, image->ysize); - putshort(outf, image->zsize); - putlong(outf, image->min); - putlong(outf, image->max); - putlong(outf, 0); - return (int)fwrite("no name", 8, 1, outf); -} - -static int -writetab(FILE *outf, /*unsigned*/ Py_Int32 *tab, int len) -{ - int r = 0; - - while(len) { - r = putlong(outf, *tab++); - len--; - } - return r; -} - -static void -readtab(FILE *inf, /*unsigned*/ Py_Int32 *tab, int len) -{ - while(len) { - *tab++ = getlong(inf); - len--; - } -} - -/* - * sizeofimage - - * return the xsize and ysize of an iris image file. - * - */ -static PyObject * -sizeofimage(PyObject *self, PyObject *args) -{ - char *name; - IMAGE image; - FILE *inf; - - if (!PyArg_ParseTuple(args, "s:sizeofimage", &name)) - return NULL; - - inf = fopen(name, "rb"); - if (!inf) { - PyErr_SetString(ImgfileError, "can't open image file"); - return NULL; - } - readheader(inf, &image); - fclose(inf); - if (image.imagic != IMAGIC) { - PyErr_SetString(ImgfileError, - "bad magic number in image file"); - return NULL; - } - return Py_BuildValue("(ii)", image.xsize, image.ysize); -} - -/* - * longimagedata - - * read in a B/W RGB or RGBA iris image file and return a - * pointer to an array of longs. - * - */ -static PyObject * -longimagedata(PyObject *self, PyObject *args) -{ - char *name; - unsigned char *base, *lptr; - unsigned char *rledat = NULL, *verdat = NULL; - Py_Int32 *starttab = NULL, *lengthtab = NULL; - FILE *inf = NULL; - IMAGE image; - int y, z, tablen; - int xsize, ysize, zsize; - int bpp, rle, cur, badorder; - int rlebuflen; - PyObject *rv = NULL; - - if (!PyArg_ParseTuple(args, "s:longimagedata", &name)) - return NULL; - - inf = fopen(name,"rb"); - if (!inf) { - PyErr_SetString(ImgfileError, "can't open image file"); - return NULL; - } - readheader(inf,&image); - if (image.imagic != IMAGIC) { - PyErr_SetString(ImgfileError, - "bad magic number in image file"); - goto finally; - } - rle = ISRLE(image.type); - bpp = BPP(image.type); - if (bpp != 1) { - PyErr_SetString(ImgfileError, - "image must have 1 byte per pix chan"); - goto finally; - } - xsize = image.xsize; - ysize = image.ysize; - zsize = image.zsize; - if (rle) { - tablen = ysize * zsize * sizeof(Py_Int32); - starttab = (Py_Int32 *)malloc(tablen); - lengthtab = (Py_Int32 *)malloc(tablen); - rlebuflen = (int) (1.05 * xsize +10); - rledat = (unsigned char *)malloc(rlebuflen); - if (!starttab || !lengthtab || !rledat) { - PyErr_NoMemory(); - goto finally; - } - - fseek(inf, 512, SEEK_SET); - readtab(inf, starttab, ysize*zsize); - readtab(inf, lengthtab, ysize*zsize); - - /* check data order */ - cur = 0; - badorder = 0; - for(y = 0; y < ysize; y++) { - for(z = 0; z < zsize; z++) { - if (starttab[y + z * ysize] < cur) { - badorder = 1; - break; - } - cur = starttab[y +z * ysize]; - } - if (badorder) - break; - } - - fseek(inf, 512 + 2 * tablen, SEEK_SET); - cur = 512 + 2 * tablen; - rv = PyString_FromStringAndSize((char *)NULL, - (xsize * ysize + TAGLEN) * sizeof(Py_Int32)); - if (rv == NULL) - goto finally; - - base = (unsigned char *) PyString_AsString(rv); -#ifdef ADD_TAGS - addlongimgtag(base,xsize,ysize); -#endif - if (badorder) { - for (z = 0; z < zsize; z++) { - lptr = base; - if (reverse_order) - lptr += (ysize - 1) * xsize - * sizeof(Py_UInt32); - for (y = 0; y < ysize; y++) { - int idx = y + z * ysize; - if (cur != starttab[idx]) { - fseek(inf,starttab[idx], - SEEK_SET); - cur = starttab[idx]; - } - if (lengthtab[idx] > rlebuflen) { - PyErr_SetString(ImgfileError, - "rlebuf is too small"); - Py_DECREF(rv); - rv = NULL; - goto finally; - } - fread(rledat, lengthtab[idx], 1, inf); - cur += lengthtab[idx]; - expandrow(lptr, rledat, 3-z); - if (reverse_order) - lptr -= xsize - * sizeof(Py_UInt32); - else - lptr += xsize - * sizeof(Py_UInt32); - } - } - } else { - lptr = base; - if (reverse_order) - lptr += (ysize - 1) * xsize - * sizeof(Py_UInt32); - for (y = 0; y < ysize; y++) { - for(z = 0; z < zsize; z++) { - int idx = y + z * ysize; - if (cur != starttab[idx]) { - fseek(inf, starttab[idx], - SEEK_SET); - cur = starttab[idx]; - } - fread(rledat, lengthtab[idx], 1, inf); - cur += lengthtab[idx]; - expandrow(lptr, rledat, 3-z); - } - if (reverse_order) - lptr -= xsize * sizeof(Py_UInt32); - else - lptr += xsize * sizeof(Py_UInt32); - } - } - if (zsize == 3) - setalpha(base, xsize * ysize); - else if (zsize < 3) - copybw((Py_Int32 *) base, xsize * ysize); - } - else { - rv = PyString_FromStringAndSize((char *) 0, - (xsize*ysize+TAGLEN)*sizeof(Py_Int32)); - if (rv == NULL) - goto finally; - - base = (unsigned char *) PyString_AsString(rv); -#ifdef ADD_TAGS - addlongimgtag(base, xsize, ysize); -#endif - verdat = (unsigned char *)malloc(xsize); - if (!verdat) { - Py_CLEAR(rv); - goto finally; - } - - fseek(inf, 512, SEEK_SET); - for (z = 0; z < zsize; z++) { - lptr = base; - if (reverse_order) - lptr += (ysize - 1) * xsize - * sizeof(Py_UInt32); - for (y = 0; y < ysize; y++) { - fread(verdat, xsize, 1, inf); - interleaverow(lptr, verdat, 3-z, xsize); - if (reverse_order) - lptr -= xsize * sizeof(Py_UInt32); - else - lptr += xsize * sizeof(Py_UInt32); - } - } - if (zsize == 3) - setalpha(base, xsize * ysize); - else if (zsize < 3) - copybw((Py_Int32 *) base, xsize * ysize); - } - finally: - if (starttab) - free(starttab); - if (lengthtab) - free(lengthtab); - if (rledat) - free(rledat); - if (verdat) - free(verdat); - fclose(inf); - return rv; -} - -/* static utility functions for longimagedata */ - -static void -interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n) -{ - lptr += z; - while (n--) { - *lptr = *cptr++; - lptr += 4; - } -} - -static void -copybw(Py_Int32 *lptr, int n) -{ - while (n >= 8) { - lptr[0] = 0xff000000 + (0x010101 * (lptr[0] & 0xff)); - lptr[1] = 0xff000000 + (0x010101 * (lptr[1] & 0xff)); - lptr[2] = 0xff000000 + (0x010101 * (lptr[2] & 0xff)); - lptr[3] = 0xff000000 + (0x010101 * (lptr[3] & 0xff)); - lptr[4] = 0xff000000 + (0x010101 * (lptr[4] & 0xff)); - lptr[5] = 0xff000000 + (0x010101 * (lptr[5] & 0xff)); - lptr[6] = 0xff000000 + (0x010101 * (lptr[6] & 0xff)); - lptr[7] = 0xff000000 + (0x010101 * (lptr[7] & 0xff)); - lptr += 8; - n -= 8; - } - while (n--) { - *lptr = 0xff000000 + (0x010101 * (*lptr&0xff)); - lptr++; - } -} - -static void -setalpha(unsigned char *lptr, int n) -{ - while (n >= 8) { - lptr[0 * 4] = 0xff; - lptr[1 * 4] = 0xff; - lptr[2 * 4] = 0xff; - lptr[3 * 4] = 0xff; - lptr[4 * 4] = 0xff; - lptr[5 * 4] = 0xff; - lptr[6 * 4] = 0xff; - lptr[7 * 4] = 0xff; - lptr += 4 * 8; - n -= 8; - } - while (n--) { - *lptr = 0xff; - lptr += 4; - } -} - -static void -expandrow(unsigned char *optr, unsigned char *iptr, int z) -{ - unsigned char pixel, count; - - optr += z; - while (1) { - pixel = *iptr++; - if (!(count = (pixel & 0x7f))) - return; - if (pixel & 0x80) { - while (count >= 8) { - optr[0 * 4] = iptr[0]; - optr[1 * 4] = iptr[1]; - optr[2 * 4] = iptr[2]; - optr[3 * 4] = iptr[3]; - optr[4 * 4] = iptr[4]; - optr[5 * 4] = iptr[5]; - optr[6 * 4] = iptr[6]; - optr[7 * 4] = iptr[7]; - optr += 8 * 4; - iptr += 8; - count -= 8; - } - while (count--) { - *optr = *iptr++; - optr += 4; - } - } - else { - pixel = *iptr++; - while (count >= 8) { - optr[0 * 4] = pixel; - optr[1 * 4] = pixel; - optr[2 * 4] = pixel; - optr[3 * 4] = pixel; - optr[4 * 4] = pixel; - optr[5 * 4] = pixel; - optr[6 * 4] = pixel; - optr[7 * 4] = pixel; - optr += 8 * 4; - count -= 8; - } - while (count--) { - *optr = pixel; - optr += 4; - } - } - } -} - -/* - * longstoimage - - * copy an array of longs to an iris image file. Each long - * represents one pixel. xsize and ysize specify the dimensions of - * the pixel array. zsize specifies what kind of image file to - * write out. if zsize is 1, the luminance of the pixels are - * calculated, and a single channel black and white image is saved. - * If zsize is 3, an RGB image file is saved. If zsize is 4, an - * RGBA image file is saved. - * - */ -static PyObject * -longstoimage(PyObject *self, PyObject *args) -{ - unsigned char *lptr; - char *name; - int xsize, ysize, zsize; - FILE *outf = NULL; - IMAGE image; - int tablen, y, z, pos, len; - Py_Int32 *starttab = NULL, *lengthtab = NULL; - unsigned char *rlebuf = NULL; - unsigned char *lumbuf = NULL; - int rlebuflen; - Py_ssize_t goodwrite; - PyObject *retval = NULL; - - if (!PyArg_ParseTuple(args, "s#iiis:longstoimage", &lptr, &len, - &xsize, &ysize, &zsize, &name)) - return NULL; - - goodwrite = 1; - outf = fopen(name, "wb"); - if (!outf) { - PyErr_SetString(ImgfileError, "can't open output file"); - return NULL; - } - tablen = ysize * zsize * sizeof(Py_Int32); - - starttab = (Py_Int32 *)malloc(tablen); - lengthtab = (Py_Int32 *)malloc(tablen); - rlebuflen = (int) (1.05 * xsize + 10); - rlebuf = (unsigned char *)malloc(rlebuflen); - lumbuf = (unsigned char *)malloc(xsize * sizeof(Py_Int32)); - if (!starttab || !lengthtab || !rlebuf || !lumbuf) { - PyErr_NoMemory(); - goto finally; - } - - memset(&image, 0, sizeof(IMAGE)); - image.imagic = IMAGIC; - image.type = RLE(1); - if (zsize>1) - image.dim = 3; - else - image.dim = 2; - image.xsize = xsize; - image.ysize = ysize; - image.zsize = zsize; - image.min = 0; - image.max = 255; - goodwrite *= writeheader(outf, &image); - pos = 512 + 2 * tablen; - fseek(outf, pos, SEEK_SET); - if (reverse_order) - lptr += (ysize - 1) * xsize * sizeof(Py_UInt32); - for (y = 0; y < ysize; y++) { - for (z = 0; z < zsize; z++) { - if (zsize == 1) { - lumrow(lptr, lumbuf, xsize); - len = compressrow(lumbuf, rlebuf, - CHANOFFSET(z), xsize); - } else { - len = compressrow(lptr, rlebuf, - CHANOFFSET(z), xsize); - } - if(len > rlebuflen) { - PyErr_SetString(ImgfileError, - "rlebuf is too small"); - goto finally; - } - goodwrite *= fwrite(rlebuf, len, 1, outf); - starttab[y + z * ysize] = pos; - lengthtab[y + z * ysize] = len; - pos += len; - } - if (reverse_order) - lptr -= xsize * sizeof(Py_UInt32); - else - lptr += xsize * sizeof(Py_UInt32); - } - - fseek(outf, 512, SEEK_SET); - goodwrite *= writetab(outf, starttab, ysize*zsize); - goodwrite *= writetab(outf, lengthtab, ysize*zsize); - if (goodwrite) { - Py_INCREF(Py_None); - retval = Py_None; - } else - PyErr_SetString(ImgfileError, "not enough space for image"); - - finally: - fclose(outf); - free(starttab); - free(lengthtab); - free(rlebuf); - free(lumbuf); - return retval; -} - -/* static utility functions for longstoimage */ - -static void -lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n) -{ - lumptr += CHANOFFSET(0); - while (n--) { - *lumptr = ILUM(rgbptr[OFFSET_R], - rgbptr[OFFSET_G], - rgbptr[OFFSET_B]); - lumptr += 4; - rgbptr += 4; - } -} - -static int -compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cnt) -{ - unsigned char *iptr, *ibufend, *sptr, *optr; - short todo, cc; - Py_Int32 count; - - lbuf += z; - iptr = lbuf; - ibufend = iptr + cnt * 4; - optr = rlebuf; - - while(iptr < ibufend) { - sptr = iptr; - iptr += 8; - while ((iptr 126 ? 126 : (short)count; - count -= todo; - *optr++ = 0x80 | todo; - while (todo > 8) { - optr[0] = sptr[0 * 4]; - optr[1] = sptr[1 * 4]; - optr[2] = sptr[2 * 4]; - optr[3] = sptr[3 * 4]; - optr[4] = sptr[4 * 4]; - optr[5] = sptr[5 * 4]; - optr[6] = sptr[6 * 4]; - optr[7] = sptr[7 * 4]; - optr += 8; - sptr += 8 * 4; - todo -= 8; - } - while (todo--) { - *optr++ = *sptr; - sptr += 4; - } - } - sptr = iptr; - cc = *iptr; - iptr += 4; - while ((iptr < ibufend) && (*iptr == cc)) - iptr += 4; - count = (iptr - sptr) / 4; - while (count) { - todo = count > 126 ? 126 : (short)count; - count -= todo; - *optr++ = (unsigned char) todo; - *optr++ = (unsigned char) cc; - } - } - *optr++ = 0; - return optr - (unsigned char *)rlebuf; -} - -static PyObject * -ttob(PyObject *self, PyObject *args) -{ - int order, oldorder; - - if (!PyArg_ParseTuple(args, "i:ttob", &order)) - return NULL; - oldorder = reverse_order; - reverse_order = order; - return PyInt_FromLong(oldorder); -} - -static PyMethodDef -rgbimg_methods[] = { - {"sizeofimage", sizeofimage, METH_VARARGS}, - {"longimagedata", longimagedata, METH_VARARGS}, - {"longstoimage", longstoimage, METH_VARARGS}, - {"ttob", ttob, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - - -PyMODINIT_FUNC -initrgbimg(void) -{ - PyObject *m, *d; - m = Py_InitModule("rgbimg", rgbimg_methods); - if (m == NULL) - return; - - if (PyErr_Warn(PyExc_DeprecationWarning, - "the rgbimg module is deprecated")) - return; - - d = PyModule_GetDict(m); - ImgfileError = PyErr_NewException("rgbimg.error", NULL, NULL); - if (ImgfileError != NULL) - PyDict_SetItemString(d, "error", ImgfileError); -} Modified: python/trunk/README ============================================================================== --- python/trunk/README (original) +++ python/trunk/README Sun May 20 09:09:50 2007 @@ -294,7 +294,7 @@ XXX I think this next bit is out of date: -64-bit platforms: The modules audioop, imageop and rgbimg don't work. +64-bit platforms: The modules audioop, and imageop don't work. The setup.py script disables them on 64-bit installations. Don't try to enable them in the Modules/Setup file. They contain code that is quite wordsize sensitive. (If you have a @@ -466,9 +466,9 @@ array, audioop, binascii, cPickle, cStringIO, cmath, crypt, curses, errno, fcntl, gdbm, grp, imageop, _locale, math, md5, new, operator, parser, pcre, - posix, pwd, readline, regex, reop, rgbimg, rotor, + posix, pwd, readline, regex, reop, rotor, select, signal, socket, soundex, strop, struct, - syslog, termios, time, timing, zlib, audioop, imageop, rgbimg + syslog, termios, time, timing, zlib, audioop, imageop 3) make SHELL=/usr/local/bin/bash Modified: python/trunk/setup.py ============================================================================== --- python/trunk/setup.py (original) +++ python/trunk/setup.py Sun May 20 09:09:50 2007 @@ -508,10 +508,8 @@ if sys.maxint != 9223372036854775807L: # Operations on images exts.append( Extension('imageop', ['imageop.c']) ) - # Read SGI RGB image files (but coded portably) - exts.append( Extension('rgbimg', ['rgbimgmodule.c']) ) else: - missing.extend(['imageop', 'rgbimg']) + missing.extend(['imageop']) # readline do_readline = self.compiler.find_library_file(lib_dirs, 'readline') From python-checkins at python.org Sun May 20 09:13:47 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 20 May 2007 09:13:47 +0200 (CEST) Subject: [Python-checkins] r55459 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt peps/trunk/pep-3108.txt Message-ID: <20070520071347.4036D1E4004@bag.python.org> Author: brett.cannon Date: Sun May 20 09:13:46 2007 New Revision: 55459 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt peps/trunk/pep-3108.txt Log: Update PEPs based on the removal of rgbimg from Python 2.6. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Sun May 20 09:13:46 2007 @@ -80,7 +80,7 @@ The following modules were removed in Python 2.6: - gopherlib + gopherlib, rgbimg The following modules currently lack a DeprecationWarning: @@ -106,7 +106,8 @@ that he occasionally uses it; no other references to its use can be found as of 2003-11-19. Date: 1-Oct-2000 - Documentation: Documented as deprecated since Python 2.5. + Documentation: Documented as deprecated since Python 2.5. Removed + in Python 2.6. Module name: pre Rationale: The underlying PCRE engine doesn't support Unicode, and Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Sun May 20 09:13:46 2007 @@ -66,6 +66,7 @@ Modules removed from the standard library: - gopherlib + - rgbimg Python 3.0 compatability: @@ -110,7 +111,6 @@ Modules to be removed according to PEP 4: - - rgbimg - buildtools [if DeprecationWarning raised in 2.5] - cfmfile [if DeprecationWarning raised in 2.5] - macfs [if DeprecationWarning raised in 2.5] Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Sun May 20 09:13:46 2007 @@ -315,6 +315,9 @@ + Better support by third-party libraries (Python Imaging Library [#pil]_). + + Unit tests relied on rgbimg and imgfile. + - rgbimg was removed in Python 2.6. + - imgfile slated for removal in this PEP. [done] * linuxaudiodev From buildbot at python.org Sun May 20 09:16:45 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 20 May 2007 07:16:45 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k trunk Message-ID: <20070520071645.BA1C01E4004@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/290 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed compile sincerely, -The Buildbot From brett at python.org Sun May 20 09:23:08 2007 From: brett at python.org (Brett Cannon) Date: Sun, 20 May 2007 00:23:08 -0700 Subject: [Python-checkins] buildbot failure in x86 W2k trunk In-Reply-To: <20070520071645.BA1C01E4004@bag.python.org> References: <20070520071645.BA1C01E4004@bag.python.org> Message-ID: For removing extension modules from the build process on Windows, do you just delete the File entry from PCbuild/pythoncore.vcproj? -Brett On 5/20/07, buildbot at python.org wrote: > > The Buildbot has detected a new failure of x86 W2k trunk. > Full details are available at: > http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/290 > > Buildbot URL: http://www.python.org/dev/buildbot/all/ > > Build Reason: > Build Source Stamp: [branch trunk] HEAD > Blamelist: brett.cannon > > BUILD FAILED: failed compile > > sincerely, > -The Buildbot > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20070520/89881357/attachment.html From buildbot at python.org Sun May 20 09:31:48 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 20 May 2007 07:31:48 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070520073148.70CF71E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/451 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Sun May 20 09:32:20 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 20 May 2007 09:32:20 +0200 (CEST) Subject: [Python-checkins] r55461 - peps/trunk/pep-3108.txt Message-ID: <20070520073220.6AEE31E4004@bag.python.org> Author: brett.cannon Date: Sun May 20 09:32:18 2007 New Revision: 55461 Modified: peps/trunk/pep-3108.txt Log: imageop module was removed. Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Sun May 20 09:32:18 2007 @@ -311,7 +311,7 @@ + Undocumented. + For use with rexec which has been turned off since Python 2.3. -* imageop +* imageop [done] + Better support by third-party libraries (Python Imaging Library [#pil]_). From buildbot at python.org Sun May 20 09:35:03 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 20 May 2007 07:35:03 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20070520073504.334EE1E4004@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/2037 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test00_associateDBError (bsddb.test.test_associate.AssociateErrorTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_associate.py", line 102, in setUp os.remove(file) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test01_GetsAndPuts (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_DictionaryMethods (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03_SimpleCursorStuff (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithGetReturnsNone1 (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithoutGetReturnsNone0 (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03c_SimpleCursorGetReturnsNone2 (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test04_PartialGetAndPut (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test05_GetSize (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test06_Truncate (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test07_EnvRemoveAndRename (bsddb.test.test_basics.BasicBTreeWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test01_GetsAndPuts (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_DictionaryMethods (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03_SimpleCursorStuff (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithGetReturnsNone1 (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithoutGetReturnsNone0 (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03c_SimpleCursorGetReturnsNone2 (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test04_PartialGetAndPut (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test05_GetSize (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test06_Truncate (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test07_EnvRemoveAndRename (bsddb.test.test_basics.BasicHashWithEnvTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test01_GetsAndPuts (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_DictionaryMethods (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03_SimpleCursorStuff (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithGetReturnsNone1 (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithoutGetReturnsNone0 (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03c_SimpleCursorGetReturnsNone2 (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test04_PartialGetAndPut (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test05_GetSize (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test06_Transactions (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test06_Truncate (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test07_TxnTruncate (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test08_TxnLateUse (bsddb.test.test_basics.BTreeTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test01_GetsAndPuts (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_DictionaryMethods (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03_SimpleCursorStuff (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithGetReturnsNone1 (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithoutGetReturnsNone0 (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03c_SimpleCursorGetReturnsNone2 (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test04_PartialGetAndPut (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test05_GetSize (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test06_Transactions (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test06_Truncate (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test07_TxnTruncate (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test08_TxnLateUse (bsddb.test.test_basics.HashTransactionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test01_GetsAndPuts (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_DictionaryMethods (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03_SimpleCursorStuff (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithGetReturnsNone1 (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithoutGetReturnsNone0 (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03c_SimpleCursorGetReturnsNone2 (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test04_PartialGetAndPut (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test05_GetSize (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test06_Truncate (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test09_MultiDB (bsddb.test.test_basics.BTreeMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test01_GetsAndPuts (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_DictionaryMethods (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03_SimpleCursorStuff (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithGetReturnsNone1 (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03b_SimpleCursorWithoutGetReturnsNone0 (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03c_SimpleCursorGetReturnsNone2 (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test04_PartialGetAndPut (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test05_GetSize (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test06_Truncate (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test09_MultiDB (bsddb.test.test_basics.HashMultiDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_basics.py", line 60, in setUp shutil.rmtree(homeDir) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 176, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/shutil.py", line 174, in rmtree os.remove(fullname) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test01_both (bsddb.test.test_dbobj.dbobjTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbobj.py", line 45, in test01_both self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbobj.py", line 39, in open return apply(self._cobj.open, args, kwargs) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01_both (bsddb.test.test_dbobj.dbobjTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbobj.py", line 35, in tearDown os.remove(file) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_dbobj_dict_interface (bsddb.test.test_dbobj.dbobjTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbobj.py", line 58, in test02_dbobj_dict_interface self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbobj.py", line 39, in open return apply(self._cobj.open, args, kwargs) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_dbobj_dict_interface (bsddb.test.test_dbobj.dbobjTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbobj.py", line 35, in tearDown os.remove(file) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03_dbobj_type_before_open (bsddb.test.test_dbobj.dbobjTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbobj.py", line 35, in tearDown os.remove(file) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test01_basics (bsddb.test.test_dbshelve.EnvBTreeShelveTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 35, in setUp self.do_open() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 238, in do_open self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_cursors (bsddb.test.test_dbshelve.EnvBTreeShelveTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 35, in setUp self.do_open() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 238, in do_open self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01_basics (bsddb.test.test_dbshelve.EnvHashShelveTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 35, in setUp self.do_open() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 238, in do_open self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_cursors (bsddb.test.test_dbshelve.EnvHashShelveTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 35, in setUp self.do_open() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 238, in do_open self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01_basics (bsddb.test.test_dbshelve.EnvThreadBTreeShelveTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 35, in setUp self.do_open() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 238, in do_open self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_cursors (bsddb.test.test_dbshelve.EnvThreadBTreeShelveTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 35, in setUp self.do_open() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 238, in do_open self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01_basics (bsddb.test.test_dbshelve.EnvThreadHashShelveTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 35, in setUp self.do_open() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 238, in do_open self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_cursors (bsddb.test.test_dbshelve.EnvThreadHashShelveTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 35, in setUp self.do_open() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbshelve.py", line 238, in do_open self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01 (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 55, in setUp filename='tabletest.db', dbhome=homeDir, create=1) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbtables.py", line 161, in __init__ self.env.open(dbhome, myflags | flagsforenv) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02 (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 55, in setUp filename='tabletest.db', dbhome=homeDir, create=1) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbtables.py", line 161, in __init__ self.env.open(dbhome, myflags | flagsforenv) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test03 (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 55, in setUp filename='tabletest.db', dbhome=homeDir, create=1) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbtables.py", line 161, in __init__ self.env.open(dbhome, myflags | flagsforenv) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test04_MultiCondSelect (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 55, in setUp filename='tabletest.db', dbhome=homeDir, create=1) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbtables.py", line 161, in __init__ self.env.open(dbhome, myflags | flagsforenv) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test_CondObjs (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 55, in setUp filename='tabletest.db', dbhome=homeDir, create=1) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbtables.py", line 161, in __init__ self.env.open(dbhome, myflags | flagsforenv) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test_CreateOrExtend (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 55, in setUp filename='tabletest.db', dbhome=homeDir, create=1) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbtables.py", line 161, in __init__ self.env.open(dbhome, myflags | flagsforenv) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test_Delete (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 55, in setUp filename='tabletest.db', dbhome=homeDir, create=1) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbtables.py", line 161, in __init__ self.env.open(dbhome, myflags | flagsforenv) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test_Modify (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 55, in setUp filename='tabletest.db', dbhome=homeDir, create=1) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbtables.py", line 161, in __init__ self.env.open(dbhome, myflags | flagsforenv) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01_close_dbenv_before_db (bsddb.test.test_env_close.DBEnvClosedEarlyCrash) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_env_close.py", line 53, in test01_close_dbenv_before_db 0666) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01_close_dbenv_before_db (bsddb.test.test_env_close.DBEnvClosedEarlyCrash) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_env_close.py", line 46, in tearDown os.remove(file) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_close_dbenv_delete_db_success (bsddb.test.test_env_close.DBEnvClosedEarlyCrash) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_env_close.py", line 78, in test02_close_dbenv_delete_db_success 0666) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_close_dbenv_delete_db_success (bsddb.test.test_env_close.DBEnvClosedEarlyCrash) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_env_close.py", line 46, in tearDown os.remove(file) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test01_join (bsddb.test.test_join.JoinTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_join.py", line 57, in setUp self.env.open(homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | db.DB_INIT_LOCK ) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01_simple (bsddb.test.test_lock.LockingTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_lock.py", line 39, in setUp db.DB_INIT_LOCK | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_threaded (bsddb.test.test_lock.LockingTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_lock.py", line 39, in setUp db.DB_INIT_LOCK | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test03_set_timeout (bsddb.test.test_lock.LockingTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_lock.py", line 39, in setUp db.DB_INIT_LOCK | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01_badpointer (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_misc.py", line 36, in tearDown os.remove(file) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_db_home (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_misc.py", line 47, in test02_db_home env.open(self.homeDir, db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_db_home (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_misc.py", line 36, in tearDown os.remove(file) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test03_repr_closed_db (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_misc.py", line 36, in tearDown os.remove(file) OSError: [Errno 13] Permission denied: '/tmp/db_home/__db.001' ====================================================================== ERROR: test02_WithSource (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_recno.py", line 210, in test02_WithSource f = open(source, 'w') # create the file IOError: [Errno 13] Permission denied: '/tmp/db_home/test_recno.txt' ====================================================================== ERROR: test02_WithSource (bsddb.test.test_recno.SimpleRecnoTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_recno.py", line 31, in tearDown os.remove(self.filename) OSError: [Errno 2] No such file or directory: '/tmp/tmpXge7Ac' ====================================================================== ERROR: test01_1WriterMultiReaders (bsddb.test.test_thread.BTreeConcurrentDataStore) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 64, in setUp self.env.open(homeDir, self.envflags | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test01_1WriterMultiReaders (bsddb.test.test_thread.HashConcurrentDataStore) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 64, in setUp self.env.open(homeDir, self.envflags | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_SimpleLocks (bsddb.test.test_thread.BTreeSimpleThreaded) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 64, in setUp self.env.open(homeDir, self.envflags | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test02_SimpleLocks (bsddb.test.test_thread.HashSimpleThreaded) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 64, in setUp self.env.open(homeDir, self.envflags | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test03_ThreadedTransactions (bsddb.test.test_thread.BTreeThreadedTransactions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 64, in setUp self.env.open(homeDir, self.envflags | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test03_ThreadedTransactions (bsddb.test.test_thread.HashThreadedTransactions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 64, in setUp self.env.open(homeDir, self.envflags | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test03_ThreadedTransactions (bsddb.test.test_thread.BTreeThreadedNoWaitTransactions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 64, in setUp self.env.open(homeDir, self.envflags | db.DB_CREATE) DBAccessError: (13, 'Permission denied') ====================================================================== ERROR: test03_ThreadedTransactions (bsddb.test.test_thread.HashThreadedNoWaitTransactions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 64, in setUp self.env.open(homeDir, self.envflags | db.DB_CREATE) DBAccessError: (13, 'Permission denied') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun May 20 09:45:54 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 20 May 2007 09:45:54 +0200 (CEST) Subject: [Python-checkins] r55462 - peps/trunk/pep-3100.txt Message-ID: <20070520074554.3F0E41E4004@bag.python.org> Author: neal.norwitz Date: Sun May 20 09:45:53 2007 New Revision: 55462 Modified: peps/trunk/pep-3100.txt Log: coerce and xrange have been done Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Sun May 20 09:45:53 2007 @@ -183,11 +183,11 @@ * ``buffer()``: must die (use a bytes() type instead) (?) [2]_ * ``callable()``: just use hasattr(x, '__call__') (?) [2]_ * ``compile()``: put in ``sys`` (or perhaps in a module of its own) [2]_ -* ``coerce()``: no longer needed [2]_ +* ``coerce()``: no longer needed [2]_ [done] * ``execfile()``, ``reload()``: use ``exec()`` [2]_ * ``intern()``: put in ``sys`` [2]_, [22]_ [done] * ``reduce()``: write a loop instead [2]_, [9]_ [done] -* ``xrange()``: use ``range()`` instead [1]_ [See range() above] +* ``xrange()``: use ``range()`` instead [1]_ [See range() above] [done] Standard library From martin at v.loewis.de Sun May 20 09:59:24 2007 From: martin at v.loewis.de (=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=) Date: Sun, 20 May 2007 09:59:24 +0200 Subject: [Python-checkins] buildbot failure in x86 W2k trunk In-Reply-To: References: <20070520071645.BA1C01E4004@bag.python.org> Message-ID: <464FFFDC.4020600@v.loewis.de> Brett Cannon schrieb: > For removing extension modules from the build process on Windows, do you > just delete the File entry from PCbuild/pythoncore.vcproj? No, you also need to remove the entry from PC/config.c. Regards, Martin From python-checkins at python.org Sun May 20 13:12:55 2007 From: python-checkins at python.org (nick.coghlan) Date: Sun, 20 May 2007 13:12:55 +0200 (CEST) Subject: [Python-checkins] r55465 - python/trunk/Doc/lib/libcontextlib.tex Message-ID: <20070520111255.CEEF81E4004@bag.python.org> Author: nick.coghlan Date: Sun May 20 13:12:49 2007 New Revision: 55465 Modified: python/trunk/Doc/lib/libcontextlib.tex Log: Fix typo in example (should be backported, but my maintenance branch is woefully out of date) Modified: python/trunk/Doc/lib/libcontextlib.tex ============================================================================== --- python/trunk/Doc/lib/libcontextlib.tex (original) +++ python/trunk/Doc/lib/libcontextlib.tex Sun May 20 13:12:49 2007 @@ -111,7 +111,7 @@ \begin{verbatim} from __future__ import with_statement from contextlib import closing -import codecs +import urllib with closing(urllib.urlopen('http://www.python.org')) as page: for line in page: From python-checkins at python.org Sun May 20 17:03:07 2007 From: python-checkins at python.org (georg.brandl) Date: Sun, 20 May 2007 17:03:07 +0200 (CEST) Subject: [Python-checkins] r55467 - python/branches/release25-maint/Doc/lib/libcontextlib.tex Message-ID: <20070520150307.2DEE21E4004@bag.python.org> Author: georg.brandl Date: Sun May 20 17:03:06 2007 New Revision: 55467 Modified: python/branches/release25-maint/Doc/lib/libcontextlib.tex Log: Backport rev 55465 by Nick Coghlan. Modified: python/branches/release25-maint/Doc/lib/libcontextlib.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libcontextlib.tex (original) +++ python/branches/release25-maint/Doc/lib/libcontextlib.tex Sun May 20 17:03:06 2007 @@ -111,7 +111,7 @@ \begin{verbatim} from __future__ import with_statement from contextlib import closing -import codecs +import urllib with closing(urllib.urlopen('http://www.python.org')) as page: for line in page: From python-checkins at python.org Sun May 20 20:06:31 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 20 May 2007 20:06:31 +0200 (CEST) Subject: [Python-checkins] r55468 - python/trunk/README Message-ID: <20070520180631.CE4EC1E4004@bag.python.org> Author: neal.norwitz Date: Sun May 20 20:06:27 2007 New Revision: 55468 Modified: python/trunk/README Log: rotor is long gone. Modified: python/trunk/README ============================================================================== --- python/trunk/README (original) +++ python/trunk/README Sun May 20 20:06:27 2007 @@ -466,7 +466,7 @@ array, audioop, binascii, cPickle, cStringIO, cmath, crypt, curses, errno, fcntl, gdbm, grp, imageop, _locale, math, md5, new, operator, parser, pcre, - posix, pwd, readline, regex, reop, rotor, + posix, pwd, readline, regex, reop, select, signal, socket, soundex, strop, struct, syslog, termios, time, timing, zlib, audioop, imageop From python-checkins at python.org Sun May 20 20:43:05 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 20 May 2007 20:43:05 +0200 (CEST) Subject: [Python-checkins] r55470 - python/trunk/README Message-ID: <20070520184305.37E231E4004@bag.python.org> Author: neal.norwitz Date: Sun May 20 20:43:00 2007 New Revision: 55470 Modified: python/trunk/README Log: Update directories/files at the top-level. Modified: python/trunk/README ============================================================================== --- python/trunk/README (original) +++ python/trunk/README Sun May 20 20:43:00 2007 @@ -1237,7 +1237,6 @@ Most subdirectories have their own README files. Most files have comments. -BeOS/ Files specific to the BeOS port Demo/ Demonstration scripts, modules and programs Doc/ Documentation sources (LaTeX) Grammar/ Input for the parser generator @@ -1254,6 +1253,7 @@ Parser/ The parser and tokenizer and their input handling Python/ The byte-compiler and interpreter README The file you're reading now +RISCOS/ Files specific to RISC OS port Tools/ Some useful programs written in Python pyconfig.h.in Source from which pyconfig.h is created (GNU autoheader output) configure Configuration shell script (GNU autoconf output) @@ -1274,6 +1274,7 @@ getbuildinfo.o Object file from Modules/getbuildinfo.c libpython.a The library archive python The executable interpreter +reflog.txt Output from running the regression suite with the -R flag tags, TAGS Tags files for vi and Emacs From buildbot at python.org Sun May 20 20:49:36 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 20 May 2007 18:49:36 +0000 Subject: [Python-checkins] buildbot failure in x86 XP trunk Message-ID: <20070520184936.C9C991E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/453 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sun May 20 21:05:12 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 20 May 2007 21:05:12 +0200 (CEST) Subject: [Python-checkins] r55471 - in python/trunk: PC/config.c PCbuild/pythoncore.vcproj Message-ID: <20070520190512.034411E400C@bag.python.org> Author: brett.cannon Date: Sun May 20 21:05:06 2007 New Revision: 55471 Modified: python/trunk/PC/config.c python/trunk/PCbuild/pythoncore.vcproj Log: Try to remove rgbimg from Windows builds. Modified: python/trunk/PC/config.c ============================================================================== --- python/trunk/PC/config.c (original) +++ python/trunk/PC/config.c Sun May 20 21:05:06 2007 @@ -20,9 +20,6 @@ extern void init_md5(void); extern void initnt(void); extern void initoperator(void); -#ifndef MS_WINI64 -extern void initrgbimg(void); -#endif extern void initsignal(void); extern void init_sha(void); extern void init_sha256(void); @@ -95,9 +92,6 @@ {"_md5", init_md5}, {"nt", initnt}, /* Use the NT os functions, not posix */ {"operator", initoperator}, -#ifndef MS_WINI64 - {"rgbimg", initrgbimg}, -#endif {"signal", initsignal}, {"_sha", init_sha}, {"_sha256", init_sha256}, Modified: python/trunk/PCbuild/pythoncore.vcproj ============================================================================== --- python/trunk/PCbuild/pythoncore.vcproj (original) +++ python/trunk/PCbuild/pythoncore.vcproj Sun May 20 21:05:06 2007 @@ -713,9 +713,6 @@ RelativePath="..\Objects\rangeobject.c"> - - The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/454 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings failed slave lost sincerely, -The Buildbot From ncoghlan at gmail.com Mon May 21 00:27:23 2007 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 21 May 2007 08:27:23 +1000 Subject: [Python-checkins] r55467 - python/branches/release25-maint/Doc/lib/libcontextlib.tex In-Reply-To: <20070520150307.2DEE21E4004@bag.python.org> References: <20070520150307.2DEE21E4004@bag.python.org> Message-ID: <4650CB4B.2060603@gmail.com> georg.brandl wrote: > Log: > Backport rev 55465 by Nick Coghlan. Thanks! -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From python-checkins at python.org Mon May 21 00:27:59 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 21 May 2007 00:27:59 +0200 (CEST) Subject: [Python-checkins] r55473 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Message-ID: <20070520222759.9FE4A1E4004@bag.python.org> Author: brett.cannon Date: Mon May 21 00:27:56 2007 New Revision: 55473 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Log: Update status of what Mac modules that are documented as deprecated actually have a DeprecationWarning. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Mon May 21 00:27:56 2007 @@ -85,7 +85,7 @@ The following modules currently lack a DeprecationWarning: posixfile, rfc822, mimetools, MimeWriter, mimify, - multifile, md5, sha + multifile, md5, sha, buildtools, cfmfile Deprecated modules Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Mon May 21 00:27:56 2007 @@ -111,9 +111,7 @@ Modules to be removed according to PEP 4: - - buildtools [if DeprecationWarning raised in 2.5] - - cfmfile [if DeprecationWarning raised in 2.5] - - macfs [if DeprecationWarning raised in 2.5] + - macfs Module to gain a DeprecationWarning (as specified for Python 2.6 or through negligence): @@ -126,6 +124,8 @@ - multifile - md5 - sha + - buildtools + - cfmfile - warnings module implemented in C * Convert Parser/*.c to use warnings module rather than printf From python-checkins at python.org Mon May 21 01:17:42 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 21 May 2007 01:17:42 +0200 (CEST) Subject: [Python-checkins] r55474 - in python/trunk: Doc/mac/libmacfs.tex Doc/mac/libmacostools.tex Lib/binhex.py Lib/plat-mac/macfs.py Lib/plat-mac/macostools.py Lib/test/regrtest.py Lib/test/test_macfs.py Lib/test/test_macostools.py Misc/NEWS Message-ID: <20070520231742.EFE4A1E4004@bag.python.org> Author: brett.cannon Date: Mon May 21 01:17:38 2007 New Revision: 55474 Removed: python/trunk/Doc/mac/libmacfs.tex python/trunk/Lib/plat-mac/macfs.py python/trunk/Lib/test/test_macfs.py Modified: python/trunk/Doc/mac/libmacostools.tex python/trunk/Lib/binhex.py python/trunk/Lib/plat-mac/macostools.py python/trunk/Lib/test/regrtest.py python/trunk/Lib/test/test_macostools.py python/trunk/Misc/NEWS Log: Remove the macfs module. This led to the deprecation of macostools.touched(); it completely relied on macfs and is a no-op on OS X according to code comments. Deleted: /python/trunk/Doc/mac/libmacfs.tex ============================================================================== --- /python/trunk/Doc/mac/libmacfs.tex Mon May 21 01:17:38 2007 +++ (empty file) @@ -1,241 +0,0 @@ -\section{\module{macfs} --- - Various file system services} - -\declaremodule{standard}{macfs} - \platform{Mac} -\modulesynopsis{Support for FSSpec, the Alias Manager, - \program{finder} aliases, and the Standard File package.} - -\deprecated{2.3}{The macfs module should be considered obsolete. For -\class{FSSpec}, \class{FSRef} and \class{Alias} handling use the -\module{Carbon.File} or \refmodule{Carbon.Folder} module. For file -dialogs use the \refmodule{EasyDialogs} module. Also, this module is -known to not work correctly with UFS partitions.} - -This module provides access to Macintosh \class{FSSpec} handling, the -Alias Manager, \program{finder} aliases and the Standard File package. -\index{Macintosh Alias Manager} -\index{Alias Manager, Macintosh} -\index{Standard File} - -Whenever a function or method expects a \var{file} argument, this -argument can be one of three things:\ (1) a full or partial Macintosh -pathname, (2) an \class{FSSpec} object or (3) a 3-tuple -\code{(\var{wdRefNum}, \var{parID}, \var{name})} as described in -\citetitle{Inside Macintosh:\ Files}. An \class{FSSpec} can point to -a non-existing file, as long as the folder containing the file exists. -Under MacPython the same is true for a pathname, but not under \UNIX-Python -because of the way pathnames and FSRefs works. See Apple's documentation -for details. - -A description of aliases and the -Standard File package can also be found there. - -\begin{funcdesc}{FSSpec}{file} -Create an \class{FSSpec} object for the specified file. -\end{funcdesc} - -\begin{funcdesc}{RawFSSpec}{data} -Create an \class{FSSpec} object given the raw data for the \C{} -structure for the \class{FSSpec} as a string. This is mainly useful -if you have obtained an \class{FSSpec} structure over a network. -\end{funcdesc} - -\begin{funcdesc}{RawAlias}{data} -Create an \class{Alias} object given the raw data for the \C{} -structure for the alias as a string. This is mainly useful if you -have obtained an \class{FSSpec} structure over a network. -\end{funcdesc} - -\begin{funcdesc}{FInfo}{} -Create a zero-filled \class{FInfo} object. -\end{funcdesc} - -\begin{funcdesc}{ResolveAliasFile}{file} -Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec}, -\var{isfolder}, \var{aliased})} where \var{fsspec} is the resulting -\class{FSSpec} object, \var{isfolder} is true if \var{fsspec} points -to a folder and \var{aliased} is true if the file was an alias in the -first place (otherwise the \class{FSSpec} object for the file itself -is returned). -\end{funcdesc} - -\begin{funcdesc}{StandardGetFile}{\optional{type, \moreargs}} -Present the user with a standard ``open input file'' -dialog. Optionally, you can pass up to four 4-character file types to limit -the files the user can choose from. The function returns an \class{FSSpec} -object and a flag indicating that the user completed the dialog -without cancelling. -\end{funcdesc} - -\begin{funcdesc}{PromptGetFile}{prompt\optional{, type, \moreargs}} -Similar to \function{StandardGetFile()} but allows you to specify a -prompt which will be displayed at the top of the dialog. -\end{funcdesc} - -\begin{funcdesc}{StandardPutFile}{prompt\optional{, default}} -Present the user with a standard ``open output file'' -dialog. \var{prompt} is the prompt string, and the optional -\var{default} argument initializes the output file name. The function -returns an \class{FSSpec} object and a flag indicating that the user -completed the dialog without cancelling. -\end{funcdesc} - -\begin{funcdesc}{GetDirectory}{\optional{prompt}} -Present the user with a non-standard ``select a directory'' dialog. You -have to first open the directory before clicking on the ``select current -directory'' button. \var{prompt} is the prompt string which will be -displayed at the top of the dialog. Return an \class{FSSpec} object and -a success-indicator. -\end{funcdesc} - -\begin{funcdesc}{SetFolder}{\optional{fsspec}} -Set the folder that is initially presented to the user when one of -the file selection dialogs is presented. \var{fsspec} should point to -a file in the folder, not the folder itself (the file need not exist, -though). If no argument is passed the folder will be set to the -current directory, i.e. what \function{os.getcwd()} returns. - -Note that starting with System 7.5 the user can change Standard File -behaviour with the ``general controls'' control panel, thereby making -this call inoperative. -\end{funcdesc} - -\begin{funcdesc}{FindFolder}{where, which, create} -Locates one of the ``special'' folders that Mac OS knows about, such as -the trash or the Preferences folder. \var{where} is the disk to -search, \var{which} is the 4-character string specifying which folder to -locate. Setting \var{create} causes the folder to be created if it -does not exist. Returns a \code{(\var{vrefnum}, \var{dirid})} tuple. - -The constants for \var{where} and \var{which} can be obtained from the -standard module \var{Carbon.Folders}. -\end{funcdesc} - -\begin{funcdesc}{NewAliasMinimalFromFullPath}{pathname} -Return a minimal \class{alias} object that points to the given file, which -must be specified as a full pathname. This is the only way to create an -\class{Alias} pointing to a non-existing file. - -\end{funcdesc} - -\begin{funcdesc}{FindApplication}{creator} -Locate the application with 4-character creator code \var{creator}. The -function returns an \class{FSSpec} object pointing to the application. -\end{funcdesc} - - -\subsection{FSSpec Objects \label{fsspec-objects}} - -\begin{memberdesc}[FSSpec]{data} -The raw data from the FSSpec object, suitable for passing -to other applications, for instance. -\end{memberdesc} - -\begin{methoddesc}[FSSpec]{as_pathname}{} -Return the full pathname of the file described by the \class{FSSpec} -object. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{as_tuple}{} -Return the \code{(\var{wdRefNum}, \var{parID}, \var{name})} tuple of -the file described by the \class{FSSpec} object. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{NewAlias}{\optional{file}} -Create an Alias object pointing to the file described by this -FSSpec. If the optional \var{file} parameter is present the alias -will be relative to that file, otherwise it will be absolute. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{NewAliasMinimal}{} -Create a minimal alias pointing to this file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{GetCreatorType}{} -Return the 4-character creator and type of the file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{SetCreatorType}{creator, type} -Set the 4-character creator and type of the file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{GetFInfo}{} -Return a \class{FInfo} object describing the finder info for the file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{SetFInfo}{finfo} -Set the finder info for the file to the values given as \var{finfo} -(an \class{FInfo} object). -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{GetDates}{} -Return a tuple with three floating point values representing the -creation date, modification date and backup date of the file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{SetDates}{crdate, moddate, backupdate} -Set the creation, modification and backup date of the file. The values -are in the standard floating point format used for times throughout -Python. -\end{methoddesc} - - -\subsection{Alias Objects \label{alias-objects}} - -\begin{memberdesc}[Alias]{data} -The raw data for the Alias record, suitable for storing in a resource -or transmitting to other programs. -\end{memberdesc} - -\begin{methoddesc}[Alias]{Resolve}{\optional{file}} -Resolve the alias. If the alias was created as a relative alias you -should pass the file relative to which it is. Return the FSSpec for -the file pointed to and a flag indicating whether the \class{Alias} object -itself was modified during the search process. If the file does -not exist but the path leading up to it does exist a valid fsspec -is returned. -\end{methoddesc} - -\begin{methoddesc}[Alias]{GetInfo}{num} -An interface to the \C{} routine \cfunction{GetAliasInfo()}. -\end{methoddesc} - -\begin{methoddesc}[Alias]{Update}{file\optional{, file2}} -Update the alias to point to the \var{file} given. If \var{file2} is -present a relative alias will be created. -\end{methoddesc} - -Note that it is currently not possible to directly manipulate a -resource as an \class{Alias} object. Hence, after calling -\method{Update()} or after \method{Resolve()} indicates that the alias -has changed the Python program is responsible for getting the -\member{data} value from the \class{Alias} object and modifying the -resource. - - -\subsection{FInfo Objects \label{finfo-objects}} - -See \citetitle{Inside Macintosh: Files} for a complete description of what -the various fields mean. - -\begin{memberdesc}[FInfo]{Creator} -The 4-character creator code of the file. -\end{memberdesc} - -\begin{memberdesc}[FInfo]{Type} -The 4-character type code of the file. -\end{memberdesc} - -\begin{memberdesc}[FInfo]{Flags} -The finder flags for the file as 16-bit integer. The bit values in -\var{Flags} are defined in standard module \module{MACFS}. -\end{memberdesc} - -\begin{memberdesc}[FInfo]{Location} -A Point giving the position of the file's icon in its folder. -\end{memberdesc} - -\begin{memberdesc}[FInfo]{Fldr} -The folder the file is in (as an integer). -\end{memberdesc} Modified: python/trunk/Doc/mac/libmacostools.tex ============================================================================== --- python/trunk/Doc/mac/libmacostools.tex (original) +++ python/trunk/Doc/mac/libmacostools.tex Mon May 21 01:17:38 2007 @@ -39,6 +39,7 @@ or type for file \var{dst} has changed. The file can be specified by pathname or fsspec. This call should tell the finder to redraw the files icon. +\deprecated{2.6}{The function is a no-op on OS X.} \end{funcdesc} \begin{datadesc}{BUFSIZ} Modified: python/trunk/Lib/binhex.py ============================================================================== --- python/trunk/Lib/binhex.py (original) +++ python/trunk/Lib/binhex.py Mon May 21 01:17:38 2007 @@ -510,14 +510,7 @@ ifp.close() def _test(): - if os.name == 'mac': - import macfs - fss, ok = macfs.PromptGetFile('File to convert:') - if not ok: - sys.exit(0) - fname = fss.as_pathname() - else: - fname = sys.argv[1] + fname = sys.argv[1] binhex(fname, fname+'.hqx') hexbin(fname+'.hqx', fname+'.viahqx') #hexbin(fname, fname+'.unpacked') Deleted: /python/trunk/Lib/plat-mac/macfs.py ============================================================================== --- /python/trunk/Lib/plat-mac/macfs.py Mon May 21 01:17:38 2007 +++ (empty file) @@ -1,198 +0,0 @@ -"""macfs - Pure Python module designed to be backward compatible with -macfs and MACFS. -""" -import sys -import struct -import Carbon.Res -import Carbon.File -import warnings - -warnings.warn("macfs is deprecated, use Carbon.File, Carbon.Folder or EasyDialogs", - DeprecationWarning, stacklevel=2) - -# First step: ensure we also emulate the MACFS module, which contained -# all the constants - -sys.modules['MACFS'] = sys.modules[__name__] - -# Import all those constants -from Carbon.Files import * -from Carbon.Folders import * - -# For some obscure historical reason these are here too: -READ = 1 -WRITE = 2 -smAllScripts = -3 - -# -# Find the epoch conversion for file dates in a way that works on OS9 and OSX -import time -if time.gmtime(0)[0] == 1970: - _EPOCHCONVERT = -((1970-1904)*365 + 17) * (24*60*60) + 0x100000000L - def _utc2time(utc): - t = utc[1] + _EPOCHCONVERT - return int(t) - def _time2utc(t): - t = int(t) - _EPOCHCONVERT - if t < -0x7fffffff: - t = t + 0x10000000L - return (0, int(t), 0) -else: - def _utc2time(utc): - t = utc[1] - if t < 0: - t = t + 0x100000000L - return t - def _time2utc(t): - if t > 0x7fffffff: - t = t - 0x100000000L - return (0, int(t), 0) - -# The old name of the error object: -error = Carbon.File.Error - -# -# The various objects macfs used to export. We override them here, because some -# of the method names are subtly different. -# -class FSSpec(Carbon.File.FSSpec): - def as_fsref(self): - return FSRef(self) - - def NewAlias(self, src=None): - return Alias(Carbon.File.NewAlias(src, self)) - - def GetCreatorType(self): - finfo = self.FSpGetFInfo() - return finfo.Creator, finfo.Type - - def SetCreatorType(self, ctor, tp): - finfo = self.FSpGetFInfo() - finfo.Creator = ctor - finfo.Type = tp - self.FSpSetFInfo(finfo) - - def GetFInfo(self): - return self.FSpGetFInfo() - - def SetFInfo(self, info): - return self.FSpSetFInfo(info) - - def GetDates(self): - catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate - catinfo, d1, d2, d3 = FSRef(self).FSGetCatalogInfo(catInfoFlags) - cdate = catinfo.createDate - mdate = catinfo.contentModDate - bdate = catinfo.backupDate - return _utc2time(cdate), _utc2time(mdate), _utc2time(bdate) - - def SetDates(self, cdate, mdate, bdate): - catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate - catinfo = Carbon.File.FSCatalogInfo( - createDate = _time2utc(cdate), - contentModDate = _time2utc(mdate), - backupDate = _time2utc(bdate)) - FSRef(self).FSSetCatalogInfo(catInfoFlags, catinfo) - -class FSRef(Carbon.File.FSRef): - def as_fsspec(self): - return FSSpec(self) - -class Alias(Carbon.File.Alias): - - def GetInfo(self, index): - return self.GetAliasInfo(index) - - def Update(self, *args): - pass # print "Alias.Update not yet implemented" - - def Resolve(self, src=None): - fss, changed = self.ResolveAlias(src) - return FSSpec(fss), changed - -from Carbon.File import FInfo - -# Backward-compatible type names: -FSSpecType = FSSpec -FSRefType = FSRef -AliasType = Alias -FInfoType = FInfo - -# Global functions: -def ResolveAliasFile(fss, chain=1): - fss, isdir, isalias = Carbon.File.ResolveAliasFile(fss, chain) - return FSSpec(fss), isdir, isalias - -def RawFSSpec(data): - return FSSpec(rawdata=data) - -def RawAlias(data): - return Alias(rawdata=data) - -def FindApplication(*args): - raise NotImplementedError, "FindApplication no longer implemented" - -def NewAliasMinimalFromFullPath(path): - return Alias(Carbon.File.NewAliasMinimalFromFullPath(path, '', '')) - -# Another global function: -from Carbon.Folder import FindFolder - -# -# Finally the old Standard File routine emulators. -# - -_curfolder = None - -def StandardGetFile(*typelist): - """Ask for an input file, optionally specifying 4-char file types that are - allowable""" - return PromptGetFile('', *typelist) - -def PromptGetFile(prompt, *typelist): - """Ask for an input file giving the user a prompt message. Optionally you can - specifying 4-char file types that are allowable""" - import EasyDialogs - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - if not typelist: - typelist = None - fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec, - typeList=typelist, defaultLocation=_handleSetFolder()) - return fss, not fss is None - -def StandardPutFile(prompt, default=None): - """Ask the user for an output file, with a prompt. Optionally you cn supply a - default output filename""" - import EasyDialogs - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt, - savedFileName=default, defaultLocation=_handleSetFolder()) - return fss, not fss is None - -def SetFolder(folder): - global _curfolder - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - if _curfolder: - rv = FSSpec(_curfolder) - else: - rv = None - _curfolder = folder - return rv - -def _handleSetFolder(): - global _curfolder - rv = _curfolder - _curfolder = None - return rv - -def GetDirectory(prompt=None): - """Ask the user to select a folder. Optionally you can give a prompt.""" - import EasyDialogs - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec, - defaultLocation=_handleSetFolder()) - return fss, not fss is None Modified: python/trunk/Lib/plat-mac/macostools.py ============================================================================== --- python/trunk/Lib/plat-mac/macostools.py (original) +++ python/trunk/Lib/plat-mac/macostools.py Mon May 21 01:17:38 2007 @@ -65,21 +65,9 @@ def touched(dst): """Tell the finder a file has changed. No-op on MacOSX.""" - if sys.platform != 'mac': return import warnings - warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) - import macfs - file_fss = macfs.FSSpec(dst) - vRefNum, dirID, name = file_fss.as_tuple() - dir_fss = macfs.FSSpec((vRefNum, dirID, '')) - crdate, moddate, bkdate = dir_fss.GetDates() - now = time.time() - if now == moddate: - now = now + 1 - try: - dir_fss.SetDates(crdate, now, bkdate) - except macfs.error: - pass + warnings.warn("macostools.touched() has been deprecated", + DeprecationWarning, 2) def touched_ae(dst): """Tell the finder a file has changed""" @@ -129,7 +117,6 @@ dstfsr = File.FSRef(dst) catinfo, _, _, _ = srcfsr.FSGetCatalogInfo(Files.kFSCatInfoAllDates) dstfsr.FSSetCatalogInfo(Files.kFSCatInfoAllDates, catinfo) - touched(dstfss) def copytree(src, dst, copydates=1): """Copy a complete file tree to a new destination""" Modified: python/trunk/Lib/test/regrtest.py ============================================================================== --- python/trunk/Lib/test/regrtest.py (original) +++ python/trunk/Lib/test/regrtest.py Mon May 21 01:17:38 2007 @@ -1198,7 +1198,6 @@ test_imgfile test_linuxaudiodev test_locale - test_macfs test_macostools test_nis test_ossaudiodev @@ -1235,7 +1234,6 @@ test_gzip test_imgfile test_linuxaudiodev - test_macfs test_macostools test_nis test_ossaudiodev @@ -1264,7 +1262,6 @@ test_imgfile test_linuxaudiodev test_locale - test_macfs test_macostools test_nis test_normalization @@ -1298,7 +1295,6 @@ test_imgfile test_linuxaudiodev test_locale - test_macfs test_macostools test_nis test_ossaudiodev @@ -1340,7 +1336,7 @@ self.expected.add('test_imageop') if not sys.platform in ("mac", "darwin"): - MAC_ONLY = ["test_macostools", "test_macfs", "test_aepack", + MAC_ONLY = ["test_macostools", "test_aepack", "test_plistlib", "test_scriptpackages"] for skip in MAC_ONLY: self.expected.add(skip) Deleted: /python/trunk/Lib/test/test_macfs.py ============================================================================== --- /python/trunk/Lib/test/test_macfs.py Mon May 21 01:17:38 2007 +++ (empty file) @@ -1,78 +0,0 @@ -# Copyright (C) 2003 Python Software Foundation - -import unittest -import warnings -warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) -import macfs -import os -import sys -import tempfile -from test import test_support - -class TestMacfs(unittest.TestCase): - - def setUp(self): - fp = open(test_support.TESTFN, 'w') - fp.write('hello world\n') - fp.close() - - def tearDown(self): - try: - os.unlink(test_support.TESTFN) - except: - pass - - def test_fsspec(self): - fss = macfs.FSSpec(test_support.TESTFN) - self.assertEqual(os.path.realpath(test_support.TESTFN), fss.as_pathname()) - - def test_fsref(self): - fsr = macfs.FSRef(test_support.TESTFN) - self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) - - def test_fsref_unicode(self): - if sys.getfilesystemencoding(): - testfn_unicode = unicode(test_support.TESTFN) - fsr = macfs.FSRef(testfn_unicode) - self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) - - def test_coercion(self): - fss = macfs.FSSpec(test_support.TESTFN) - fsr = macfs.FSRef(test_support.TESTFN) - fss2 = fsr.as_fsspec() - fsr2 = fss.as_fsref() - self.assertEqual(fss.as_pathname(), fss2.as_pathname()) - self.assertEqual(fsr.as_pathname(), fsr2.as_pathname()) - - def test_dates(self): - import time - fss = macfs.FSSpec(test_support.TESTFN) - now = int(time.time()) - fss.SetDates(now, now+1, now+2) - dates = fss.GetDates() - self.assertEqual(dates, (now, now+1, now+2)) - - def test_ctor_type(self): - fss = macfs.FSSpec(test_support.TESTFN) - fss.SetCreatorType('Pyth', 'TEXT') - filecr, filetp = fss.GetCreatorType() - self.assertEqual((filecr, filetp), ('Pyth', 'TEXT')) - - def test_alias(self): - fss = macfs.FSSpec(test_support.TESTFN) - alias = fss.NewAlias() - fss2, changed = alias.Resolve() - self.assertEqual(changed, 0) - self.assertEqual(fss.as_pathname(), fss2.as_pathname()) - - - def test_fss_alias(self): - fss = macfs.FSSpec(test_support.TESTFN) - - -def test_main(): - test_support.run_unittest(TestMacfs) - - -if __name__ == '__main__': - test_main() Modified: python/trunk/Lib/test/test_macostools.py ============================================================================== --- python/trunk/Lib/test/test_macostools.py (original) +++ python/trunk/Lib/test/test_macostools.py Mon May 21 01:17:38 2007 @@ -51,7 +51,11 @@ def test_touched(self): # This really only tests that nothing unforeseen happens. - macostools.touched(test_support.TESTFN) + import warnings + with test_support.guard_warnings_filter(): + warnings.filterwarnings('ignore', 'macostools.touched*', + DeprecationWarning) + macostools.touched(test_support.TESTFN) def test_copy(self): try: Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon May 21 01:17:38 2007 @@ -883,6 +883,10 @@ Mac --- +- Removed the macfs module. It had been deprecated since Python 2.5. This + lead to the deprecation of macostools.touched() as it relied solely on macfs + and was a no-op under OS X. + What's New in Python 2.5 release candidate 1? ============================================= From python-checkins at python.org Mon May 21 01:18:14 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 21 May 2007 01:18:14 +0200 (CEST) Subject: [Python-checkins] r55475 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Message-ID: <20070520231814.4AED91E4004@bag.python.org> Author: brett.cannon Date: Mon May 21 01:18:12 2007 New Revision: 55475 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Log: Update PEPs based on removal of macfs. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Mon May 21 01:18:12 2007 @@ -80,7 +80,7 @@ The following modules were removed in Python 2.6: - gopherlib, rgbimg + gopherlib, rgbimg, macfs The following modules currently lack a DeprecationWarning: @@ -215,7 +215,8 @@ Rationale: Unknown. Date: 15-May-2007 Documentation: Documented as deprecated as of Python 2.3, but - listing in this PEP was neglected. + listing in this PEP was neglected. Removed in + Python 2.6. Module name: md5 Rationale: Replaced by the 'hashlib' module. Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Mon May 21 01:18:12 2007 @@ -59,14 +59,16 @@ None - Deprecated modules in the standard library: + Deprecated modules and functions in the standard library: - sets + - macostools.touched() Modules removed from the standard library: - gopherlib - rgbimg + - macfs Python 3.0 compatability: @@ -109,10 +111,6 @@ PJE's withdrawal from 2.5 for inclusion in 2.6: http://mail.python.org/pipermail/python-dev/2006-April/064145.html - Modules to be removed according to PEP 4: - - - macfs - Module to gain a DeprecationWarning (as specified for Python 2.6 or through negligence): From python-checkins at python.org Mon May 21 01:56:23 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 21 May 2007 01:56:23 +0200 (CEST) Subject: [Python-checkins] r55476 - python/trunk/Lib/test/test_imageop.py Message-ID: <20070520235623.BBCC91E4010@bag.python.org> Author: brett.cannon Date: Mon May 21 01:56:18 2007 New Revision: 55476 Modified: python/trunk/Lib/test/test_imageop.py Log: Move imgfile import to the global namespace to trigger an import error ASAP to prevent creation of a test file. Modified: python/trunk/Lib/test/test_imageop.py ============================================================================== --- python/trunk/Lib/test/test_imageop.py (original) +++ python/trunk/Lib/test/test_imageop.py Mon May 21 01:56:18 2007 @@ -7,7 +7,7 @@ from test.test_support import verbose, unlink -import imageop, uu, os +import imageop, uu, os, imgfile import warnings @@ -119,9 +119,6 @@ """return a tuple consisting of image (in 'imgfile' format) width and height """ - - import imgfile - try: sizes = imgfile.getsizes(name) except imgfile.error: From python-checkins at python.org Mon May 21 01:57:41 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 21 May 2007 01:57:41 +0200 (CEST) Subject: [Python-checkins] r55477 - in python/trunk: Lib/posixfile.py Lib/test/test_sundry.py Misc/NEWS Message-ID: <20070520235741.8BC171E400C@bag.python.org> Author: brett.cannon Date: Mon May 21 01:57:38 2007 New Revision: 55477 Modified: python/trunk/Lib/posixfile.py python/trunk/Lib/test/test_sundry.py python/trunk/Misc/NEWS Log: Cause posixfile to raise a DeprecationWarning. Documented as deprecated since Ptyhon 1.5. Modified: python/trunk/Lib/posixfile.py ============================================================================== --- python/trunk/Lib/posixfile.py (original) +++ python/trunk/Lib/posixfile.py Mon May 21 01:57:38 2007 @@ -52,7 +52,9 @@ note: - the '?' modifier prevents a region from being locked; it is query only """ - +import warnings +warnings.warn("The posixfile module is deprecated; " + "fcntl.lockf() provides better locking", DeprecationWarning, 2) class _posixfile_: """File wrapper class that provides extra POSIX file routines.""" Modified: python/trunk/Lib/test/test_sundry.py ============================================================================== --- python/trunk/Lib/test/test_sundry.py (original) +++ python/trunk/Lib/test/test_sundry.py Mon May 21 01:57:38 2007 @@ -1,71 +1,74 @@ """Do a minimal test of all the modules that aren't otherwise tested.""" +from test.test_support import guard_warnings_filter import warnings -warnings.filterwarnings('ignore', r".*posixfile module", - DeprecationWarning, 'posixfile$') -from test.test_support import verbose +with guard_warnings_filter(): + warnings.filterwarnings('ignore', r".*posixfile", + DeprecationWarning) -import BaseHTTPServer -import DocXMLRPCServer -import CGIHTTPServer -import SimpleHTTPServer -import SimpleXMLRPCServer -import aifc -import audiodev -import bdb -import cgitb -import cmd -import code -import compileall -import encodings -import formatter -import ftplib -import getpass -import htmlentitydefs -import ihooks -import imghdr -import imputil -import keyword -import linecache -import macurl2path -import mailcap -import mimify -import mutex -import nntplib -import nturl2path -import opcode -import os2emxpath -import pdb -import pipes -#import poplib -import posixfile -import pstats -import py_compile -import pydoc -import rexec -import rlcompleter -import sched -import smtplib -import sndhdr -import statvfs -import stringold -import sunau -import sunaudio -import symbol -import tabnanny -import telnetlib -import timeit -import toaiff -import token -try: - import tty # not available on Windows -except ImportError: - if verbose: - print "skipping tty" + from test.test_support import verbose -# Can't test the "user" module -- if the user has a ~/.pythonrc.py, it -# can screw up all sorts of things (esp. if it prints!). -#import user -import webbrowser -import xml + import BaseHTTPServer + import DocXMLRPCServer + import CGIHTTPServer + import SimpleHTTPServer + import SimpleXMLRPCServer + import aifc + import audiodev + import bdb + import cgitb + import cmd + import code + import compileall + import encodings + import formatter + import ftplib + import getpass + import htmlentitydefs + import ihooks + import imghdr + import imputil + import keyword + import linecache + import macurl2path + import mailcap + import mimify + import mutex + import nntplib + import nturl2path + import opcode + import os2emxpath + import pdb + import pipes + #import poplib + import posixfile + import pstats + import py_compile + import pydoc + import rexec + import rlcompleter + import sched + import smtplib + import sndhdr + import statvfs + import stringold + import sunau + import sunaudio + import symbol + import tabnanny + import telnetlib + import timeit + import toaiff + import token + try: + import tty # not available on Windows + except ImportError: + if verbose: + print "skipping tty" + + # Can't test the "user" module -- if the user has a ~/.pythonrc.py, it + # can screw up all sorts of things (esp. if it prints!). + #import user + import webbrowser + import xml Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon May 21 01:57:38 2007 @@ -211,6 +211,8 @@ Library ------- +- The posixfile module now raises a DeprecationWarning. + - Remove the gopherlib module. This also leads to the removal of gopher support in urllib/urllib2. From python-checkins at python.org Mon May 21 01:59:52 2007 From: python-checkins at python.org (brett.cannon) Date: Mon, 21 May 2007 01:59:52 +0200 (CEST) Subject: [Python-checkins] r55478 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Message-ID: <20070520235952.A6D961E4004@bag.python.org> Author: brett.cannon Date: Mon May 21 01:59:49 2007 New Revision: 55478 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Log: Document that posixfile now raises a DeprecationWarning. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Mon May 21 01:59:49 2007 @@ -84,7 +84,7 @@ The following modules currently lack a DeprecationWarning: - posixfile, rfc822, mimetools, MimeWriter, mimify, + rfc822, mimetools, MimeWriter, mimify, multifile, md5, sha, buildtools, cfmfile @@ -93,7 +93,8 @@ Module name: posixfile Rationale: Locking is better done by fcntl.lockf(). Date: Before 1-Oct-2000. - Documentation: Already documented as obsolete. + Documentation: Already documented as obsolete. Deprecation + warning added in Python 2.6. Module name: gopherlib Rationale: The gopher protocol is not in active use anymore. Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Mon May 21 01:59:49 2007 @@ -63,6 +63,7 @@ - sets - macostools.touched() + - posixfile Modules removed from the standard library: @@ -114,7 +115,6 @@ Module to gain a DeprecationWarning (as specified for Python 2.6 or through negligence): - - posixfile - rfc822 - mimetools - MimeWriter From python-checkins at python.org Mon May 21 02:03:16 2007 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 21 May 2007 02:03:16 +0200 (CEST) Subject: [Python-checkins] r55479 - python/trunk/Doc/whatsnew/whatsnew26.tex Message-ID: <20070521000316.16D791E4005@bag.python.org> Author: andrew.kuchling Date: Mon May 21 02:03:15 2007 New Revision: 55479 Modified: python/trunk/Doc/whatsnew/whatsnew26.tex Log: Note removed modules Modified: python/trunk/Doc/whatsnew/whatsnew26.tex ============================================================================== --- python/trunk/Doc/whatsnew/whatsnew26.tex (original) +++ python/trunk/Doc/whatsnew/whatsnew26.tex Mon May 21 02:03:15 2007 @@ -147,6 +147,8 @@ (Contributed by Fabian Kreutz.) +\item The \module{gopherlib} module has been removed. + \item New function in the \module{heapq} module: \function{merge(iter1, iter2, ...)} takes any number of iterables that return data @@ -175,6 +177,10 @@ (Contributed by Raymond Hettinger.) +\item The \module{macfs} module has been removed. This in turn +required the \function{macostools.touched()} function to be removed +because it depended on the \module{macfs} module. + % Patch #1490190 \item New functions in the \module{posix} module: \function{chflags()} and \function{lchflags()} are wrappers for the corresponding system @@ -184,6 +190,8 @@ \constant{UF_APPEND} to indicate that data can only be appended to the file. (Contributed by M. Levinson.) +\item The \module{rgbimg} module has been removed. + \item The \module{smtplib} module now supports SMTP over SSL thanks to the addition of the \class{SMTP_SSL} class. This class supports an interface identical to the existing \class{SMTP} From buildbot at python.org Mon May 21 02:07:09 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 21 May 2007 00:07:09 +0000 Subject: [Python-checkins] buildbot failure in x86 XP trunk Message-ID: <20070521000710.025BC1E4005@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/456 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon May 21 02:33:54 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 21 May 2007 00:33:54 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo 2.5 Message-ID: <20070521003354.9B6BD1E4004@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%25202.5/builds/356 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: neal.norwitz Build had warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon May 21 03:26:03 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 21 May 2007 01:26:03 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20070521012603.324101E4004@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2209 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_telnetlib.py", line 14, in server serv.bind(("", 9091)) File "", line 1, in bind error: (98, 'Address already in use') sincerely, -The Buildbot From python-checkins at python.org Mon May 21 06:21:15 2007 From: python-checkins at python.org (collin.winter) Date: Mon, 21 May 2007 06:21:15 +0200 (CEST) Subject: [Python-checkins] r55480 - in sandbox/trunk/2to3: Grammar.txt tests/data/py3_test_grammar.py Message-ID: <20070521042115.F22D71E4004@bag.python.org> Author: collin.winter Date: Mon May 21 06:21:11 2007 New Revision: 55480 Modified: sandbox/trunk/2to3/Grammar.txt sandbox/trunk/2to3/tests/data/py3_test_grammar.py Log: Add support (and tests) for class decorators Modified: sandbox/trunk/2to3/Grammar.txt ============================================================================== --- sandbox/trunk/2to3/Grammar.txt (original) +++ sandbox/trunk/2to3/Grammar.txt Mon May 21 06:21:11 2007 @@ -33,7 +33,8 @@ decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE decorators: decorator+ -funcdef: [decorators] 'def' NAME parameters ['->' test] ':' suite +decorated: decorators (classdef | funcdef) +funcdef: 'def' NAME parameters ['->' test] ':' suite parameters: '(' [typedargslist] ')' typedargslist: ((tfpdef ['=' test] ',')* ('*' [tname] (',' tname ['=' test])* [',' '**' tname] | '**' tname) @@ -80,7 +81,7 @@ exec_stmt: 'exec' expr ['in' test [',' test]] assert_stmt: 'assert' test [',' test] -compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef +compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] while_stmt: 'while' test ':' suite ['else' ':' suite] for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite] Modified: sandbox/trunk/2to3/tests/data/py3_test_grammar.py ============================================================================== --- sandbox/trunk/2to3/tests/data/py3_test_grammar.py (original) +++ sandbox/trunk/2to3/tests/data/py3_test_grammar.py Mon May 21 06:21:11 2007 @@ -16,6 +16,7 @@ # testing import * from sys import * + at class_decorator class TokenTests(unittest.TestCase): def testBackslash(self): From python-checkins at python.org Mon May 21 06:35:52 2007 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 21 May 2007 06:35:52 +0200 (CEST) Subject: [Python-checkins] r55481 - python/trunk/Misc/developers.txt Message-ID: <20070521043552.B043C1E4004@bag.python.org> Author: martin.v.loewis Date: Mon May 21 06:35:47 2007 New Revision: 55481 Modified: python/trunk/Misc/developers.txt Log: Add Alexandre Vassalotti. Modified: python/trunk/Misc/developers.txt ============================================================================== --- python/trunk/Misc/developers.txt (original) +++ python/trunk/Misc/developers.txt Mon May 21 06:35:47 2007 @@ -17,6 +17,10 @@ Permissions History ------------------- +- Alexandre Vassalotti was given SVN access on May 21 2007 + by MvL, for his Summer-of-Code project, mentored by + Brett Cannon. + - Travis Oliphant was given SVN access on 17 Apr 2007 by MvL, for implementing the extended buffer protocol. From python-checkins at python.org Mon May 21 06:41:27 2007 From: python-checkins at python.org (george.yoshida) Date: Mon, 21 May 2007 06:41:27 +0200 (CEST) Subject: [Python-checkins] r55482 - in python/trunk/Doc: Makefile.deps mac/mac.tex Message-ID: <20070521044127.581331E4006@bag.python.org> Author: george.yoshida Date: Mon May 21 06:41:21 2007 New Revision: 55482 Modified: python/trunk/Doc/Makefile.deps python/trunk/Doc/mac/mac.tex Log: fix against r55474 [Remove the macfs module] Remove "libmacfs.tex" from Makefile.deps and mac/mac.tex. Modified: python/trunk/Doc/Makefile.deps ============================================================================== --- python/trunk/Doc/Makefile.deps (original) +++ python/trunk/Doc/Makefile.deps Mon May 21 06:41:21 2007 @@ -366,7 +366,6 @@ mac/libaetools.tex \ mac/libaepack.tex \ mac/libaetypes.tex \ - mac/libmacfs.tex \ mac/libmacos.tex \ mac/libmacostools.tex \ mac/libmacui.tex \ Modified: python/trunk/Doc/mac/mac.tex ============================================================================== --- python/trunk/Doc/mac/mac.tex (original) +++ python/trunk/Doc/mac/mac.tex Mon May 21 06:41:21 2007 @@ -51,7 +51,6 @@ \localmoduletable \input{libmac} -\input{libmacfs} \input{libmacic} \input{libmacos} \input{libmacostools} From python-checkins at python.org Mon May 21 08:07:31 2007 From: python-checkins at python.org (neal.norwitz) Date: Mon, 21 May 2007 08:07:31 +0200 (CEST) Subject: [Python-checkins] r55483 - in sandbox/trunk/2to3: fixes/fix_callable.py tests/test_fixers.py Message-ID: <20070521060731.E9A7E1E4004@bag.python.org> Author: neal.norwitz Date: Mon May 21 08:07:29 2007 New Revision: 55483 Added: sandbox/trunk/2to3/fixes/fix_callable.py (contents, props changed) Modified: sandbox/trunk/2to3/tests/test_fixers.py Log: A simplistic fixer for callable. Added: sandbox/trunk/2to3/fixes/fix_callable.py ============================================================================== --- (empty file) +++ sandbox/trunk/2to3/fixes/fix_callable.py Mon May 21 08:07:29 2007 @@ -0,0 +1,28 @@ +# Copyright 2007 Google, Inc. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +"""Fixer for callable(). + +This converts callable(obj) into hasattr(obj, '__call__').""" + +# Local imports +import pytree +from fixes import basefix +from fixes.util import Call, Name, String + +class FixCallable(basefix.BaseFix): + + # XXX(nnorwitz): how should this code be handled: callable(*args) + PATTERN = """ + power< 'callable' trailer< '(' func=any ')' > > + """ + + def transform(self, node): + results = self.match(node) + func = results["func"] + + args = [func.clone(), String(', '), String("'__call__'")] + new = Call(Name("hasattr"), args) + new.set_prefix(node.get_prefix()) + return new + Modified: sandbox/trunk/2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/tests/test_fixers.py Mon May 21 08:07:29 2007 @@ -1783,6 +1783,14 @@ a = """R'''x'''""" self.check(b, a) +class Test_callable(FixerTestCase): + fixer = "callable" + + def test_callable_call(self): + b = """callable(x)""" + a = """hasattr(x, '__call__')""" + self.check(b, a) + if __name__ == "__main__": import __main__ From python-checkins at python.org Mon May 21 08:31:16 2007 From: python-checkins at python.org (neal.norwitz) Date: Mon, 21 May 2007 08:31:16 +0200 (CEST) Subject: [Python-checkins] r55484 - sandbox/trunk/2to3/fixes/fix_callable.py Message-ID: <20070521063116.E1CAA1E4004@bag.python.org> Author: neal.norwitz Date: Mon May 21 08:31:12 2007 New Revision: 55484 Modified: sandbox/trunk/2to3/fixes/fix_callable.py Log: Add some comments about how this pattern needs to be enhanced. Modified: sandbox/trunk/2to3/fixes/fix_callable.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_callable.py (original) +++ sandbox/trunk/2to3/fixes/fix_callable.py Mon May 21 08:31:12 2007 @@ -12,7 +12,9 @@ class FixCallable(basefix.BaseFix): - # XXX(nnorwitz): how should this code be handled: callable(*args) + # XXX(nnorwitz): need to ignore: callable(*args) + # XXX(nnorwitz): or use of keywords, it could signify doing a callback, + # not using the builtin callable(). PATTERN = """ power< 'callable' trailer< '(' func=any ')' > > """ From python-checkins at python.org Mon May 21 08:59:57 2007 From: python-checkins at python.org (neal.norwitz) Date: Mon, 21 May 2007 08:59:57 +0200 (CEST) Subject: [Python-checkins] r55485 - peps/trunk/pep-3100.txt Message-ID: <20070521065957.509E21E4004@bag.python.org> Author: neal.norwitz Date: Mon May 21 08:59:52 2007 New Revision: 55485 Modified: peps/trunk/pep-3100.txt Log: Remove callable Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Mon May 21 08:59:52 2007 @@ -181,7 +181,7 @@ * ``apply()``: use ``f(*args, **kw)`` instead [2]_ [done] * ``buffer()``: must die (use a bytes() type instead) (?) [2]_ -* ``callable()``: just use hasattr(x, '__call__') (?) [2]_ +* ``callable()``: just use hasattr(x, '__call__') (?) [2]_ [done] * ``compile()``: put in ``sys`` (or perhaps in a module of its own) [2]_ * ``coerce()``: no longer needed [2]_ [done] * ``execfile()``, ``reload()``: use ``exec()`` [2]_ From python-checkins at python.org Mon May 21 10:13:39 2007 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 21 May 2007 10:13:39 +0200 (CEST) Subject: [Python-checkins] r55487 - python/trunk/Lib/collections.py Message-ID: <20070521081339.F2EAE1E4004@bag.python.org> Author: raymond.hettinger Date: Mon May 21 10:13:35 2007 New Revision: 55487 Modified: python/trunk/Lib/collections.py Log: Replace assertion with straight error-checking. Modified: python/trunk/Lib/collections.py ============================================================================== --- python/trunk/Lib/collections.py (original) +++ python/trunk/Lib/collections.py Mon May 21 10:13:35 2007 @@ -24,7 +24,8 @@ """ field_names = s.split() - assert ''.join(field_names).replace('_', '').isalpha() # protect against exec attacks + if not ''.join([typename] + field_names).replace('_', '').isalpha(): + raise ValueError('Type names and field names can only contain alphanumeric characters and underscores') argtxt = ', '.join(field_names) reprtxt = ', '.join('%s=%%r' % name for name in field_names) template = '''class %(typename)s(tuple): From buildbot at python.org Mon May 21 10:59:04 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 21 May 2007 08:59:04 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070521085904.8F73B1E4004@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2028 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,george.yoshida,martin.v.loewis,raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver sincerely, -The Buildbot From python-checkins at python.org Mon May 21 18:40:17 2007 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 21 May 2007 18:40:17 +0200 (CEST) Subject: [Python-checkins] r55489 - in python/trunk/Lib: collections.py test/test_collections.py Message-ID: <20070521164017.2A2261E4005@bag.python.org> Author: raymond.hettinger Date: Mon May 21 18:40:10 2007 New Revision: 55489 Modified: python/trunk/Lib/collections.py python/trunk/Lib/test/test_collections.py Log: Allow all alphanumeric and underscores in type and field names. Modified: python/trunk/Lib/collections.py ============================================================================== --- python/trunk/Lib/collections.py (original) +++ python/trunk/Lib/collections.py Mon May 21 18:40:10 2007 @@ -24,7 +24,7 @@ """ field_names = s.split() - if not ''.join([typename] + field_names).replace('_', '').isalpha(): + if not ''.join([typename] + field_names).replace('_', '').isalnum(): raise ValueError('Type names and field names can only contain alphanumeric characters and underscores') argtxt = ', '.join(field_names) reprtxt = ', '.join('%s=%%r' % name for name in field_names) Modified: python/trunk/Lib/test/test_collections.py ============================================================================== --- python/trunk/Lib/test/test_collections.py (original) +++ python/trunk/Lib/test/test_collections.py Mon May 21 18:40:10 2007 @@ -11,6 +11,9 @@ self.assertEqual(Point.__slots__, ()) self.assertEqual(Point.__module__, __name__) self.assertEqual(Point.__getitem__, tuple.__getitem__) + self.assertRaises(ValueError, NamedTuple, 'abc%', 'def ghi') + self.assertRaises(ValueError, NamedTuple, 'abc', 'def g%hi') + NamedTuple('Point0', 'x1 y2') # Verify that numbers are allowed in names def test_instance(self): Point = NamedTuple('Point', 'x y') From buildbot at python.org Mon May 21 19:04:50 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 21 May 2007 17:04:50 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070521170451.06BE21E4006@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/550 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon May 21 19:32:37 2007 From: python-checkins at python.org (facundo.batista) Date: Mon, 21 May 2007 19:32:37 +0200 (CEST) Subject: [Python-checkins] r55490 - in python/trunk: Lib/httplib.py Lib/test/test_httplib.py Misc/NEWS Message-ID: <20070521173237.BF7E41E4005@bag.python.org> Author: facundo.batista Date: Mon May 21 19:32:32 2007 New Revision: 55490 Modified: python/trunk/Lib/httplib.py python/trunk/Lib/test/test_httplib.py python/trunk/Misc/NEWS Log: Added timeout support to HTTPSConnection, through the socket.create_connection function. Also added a small test for this, and updated NEWS file. Modified: python/trunk/Lib/httplib.py ============================================================================== --- python/trunk/Lib/httplib.py (original) +++ python/trunk/Lib/httplib.py Mon May 21 19:32:32 2007 @@ -1124,16 +1124,15 @@ default_port = HTTPS_PORT def __init__(self, host, port=None, key_file=None, cert_file=None, - strict=None): - HTTPConnection.__init__(self, host, port, strict) + strict=None, timeout=None): + HTTPConnection.__init__(self, host, port, strict, timeout) self.key_file = key_file self.cert_file = cert_file def connect(self): "Connect to a host on a given (SSL) port." - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) + sock = socket.create_connection((self.host, self.port), self.timeout) ssl = socket.ssl(sock, self.key_file, self.cert_file) self.sock = FakeSocket(sock, ssl) Modified: python/trunk/Lib/test/test_httplib.py ============================================================================== --- python/trunk/Lib/test/test_httplib.py (original) +++ python/trunk/Lib/test/test_httplib.py Mon May 21 19:32:32 2007 @@ -194,8 +194,16 @@ httpConn.close() +class HTTPSTimeoutTest(TestCase): +# XXX Here should be tests for HTTPS, there isn't any right now! + + def test_attributes(self): + # simple test to check it's storing it + h = httplib.HTTPSConnection(HOST, PORT, timeout=30) + self.assertEqual(h.timeout, 30) + def test_main(verbose=None): - test_support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest) + test_support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest, HTTPSTimeoutTest) if __name__ == '__main__': test_main() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon May 21 19:32:32 2007 @@ -259,7 +259,7 @@ - Patch #1676823: Added create_connection() to socket.py, which may be called with a timeout, and use it from httplib (whose HTTPConnection - now accepts an optional timeout). + and HTTPSConnection now accept an optional timeout). - Bug #978833: Revert r50844, as it broke _socketobject.dup. From buildbot at python.org Mon May 21 19:35:02 2007 From: buildbot at python.org (buildbot at python.org) Date: Mon, 21 May 2007 17:35:02 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070521173503.1767A1E4005@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/458 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_timeout sincerely, -The Buildbot From python-checkins at python.org Mon May 21 22:34:22 2007 From: python-checkins at python.org (georg.brandl) Date: Mon, 21 May 2007 22:34:22 +0200 (CEST) Subject: [Python-checkins] r55495 - in python/trunk: Doc/ref/ref5.tex Lib/test/output/test_extcall Lib/test/test_extcall.py Misc/NEWS Python/ceval.c Message-ID: <20070521203422.419B11E4007@bag.python.org> Author: georg.brandl Date: Mon May 21 22:34:16 2007 New Revision: 55495 Modified: python/trunk/Doc/ref/ref5.tex python/trunk/Lib/test/output/test_extcall python/trunk/Lib/test/test_extcall.py python/trunk/Misc/NEWS python/trunk/Python/ceval.c Log: Patch #1686487: you can now pass any mapping after '**' in function calls. Modified: python/trunk/Doc/ref/ref5.tex ============================================================================== --- python/trunk/Doc/ref/ref5.tex (original) +++ python/trunk/Doc/ref/ref5.tex Mon May 21 22:34:16 2007 @@ -704,7 +704,7 @@ this confusion does not arise. If the syntax \samp{**expression} appears in the function call, -\samp{expression} must evaluate to a (subclass of) dictionary, the +\samp{expression} must evaluate to a mapping, the contents of which are treated as additional keyword arguments. In the case of a keyword appearing in both \samp{expression} and as an explicit keyword argument, a \exception{TypeError} exception is Modified: python/trunk/Lib/test/output/test_extcall ============================================================================== --- python/trunk/Lib/test/output/test_extcall (original) +++ python/trunk/Lib/test/output/test_extcall Mon May 21 22:34:16 2007 @@ -9,6 +9,9 @@ (1, 2, 3) {'a': 4, 'b': 5} (1, 2, 3, 4, 5) {'a': 6, 'b': 7} (1, 2, 3, 6, 7) {'a': 8, 'b': 9, 'x': 4, 'y': 5} +(1, 2, 3) {'a': 4, 'b': 5} +(1, 2, 3, 4, 5) {'a': 6, 'b': 7} +(1, 2, 3, 6, 7) {'a': 8, 'b': 9, 'x': 4, 'y': 5} TypeError: g() takes at least 1 argument (0 given) TypeError: g() takes at least 1 argument (0 given) TypeError: g() takes at least 1 argument (0 given) @@ -25,12 +28,12 @@ g() got multiple values for keyword argument 'b' f() keywords must be strings h() got an unexpected keyword argument 'e' -h() argument after * must be a sequence -dir() argument after * must be a sequence -NoneType object argument after * must be a sequence -h() argument after ** must be a dictionary -dir() argument after ** must be a dictionary -NoneType object argument after ** must be a dictionary +h() argument after * must be a sequence, not function +dir() argument after * must be a sequence, not function +NoneType object argument after * must be a sequence, not function +h() argument after ** must be a mapping, not function +dir() argument after ** must be a mapping, not function +NoneType object argument after ** must be a mapping, not function dir() got multiple values for keyword argument 'b' 3 512 True 3 Modified: python/trunk/Lib/test/test_extcall.py ============================================================================== --- python/trunk/Lib/test/test_extcall.py (original) +++ python/trunk/Lib/test/test_extcall.py Mon May 21 22:34:16 2007 @@ -1,5 +1,6 @@ from test.test_support import verify, verbose, TestFailed, sortdict from UserList import UserList +from UserDict import UserDict def e(a, b): print a, b @@ -25,6 +26,12 @@ f(1, 2, 3, *(4, 5), **{'a':6, 'b':7}) f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b':9}) + +f(1, 2, 3, **UserDict(a=4, b=5)) +f(1, 2, 3, *(4, 5), **UserDict(a=6, b=7)) +f(1, 2, 3, x=4, y=5, *(6, 7), **UserDict(a=8, b=9)) + + # Verify clearing of SF bug #733667 try: e(c=3) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon May 21 22:34:16 2007 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Patch #1686487: you can now pass any mapping after '**' in function + calls. + - except clauses may now be spelled either "except E, target:" or "except E as target:". This is to provide forwards compatibility with Python 3.0. Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Mon May 21 22:34:16 2007 @@ -3790,13 +3790,31 @@ if (flags & CALL_FLAG_KW) { kwdict = EXT_POP(*pp_stack); - if (!(kwdict && PyDict_Check(kwdict))) { - PyErr_Format(PyExc_TypeError, - "%s%s argument after ** " - "must be a dictionary", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func)); - goto ext_call_fail; + if (!PyDict_Check(kwdict)) { + PyObject *d; + d = PyDict_New(); + if (d == NULL) + goto ext_call_fail; + if (PyDict_Update(d, kwdict) != 0) { + Py_DECREF(d); + /* PyDict_Update raises attribute + * error (percolated from an attempt + * to get 'keys' attribute) instead of + * a type error if its second argument + * is not a mapping. + */ + if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_TypeError, + "%.200s%.200s argument after ** " + "must be a mapping, not %.200s", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func), + kwdict->ob_type->tp_name); + } + goto ext_call_fail; + } + Py_DECREF(kwdict); + kwdict = d; } } if (flags & CALL_FLAG_VAR) { @@ -3807,10 +3825,11 @@ if (t == NULL) { if (PyErr_ExceptionMatches(PyExc_TypeError)) { PyErr_Format(PyExc_TypeError, - "%s%s argument after * " - "must be a sequence", + "%.200s%.200s argument after * " + "must be a sequence, not %200s", PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func)); + PyEval_GetFuncDesc(func), + stararg->ob_type->tp_name); } goto ext_call_fail; } From python-checkins at python.org Tue May 22 07:49:06 2007 From: python-checkins at python.org (neal.norwitz) Date: Tue, 22 May 2007 07:49:06 +0200 (CEST) Subject: [Python-checkins] r55501 - in sandbox/trunk/2to3: fixes/fix_callable.py tests/test_fixers.py Message-ID: <20070522054906.8122E1E4003@bag.python.org> Author: neal.norwitz Date: Tue May 22 07:49:04 2007 New Revision: 55501 Modified: sandbox/trunk/2to3/fixes/fix_callable.py sandbox/trunk/2to3/tests/test_fixers.py Log: Fix XXXs by tightening the pattern and add a few test cases. Modified: sandbox/trunk/2to3/fixes/fix_callable.py ============================================================================== --- sandbox/trunk/2to3/fixes/fix_callable.py (original) +++ sandbox/trunk/2to3/fixes/fix_callable.py Tue May 22 07:49:04 2007 @@ -12,11 +12,16 @@ class FixCallable(basefix.BaseFix): - # XXX(nnorwitz): need to ignore: callable(*args) - # XXX(nnorwitz): or use of keywords, it could signify doing a callback, - # not using the builtin callable(). + # Ignore callable(*args) or use of keywords. + # Either could be a hint that the builtin callable() is not being used. PATTERN = """ - power< 'callable' trailer< '(' func=any ')' > > + power< 'callable' + trailer< lpar='(' + ( not(arglist | argument) any ','> ) + rpar=')' > + after=any* + > """ def transform(self, node): Modified: sandbox/trunk/2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/tests/test_fixers.py Tue May 22 07:49:04 2007 @@ -1791,6 +1791,16 @@ a = """hasattr(x, '__call__')""" self.check(b, a) + def test_callable_should_not_change(self): + a = """callable(*x)""" + self.check(a, a) + + a = """callable(x, y)""" + self.check(a, a) + + a = """callable(x, kw=y)""" + self.check(a, a) + if __name__ == "__main__": import __main__ From python-checkins at python.org Tue May 22 08:03:36 2007 From: python-checkins at python.org (neal.norwitz) Date: Tue, 22 May 2007 08:03:36 +0200 (CEST) Subject: [Python-checkins] r55502 - python/trunk/Doc/lib/libhttplib.tex Message-ID: <20070522060336.EE4A01E4003@bag.python.org> Author: neal.norwitz Date: Tue May 22 08:03:36 2007 New Revision: 55502 Modified: python/trunk/Doc/lib/libhttplib.tex Log: Document new params to HTTPSConnection Modified: python/trunk/Doc/lib/libhttplib.tex ============================================================================== --- python/trunk/Doc/lib/libhttplib.tex (original) +++ python/trunk/Doc/lib/libhttplib.tex Tue May 22 08:03:36 2007 @@ -51,7 +51,9 @@ \versionadded{2.0} \end{classdesc} -\begin{classdesc}{HTTPSConnection}{host\optional{, port, key_file, cert_file}} +\begin{classdesc}{HTTPSConnection}{host\optional{, port\optional{, + key_file\optional{, cert_file\optional{, + strict\optional{, timeout}}}}}} A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. \var{key_file} is From python-checkins at python.org Tue May 22 08:09:26 2007 From: python-checkins at python.org (neal.norwitz) Date: Tue, 22 May 2007 08:09:26 +0200 (CEST) Subject: [Python-checkins] r55503 - python/branches/release25-maint/Doc/lib/libhttplib.tex Message-ID: <20070522060926.6E62B1E4003@bag.python.org> Author: neal.norwitz Date: Tue May 22 08:09:24 2007 New Revision: 55503 Modified: python/branches/release25-maint/Doc/lib/libhttplib.tex Log: Document "new" params to HTTPConnection/HTTPSConnection Modified: python/branches/release25-maint/Doc/lib/libhttplib.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libhttplib.tex (original) +++ python/branches/release25-maint/Doc/lib/libhttplib.tex Tue May 22 08:09:24 2007 @@ -26,12 +26,16 @@ The module provides the following classes: -\begin{classdesc}{HTTPConnection}{host\optional{, port}} +\begin{classdesc}{HTTPConnection}{host\optional{, port\optional{, strict}}} An \class{HTTPConnection} instance represents one transaction with an HTTP server. It should be instantiated passing it a host and optional port number. If no port number is passed, the port is extracted from the host string if it has the form \code{\var{host}:\var{port}}, else the default HTTP port (80) is -used. For example, the following calls all create instances that connect to +used. When True, the optional parameter \var{strict} +causes \code{BadStatusLine} to be raised if the status line can't be parsed +as a valid HTTP/1.0 or 1.1 status line. + +For example, the following calls all create instances that connect to the server at the same host and port: \begin{verbatim} @@ -42,7 +46,8 @@ \versionadded{2.0} \end{classdesc} -\begin{classdesc}{HTTPSConnection}{host\optional{, port, key_file, cert_file}} +\begin{classdesc}{HTTPSConnection}{host\optional{, port\optional{, + key_file\optional{, cert_file\optional{, strict}}}}} A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. \var{key_file} is From python-checkins at python.org Tue May 22 09:16:11 2007 From: python-checkins at python.org (neal.norwitz) Date: Tue, 22 May 2007 09:16:11 +0200 (CEST) Subject: [Python-checkins] r55504 - python/trunk/Modules/_tkinter.c Message-ID: <20070522071611.C8D341E4003@bag.python.org> Author: neal.norwitz Date: Tue May 22 09:16:10 2007 New Revision: 55504 Modified: python/trunk/Modules/_tkinter.c Log: Stop using METH_OLDARGS Modified: python/trunk/Modules/_tkinter.c ============================================================================== --- python/trunk/Modules/_tkinter.c (original) +++ python/trunk/Modules/_tkinter.c Tue May 22 09:16:10 2007 @@ -2698,8 +2698,8 @@ { {"willdispatch", Tkapp_WillDispatch, METH_NOARGS}, {"wantobjects", Tkapp_WantObjects, METH_VARARGS}, - {"call", Tkapp_Call, METH_OLDARGS}, - {"globalcall", Tkapp_GlobalCall, METH_OLDARGS}, + {"call", Tkapp_Call, METH_VARARGS}, + {"globalcall", Tkapp_GlobalCall, METH_VARARGS}, {"eval", Tkapp_Eval, METH_VARARGS}, {"globaleval", Tkapp_GlobalEval, METH_VARARGS}, {"evalfile", Tkapp_EvalFile, METH_VARARGS}, @@ -2720,7 +2720,7 @@ {"exprboolean", Tkapp_ExprBoolean, METH_VARARGS}, {"splitlist", Tkapp_SplitList, METH_VARARGS}, {"split", Tkapp_Split, METH_VARARGS}, - {"merge", Tkapp_Merge, METH_OLDARGS}, + {"merge", Tkapp_Merge, METH_VARARGS}, {"createcommand", Tkapp_CreateCommand, METH_VARARGS}, {"deletecommand", Tkapp_DeleteCommand, METH_VARARGS}, #ifdef HAVE_CREATEFILEHANDLER From python-checkins at python.org Tue May 22 09:16:46 2007 From: python-checkins at python.org (neal.norwitz) Date: Tue, 22 May 2007 09:16:46 +0200 (CEST) Subject: [Python-checkins] r55505 - in python/trunk: Modules/_cursesmodule.c Modules/_struct.c Modules/datetimemodule.c Objects/typeobject.c Message-ID: <20070522071646.502771E4003@bag.python.org> Author: neal.norwitz Date: Tue May 22 09:16:44 2007 New Revision: 55505 Modified: python/trunk/Modules/_cursesmodule.c python/trunk/Modules/_struct.c python/trunk/Modules/datetimemodule.c python/trunk/Objects/typeobject.c Log: Stop using METH_OLDARGS implicitly Modified: python/trunk/Modules/_cursesmodule.c ============================================================================== --- python/trunk/Modules/_cursesmodule.c (original) +++ python/trunk/Modules/_cursesmodule.c Tue May 22 09:16:44 2007 @@ -1299,7 +1299,7 @@ PyCursesWindow_RedrawLine(PyCursesWindowObject *self, PyObject *args) { int beg, num; - if (!PyArg_ParseTuple(args,"ii;beg,num", &beg, &num)) + if (!PyArg_ParseTuple(args, "ii;beg,num", &beg, &num)) return NULL; return PyCursesCheckERR(wredrawln(self->win,beg,num), "redrawln"); } @@ -1533,7 +1533,7 @@ {"overwrite", (PyCFunction)PyCursesWindow_Overwrite, METH_VARARGS}, {"putwin", (PyCFunction)PyCursesWindow_PutWin, METH_VARARGS}, - {"redrawln", (PyCFunction)PyCursesWindow_RedrawLine}, + {"redrawln", (PyCFunction)PyCursesWindow_RedrawLine, METH_VARARGS}, {"redrawwin", (PyCFunction)PyCursesWindow_redrawwin, METH_NOARGS}, {"refresh", (PyCFunction)PyCursesWindow_Refresh, METH_VARARGS}, #ifndef STRICT_SYSV_CURSES Modified: python/trunk/Modules/_struct.c ============================================================================== --- python/trunk/Modules/_struct.c (original) +++ python/trunk/Modules/_struct.c Tue May 22 09:16:44 2007 @@ -1789,7 +1789,7 @@ {"pack", s_pack, METH_VARARGS, s_pack__doc__}, {"pack_into", s_pack_into, METH_VARARGS, s_pack_into__doc__}, {"unpack", s_unpack, METH_O, s_unpack__doc__}, - {"unpack_from", (PyCFunction)s_unpack_from, METH_KEYWORDS, + {"unpack_from", (PyCFunction)s_unpack_from, METH_VARARGS|METH_KEYWORDS, s_unpack_from__doc__}, {NULL, NULL} /* sentinel */ }; Modified: python/trunk/Modules/datetimemodule.c ============================================================================== --- python/trunk/Modules/datetimemodule.c (original) +++ python/trunk/Modules/datetimemodule.c Tue May 22 09:16:44 2007 @@ -2631,7 +2631,7 @@ {"ctime", (PyCFunction)date_ctime, METH_NOARGS, PyDoc_STR("Return ctime() style string.")}, - {"strftime", (PyCFunction)date_strftime, METH_KEYWORDS, + {"strftime", (PyCFunction)date_strftime, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("format -> strftime() style string.")}, {"timetuple", (PyCFunction)date_timetuple, METH_NOARGS, @@ -2656,7 +2656,7 @@ PyDoc_STR("Return the day of the week represented by the date.\n" "Monday == 0 ... Sunday == 6")}, - {"replace", (PyCFunction)date_replace, METH_KEYWORDS, + {"replace", (PyCFunction)date_replace, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("Return date with new specified fields.")}, {"__reduce__", (PyCFunction)date_reduce, METH_NOARGS, @@ -3417,7 +3417,7 @@ PyDoc_STR("Return string in ISO 8601 format, HH:MM:SS[.mmmmmm]" "[+HH:MM].")}, - {"strftime", (PyCFunction)time_strftime, METH_KEYWORDS, + {"strftime", (PyCFunction)time_strftime, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("format -> strftime() style string.")}, {"utcoffset", (PyCFunction)time_utcoffset, METH_NOARGS, @@ -3429,7 +3429,7 @@ {"dst", (PyCFunction)time_dst, METH_NOARGS, PyDoc_STR("Return self.tzinfo.dst(self).")}, - {"replace", (PyCFunction)time_replace, METH_KEYWORDS, + {"replace", (PyCFunction)time_replace, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("Return time with new specified fields.")}, {"__reduce__", (PyCFunction)time_reduce, METH_NOARGS, @@ -4468,7 +4468,7 @@ /* Class methods: */ {"now", (PyCFunction)datetime_now, - METH_KEYWORDS | METH_CLASS, + METH_VARARGS | METH_KEYWORDS | METH_CLASS, PyDoc_STR("[tz] -> new datetime with tz's local day and time.")}, {"utcnow", (PyCFunction)datetime_utcnow, @@ -4476,7 +4476,7 @@ PyDoc_STR("Return a new datetime representing UTC day and time.")}, {"fromtimestamp", (PyCFunction)datetime_fromtimestamp, - METH_KEYWORDS | METH_CLASS, + METH_VARARGS | METH_KEYWORDS | METH_CLASS, PyDoc_STR("timestamp[, tz] -> tz's local time from POSIX timestamp.")}, {"utcfromtimestamp", (PyCFunction)datetime_utcfromtimestamp, @@ -4513,7 +4513,7 @@ {"utctimetuple", (PyCFunction)datetime_utctimetuple, METH_NOARGS, PyDoc_STR("Return UTC time tuple, compatible with time.localtime().")}, - {"isoformat", (PyCFunction)datetime_isoformat, METH_KEYWORDS, + {"isoformat", (PyCFunction)datetime_isoformat, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("[sep] -> string in ISO 8601 format, " "YYYY-MM-DDTHH:MM:SS[.mmmmmm][+HH:MM].\n\n" "sep is used to separate the year from the time, and " @@ -4528,10 +4528,10 @@ {"dst", (PyCFunction)datetime_dst, METH_NOARGS, PyDoc_STR("Return self.tzinfo.dst(self).")}, - {"replace", (PyCFunction)datetime_replace, METH_KEYWORDS, + {"replace", (PyCFunction)datetime_replace, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("Return datetime with new specified fields.")}, - {"astimezone", (PyCFunction)datetime_astimezone, METH_KEYWORDS, + {"astimezone", (PyCFunction)datetime_astimezone, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("tz -> convert to local time in new timezone tz\n")}, {"__reduce__", (PyCFunction)datetime_reduce, METH_NOARGS, Modified: python/trunk/Objects/typeobject.c ============================================================================== --- python/trunk/Objects/typeobject.c (original) +++ python/trunk/Objects/typeobject.c Tue May 22 09:16:44 2007 @@ -4259,7 +4259,7 @@ } static struct PyMethodDef tp_new_methoddef[] = { - {"__new__", (PyCFunction)tp_new_wrapper, METH_KEYWORDS, + {"__new__", (PyCFunction)tp_new_wrapper, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("T.__new__(S, ...) -> " "a new object with type S, a subtype of T")}, {0} From g.brandl at gmx.net Tue May 22 09:28:29 2007 From: g.brandl at gmx.net (Georg Brandl) Date: Tue, 22 May 2007 09:28:29 +0200 Subject: [Python-checkins] r55504 - python/trunk/Modules/_tkinter.c In-Reply-To: <20070522071611.C8D341E4003@bag.python.org> References: <20070522071611.C8D341E4003@bag.python.org> Message-ID: neal.norwitz schrieb: > Author: neal.norwitz > Date: Tue May 22 09:16:10 2007 > New Revision: 55504 > > Modified: > python/trunk/Modules/_tkinter.c > Log: > Stop using METH_OLDARGS > > Modified: python/trunk/Modules/_tkinter.c > ============================================================================== > --- python/trunk/Modules/_tkinter.c (original) > +++ python/trunk/Modules/_tkinter.c Tue May 22 09:16:10 2007 > @@ -2698,8 +2698,8 @@ > { > {"willdispatch", Tkapp_WillDispatch, METH_NOARGS}, > {"wantobjects", Tkapp_WantObjects, METH_VARARGS}, > - {"call", Tkapp_Call, METH_OLDARGS}, > - {"globalcall", Tkapp_GlobalCall, METH_OLDARGS}, > + {"call", Tkapp_Call, METH_VARARGS}, > + {"globalcall", Tkapp_GlobalCall, METH_VARARGS}, > {"eval", Tkapp_Eval, METH_VARARGS}, > {"globaleval", Tkapp_GlobalEval, METH_VARARGS}, > {"evalfile", Tkapp_EvalFile, METH_VARARGS}, > @@ -2720,7 +2720,7 @@ > {"exprboolean", Tkapp_ExprBoolean, METH_VARARGS}, > {"splitlist", Tkapp_SplitList, METH_VARARGS}, > {"split", Tkapp_Split, METH_VARARGS}, > - {"merge", Tkapp_Merge, METH_OLDARGS}, > + {"merge", Tkapp_Merge, METH_VARARGS}, > {"createcommand", Tkapp_CreateCommand, METH_VARARGS}, > {"deletecommand", Tkapp_DeleteCommand, METH_VARARGS}, > #ifdef HAVE_CREATEFILEHANDLER Don't you have to adapt the functions that used to use oldargs too? At least, you can remove the cases for args == NULL and args not being a tuple. Georg From nnorwitz at gmail.com Tue May 22 09:51:39 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 22 May 2007 00:51:39 -0700 Subject: [Python-checkins] r55504 - python/trunk/Modules/_tkinter.c In-Reply-To: References: <20070522071611.C8D341E4003@bag.python.org> Message-ID: On 5/22/07, Georg Brandl wrote: > neal.norwitz schrieb: > > Author: neal.norwitz > > Date: Tue May 22 09:16:10 2007 > > New Revision: 55504 > > > > Modified: > > python/trunk/Modules/_tkinter.c > > Log: > > Stop using METH_OLDARGS > > > > Modified: python/trunk/Modules/_tkinter.c > > ============================================================================== > > --- python/trunk/Modules/_tkinter.c (original) > > +++ python/trunk/Modules/_tkinter.c Tue May 22 09:16:10 2007 > > @@ -2698,8 +2698,8 @@ > > { > > {"willdispatch", Tkapp_WillDispatch, METH_NOARGS}, > > {"wantobjects", Tkapp_WantObjects, METH_VARARGS}, > > - {"call", Tkapp_Call, METH_OLDARGS}, > > - {"globalcall", Tkapp_GlobalCall, METH_OLDARGS}, > > + {"call", Tkapp_Call, METH_VARARGS}, > > + {"globalcall", Tkapp_GlobalCall, METH_VARARGS}, > > {"eval", Tkapp_Eval, METH_VARARGS}, > > {"globaleval", Tkapp_GlobalEval, METH_VARARGS}, > > {"evalfile", Tkapp_EvalFile, METH_VARARGS}, > > @@ -2720,7 +2720,7 @@ > > {"exprboolean", Tkapp_ExprBoolean, METH_VARARGS}, > > {"splitlist", Tkapp_SplitList, METH_VARARGS}, > > {"split", Tkapp_Split, METH_VARARGS}, > > - {"merge", Tkapp_Merge, METH_OLDARGS}, > > + {"merge", Tkapp_Merge, METH_VARARGS}, > > {"createcommand", Tkapp_CreateCommand, METH_VARARGS}, > > {"deletecommand", Tkapp_DeleteCommand, METH_VARARGS}, > > #ifdef HAVE_CREATEFILEHANDLER > > Don't you have to adapt the functions that used to use oldargs too? > At least, you can remove the cases for args == NULL and args not being a tuple. Normally, yes. In this case, it looked like all the methods calls into Merge() which handles NULL, tuples, and non-tuples. ~lines 385 - 400. I wasn't sure if any of that code could be removed though. (Looking through the code, it does look like these other conditions might be dead now. But I didn't look that closely.) This could use some extra testing. Let me know if you see something I screwed up. In the case of the other checkin where METH_OLDARGS was implicitly used with METH_KEYWORDS, this case was handled the same as METH_VARARGS. So no code needed to change when adding METH_VARARGS. n From buildbot at python.org Tue May 22 11:38:40 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 22 May 2007 09:38:40 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20070522093840.E896B1E4003@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/670 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_timeout make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue May 22 14:44:47 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 22 May 2007 12:44:47 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070522124447.E8D4F1E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/461 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_winsound ====================================================================== ERROR: test_alias_asterisk (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 64, in test_alias_asterisk winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exclamation (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 74, in test_alias_exclamation winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exit (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 84, in test_alias_exit winsound.PlaySound('SystemExit', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_hand (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 94, in test_alias_hand winsound.PlaySound('SystemHand', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_question (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 104, in test_alias_question winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_stopasync (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 158, in test_stopasync winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP RuntimeError: Failed to play sound sincerely, -The Buildbot From facundobatista at gmail.com Tue May 22 16:23:59 2007 From: facundobatista at gmail.com (Facundo Batista) Date: Tue, 22 May 2007 11:23:59 -0300 Subject: [Python-checkins] r55502 - python/trunk/Doc/lib/libhttplib.tex In-Reply-To: <20070522060336.EE4A01E4003@bag.python.org> References: <20070522060336.EE4A01E4003@bag.python.org> Message-ID: 2007/5/22, neal.norwitz : > Author: neal.norwitz > Date: Tue May 22 08:03:36 2007 > New Revision: 55502 > > Modified: > python/trunk/Doc/lib/libhttplib.tex > ... Oops, :( Thank you! -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ From python-checkins at python.org Tue May 22 16:28:22 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 22 May 2007 16:28:22 +0200 (CEST) Subject: [Python-checkins] r55507 - python/trunk/Doc/lib/lib.tex python/trunk/Doc/lib/libpanel.tex Message-ID: <20070522142822.E9C5F1E4003@bag.python.org> Author: georg.brandl Date: Tue May 22 16:28:17 2007 New Revision: 55507 Removed: python/trunk/Doc/lib/libpanel.tex Modified: python/trunk/Doc/lib/lib.tex Log: Remove the "panel" module doc file which has been ignored since 1994. Modified: python/trunk/Doc/lib/lib.tex ============================================================================== --- python/trunk/Doc/lib/lib.tex (original) +++ python/trunk/Doc/lib/lib.tex Tue May 22 16:28:17 2007 @@ -437,7 +437,6 @@ \input{libgl} \input{libimgfile} \input{libjpeg} -%\input{libpanel} \input{libsun} % SUNOS ONLY \input{libsunaudio} Deleted: /python/trunk/Doc/lib/libpanel.tex ============================================================================== --- /python/trunk/Doc/lib/libpanel.tex Tue May 22 16:28:17 2007 +++ (empty file) @@ -1,74 +0,0 @@ -\section{\module{panel} --- - None} -\declaremodule{standard}{panel} - -\modulesynopsis{None} - - -\strong{Please note:} The FORMS library, to which the -\code{fl}\refbimodindex{fl} module described above interfaces, is a -simpler and more accessible user interface library for use with GL -than the \code{panel} module (besides also being by a Dutch author). - -This module should be used instead of the built-in module -\code{pnl}\refbimodindex{pnl} -to interface with the -\emph{Panel Library}. - -The module is too large to document here in its entirety. -One interesting function: - -\begin{funcdesc}{defpanellist}{filename} -Parses a panel description file containing S-expressions written by the -\emph{Panel Editor} -that accompanies the Panel Library and creates the described panels. -It returns a list of panel objects. -\end{funcdesc} - -\warning{The Python interpreter will dump core if you don't create a -GL window before calling -\code{panel.mkpanel()} -or -\code{panel.defpanellist()}.} - -\section{\module{panelparser} --- - None} -\declaremodule{standard}{panelparser} - -\modulesynopsis{None} - - -This module defines a self-contained parser for S-expressions as output -by the Panel Editor (which is written in Scheme so it can't help writing -S-expressions). -The relevant function is -\code{panelparser.parse_file(\var{file})} -which has a file object (not a filename!) as argument and returns a list -of parsed S-expressions. -Each S-expression is converted into a Python list, with atoms converted -to Python strings and sub-expressions (recursively) to Python lists. -For more details, read the module file. -% XXXXJH should be funcdesc, I think - -\section{\module{pnl} --- - None} -\declaremodule{builtin}{pnl} - -\modulesynopsis{None} - - -This module provides access to the -\emph{Panel Library} -built by NASA Ames\index{NASA} (to get it, send email to -\code{panel-request at nas.nasa.gov}). -All access to it should be done through the standard module -\code{panel}\refstmodindex{panel}, -which transparently exports most functions from -\code{pnl} -but redefines -\code{pnl.dopanel()}. - -\warning{The Python interpreter will dump core if you don't create a -GL window before calling \code{pnl.mkpanel()}.} - -The module is too large to document here in its entirety. From python-checkins at python.org Wed May 23 03:45:36 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 23 May 2007 03:45:36 +0200 (CEST) Subject: [Python-checkins] r55521 - in sandbox/trunk/cpy_merge: Include Include/cStringIO.h Lib Lib/StringIO.py Lib/cProfile.py Lib/copy_reg.py Lib/pickle.py Lib/pickletools.py Lib/profile.py Lib/test Lib/test/output Lib/test/output/test_cProfile Lib/test/pickletester.py Lib/test/regrtest.py Lib/test/test_StringIO.py Lib/test/test_cProfile.py Lib/test/test_copy_reg.py Lib/test/test_cpickle.py Lib/test/test_pickle.py Lib/test/test_pickletools.py Modules Modules/_lsprof.c Modules/cPickle.c Modules/cStringIO.c Modules/rotatingtree.c Modules/rotatingtree.h README setup.py Message-ID: <20070523014536.5C3DB1E4005@bag.python.org> Author: alexandre.vassalotti Date: Wed May 23 03:45:28 2007 New Revision: 55521 Added: sandbox/trunk/cpy_merge/ sandbox/trunk/cpy_merge/Include/ sandbox/trunk/cpy_merge/Include/cStringIO.h (contents, props changed) sandbox/trunk/cpy_merge/Lib/ sandbox/trunk/cpy_merge/Lib/StringIO.py sandbox/trunk/cpy_merge/Lib/cProfile.py (contents, props changed) sandbox/trunk/cpy_merge/Lib/copy_reg.py sandbox/trunk/cpy_merge/Lib/pickle.py sandbox/trunk/cpy_merge/Lib/pickletools.py sandbox/trunk/cpy_merge/Lib/profile.py (contents, props changed) sandbox/trunk/cpy_merge/Lib/test/ sandbox/trunk/cpy_merge/Lib/test/output/ sandbox/trunk/cpy_merge/Lib/test/output/test_cProfile sandbox/trunk/cpy_merge/Lib/test/pickletester.py sandbox/trunk/cpy_merge/Lib/test/regrtest.py (contents, props changed) sandbox/trunk/cpy_merge/Lib/test/test_StringIO.py sandbox/trunk/cpy_merge/Lib/test/test_cProfile.py sandbox/trunk/cpy_merge/Lib/test/test_copy_reg.py sandbox/trunk/cpy_merge/Lib/test/test_cpickle.py sandbox/trunk/cpy_merge/Lib/test/test_pickle.py sandbox/trunk/cpy_merge/Lib/test/test_pickletools.py sandbox/trunk/cpy_merge/Modules/ sandbox/trunk/cpy_merge/Modules/_lsprof.c (contents, props changed) sandbox/trunk/cpy_merge/Modules/cPickle.c (contents, props changed) sandbox/trunk/cpy_merge/Modules/cStringIO.c (contents, props changed) sandbox/trunk/cpy_merge/Modules/rotatingtree.c (contents, props changed) sandbox/trunk/cpy_merge/Modules/rotatingtree.h (contents, props changed) sandbox/trunk/cpy_merge/README sandbox/trunk/cpy_merge/setup.py (contents, props changed) Log: Initial import taken from the p3yk branch (r55520). Added: sandbox/trunk/cpy_merge/Include/cStringIO.h ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Include/cStringIO.h Wed May 23 03:45:28 2007 @@ -0,0 +1,70 @@ +#ifndef Py_CSTRINGIO_H +#define Py_CSTRINGIO_H +#ifdef __cplusplus +extern "C" { +#endif +/* + + This header provides access to cStringIO objects from C. + Functions are provided for calling cStringIO objects and + macros are provided for testing whether you have cStringIO + objects. + + Before calling any of the functions or macros, you must initialize + the routines with: + + PycString_IMPORT + + This would typically be done in your init function. + +*/ +#define PycString_IMPORT \ + PycStringIO = (struct PycStringIO_CAPI*)PyCObject_Import("cStringIO", \ + "cStringIO_CAPI") + +/* Basic functions to manipulate cStringIO objects from C */ + +static struct PycStringIO_CAPI { + + /* Read a string from an input object. If the last argument + is -1, the remainder will be read. + */ + int(*cread)(PyObject *, char **, Py_ssize_t); + + /* Read a line from an input object. Returns the length of the read + line as an int and a pointer inside the object buffer as char** (so + the caller doesn't have to provide its own buffer as destination). + */ + int(*creadline)(PyObject *, char **); + + /* Write a string to an output object*/ + int(*cwrite)(PyObject *, const char *, Py_ssize_t); + + /* Get the output object as a Python string (returns new reference). */ + PyObject *(*cgetvalue)(PyObject *); + + /* Create a new output object */ + PyObject *(*NewOutput)(int); + + /* Create an input object from a Python string + (copies the Python string reference). + */ + PyObject *(*NewInput)(PyObject *); + + /* The Python types for cStringIO input and output objects. + Note that you can do input on an output object. + */ + PyTypeObject *InputType, *OutputType; + +} *PycStringIO; + +/* These can be used to test if you have one */ +#define PycStringIO_InputCheck(O) \ + ((O)->ob_type==PycStringIO->InputType) +#define PycStringIO_OutputCheck(O) \ + ((O)->ob_type==PycStringIO->OutputType) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CSTRINGIO_H */ Added: sandbox/trunk/cpy_merge/Lib/StringIO.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/StringIO.py Wed May 23 03:45:28 2007 @@ -0,0 +1,324 @@ +r"""File-like objects that read from or write to a string buffer. + +This implements (nearly) all stdio methods. + +f = StringIO() # ready for writing +f = StringIO(buf) # ready for reading +f.close() # explicitly release resources held +flag = f.isatty() # always false +pos = f.tell() # get current position +f.seek(pos) # set current position +f.seek(pos, mode) # mode 0: absolute; 1: relative; 2: relative to EOF +buf = f.read() # read until EOF +buf = f.read(n) # read up to n bytes +buf = f.readline() # read until end of line ('\n') or EOF +list = f.readlines()# list of f.readline() results until EOF +f.truncate([size]) # truncate file at to at most size (default: current pos) +f.write(buf) # write at current position +f.writelines(list) # for line in list: f.write(line) +f.getvalue() # return whole file's contents as a string + +Notes: +- Using a real file is often faster (but less convenient). +- There's also a much faster implementation in C, called cStringIO, but + it's not subclassable. +- fileno() is left unimplemented so that code which uses it triggers + an exception early. +- Seeking far beyond EOF and then writing will insert real null + bytes that occupy space in the buffer. +- There's a simple test set (see end of this file). +""" +try: + from errno import EINVAL +except ImportError: + EINVAL = 22 + +__all__ = ["StringIO"] + +def _complain_ifclosed(closed): + if closed: + raise ValueError, "I/O operation on closed file" + +class StringIO: + """class StringIO([buffer]) + + When a StringIO object is created, it can be initialized to an existing + string by passing the string to the constructor. If no string is given, + the StringIO will start empty. + + The StringIO object can accept either Unicode or 8-bit strings, but + mixing the two may take some care. If both are used, 8-bit strings that + cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause + a UnicodeError to be raised when getvalue() is called. + """ + def __init__(self, buf = ''): + # Force self.buf to be a string or unicode + if not isinstance(buf, basestring): + buf = str(buf) + self.buf = buf + self.len = len(buf) + self.buflist = [] + self.pos = 0 + self.closed = False + + def __iter__(self): + return self + + def __next__(self): + """A file object is its own iterator, for example iter(f) returns f + (unless f is closed). When a file is used as an iterator, typically + in a for loop (for example, for line in f: print line), the __next__() + method is called repeatedly. This method returns the next input line, + or raises StopIteration when EOF is hit. + """ + _complain_ifclosed(self.closed) + r = self.readline() + if not r: + raise StopIteration + return r + + def close(self): + """Free the memory buffer. + """ + if not self.closed: + self.closed = True + del self.buf, self.pos + + def isatty(self): + """Returns False because StringIO objects are not connected to a + tty-like device. + """ + _complain_ifclosed(self.closed) + return False + + def seek(self, pos, mode = 0): + """Set the file's current position. + + The mode argument is optional and defaults to 0 (absolute file + positioning); other values are 1 (seek relative to the current + position) and 2 (seek relative to the file's end). + + There is no return value. + """ + _complain_ifclosed(self.closed) + if self.buflist: + self.buf += ''.join(self.buflist) + self.buflist = [] + if mode == 1: + pos += self.pos + elif mode == 2: + pos += self.len + self.pos = max(0, pos) + + def tell(self): + """Return the file's current position.""" + _complain_ifclosed(self.closed) + return self.pos + + def read(self, n=None): + """Read at most size bytes from the file + (less if the read hits EOF before obtaining size bytes). + + If the size argument is negative or omitted, read all data until EOF + is reached. The bytes are returned as a string object. An empty + string is returned when EOF is encountered immediately. + """ + _complain_ifclosed(self.closed) + if self.buflist: + self.buf += ''.join(self.buflist) + self.buflist = [] + if n is None: + n = -1 + if n < 0: + newpos = self.len + else: + newpos = min(self.pos+n, self.len) + r = self.buf[self.pos:newpos] + self.pos = newpos + return r + + def readline(self, length=None): + r"""Read one entire line from the file. + + A trailing newline character is kept in the string (but may be absent + when a file ends with an incomplete line). If the size argument is + present and non-negative, it is a maximum byte count (including the + trailing newline) and an incomplete line may be returned. + + An empty string is returned only when EOF is encountered immediately. + + Note: Unlike stdio's fgets(), the returned string contains null + characters ('\0') if they occurred in the input. + """ + _complain_ifclosed(self.closed) + if self.buflist: + self.buf += ''.join(self.buflist) + self.buflist = [] + i = self.buf.find('\n', self.pos) + if i < 0: + newpos = self.len + else: + newpos = i+1 + if length is not None: + if self.pos + length < newpos: + newpos = self.pos + length + r = self.buf[self.pos:newpos] + self.pos = newpos + return r + + def readlines(self, sizehint = 0): + """Read until EOF using readline() and return a list containing the + lines thus read. + + If the optional sizehint argument is present, instead of reading up + to EOF, whole lines totalling approximately sizehint bytes (or more + to accommodate a final whole line). + """ + total = 0 + lines = [] + line = self.readline() + while line: + lines.append(line) + total += len(line) + if 0 < sizehint <= total: + break + line = self.readline() + return lines + + def truncate(self, size=None): + """Truncate the file's size. + + If the optional size argument is present, the file is truncated to + (at most) that size. The size defaults to the current position. + The current file position is not changed unless the position + is beyond the new file size. + + If the specified size exceeds the file's current size, the + file remains unchanged. + """ + _complain_ifclosed(self.closed) + if size is None: + size = self.pos + elif size < 0: + raise IOError(EINVAL, "Negative size not allowed") + elif size < self.pos: + self.pos = size + self.buf = self.getvalue()[:size] + self.len = size + + def write(self, s): + """Write a string to the file. + + There is no return value. + """ + _complain_ifclosed(self.closed) + if not s: return + # Force s to be a string or unicode + if not isinstance(s, basestring): + s = str(s) + spos = self.pos + slen = self.len + if spos == slen: + self.buflist.append(s) + self.len = self.pos = spos + len(s) + return + if spos > slen: + self.buflist.append('\0'*(spos - slen)) + slen = spos + newpos = spos + len(s) + if spos < slen: + if self.buflist: + self.buf += ''.join(self.buflist) + self.buflist = [self.buf[:spos], s, self.buf[newpos:]] + self.buf = '' + if newpos > slen: + slen = newpos + else: + self.buflist.append(s) + slen = newpos + self.len = slen + self.pos = newpos + + def writelines(self, iterable): + """Write a sequence of strings to the file. The sequence can be any + iterable object producing strings, typically a list of strings. There + is no return value. + + (The name is intended to match readlines(); writelines() does not add + line separators.) + """ + write = self.write + for line in iterable: + write(line) + + def flush(self): + """Flush the internal buffer + """ + _complain_ifclosed(self.closed) + + def getvalue(self): + """ + Retrieve the entire contents of the "file" at any time before + the StringIO object's close() method is called. + + The StringIO object can accept either Unicode or 8-bit strings, + but mixing the two may take some care. If both are used, 8-bit + strings that cannot be interpreted as 7-bit ASCII (that use the + 8th bit) will cause a UnicodeError to be raised when getvalue() + is called. + """ + if self.buflist: + self.buf += ''.join(self.buflist) + self.buflist = [] + return self.buf + + +# A little test suite + +def test(): + import sys + if sys.argv[1:]: + file = sys.argv[1] + else: + file = '/etc/passwd' + lines = open(file, 'r').readlines() + text = open(file, 'r').read() + f = StringIO() + for line in lines[:-2]: + f.write(line) + f.writelines(lines[-2:]) + if f.getvalue() != text: + raise RuntimeError, 'write failed' + length = f.tell() + print('File length =', length) + f.seek(len(lines[0])) + f.write(lines[1]) + f.seek(0) + print('First line =', repr(f.readline())) + print('Position =', f.tell()) + line = f.readline() + print('Second line =', repr(line)) + f.seek(-len(line), 1) + line2 = f.read(len(line)) + if line != line2: + raise RuntimeError, 'bad result after seek back' + f.seek(len(line2), 1) + list = f.readlines() + line = list[-1] + f.seek(f.tell() - len(line)) + line2 = f.read() + if line != line2: + raise RuntimeError, 'bad result after seek back from EOF' + print('Read', len(list), 'more lines') + print('File length =', f.tell()) + if f.tell() != length: + raise RuntimeError, 'bad length' + f.truncate(length/2) + f.seek(0, 2) + print('Truncated length =', f.tell()) + if f.tell() != length/2: + raise RuntimeError, 'truncate did not adjust length' + f.close() + +if __name__ == '__main__': + test() Added: sandbox/trunk/cpy_merge/Lib/cProfile.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/cProfile.py Wed May 23 03:45:28 2007 @@ -0,0 +1,190 @@ +#! /usr/bin/env python + +"""Python interface for the 'lsprof' profiler. + Compatible with the 'profile' module. +""" + +__all__ = ["run", "runctx", "help", "Profile"] + +import _lsprof + +# ____________________________________________________________ +# Simple interface + +def run(statement, filename=None, sort=-1): + """Run statement under profiler optionally saving results in filename + + This function takes a single argument that can be passed to the + "exec" statement, and an optional file name. In all cases this + routine attempts to "exec" its first argument and gather profiling + statistics from the execution. If no file name is present, then this + function automatically prints a simple profiling report, sorted by the + standard name string (file/line/function-name) that is presented in + each line. + """ + prof = Profile() + result = None + try: + try: + prof = prof.run(statement) + except SystemExit: + pass + finally: + if filename is not None: + prof.dump_stats(filename) + else: + result = prof.print_stats(sort) + return result + +def runctx(statement, globals, locals, filename=None): + """Run statement under profiler, supplying your own globals and locals, + optionally saving results in filename. + + statement and filename have the same semantics as profile.run + """ + prof = Profile() + result = None + try: + try: + prof = prof.runctx(statement, globals, locals) + except SystemExit: + pass + finally: + if filename is not None: + prof.dump_stats(filename) + else: + result = prof.print_stats() + return result + +# Backwards compatibility. +def help(): + print("Documentation for the profile/cProfile modules can be found ") + print("in the Python Library Reference, section 'The Python Profiler'.") + +# ____________________________________________________________ + +class Profile(_lsprof.Profiler): + """Profile(custom_timer=None, time_unit=None, subcalls=True, builtins=True) + + Builds a profiler object using the specified timer function. + The default timer is a fast built-in one based on real time. + For custom timer functions returning integers, time_unit can + be a float specifying a scale (i.e. how long each integer unit + is, in seconds). + """ + + # Most of the functionality is in the base class. + # This subclass only adds convenient and backward-compatible methods. + + def print_stats(self, sort=-1): + import pstats + pstats.Stats(self).strip_dirs().sort_stats(sort).print_stats() + + def dump_stats(self, file): + import marshal + f = open(file, 'wb') + self.create_stats() + marshal.dump(self.stats, f) + f.close() + + def create_stats(self): + self.disable() + self.snapshot_stats() + + def snapshot_stats(self): + entries = self.getstats() + self.stats = {} + callersdicts = {} + # call information + for entry in entries: + func = label(entry.code) + nc = entry.callcount # ncalls column of pstats (before '/') + cc = nc - entry.reccallcount # ncalls column of pstats (after '/') + tt = entry.inlinetime # tottime column of pstats + ct = entry.totaltime # cumtime column of pstats + callers = {} + callersdicts[id(entry.code)] = callers + self.stats[func] = cc, nc, tt, ct, callers + # subcall information + for entry in entries: + if entry.calls: + func = label(entry.code) + for subentry in entry.calls: + try: + callers = callersdicts[id(subentry.code)] + except KeyError: + continue + nc = subentry.callcount + cc = nc - subentry.reccallcount + tt = subentry.inlinetime + ct = subentry.totaltime + if func in callers: + prev = callers[func] + nc += prev[0] + cc += prev[1] + tt += prev[2] + ct += prev[3] + callers[func] = nc, cc, tt, ct + + # The following two methods can be called by clients to use + # a profiler to profile a statement, given as a string. + + def run(self, cmd): + import __main__ + dict = __main__.__dict__ + return self.runctx(cmd, dict, dict) + + def runctx(self, cmd, globals, locals): + self.enable() + try: + exec(cmd, globals, locals) + finally: + self.disable() + return self + + # This method is more useful to profile a single function call. + def runcall(self, func, *args, **kw): + self.enable() + try: + return func(*args, **kw) + finally: + self.disable() + +# ____________________________________________________________ + +def label(code): + if isinstance(code, str): + return ('~', 0, code) # built-in functions ('~' sorts at the end) + else: + return (code.co_filename, code.co_firstlineno, code.co_name) + +# ____________________________________________________________ + +def main(): + import os, sys + from optparse import OptionParser + usage = "cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ..." + parser = OptionParser(usage=usage) + parser.allow_interspersed_args = False + parser.add_option('-o', '--outfile', dest="outfile", + help="Save stats to ", default=None) + parser.add_option('-s', '--sort', dest="sort", + help="Sort order when printing to stdout, based on pstats.Stats class", default=-1) + + if not sys.argv[1:]: + parser.print_usage() + sys.exit(2) + + (options, args) = parser.parse_args() + sys.argv[:] = args + + if (len(sys.argv) > 0): + sys.path.insert(0, os.path.dirname(sys.argv[0])) + run('execfile(%r)' % (sys.argv[0],), options.outfile, options.sort) + else: + parser.print_usage() + return parser + +# When invoked as main program, invoke the profiler on a script +if __name__ == '__main__': + main() Added: sandbox/trunk/cpy_merge/Lib/copy_reg.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/copy_reg.py Wed May 23 03:45:28 2007 @@ -0,0 +1,196 @@ +"""Helper to provide extensibility for pickle/cPickle. + +This is only useful to add pickle support for extension types defined in +C, not for instances of user-defined classes. +""" + +__all__ = ["pickle", "constructor", + "add_extension", "remove_extension", "clear_extension_cache"] + +dispatch_table = {} + +def pickle(ob_type, pickle_function, constructor_ob=None): + if not hasattr(pickle_function, '__call__'): + raise TypeError("reduction functions must be callable") + dispatch_table[ob_type] = pickle_function + + # The constructor_ob function is a vestige of safe for unpickling. + # There is no reason for the caller to pass it anymore. + if constructor_ob is not None: + constructor(constructor_ob) + +def constructor(object): + if not hasattr(object, '__call__'): + raise TypeError("constructors must be callable") + +# Example: provide pickling support for complex numbers. + +try: + complex +except NameError: + pass +else: + + def pickle_complex(c): + return complex, (c.real, c.imag) + + pickle(complex, pickle_complex, complex) + +# Support for pickling new-style objects + +def _reconstructor(cls, base, state): + if base is object: + obj = object.__new__(cls) + else: + obj = base.__new__(cls, state) + if base.__init__ != object.__init__: + base.__init__(obj, state) + return obj + +_HEAPTYPE = 1<<9 + +# Python code for object.__reduce_ex__ for protocols 0 and 1 + +def _reduce_ex(self, proto): + assert proto < 2 + for base in self.__class__.__mro__: + if hasattr(base, '__flags__') and not base.__flags__ & _HEAPTYPE: + break + else: + base = object # not really reachable + if base is object: + state = None + else: + if base is self.__class__: + raise TypeError, "can't pickle %s objects" % base.__name__ + state = base(self) + args = (self.__class__, base, state) + try: + getstate = self.__getstate__ + except AttributeError: + if getattr(self, "__slots__", None): + raise TypeError("a class that defines __slots__ without " + "defining __getstate__ cannot be pickled") + try: + dict = self.__dict__ + except AttributeError: + dict = None + else: + dict = getstate() + if dict: + return _reconstructor, args, dict + else: + return _reconstructor, args + +# Helper for __reduce_ex__ protocol 2 + +def __newobj__(cls, *args): + return cls.__new__(cls, *args) + +def _slotnames(cls): + """Return a list of slot names for a given class. + + This needs to find slots defined by the class and its bases, so we + can't simply return the __slots__ attribute. We must walk down + the Method Resolution Order and concatenate the __slots__ of each + class found there. (This assumes classes don't modify their + __slots__ attribute to misrepresent their slots after the class is + defined.) + """ + + # Get the value from a cache in the class if possible + names = cls.__dict__.get("__slotnames__") + if names is not None: + return names + + # Not cached -- calculate the value + names = [] + if not hasattr(cls, "__slots__"): + # This class has no slots + pass + else: + # Slots found -- gather slot names from all base classes + for c in cls.__mro__: + if "__slots__" in c.__dict__: + slots = c.__dict__['__slots__'] + # if class has a single slot, it can be given as a string + if isinstance(slots, basestring): + slots = (slots,) + for name in slots: + # special descriptors + if name in ("__dict__", "__weakref__"): + continue + # mangled names + elif name.startswith('__') and not name.endswith('__'): + names.append('_%s%s' % (c.__name__, name)) + else: + names.append(name) + + # Cache the outcome in the class if at all possible + try: + cls.__slotnames__ = names + except: + pass # But don't die if we can't + + return names + +# A registry of extension codes. This is an ad-hoc compression +# mechanism. Whenever a global reference to , is about +# to be pickled, the (, ) tuple is looked up here to see +# if it is a registered extension code for it. Extension codes are +# universal, so that the meaning of a pickle does not depend on +# context. (There are also some codes reserved for local use that +# don't have this restriction.) Codes are positive ints; 0 is +# reserved. + +_extension_registry = {} # key -> code +_inverted_registry = {} # code -> key +_extension_cache = {} # code -> object +# Don't ever rebind those names: cPickle grabs a reference to them when +# it's initialized, and won't see a rebinding. + +def add_extension(module, name, code): + """Register an extension code.""" + code = int(code) + if not 1 <= code <= 0x7fffffff: + raise ValueError, "code out of range" + key = (module, name) + if (_extension_registry.get(key) == code and + _inverted_registry.get(code) == key): + return # Redundant registrations are benign + if key in _extension_registry: + raise ValueError("key %s is already registered with code %s" % + (key, _extension_registry[key])) + if code in _inverted_registry: + raise ValueError("code %s is already in use for key %s" % + (code, _inverted_registry[code])) + _extension_registry[key] = code + _inverted_registry[code] = key + +def remove_extension(module, name, code): + """Unregister an extension code. For testing only.""" + key = (module, name) + if (_extension_registry.get(key) != code or + _inverted_registry.get(code) != key): + raise ValueError("key %s is not registered with code %s" % + (key, code)) + del _extension_registry[key] + del _inverted_registry[code] + if code in _extension_cache: + del _extension_cache[code] + +def clear_extension_cache(): + _extension_cache.clear() + +# Standard extension code assignments + +# Reserved ranges + +# First Last Count Purpose +# 1 127 127 Reserved for Python standard library +# 128 191 64 Reserved for Zope +# 192 239 48 Reserved for 3rd parties +# 240 255 16 Reserved for private use (will never be assigned) +# 256 Inf Inf Reserved for future assignment + +# Extension codes are assigned by the Python Software Foundation. Added: sandbox/trunk/cpy_merge/Lib/pickle.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/pickle.py Wed May 23 03:45:28 2007 @@ -0,0 +1,1328 @@ +"""Create portable serialized representations of Python objects. + +See module cPickle for a (much) faster implementation. +See module copy_reg for a mechanism for registering custom picklers. +See module pickletools source for extensive comments. + +Classes: + + Pickler + Unpickler + +Functions: + + dump(object, file) + dumps(object) -> string + load(file) -> object + loads(string) -> object + +Misc variables: + + __version__ + format_version + compatible_formats + +""" + +__version__ = "$Revision: 55514 $" # Code version + +from types import * +from copy_reg import dispatch_table +from copy_reg import _extension_registry, _inverted_registry, _extension_cache +import marshal +import sys +import struct +import re +import io + +__all__ = ["PickleError", "PicklingError", "UnpicklingError", "Pickler", + "Unpickler", "dump", "dumps", "load", "loads"] + +# These are purely informational; no code uses these. +format_version = "2.0" # File format version we write +compatible_formats = ["1.0", # Original protocol 0 + "1.1", # Protocol 0 with INST added + "1.2", # Original protocol 1 + "1.3", # Protocol 1 with BINFLOAT added + "2.0", # Protocol 2 + ] # Old format versions we can read + +# Keep in synch with cPickle. This is the highest protocol number we +# know how to read. +HIGHEST_PROTOCOL = 2 + +# The protocol we write by default. May be less than HIGHEST_PROTOCOL. +DEFAULT_PROTOCOL = 2 + +# Why use struct.pack() for pickling but marshal.loads() for +# unpickling? struct.pack() is 40% faster than marshal.dumps(), but +# marshal.loads() is twice as fast as struct.unpack()! +mloads = marshal.loads + +class PickleError(Exception): + """A common base class for the other pickling exceptions.""" + pass + +class PicklingError(PickleError): + """This exception is raised when an unpicklable object is passed to the + dump() method. + + """ + pass + +class UnpicklingError(PickleError): + """This exception is raised when there is a problem unpickling an object, + such as a security violation. + + Note that other exceptions may also be raised during unpickling, including + (but not necessarily limited to) AttributeError, EOFError, ImportError, + and IndexError. + + """ + pass + +# An instance of _Stop is raised by Unpickler.load_stop() in response to +# the STOP opcode, passing the object that is the result of unpickling. +class _Stop(Exception): + def __init__(self, value): + self.value = value + +# Jython has PyStringMap; it's a dict subclass with string keys +try: + from org.python.core import PyStringMap +except ImportError: + PyStringMap = None + +# Pickle opcodes. See pickletools.py for extensive docs. The listing +# here is in kind-of alphabetical order of 1-character pickle code. +# pickletools groups them by purpose. + +MARK = b'(' # push special markobject on stack +STOP = b'.' # every pickle ends with STOP +POP = b'0' # discard topmost stack item +POP_MARK = b'1' # discard stack top through topmost markobject +DUP = b'2' # duplicate top stack item +FLOAT = b'F' # push float object; decimal string argument +INT = b'I' # push integer or bool; decimal string argument +BININT = b'J' # push four-byte signed int +BININT1 = b'K' # push 1-byte unsigned int +LONG = b'L' # push long; decimal string argument +BININT2 = b'M' # push 2-byte unsigned int +NONE = b'N' # push None +PERSID = b'P' # push persistent object; id is taken from string arg +BINPERSID = b'Q' # " " " ; " " " " stack +REDUCE = b'R' # apply callable to argtuple, both on stack +STRING = b'S' # push string; NL-terminated string argument +BINSTRING = b'T' # push string; counted binary string argument +SHORT_BINSTRING= b'U' # " " ; " " " " < 256 bytes +UNICODE = b'V' # push Unicode string; raw-unicode-escaped'd argument +BINUNICODE = b'X' # " " " ; counted UTF-8 string argument +APPEND = b'a' # append stack top to list below it +BUILD = b'b' # call __setstate__ or __dict__.update() +GLOBAL = b'c' # push self.find_class(modname, name); 2 string args +DICT = b'd' # build a dict from stack items +EMPTY_DICT = b'}' # push empty dict +APPENDS = b'e' # extend list on stack by topmost stack slice +GET = b'g' # push item from memo on stack; index is string arg +BINGET = b'h' # " " " " " " ; " " 1-byte arg +INST = b'i' # build & push class instance +LONG_BINGET = b'j' # push item from memo on stack; index is 4-byte arg +LIST = b'l' # build list from topmost stack items +EMPTY_LIST = b']' # push empty list +OBJ = b'o' # build & push class instance +PUT = b'p' # store stack top in memo; index is string arg +BINPUT = b'q' # " " " " " ; " " 1-byte arg +LONG_BINPUT = b'r' # " " " " " ; " " 4-byte arg +SETITEM = b's' # add key+value pair to dict +TUPLE = b't' # build tuple from topmost stack items +EMPTY_TUPLE = b')' # push empty tuple +SETITEMS = b'u' # modify dict by adding topmost key+value pairs +BINFLOAT = b'G' # push float; arg is 8-byte float encoding + +TRUE = b'I01\n' # not an opcode; see INT docs in pickletools.py +FALSE = b'I00\n' # not an opcode; see INT docs in pickletools.py + +# Protocol 2 + +PROTO = b'\x80' # identify pickle protocol +NEWOBJ = b'\x81' # build object by applying cls.__new__ to argtuple +EXT1 = b'\x82' # push object from extension registry; 1-byte index +EXT2 = b'\x83' # ditto, but 2-byte index +EXT4 = b'\x84' # ditto, but 4-byte index +TUPLE1 = b'\x85' # build 1-tuple from stack top +TUPLE2 = b'\x86' # build 2-tuple from two topmost stack items +TUPLE3 = b'\x87' # build 3-tuple from three topmost stack items +NEWTRUE = b'\x88' # push True +NEWFALSE = b'\x89' # push False +LONG1 = b'\x8a' # push long from < 256 bytes +LONG4 = b'\x8b' # push really big long + +_tuplesize2code = [EMPTY_TUPLE, TUPLE1, TUPLE2, TUPLE3] + + +__all__.extend([x for x in dir() if re.match("[A-Z][A-Z0-9_]+$",x)]) + + +# Pickling machinery + +class Pickler: + + def __init__(self, file, protocol=None): + """This takes a binary file for writing a pickle data stream. + + All protocols now read and write bytes. + + The optional protocol argument tells the pickler to use the + given protocol; supported protocols are 0, 1, 2. The default + protocol is 2; it's been supported for many years now. + + Protocol 1 is more efficient than protocol 0; protocol 2 is + more efficient than protocol 1. + + Specifying a negative protocol version selects the highest + protocol version supported. The higher the protocol used, the + more recent the version of Python needed to read the pickle + produced. + + The file parameter must have a write() method that accepts a single + string argument. It can thus be an open file object, a StringIO + object, or any other custom object that meets this interface. + + """ + if protocol is None: + protocol = DEFAULT_PROTOCOL + if protocol < 0: + protocol = HIGHEST_PROTOCOL + elif not 0 <= protocol <= HIGHEST_PROTOCOL: + raise ValueError("pickle protocol must be <= %d" % HIGHEST_PROTOCOL) + self.write = file.write + self.memo = {} + self.proto = int(protocol) + self.bin = protocol >= 1 + self.fast = 0 + + def clear_memo(self): + """Clears the pickler's "memo". + + The memo is the data structure that remembers which objects the + pickler has already seen, so that shared or recursive objects are + pickled by reference and not by value. This method is useful when + re-using picklers. + + """ + self.memo.clear() + + def dump(self, obj): + """Write a pickled representation of obj to the open file.""" + if self.proto >= 2: + self.write(PROTO + bytes([self.proto])) + self.save(obj) + self.write(STOP) + + def memoize(self, obj): + """Store an object in the memo.""" + + # The Pickler memo is a dictionary mapping object ids to 2-tuples + # that contain the Unpickler memo key and the object being memoized. + # The memo key is written to the pickle and will become + # the key in the Unpickler's memo. The object is stored in the + # Pickler memo so that transient objects are kept alive during + # pickling. + + # The use of the Unpickler memo length as the memo key is just a + # convention. The only requirement is that the memo values be unique. + # But there appears no advantage to any other scheme, and this + # scheme allows the Unpickler memo to be implemented as a plain (but + # growable) array, indexed by memo key. + if self.fast: + return + assert id(obj) not in self.memo + memo_len = len(self.memo) + self.write(self.put(memo_len)) + self.memo[id(obj)] = memo_len, obj + + # Return a PUT (BINPUT, LONG_BINPUT) opcode string, with argument i. + def put(self, i, pack=struct.pack): + if self.bin: + if i < 256: + return BINPUT + bytes([i]) + else: + return LONG_BINPUT + pack("= 2 and getattr(func, "__name__", "") == "__newobj__": + # A __reduce__ implementation can direct protocol 2 to + # use the more efficient NEWOBJ opcode, while still + # allowing protocol 0 and 1 to work normally. For this to + # work, the function returned by __reduce__ should be + # called __newobj__, and its first argument should be a + # new-style class. The implementation for __newobj__ + # should be as follows, although pickle has no way to + # verify this: + # + # def __newobj__(cls, *args): + # return cls.__new__(cls, *args) + # + # Protocols 0 and 1 will pickle a reference to __newobj__, + # while protocol 2 (and above) will pickle a reference to + # cls, the remaining args tuple, and the NEWOBJ code, + # which calls cls.__new__(cls, *args) at unpickling time + # (see load_newobj below). If __reduce__ returns a + # three-tuple, the state from the third tuple item will be + # pickled regardless of the protocol, calling __setstate__ + # at unpickling time (see load_build below). + # + # Note that no standard __newobj__ implementation exists; + # you have to provide your own. This is to enforce + # compatibility with Python 2.2 (pickles written using + # protocol 0 or 1 in Python 2.3 should be unpicklable by + # Python 2.2). + cls = args[0] + if not hasattr(cls, "__new__"): + raise PicklingError( + "args[0] from __newobj__ args has no __new__") + if obj is not None and cls is not obj.__class__: + raise PicklingError( + "args[0] from __newobj__ args has the wrong class") + args = args[1:] + save(cls) + save(args) + write(NEWOBJ) + else: + save(func) + save(args) + write(REDUCE) + + if obj is not None: + self.memoize(obj) + + # More new special cases (that work with older protocols as + # well): when __reduce__ returns a tuple with 4 or 5 items, + # the 4th and 5th item should be iterators that provide list + # items and dict items (as (key, value) tuples), or None. + + if listitems is not None: + self._batch_appends(listitems) + + if dictitems is not None: + self._batch_setitems(dictitems) + + if state is not None: + save(state) + write(BUILD) + + # Methods below this point are dispatched through the dispatch table + + dispatch = {} + + def save_none(self, obj): + self.write(NONE) + dispatch[NoneType] = save_none + + def save_bool(self, obj): + if self.proto >= 2: + self.write(obj and NEWTRUE or NEWFALSE) + else: + self.write(obj and TRUE or FALSE) + dispatch[bool] = save_bool + + def save_int(self, obj, pack=struct.pack): + if self.bin: + # If the int is small enough to fit in a signed 4-byte 2's-comp + # format, we can store it more efficiently than the general + # case. + # First one- and two-byte unsigned ints: + if obj >= 0: + if obj <= 0xff: + self.write(BININT1 + bytes([obj])) + return + if obj <= 0xffff: + self.write(BININT2 + bytes([obj&0xff, obj>>8])) + return + # Next check for 4-byte signed ints: + high_bits = obj >> 31 # note that Python shift sign-extends + if high_bits == 0 or high_bits == -1: + # All high bits are copies of bit 2**31, so the value + # fits in a 4-byte signed int. + self.write(BININT + pack("= 0: + if obj <= 0xff: + self.write(BININT1 + bytes([obj])) + return + if obj <= 0xffff: + self.write(BININT2 + bytes([obj&0xff, obj>>8])) + return + # Next check for 4-byte signed ints: + high_bits = obj >> 31 # note that Python shift sign-extends + if high_bits == 0 or high_bits == -1: + # All high bits are copies of bit 2**31, so the value + # fits in a 4-byte signed int. + self.write(BININT + pack("= 2: + encoded = encode_long(obj) + n = len(encoded) + if n < 256: + self.write(LONG1 + bytes([n]) + encoded) + else: + self.write(LONG4 + pack("d', obj)) + else: + self.write(FLOAT + bytes(repr(obj)) + b'\n') + dispatch[FloatType] = save_float + + def save_string(self, obj, pack=struct.pack): + if self.bin: + n = len(obj) + if n < 256: + self.write(SHORT_BINSTRING + bytes([n]) + bytes(obj)) + else: + self.write(BINSTRING + pack("= 2: + for element in obj: + save(element) + # Subtle. Same as in the big comment below. + if id(obj) in memo: + get = self.get(memo[id(obj)][0]) + write(POP * n + get) + else: + write(_tuplesize2code[n]) + self.memoize(obj) + return + + # proto 0 or proto 1 and tuple isn't empty, or proto > 1 and tuple + # has more than 3 elements. + write(MARK) + for element in obj: + save(element) + + if id(obj) in memo: + # Subtle. d was not in memo when we entered save_tuple(), so + # the process of saving the tuple's elements must have saved + # the tuple itself: the tuple is recursive. The proper action + # now is to throw away everything we put on the stack, and + # simply GET the tuple (it's already constructed). This check + # could have been done in the "for element" loop instead, but + # recursive tuples are a rare thing. + get = self.get(memo[id(obj)][0]) + if proto: + write(POP_MARK + get) + else: # proto 0 -- POP_MARK not available + write(POP * (n+1) + get) + return + + # No recursion. + self.write(TUPLE) + self.memoize(obj) + + dispatch[TupleType] = save_tuple + + # save_empty_tuple() isn't used by anything in Python 2.3. However, I + # found a Pickler subclass in Zope3 that calls it, so it's not harmless + # to remove it. + def save_empty_tuple(self, obj): + self.write(EMPTY_TUPLE) + + def save_list(self, obj): + write = self.write + + if self.bin: + write(EMPTY_LIST) + else: # proto 0 -- can't use EMPTY_LIST + write(MARK + LIST) + + self.memoize(obj) + self._batch_appends(iter(obj)) + + dispatch[ListType] = save_list + + # Keep in synch with cPickle's BATCHSIZE. Nothing will break if it gets + # out of synch, though. + _BATCHSIZE = 1000 + + def _batch_appends(self, items): + # Helper to batch up APPENDS sequences + save = self.save + write = self.write + + if not self.bin: + for x in items: + save(x) + write(APPEND) + return + + r = range(self._BATCHSIZE) + while items is not None: + tmp = [] + for i in r: + try: + x = next(items) + tmp.append(x) + except StopIteration: + items = None + break + n = len(tmp) + if n > 1: + write(MARK) + for x in tmp: + save(x) + write(APPENDS) + elif n: + save(tmp[0]) + write(APPEND) + # else tmp is empty, and we're done + + def save_dict(self, obj): + write = self.write + + if self.bin: + write(EMPTY_DICT) + else: # proto 0 -- can't use EMPTY_DICT + write(MARK + DICT) + + self.memoize(obj) + self._batch_setitems(iter(obj.items())) + + dispatch[DictionaryType] = save_dict + if not PyStringMap is None: + dispatch[PyStringMap] = save_dict + + def _batch_setitems(self, items): + # Helper to batch up SETITEMS sequences; proto >= 1 only + save = self.save + write = self.write + + if not self.bin: + for k, v in items: + save(k) + save(v) + write(SETITEM) + return + + r = range(self._BATCHSIZE) + while items is not None: + tmp = [] + for i in r: + try: + tmp.append(next(items)) + except StopIteration: + items = None + break + n = len(tmp) + if n > 1: + write(MARK) + for k, v in tmp: + save(k) + save(v) + write(SETITEMS) + elif n: + k, v = tmp[0] + save(k) + save(v) + write(SETITEM) + # else tmp is empty, and we're done + + def save_global(self, obj, name=None, pack=struct.pack): + write = self.write + memo = self.memo + + if name is None: + name = obj.__name__ + + module = getattr(obj, "__module__", None) + if module is None: + module = whichmodule(obj, name) + + try: + __import__(module) + mod = sys.modules[module] + klass = getattr(mod, name) + except (ImportError, KeyError, AttributeError): + raise PicklingError( + "Can't pickle %r: it's not found as %s.%s" % + (obj, module, name)) + else: + if klass is not obj: + raise PicklingError( + "Can't pickle %r: it's not the same object as %s.%s" % + (obj, module, name)) + + if self.proto >= 2: + code = _extension_registry.get((module, name)) + if code: + assert code > 0 + if code <= 0xff: + write(EXT1 + bytes([code])) + elif code <= 0xffff: + write(EXT2 + bytes([code&0xff, code>>8])) + else: + write(EXT4 + pack("d', self.read(8))[0]) + dispatch[BINFLOAT[0]] = load_binfloat + + def load_string(self): + rep = self.readline()[:-1] + for q in "\"'": # double or single quote + if rep.startswith(q): + if not rep.endswith(q): + raise ValueError, "insecure string pickle" + rep = rep[len(q):-len(q)] + break + else: + raise ValueError, "insecure string pickle" + self.append(str8(rep.decode("string-escape"))) + dispatch[STRING[0]] = load_string + + def load_binstring(self): + len = mloads(b'i' + self.read(4)) + self.append(str8(self.read(len))) + dispatch[BINSTRING[0]] = load_binstring + + def load_unicode(self): + self.append(str(self.readline()[:-1], 'raw-unicode-escape')) + dispatch[UNICODE[0]] = load_unicode + + def load_binunicode(self): + len = mloads(b'i' + self.read(4)) + self.append(str(self.read(len), 'utf-8')) + dispatch[BINUNICODE[0]] = load_binunicode + + def load_short_binstring(self): + len = ord(self.read(1)) + self.append(str8(self.read(len))) + dispatch[SHORT_BINSTRING[0]] = load_short_binstring + + def load_tuple(self): + k = self.marker() + self.stack[k:] = [tuple(self.stack[k+1:])] + dispatch[TUPLE[0]] = load_tuple + + def load_empty_tuple(self): + self.stack.append(()) + dispatch[EMPTY_TUPLE[0]] = load_empty_tuple + + def load_tuple1(self): + self.stack[-1] = (self.stack[-1],) + dispatch[TUPLE1[0]] = load_tuple1 + + def load_tuple2(self): + self.stack[-2:] = [(self.stack[-2], self.stack[-1])] + dispatch[TUPLE2[0]] = load_tuple2 + + def load_tuple3(self): + self.stack[-3:] = [(self.stack[-3], self.stack[-2], self.stack[-1])] + dispatch[TUPLE3[0]] = load_tuple3 + + def load_empty_list(self): + self.stack.append([]) + dispatch[EMPTY_LIST[0]] = load_empty_list + + def load_empty_dictionary(self): + self.stack.append({}) + dispatch[EMPTY_DICT[0]] = load_empty_dictionary + + def load_list(self): + k = self.marker() + self.stack[k:] = [self.stack[k+1:]] + dispatch[LIST[0]] = load_list + + def load_dict(self): + k = self.marker() + d = {} + items = self.stack[k+1:] + for i in range(0, len(items), 2): + key = items[i] + value = items[i+1] + d[key] = value + self.stack[k:] = [d] + dispatch[DICT[0]] = load_dict + + # INST and OBJ differ only in how they get a class object. It's not + # only sensible to do the rest in a common routine, the two routines + # previously diverged and grew different bugs. + # klass is the class to instantiate, and k points to the topmost mark + # object, following which are the arguments for klass.__init__. + def _instantiate(self, klass, k): + args = tuple(self.stack[k+1:]) + del self.stack[k:] + instantiated = 0 + if (not args and + type(klass) is ClassType and + not hasattr(klass, "__getinitargs__")): + value = _EmptyClass() + value.__class__ = klass + instantiated = 1 + if not instantiated: + try: + value = klass(*args) + except TypeError as err: + raise TypeError, "in constructor for %s: %s" % ( + klass.__name__, str(err)), sys.exc_info()[2] + self.append(value) + + def load_inst(self): + module = self.readline()[:-1] + name = self.readline()[:-1] + klass = self.find_class(module, name) + self._instantiate(klass, self.marker()) + dispatch[INST[0]] = load_inst + + def load_obj(self): + # Stack is ... markobject classobject arg1 arg2 ... + k = self.marker() + klass = self.stack.pop(k+1) + self._instantiate(klass, k) + dispatch[OBJ[0]] = load_obj + + def load_newobj(self): + args = self.stack.pop() + cls = self.stack[-1] + obj = cls.__new__(cls, *args) + self.stack[-1] = obj + dispatch[NEWOBJ[0]] = load_newobj + + def load_global(self): + module = self.readline()[:-1] + name = self.readline()[:-1] + klass = self.find_class(module, name) + self.append(klass) + dispatch[GLOBAL[0]] = load_global + + def load_ext1(self): + code = ord(self.read(1)) + self.get_extension(code) + dispatch[EXT1[0]] = load_ext1 + + def load_ext2(self): + code = mloads(b'i' + self.read(2) + b'\000\000') + self.get_extension(code) + dispatch[EXT2[0]] = load_ext2 + + def load_ext4(self): + code = mloads(b'i' + self.read(4)) + self.get_extension(code) + dispatch[EXT4[0]] = load_ext4 + + def get_extension(self, code): + nil = [] + obj = _extension_cache.get(code, nil) + if obj is not nil: + self.append(obj) + return + key = _inverted_registry.get(code) + if not key: + raise ValueError("unregistered extension code %d" % code) + obj = self.find_class(*key) + _extension_cache[code] = obj + self.append(obj) + + def find_class(self, module, name): + # Subclasses may override this + module = str(module) + name = str(name) + __import__(module) + mod = sys.modules[module] + klass = getattr(mod, name) + return klass + + def load_reduce(self): + stack = self.stack + args = stack.pop() + func = stack[-1] + value = func(*args) + stack[-1] = value + dispatch[REDUCE[0]] = load_reduce + + def load_pop(self): + del self.stack[-1] + dispatch[POP[0]] = load_pop + + def load_pop_mark(self): + k = self.marker() + del self.stack[k:] + dispatch[POP_MARK[0]] = load_pop_mark + + def load_dup(self): + self.append(self.stack[-1]) + dispatch[DUP[0]] = load_dup + + def load_get(self): + self.append(self.memo[str8(self.readline())[:-1]]) + dispatch[GET[0]] = load_get + + def load_binget(self): + i = ord(self.read(1)) + self.append(self.memo[repr(i)]) + dispatch[BINGET[0]] = load_binget + + def load_long_binget(self): + i = mloads(b'i' + self.read(4)) + self.append(self.memo[repr(i)]) + dispatch[LONG_BINGET[0]] = load_long_binget + + def load_put(self): + self.memo[str(self.readline()[:-1])] = self.stack[-1] + dispatch[PUT[0]] = load_put + + def load_binput(self): + i = ord(self.read(1)) + self.memo[repr(i)] = self.stack[-1] + dispatch[BINPUT[0]] = load_binput + + def load_long_binput(self): + i = mloads(b'i' + self.read(4)) + self.memo[repr(i)] = self.stack[-1] + dispatch[LONG_BINPUT[0]] = load_long_binput + + def load_append(self): + stack = self.stack + value = stack.pop() + list = stack[-1] + list.append(value) + dispatch[APPEND[0]] = load_append + + def load_appends(self): + stack = self.stack + mark = self.marker() + list = stack[mark - 1] + list.extend(stack[mark + 1:]) + del stack[mark:] + dispatch[APPENDS[0]] = load_appends + + def load_setitem(self): + stack = self.stack + value = stack.pop() + key = stack.pop() + dict = stack[-1] + dict[key] = value + dispatch[SETITEM[0]] = load_setitem + + def load_setitems(self): + stack = self.stack + mark = self.marker() + dict = stack[mark - 1] + for i in range(mark + 1, len(stack), 2): + dict[stack[i]] = stack[i + 1] + + del stack[mark:] + dispatch[SETITEMS[0]] = load_setitems + + def load_build(self): + stack = self.stack + state = stack.pop() + inst = stack[-1] + setstate = getattr(inst, "__setstate__", None) + if setstate: + setstate(state) + return + slotstate = None + if isinstance(state, tuple) and len(state) == 2: + state, slotstate = state + if state: + inst.__dict__.update(state) + if slotstate: + for k, v in slotstate.items(): + setattr(inst, k, v) + dispatch[BUILD[0]] = load_build + + def load_mark(self): + self.append(self.mark) + dispatch[MARK[0]] = load_mark + + def load_stop(self): + value = self.stack.pop() + raise _Stop(value) + dispatch[STOP[0]] = load_stop + +# Helper class for load_inst/load_obj + +class _EmptyClass: + pass + +# Encode/decode longs in linear time. + +import binascii as _binascii + +def encode_long(x): + r"""Encode a long to a two's complement little-endian binary string. + Note that 0 is a special case, returning an empty string, to save a + byte in the LONG1 pickling context. + + >>> encode_long(0) + b'' + >>> encode_long(255) + b'\xff\x00' + >>> encode_long(32767) + b'\xff\x7f' + >>> encode_long(-256) + b'\x00\xff' + >>> encode_long(-32768) + b'\x00\x80' + >>> encode_long(-128) + b'\x80' + >>> encode_long(127) + b'\x7f' + >>> + """ + + if x == 0: + return b'' + if x > 0: + ashex = hex(x) + assert ashex.startswith("0x") + njunkchars = 2 + ashex.endswith('L') + nibbles = len(ashex) - njunkchars + if nibbles & 1: + # need an even # of nibbles for unhexlify + ashex = "0x0" + ashex[2:] + elif int(ashex[2], 16) >= 8: + # "looks negative", so need a byte of sign bits + ashex = "0x00" + ashex[2:] + else: + # Build the 256's-complement: (1L << nbytes) + x. The trick is + # to find the number of bytes in linear time (although that should + # really be a constant-time task). + ashex = hex(-x) + assert ashex.startswith("0x") + njunkchars = 2 + ashex.endswith('L') + nibbles = len(ashex) - njunkchars + if nibbles & 1: + # Extend to a full byte. + nibbles += 1 + nbits = nibbles * 4 + x += 1 << nbits + assert x > 0 + ashex = hex(x) + njunkchars = 2 + ashex.endswith('L') + newnibbles = len(ashex) - njunkchars + if newnibbles < nibbles: + ashex = "0x" + "0" * (nibbles - newnibbles) + ashex[2:] + if int(ashex[2], 16) < 8: + # "looks positive", so need a byte of sign bits + ashex = "0xff" + ashex[2:] + + if ashex.endswith('L'): + ashex = ashex[2:-1] + else: + ashex = ashex[2:] + assert len(ashex) & 1 == 0, (x, ashex) + binary = _binascii.unhexlify(ashex) + return bytes(binary[::-1]) + +def decode_long(data): + r"""Decode a long from a two's complement little-endian binary string. + + >>> decode_long(b'') + 0 + >>> decode_long(b"\xff\x00") + 255 + >>> decode_long(b"\xff\x7f") + 32767 + >>> decode_long(b"\x00\xff") + -256 + >>> decode_long(b"\x00\x80") + -32768 + >>> decode_long(b"\x80") + -128 + >>> decode_long(b"\x7f") + 127 + """ + + nbytes = len(data) + if nbytes == 0: + return 0 + ashex = _binascii.hexlify(data[::-1]) + n = int(ashex, 16) # quadratic time before Python 2.3; linear now + if data[-1] >= 0x80: + n -= 1 << (nbytes * 8) + return n + +# Shorthands + +def dump(obj, file, protocol=None): + Pickler(file, protocol).dump(obj) + +def dumps(obj, protocol=None): + f = io.BytesIO() + Pickler(f, protocol).dump(obj) + res = f.getvalue() + assert isinstance(res, bytes) + return res + +def load(file): + return Unpickler(file).load() + +def loads(s): + if isinstance(s, str): + raise TypeError("Can't load pickle from unicode string") + file = io.BytesIO(s) + return Unpickler(file).load() + +# Doctest + +def _test(): + import doctest + return doctest.testmod() + +if __name__ == "__main__": + _test() Added: sandbox/trunk/cpy_merge/Lib/pickletools.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/pickletools.py Wed May 23 03:45:28 2007 @@ -0,0 +1,2257 @@ +'''"Executable documentation" for the pickle module. + +Extensive comments about the pickle protocols and pickle-machine opcodes +can be found here. Some functions meant for external use: + +genops(pickle) + Generate all the opcodes in a pickle, as (opcode, arg, position) triples. + +dis(pickle, out=None, memo=None, indentlevel=4) + Print a symbolic disassembly of a pickle. +''' + +__all__ = ['dis', + 'genops', + ] + +# Other ideas: +# +# - A pickle verifier: read a pickle and check it exhaustively for +# well-formedness. dis() does a lot of this already. +# +# - A protocol identifier: examine a pickle and return its protocol number +# (== the highest .proto attr value among all the opcodes in the pickle). +# dis() already prints this info at the end. +# +# - A pickle optimizer: for example, tuple-building code is sometimes more +# elaborate than necessary, catering for the possibility that the tuple +# is recursive. Or lots of times a PUT is generated that's never accessed +# by a later GET. + + +""" +"A pickle" is a program for a virtual pickle machine (PM, but more accurately +called an unpickling machine). It's a sequence of opcodes, interpreted by the +PM, building an arbitrarily complex Python object. + +For the most part, the PM is very simple: there are no looping, testing, or +conditional instructions, no arithmetic and no function calls. Opcodes are +executed once each, from first to last, until a STOP opcode is reached. + +The PM has two data areas, "the stack" and "the memo". + +Many opcodes push Python objects onto the stack; e.g., INT pushes a Python +integer object on the stack, whose value is gotten from a decimal string +literal immediately following the INT opcode in the pickle bytestream. Other +opcodes take Python objects off the stack. The result of unpickling is +whatever object is left on the stack when the final STOP opcode is executed. + +The memo is simply an array of objects, or it can be implemented as a dict +mapping little integers to objects. The memo serves as the PM's "long term +memory", and the little integers indexing the memo are akin to variable +names. Some opcodes pop a stack object into the memo at a given index, +and others push a memo object at a given index onto the stack again. + +At heart, that's all the PM has. Subtleties arise for these reasons: + ++ Object identity. Objects can be arbitrarily complex, and subobjects + may be shared (for example, the list [a, a] refers to the same object a + twice). It can be vital that unpickling recreate an isomorphic object + graph, faithfully reproducing sharing. + ++ Recursive objects. For example, after "L = []; L.append(L)", L is a + list, and L[0] is the same list. This is related to the object identity + point, and some sequences of pickle opcodes are subtle in order to + get the right result in all cases. + ++ Things pickle doesn't know everything about. Examples of things pickle + does know everything about are Python's builtin scalar and container + types, like ints and tuples. They generally have opcodes dedicated to + them. For things like module references and instances of user-defined + classes, pickle's knowledge is limited. Historically, many enhancements + have been made to the pickle protocol in order to do a better (faster, + and/or more compact) job on those. + ++ Backward compatibility and micro-optimization. As explained below, + pickle opcodes never go away, not even when better ways to do a thing + get invented. The repertoire of the PM just keeps growing over time. + For example, protocol 0 had two opcodes for building Python integers (INT + and LONG), protocol 1 added three more for more-efficient pickling of short + integers, and protocol 2 added two more for more-efficient pickling of + long integers (before protocol 2, the only ways to pickle a Python long + took time quadratic in the number of digits, for both pickling and + unpickling). "Opcode bloat" isn't so much a subtlety as a source of + wearying complication. + + +Pickle protocols: + +For compatibility, the meaning of a pickle opcode never changes. Instead new +pickle opcodes get added, and each version's unpickler can handle all the +pickle opcodes in all protocol versions to date. So old pickles continue to +be readable forever. The pickler can generally be told to restrict itself to +the subset of opcodes available under previous protocol versions too, so that +users can create pickles under the current version readable by older +versions. However, a pickle does not contain its version number embedded +within it. If an older unpickler tries to read a pickle using a later +protocol, the result is most likely an exception due to seeing an unknown (in +the older unpickler) opcode. + +The original pickle used what's now called "protocol 0", and what was called +"text mode" before Python 2.3. The entire pickle bytestream is made up of +printable 7-bit ASCII characters, plus the newline character, in protocol 0. +That's why it was called text mode. Protocol 0 is small and elegant, but +sometimes painfully inefficient. + +The second major set of additions is now called "protocol 1", and was called +"binary mode" before Python 2.3. This added many opcodes with arguments +consisting of arbitrary bytes, including NUL bytes and unprintable "high bit" +bytes. Binary mode pickles can be substantially smaller than equivalent +text mode pickles, and sometimes faster too; e.g., BININT represents a 4-byte +int as 4 bytes following the opcode, which is cheaper to unpickle than the +(perhaps) 11-character decimal string attached to INT. Protocol 1 also added +a number of opcodes that operate on many stack elements at once (like APPENDS +and SETITEMS), and "shortcut" opcodes (like EMPTY_DICT and EMPTY_TUPLE). + +The third major set of additions came in Python 2.3, and is called "protocol +2". This added: + +- A better way to pickle instances of new-style classes (NEWOBJ). + +- A way for a pickle to identify its protocol (PROTO). + +- Time- and space- efficient pickling of long ints (LONG{1,4}). + +- Shortcuts for small tuples (TUPLE{1,2,3}}. + +- Dedicated opcodes for bools (NEWTRUE, NEWFALSE). + +- The "extension registry", a vector of popular objects that can be pushed + efficiently by index (EXT{1,2,4}). This is akin to the memo and GET, but + the registry contents are predefined (there's nothing akin to the memo's + PUT). + +Another independent change with Python 2.3 is the abandonment of any +pretense that it might be safe to load pickles received from untrusted +parties -- no sufficient security analysis has been done to guarantee +this and there isn't a use case that warrants the expense of such an +analysis. + +To this end, all tests for __safe_for_unpickling__ or for +copy_reg.safe_constructors are removed from the unpickling code. +References to these variables in the descriptions below are to be seen +as describing unpickling in Python 2.2 and before. +""" + +# Meta-rule: Descriptions are stored in instances of descriptor objects, +# with plain constructors. No meta-language is defined from which +# descriptors could be constructed. If you want, e.g., XML, write a little +# program to generate XML from the objects. + +############################################################################## +# Some pickle opcodes have an argument, following the opcode in the +# bytestream. An argument is of a specific type, described by an instance +# of ArgumentDescriptor. These are not to be confused with arguments taken +# off the stack -- ArgumentDescriptor applies only to arguments embedded in +# the opcode stream, immediately following an opcode. + +# Represents the number of bytes consumed by an argument delimited by the +# next newline character. +UP_TO_NEWLINE = -1 + +# Represents the number of bytes consumed by a two-argument opcode where +# the first argument gives the number of bytes in the second argument. +TAKEN_FROM_ARGUMENT1 = -2 # num bytes is 1-byte unsigned int +TAKEN_FROM_ARGUMENT4 = -3 # num bytes is 4-byte signed little-endian int + +class ArgumentDescriptor(object): + __slots__ = ( + # name of descriptor record, also a module global name; a string + 'name', + + # length of argument, in bytes; an int; UP_TO_NEWLINE and + # TAKEN_FROM_ARGUMENT{1,4} are negative values for variable-length + # cases + 'n', + + # a function taking a file-like object, reading this kind of argument + # from the object at the current position, advancing the current + # position by n bytes, and returning the value of the argument + 'reader', + + # human-readable docs for this arg descriptor; a string + 'doc', + ) + + def __init__(self, name, n, reader, doc): + assert isinstance(name, str) + self.name = name + + assert isinstance(n, int) and (n >= 0 or + n in (UP_TO_NEWLINE, + TAKEN_FROM_ARGUMENT1, + TAKEN_FROM_ARGUMENT4)) + self.n = n + + self.reader = reader + + assert isinstance(doc, str) + self.doc = doc + +from struct import unpack as _unpack + +def read_uint1(f): + r""" + >>> import io + >>> read_uint1(io.BytesIO(b'\xff')) + 255 + """ + + data = f.read(1) + if data: + return data[0] + raise ValueError("not enough data in stream to read uint1") + +uint1 = ArgumentDescriptor( + name='uint1', + n=1, + reader=read_uint1, + doc="One-byte unsigned integer.") + + +def read_uint2(f): + r""" + >>> import io + >>> read_uint2(io.BytesIO(b'\xff\x00')) + 255 + >>> read_uint2(io.BytesIO(b'\xff\xff')) + 65535 + """ + + data = f.read(2) + if len(data) == 2: + return _unpack(">> import io + >>> read_int4(io.BytesIO(b'\xff\x00\x00\x00')) + 255 + >>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31) + True + """ + + data = f.read(4) + if len(data) == 4: + return _unpack(">> import io + >>> read_stringnl(io.BytesIO(b"'abcd'\nefg\n")) + 'abcd' + + >>> read_stringnl(io.BytesIO(b"\n")) + Traceback (most recent call last): + ... + ValueError: no string quotes around b'' + + >>> read_stringnl(io.BytesIO(b"\n"), stripquotes=False) + '' + + >>> read_stringnl(io.BytesIO(b"''\n")) + '' + + >>> read_stringnl(io.BytesIO(b'"abcd"')) + Traceback (most recent call last): + ... + ValueError: no newline found when trying to read stringnl + + Embedded escapes are undone in the result. + >>> read_stringnl(io.BytesIO(br"'a\n\\b\x00c\td'" + b"\n'e'")) + 'a\n\\b\x00c\td' + """ + + data = readline(f) + if not data.endswith('\n'): + raise ValueError("no newline found when trying to read stringnl") + data = data[:-1] # lose the newline + + if stripquotes: + for q in "'\"": + if data.startswith(q): + if not data.endswith(q): + raise ValueError("strinq quote %r not found at both " + "ends of %r" % (q, data)) + data = data[1:-1] + break + else: + raise ValueError("no string quotes around %r" % data) + + # I'm not sure when 'string_escape' was added to the std codecs; it's + # crazy not to use it if it's there. + if decode: + data = data.decode('string_escape') + return data + +stringnl = ArgumentDescriptor( + name='stringnl', + n=UP_TO_NEWLINE, + reader=read_stringnl, + doc="""A newline-terminated string. + + This is a repr-style string, with embedded escapes, and + bracketing quotes. + """) + +def read_stringnl_noescape(f): + return read_stringnl(f, decode=False, stripquotes=False) + +stringnl_noescape = ArgumentDescriptor( + name='stringnl_noescape', + n=UP_TO_NEWLINE, + reader=read_stringnl_noescape, + doc="""A newline-terminated string. + + This is a str-style string, without embedded escapes, + or bracketing quotes. It should consist solely of + printable ASCII characters. + """) + +def read_stringnl_noescape_pair(f): + r""" + >>> import io + >>> read_stringnl_noescape_pair(io.BytesIO(b"Queue\nEmpty\njunk")) + 'Queue Empty' + """ + + return "%s %s" % (read_stringnl_noescape(f), read_stringnl_noescape(f)) + +stringnl_noescape_pair = ArgumentDescriptor( + name='stringnl_noescape_pair', + n=UP_TO_NEWLINE, + reader=read_stringnl_noescape_pair, + doc="""A pair of newline-terminated strings. + + These are str-style strings, without embedded + escapes, or bracketing quotes. They should + consist solely of printable ASCII characters. + The pair is returned as a single string, with + a single blank separating the two strings. + """) + +def read_string4(f): + r""" + >>> import io + >>> read_string4(io.BytesIO(b"\x00\x00\x00\x00abc")) + '' + >>> read_string4(io.BytesIO(b"\x03\x00\x00\x00abcdef")) + 'abc' + >>> read_string4(io.BytesIO(b"\x00\x00\x00\x03abcdef")) + Traceback (most recent call last): + ... + ValueError: expected 50331648 bytes in a string4, but only 6 remain + """ + + n = read_int4(f) + if n < 0: + raise ValueError("string4 byte count < 0: %d" % n) + data = f.read(n) + if len(data) == n: + return data.decode("latin-1") + raise ValueError("expected %d bytes in a string4, but only %d remain" % + (n, len(data))) + +string4 = ArgumentDescriptor( + name="string4", + n=TAKEN_FROM_ARGUMENT4, + reader=read_string4, + doc="""A counted string. + + The first argument is a 4-byte little-endian signed int giving + the number of bytes in the string, and the second argument is + that many bytes. + """) + + +def read_string1(f): + r""" + >>> import io + >>> read_string1(io.BytesIO(b"\x00")) + '' + >>> read_string1(io.BytesIO(b"\x03abcdef")) + 'abc' + """ + + n = read_uint1(f) + assert n >= 0 + data = f.read(n) + if len(data) == n: + return data.decode("latin-1") + raise ValueError("expected %d bytes in a string1, but only %d remain" % + (n, len(data))) + +string1 = ArgumentDescriptor( + name="string1", + n=TAKEN_FROM_ARGUMENT1, + reader=read_string1, + doc="""A counted string. + + The first argument is a 1-byte unsigned int giving the number + of bytes in the string, and the second argument is that many + bytes. + """) + + +def read_unicodestringnl(f): + r""" + >>> import io + >>> read_unicodestringnl(io.BytesIO(b"abc\\uabcd\njunk")) == 'abc\uabcd' + True + """ + + data = readline(f) + if not data.endswith('\n'): + raise ValueError("no newline found when trying to read " + "unicodestringnl") + data = data[:-1] # lose the newline + return str(data, 'raw-unicode-escape') + +unicodestringnl = ArgumentDescriptor( + name='unicodestringnl', + n=UP_TO_NEWLINE, + reader=read_unicodestringnl, + doc="""A newline-terminated Unicode string. + + This is raw-unicode-escape encoded, so consists of + printable ASCII characters, and may contain embedded + escape sequences. + """) + +def read_unicodestring4(f): + r""" + >>> import io + >>> s = 'abcd\uabcd' + >>> enc = s.encode('utf-8') + >>> enc + b'abcd\xea\xaf\x8d' + >>> n = bytes([len(enc), 0, 0, 0]) # little-endian 4-byte length + >>> t = read_unicodestring4(io.BytesIO(n + enc + b'junk')) + >>> s == t + True + + >>> read_unicodestring4(io.BytesIO(n + enc[:-1])) + Traceback (most recent call last): + ... + ValueError: expected 7 bytes in a unicodestring4, but only 6 remain + """ + + n = read_int4(f) + if n < 0: + raise ValueError("unicodestring4 byte count < 0: %d" % n) + data = f.read(n) + if len(data) == n: + return str(data, 'utf-8') + raise ValueError("expected %d bytes in a unicodestring4, but only %d " + "remain" % (n, len(data))) + +unicodestring4 = ArgumentDescriptor( + name="unicodestring4", + n=TAKEN_FROM_ARGUMENT4, + reader=read_unicodestring4, + doc="""A counted Unicode string. + + The first argument is a 4-byte little-endian signed int + giving the number of bytes in the string, and the second + argument-- the UTF-8 encoding of the Unicode string -- + contains that many bytes. + """) + + +def read_decimalnl_short(f): + r""" + >>> import io + >>> read_decimalnl_short(io.BytesIO(b"1234\n56")) + 1234 + + >>> read_decimalnl_short(io.BytesIO(b"1234L\n56")) + Traceback (most recent call last): + ... + ValueError: trailing 'L' not allowed in b'1234L' + """ + + s = read_stringnl(f, decode=False, stripquotes=False) + if s.endswith("L"): + raise ValueError("trailing 'L' not allowed in %r" % s) + + # It's not necessarily true that the result fits in a Python short int: + # the pickle may have been written on a 64-bit box. There's also a hack + # for True and False here. + if s == "00": + return False + elif s == "01": + return True + + try: + return int(s) + except OverflowError: + return int(s) + +def read_decimalnl_long(f): + r""" + >>> import io + + >>> read_decimalnl_long(io.BytesIO(b"1234L\n56")) + 1234 + + >>> read_decimalnl_long(io.BytesIO(b"123456789012345678901234L\n6")) + 123456789012345678901234 + """ + + s = read_stringnl(f, decode=False, stripquotes=False) + return int(s) + + +decimalnl_short = ArgumentDescriptor( + name='decimalnl_short', + n=UP_TO_NEWLINE, + reader=read_decimalnl_short, + doc="""A newline-terminated decimal integer literal. + + This never has a trailing 'L', and the integer fit + in a short Python int on the box where the pickle + was written -- but there's no guarantee it will fit + in a short Python int on the box where the pickle + is read. + """) + +decimalnl_long = ArgumentDescriptor( + name='decimalnl_long', + n=UP_TO_NEWLINE, + reader=read_decimalnl_long, + doc="""A newline-terminated decimal integer literal. + + This has a trailing 'L', and can represent integers + of any size. + """) + + +def read_floatnl(f): + r""" + >>> import io + >>> read_floatnl(io.BytesIO(b"-1.25\n6")) + -1.25 + """ + s = read_stringnl(f, decode=False, stripquotes=False) + return float(s) + +floatnl = ArgumentDescriptor( + name='floatnl', + n=UP_TO_NEWLINE, + reader=read_floatnl, + doc="""A newline-terminated decimal floating literal. + + In general this requires 17 significant digits for roundtrip + identity, and pickling then unpickling infinities, NaNs, and + minus zero doesn't work across boxes, or on some boxes even + on itself (e.g., Windows can't read the strings it produces + for infinities or NaNs). + """) + +def read_float8(f): + r""" + >>> import io, struct + >>> raw = struct.pack(">d", -1.25) + >>> raw + b'\xbf\xf4\x00\x00\x00\x00\x00\x00' + >>> read_float8(io.BytesIO(raw + b"\n")) + -1.25 + """ + + data = f.read(8) + if len(data) == 8: + return _unpack(">d", data)[0] + raise ValueError("not enough data in stream to read float8") + + +float8 = ArgumentDescriptor( + name='float8', + n=8, + reader=read_float8, + doc="""An 8-byte binary representation of a float, big-endian. + + The format is unique to Python, and shared with the struct + module (format string '>d') "in theory" (the struct and cPickle + implementations don't share the code -- they should). It's + strongly related to the IEEE-754 double format, and, in normal + cases, is in fact identical to the big-endian 754 double format. + On other boxes the dynamic range is limited to that of a 754 + double, and "add a half and chop" rounding is used to reduce + the precision to 53 bits. However, even on a 754 box, + infinities, NaNs, and minus zero may not be handled correctly + (may not survive roundtrip pickling intact). + """) + +# Protocol 2 formats + +from pickle import decode_long + +def read_long1(f): + r""" + >>> import io + >>> read_long1(io.BytesIO(b"\x00")) + 0 + >>> read_long1(io.BytesIO(b"\x02\xff\x00")) + 255 + >>> read_long1(io.BytesIO(b"\x02\xff\x7f")) + 32767 + >>> read_long1(io.BytesIO(b"\x02\x00\xff")) + -256 + >>> read_long1(io.BytesIO(b"\x02\x00\x80")) + -32768 + """ + + n = read_uint1(f) + data = f.read(n) + if len(data) != n: + raise ValueError("not enough data in stream to read long1") + return decode_long(data) + +long1 = ArgumentDescriptor( + name="long1", + n=TAKEN_FROM_ARGUMENT1, + reader=read_long1, + doc="""A binary long, little-endian, using 1-byte size. + + This first reads one byte as an unsigned size, then reads that + many bytes and interprets them as a little-endian 2's-complement long. + If the size is 0, that's taken as a shortcut for the long 0L. + """) + +def read_long4(f): + r""" + >>> import io + >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x00")) + 255 + >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x7f")) + 32767 + >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\xff")) + -256 + >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\x80")) + -32768 + >>> read_long1(io.BytesIO(b"\x00\x00\x00\x00")) + 0 + """ + + n = read_int4(f) + if n < 0: + raise ValueError("long4 byte count < 0: %d" % n) + data = f.read(n) + if len(data) != n: + raise ValueError("not enough data in stream to read long4") + return decode_long(data) + +long4 = ArgumentDescriptor( + name="long4", + n=TAKEN_FROM_ARGUMENT4, + reader=read_long4, + doc="""A binary representation of a long, little-endian. + + This first reads four bytes as a signed size (but requires the + size to be >= 0), then reads that many bytes and interprets them + as a little-endian 2's-complement long. If the size is 0, that's taken + as a shortcut for the int 0, although LONG1 should really be used + then instead (and in any case where # of bytes < 256). + """) + + +############################################################################## +# Object descriptors. The stack used by the pickle machine holds objects, +# and in the stack_before and stack_after attributes of OpcodeInfo +# descriptors we need names to describe the various types of objects that can +# appear on the stack. + +class StackObject(object): + __slots__ = ( + # name of descriptor record, for info only + 'name', + + # type of object, or tuple of type objects (meaning the object can + # be of any type in the tuple) + 'obtype', + + # human-readable docs for this kind of stack object; a string + 'doc', + ) + + def __init__(self, name, obtype, doc): + assert isinstance(name, basestring) + self.name = name + + assert isinstance(obtype, type) or isinstance(obtype, tuple) + if isinstance(obtype, tuple): + for contained in obtype: + assert isinstance(contained, type) + self.obtype = obtype + + assert isinstance(doc, basestring) + self.doc = doc + + def __repr__(self): + return self.name + + +pyint = StackObject( + name='int', + obtype=int, + doc="A short (as opposed to long) Python integer object.") + +pylong = StackObject( + name='long', + obtype=int, + doc="A long (as opposed to short) Python integer object.") + +pyinteger_or_bool = StackObject( + name='int_or_bool', + obtype=(int, int, bool), + doc="A Python integer object (short or long), or " + "a Python bool.") + +pybool = StackObject( + name='bool', + obtype=(bool,), + doc="A Python bool object.") + +pyfloat = StackObject( + name='float', + obtype=float, + doc="A Python float object.") + +pystring = StackObject( + name='str', + obtype=str, + doc="A Python string object.") + +pyunicode = StackObject( + name='unicode', + obtype=str, + doc="A Python Unicode string object.") + +pynone = StackObject( + name="None", + obtype=type(None), + doc="The Python None object.") + +pytuple = StackObject( + name="tuple", + obtype=tuple, + doc="A Python tuple object.") + +pylist = StackObject( + name="list", + obtype=list, + doc="A Python list object.") + +pydict = StackObject( + name="dict", + obtype=dict, + doc="A Python dict object.") + +anyobject = StackObject( + name='any', + obtype=object, + doc="Any kind of object whatsoever.") + +markobject = StackObject( + name="mark", + obtype=StackObject, + doc="""'The mark' is a unique object. + + Opcodes that operate on a variable number of objects + generally don't embed the count of objects in the opcode, + or pull it off the stack. Instead the MARK opcode is used + to push a special marker object on the stack, and then + some other opcodes grab all the objects from the top of + the stack down to (but not including) the topmost marker + object. + """) + +stackslice = StackObject( + name="stackslice", + obtype=StackObject, + doc="""An object representing a contiguous slice of the stack. + + This is used in conjuction with markobject, to represent all + of the stack following the topmost markobject. For example, + the POP_MARK opcode changes the stack from + + [..., markobject, stackslice] + to + [...] + + No matter how many object are on the stack after the topmost + markobject, POP_MARK gets rid of all of them (including the + topmost markobject too). + """) + +############################################################################## +# Descriptors for pickle opcodes. + +class OpcodeInfo(object): + + __slots__ = ( + # symbolic name of opcode; a string + 'name', + + # the code used in a bytestream to represent the opcode; a + # one-character string + 'code', + + # If the opcode has an argument embedded in the byte string, an + # instance of ArgumentDescriptor specifying its type. Note that + # arg.reader(s) can be used to read and decode the argument from + # the bytestream s, and arg.doc documents the format of the raw + # argument bytes. If the opcode doesn't have an argument embedded + # in the bytestream, arg should be None. + 'arg', + + # what the stack looks like before this opcode runs; a list + 'stack_before', + + # what the stack looks like after this opcode runs; a list + 'stack_after', + + # the protocol number in which this opcode was introduced; an int + 'proto', + + # human-readable docs for this opcode; a string + 'doc', + ) + + def __init__(self, name, code, arg, + stack_before, stack_after, proto, doc): + assert isinstance(name, basestring) + self.name = name + + assert isinstance(code, basestring) + assert len(code) == 1 + self.code = code + + assert arg is None or isinstance(arg, ArgumentDescriptor) + self.arg = arg + + assert isinstance(stack_before, list) + for x in stack_before: + assert isinstance(x, StackObject) + self.stack_before = stack_before + + assert isinstance(stack_after, list) + for x in stack_after: + assert isinstance(x, StackObject) + self.stack_after = stack_after + + assert isinstance(proto, int) and 0 <= proto <= 2 + self.proto = proto + + assert isinstance(doc, basestring) + self.doc = doc + +I = OpcodeInfo +opcodes = [ + + # Ways to spell integers. + + I(name='INT', + code='I', + arg=decimalnl_short, + stack_before=[], + stack_after=[pyinteger_or_bool], + proto=0, + doc="""Push an integer or bool. + + The argument is a newline-terminated decimal literal string. + + The intent may have been that this always fit in a short Python int, + but INT can be generated in pickles written on a 64-bit box that + require a Python long on a 32-bit box. The difference between this + and LONG then is that INT skips a trailing 'L', and produces a short + int whenever possible. + + Another difference is due to that, when bool was introduced as a + distinct type in 2.3, builtin names True and False were also added to + 2.2.2, mapping to ints 1 and 0. For compatibility in both directions, + True gets pickled as INT + "I01\\n", and False as INT + "I00\\n". + Leading zeroes are never produced for a genuine integer. The 2.3 + (and later) unpicklers special-case these and return bool instead; + earlier unpicklers ignore the leading "0" and return the int. + """), + + I(name='BININT', + code='J', + arg=int4, + stack_before=[], + stack_after=[pyint], + proto=1, + doc="""Push a four-byte signed integer. + + This handles the full range of Python (short) integers on a 32-bit + box, directly as binary bytes (1 for the opcode and 4 for the integer). + If the integer is non-negative and fits in 1 or 2 bytes, pickling via + BININT1 or BININT2 saves space. + """), + + I(name='BININT1', + code='K', + arg=uint1, + stack_before=[], + stack_after=[pyint], + proto=1, + doc="""Push a one-byte unsigned integer. + + This is a space optimization for pickling very small non-negative ints, + in range(256). + """), + + I(name='BININT2', + code='M', + arg=uint2, + stack_before=[], + stack_after=[pyint], + proto=1, + doc="""Push a two-byte unsigned integer. + + This is a space optimization for pickling small positive ints, in + range(256, 2**16). Integers in range(256) can also be pickled via + BININT2, but BININT1 instead saves a byte. + """), + + I(name='LONG', + code='L', + arg=decimalnl_long, + stack_before=[], + stack_after=[pylong], + proto=0, + doc="""Push a long integer. + + The same as INT, except that the literal ends with 'L', and always + unpickles to a Python long. There doesn't seem a real purpose to the + trailing 'L'. + + Note that LONG takes time quadratic in the number of digits when + unpickling (this is simply due to the nature of decimal->binary + conversion). Proto 2 added linear-time (in C; still quadratic-time + in Python) LONG1 and LONG4 opcodes. + """), + + I(name="LONG1", + code='\x8a', + arg=long1, + stack_before=[], + stack_after=[pylong], + proto=2, + doc="""Long integer using one-byte length. + + A more efficient encoding of a Python long; the long1 encoding + says it all."""), + + I(name="LONG4", + code='\x8b', + arg=long4, + stack_before=[], + stack_after=[pylong], + proto=2, + doc="""Long integer using found-byte length. + + A more efficient encoding of a Python long; the long4 encoding + says it all."""), + + # Ways to spell strings (8-bit, not Unicode). + + I(name='STRING', + code='S', + arg=stringnl, + stack_before=[], + stack_after=[pystring], + proto=0, + doc="""Push a Python string object. + + The argument is a repr-style string, with bracketing quote characters, + and perhaps embedded escapes. The argument extends until the next + newline character. + """), + + I(name='BINSTRING', + code='T', + arg=string4, + stack_before=[], + stack_after=[pystring], + proto=1, + doc="""Push a Python string object. + + There are two arguments: the first is a 4-byte little-endian signed int + giving the number of bytes in the string, and the second is that many + bytes, which are taken literally as the string content. + """), + + I(name='SHORT_BINSTRING', + code='U', + arg=string1, + stack_before=[], + stack_after=[pystring], + proto=1, + doc="""Push a Python string object. + + There are two arguments: the first is a 1-byte unsigned int giving + the number of bytes in the string, and the second is that many bytes, + which are taken literally as the string content. + """), + + # Ways to spell None. + + I(name='NONE', + code='N', + arg=None, + stack_before=[], + stack_after=[pynone], + proto=0, + doc="Push None on the stack."), + + # Ways to spell bools, starting with proto 2. See INT for how this was + # done before proto 2. + + I(name='NEWTRUE', + code='\x88', + arg=None, + stack_before=[], + stack_after=[pybool], + proto=2, + doc="""True. + + Push True onto the stack."""), + + I(name='NEWFALSE', + code='\x89', + arg=None, + stack_before=[], + stack_after=[pybool], + proto=2, + doc="""True. + + Push False onto the stack."""), + + # Ways to spell Unicode strings. + + I(name='UNICODE', + code='V', + arg=unicodestringnl, + stack_before=[], + stack_after=[pyunicode], + proto=0, # this may be pure-text, but it's a later addition + doc="""Push a Python Unicode string object. + + The argument is a raw-unicode-escape encoding of a Unicode string, + and so may contain embedded escape sequences. The argument extends + until the next newline character. + """), + + I(name='BINUNICODE', + code='X', + arg=unicodestring4, + stack_before=[], + stack_after=[pyunicode], + proto=1, + doc="""Push a Python Unicode string object. + + There are two arguments: the first is a 4-byte little-endian signed int + giving the number of bytes in the string. The second is that many + bytes, and is the UTF-8 encoding of the Unicode string. + """), + + # Ways to spell floats. + + I(name='FLOAT', + code='F', + arg=floatnl, + stack_before=[], + stack_after=[pyfloat], + proto=0, + doc="""Newline-terminated decimal float literal. + + The argument is repr(a_float), and in general requires 17 significant + digits for roundtrip conversion to be an identity (this is so for + IEEE-754 double precision values, which is what Python float maps to + on most boxes). + + In general, FLOAT cannot be used to transport infinities, NaNs, or + minus zero across boxes (or even on a single box, if the platform C + library can't read the strings it produces for such things -- Windows + is like that), but may do less damage than BINFLOAT on boxes with + greater precision or dynamic range than IEEE-754 double. + """), + + I(name='BINFLOAT', + code='G', + arg=float8, + stack_before=[], + stack_after=[pyfloat], + proto=1, + doc="""Float stored in binary form, with 8 bytes of data. + + This generally requires less than half the space of FLOAT encoding. + In general, BINFLOAT cannot be used to transport infinities, NaNs, or + minus zero, raises an exception if the exponent exceeds the range of + an IEEE-754 double, and retains no more than 53 bits of precision (if + there are more than that, "add a half and chop" rounding is used to + cut it back to 53 significant bits). + """), + + # Ways to build lists. + + I(name='EMPTY_LIST', + code=']', + arg=None, + stack_before=[], + stack_after=[pylist], + proto=1, + doc="Push an empty list."), + + I(name='APPEND', + code='a', + arg=None, + stack_before=[pylist, anyobject], + stack_after=[pylist], + proto=0, + doc="""Append an object to a list. + + Stack before: ... pylist anyobject + Stack after: ... pylist+[anyobject] + + although pylist is really extended in-place. + """), + + I(name='APPENDS', + code='e', + arg=None, + stack_before=[pylist, markobject, stackslice], + stack_after=[pylist], + proto=1, + doc="""Extend a list by a slice of stack objects. + + Stack before: ... pylist markobject stackslice + Stack after: ... pylist+stackslice + + although pylist is really extended in-place. + """), + + I(name='LIST', + code='l', + arg=None, + stack_before=[markobject, stackslice], + stack_after=[pylist], + proto=0, + doc="""Build a list out of the topmost stack slice, after markobject. + + All the stack entries following the topmost markobject are placed into + a single Python list, which single list object replaces all of the + stack from the topmost markobject onward. For example, + + Stack before: ... markobject 1 2 3 'abc' + Stack after: ... [1, 2, 3, 'abc'] + """), + + # Ways to build tuples. + + I(name='EMPTY_TUPLE', + code=')', + arg=None, + stack_before=[], + stack_after=[pytuple], + proto=1, + doc="Push an empty tuple."), + + I(name='TUPLE', + code='t', + arg=None, + stack_before=[markobject, stackslice], + stack_after=[pytuple], + proto=0, + doc="""Build a tuple out of the topmost stack slice, after markobject. + + All the stack entries following the topmost markobject are placed into + a single Python tuple, which single tuple object replaces all of the + stack from the topmost markobject onward. For example, + + Stack before: ... markobject 1 2 3 'abc' + Stack after: ... (1, 2, 3, 'abc') + """), + + I(name='TUPLE1', + code='\x85', + arg=None, + stack_before=[anyobject], + stack_after=[pytuple], + proto=2, + doc="""One-tuple. + + This code pops one value off the stack and pushes a tuple of + length 1 whose one item is that value back onto it. IOW: + + stack[-1] = tuple(stack[-1:]) + """), + + I(name='TUPLE2', + code='\x86', + arg=None, + stack_before=[anyobject, anyobject], + stack_after=[pytuple], + proto=2, + doc="""One-tuple. + + This code pops two values off the stack and pushes a tuple + of length 2 whose items are those values back onto it. IOW: + + stack[-2:] = [tuple(stack[-2:])] + """), + + I(name='TUPLE3', + code='\x87', + arg=None, + stack_before=[anyobject, anyobject, anyobject], + stack_after=[pytuple], + proto=2, + doc="""One-tuple. + + This code pops three values off the stack and pushes a tuple + of length 3 whose items are those values back onto it. IOW: + + stack[-3:] = [tuple(stack[-3:])] + """), + + # Ways to build dicts. + + I(name='EMPTY_DICT', + code='}', + arg=None, + stack_before=[], + stack_after=[pydict], + proto=1, + doc="Push an empty dict."), + + I(name='DICT', + code='d', + arg=None, + stack_before=[markobject, stackslice], + stack_after=[pydict], + proto=0, + doc="""Build a dict out of the topmost stack slice, after markobject. + + All the stack entries following the topmost markobject are placed into + a single Python dict, which single dict object replaces all of the + stack from the topmost markobject onward. The stack slice alternates + key, value, key, value, .... For example, + + Stack before: ... markobject 1 2 3 'abc' + Stack after: ... {1: 2, 3: 'abc'} + """), + + I(name='SETITEM', + code='s', + arg=None, + stack_before=[pydict, anyobject, anyobject], + stack_after=[pydict], + proto=0, + doc="""Add a key+value pair to an existing dict. + + Stack before: ... pydict key value + Stack after: ... pydict + + where pydict has been modified via pydict[key] = value. + """), + + I(name='SETITEMS', + code='u', + arg=None, + stack_before=[pydict, markobject, stackslice], + stack_after=[pydict], + proto=1, + doc="""Add an arbitrary number of key+value pairs to an existing dict. + + The slice of the stack following the topmost markobject is taken as + an alternating sequence of keys and values, added to the dict + immediately under the topmost markobject. Everything at and after the + topmost markobject is popped, leaving the mutated dict at the top + of the stack. + + Stack before: ... pydict markobject key_1 value_1 ... key_n value_n + Stack after: ... pydict + + where pydict has been modified via pydict[key_i] = value_i for i in + 1, 2, ..., n, and in that order. + """), + + # Stack manipulation. + + I(name='POP', + code='0', + arg=None, + stack_before=[anyobject], + stack_after=[], + proto=0, + doc="Discard the top stack item, shrinking the stack by one item."), + + I(name='DUP', + code='2', + arg=None, + stack_before=[anyobject], + stack_after=[anyobject, anyobject], + proto=0, + doc="Push the top stack item onto the stack again, duplicating it."), + + I(name='MARK', + code='(', + arg=None, + stack_before=[], + stack_after=[markobject], + proto=0, + doc="""Push markobject onto the stack. + + markobject is a unique object, used by other opcodes to identify a + region of the stack containing a variable number of objects for them + to work on. See markobject.doc for more detail. + """), + + I(name='POP_MARK', + code='1', + arg=None, + stack_before=[markobject, stackslice], + stack_after=[], + proto=0, + doc="""Pop all the stack objects at and above the topmost markobject. + + When an opcode using a variable number of stack objects is done, + POP_MARK is used to remove those objects, and to remove the markobject + that delimited their starting position on the stack. + """), + + # Memo manipulation. There are really only two operations (get and put), + # each in all-text, "short binary", and "long binary" flavors. + + I(name='GET', + code='g', + arg=decimalnl_short, + stack_before=[], + stack_after=[anyobject], + proto=0, + doc="""Read an object from the memo and push it on the stack. + + The index of the memo object to push is given by the newline-teriminated + decimal string following. BINGET and LONG_BINGET are space-optimized + versions. + """), + + I(name='BINGET', + code='h', + arg=uint1, + stack_before=[], + stack_after=[anyobject], + proto=1, + doc="""Read an object from the memo and push it on the stack. + + The index of the memo object to push is given by the 1-byte unsigned + integer following. + """), + + I(name='LONG_BINGET', + code='j', + arg=int4, + stack_before=[], + stack_after=[anyobject], + proto=1, + doc="""Read an object from the memo and push it on the stack. + + The index of the memo object to push is given by the 4-byte signed + little-endian integer following. + """), + + I(name='PUT', + code='p', + arg=decimalnl_short, + stack_before=[], + stack_after=[], + proto=0, + doc="""Store the stack top into the memo. The stack is not popped. + + The index of the memo location to write into is given by the newline- + terminated decimal string following. BINPUT and LONG_BINPUT are + space-optimized versions. + """), + + I(name='BINPUT', + code='q', + arg=uint1, + stack_before=[], + stack_after=[], + proto=1, + doc="""Store the stack top into the memo. The stack is not popped. + + The index of the memo location to write into is given by the 1-byte + unsigned integer following. + """), + + I(name='LONG_BINPUT', + code='r', + arg=int4, + stack_before=[], + stack_after=[], + proto=1, + doc="""Store the stack top into the memo. The stack is not popped. + + The index of the memo location to write into is given by the 4-byte + signed little-endian integer following. + """), + + # Access the extension registry (predefined objects). Akin to the GET + # family. + + I(name='EXT1', + code='\x82', + arg=uint1, + stack_before=[], + stack_after=[anyobject], + proto=2, + doc="""Extension code. + + This code and the similar EXT2 and EXT4 allow using a registry + of popular objects that are pickled by name, typically classes. + It is envisioned that through a global negotiation and + registration process, third parties can set up a mapping between + ints and object names. + + In order to guarantee pickle interchangeability, the extension + code registry ought to be global, although a range of codes may + be reserved for private use. + + EXT1 has a 1-byte integer argument. This is used to index into the + extension registry, and the object at that index is pushed on the stack. + """), + + I(name='EXT2', + code='\x83', + arg=uint2, + stack_before=[], + stack_after=[anyobject], + proto=2, + doc="""Extension code. + + See EXT1. EXT2 has a two-byte integer argument. + """), + + I(name='EXT4', + code='\x84', + arg=int4, + stack_before=[], + stack_after=[anyobject], + proto=2, + doc="""Extension code. + + See EXT1. EXT4 has a four-byte integer argument. + """), + + # Push a class object, or module function, on the stack, via its module + # and name. + + I(name='GLOBAL', + code='c', + arg=stringnl_noescape_pair, + stack_before=[], + stack_after=[anyobject], + proto=0, + doc="""Push a global object (module.attr) on the stack. + + Two newline-terminated strings follow the GLOBAL opcode. The first is + taken as a module name, and the second as a class name. The class + object module.class is pushed on the stack. More accurately, the + object returned by self.find_class(module, class) is pushed on the + stack, so unpickling subclasses can override this form of lookup. + """), + + # Ways to build objects of classes pickle doesn't know about directly + # (user-defined classes). I despair of documenting this accurately + # and comprehensibly -- you really have to read the pickle code to + # find all the special cases. + + I(name='REDUCE', + code='R', + arg=None, + stack_before=[anyobject, anyobject], + stack_after=[anyobject], + proto=0, + doc="""Push an object built from a callable and an argument tuple. + + The opcode is named to remind of the __reduce__() method. + + Stack before: ... callable pytuple + Stack after: ... callable(*pytuple) + + The callable and the argument tuple are the first two items returned + by a __reduce__ method. Applying the callable to the argtuple is + supposed to reproduce the original object, or at least get it started. + If the __reduce__ method returns a 3-tuple, the last component is an + argument to be passed to the object's __setstate__, and then the REDUCE + opcode is followed by code to create setstate's argument, and then a + BUILD opcode to apply __setstate__ to that argument. + + If type(callable) is not ClassType, REDUCE complains unless the + callable has been registered with the copy_reg module's + safe_constructors dict, or the callable has a magic + '__safe_for_unpickling__' attribute with a true value. I'm not sure + why it does this, but I've sure seen this complaint often enough when + I didn't want to . + """), + + I(name='BUILD', + code='b', + arg=None, + stack_before=[anyobject, anyobject], + stack_after=[anyobject], + proto=0, + doc="""Finish building an object, via __setstate__ or dict update. + + Stack before: ... anyobject argument + Stack after: ... anyobject + + where anyobject may have been mutated, as follows: + + If the object has a __setstate__ method, + + anyobject.__setstate__(argument) + + is called. + + Else the argument must be a dict, the object must have a __dict__, and + the object is updated via + + anyobject.__dict__.update(argument) + """), + + I(name='INST', + code='i', + arg=stringnl_noescape_pair, + stack_before=[markobject, stackslice], + stack_after=[anyobject], + proto=0, + doc="""Build a class instance. + + This is the protocol 0 version of protocol 1's OBJ opcode. + INST is followed by two newline-terminated strings, giving a + module and class name, just as for the GLOBAL opcode (and see + GLOBAL for more details about that). self.find_class(module, name) + is used to get a class object. + + In addition, all the objects on the stack following the topmost + markobject are gathered into a tuple and popped (along with the + topmost markobject), just as for the TUPLE opcode. + + Now it gets complicated. If all of these are true: + + + The argtuple is empty (markobject was at the top of the stack + at the start). + + + It's an old-style class object (the type of the class object is + ClassType). + + + The class object does not have a __getinitargs__ attribute. + + then we want to create an old-style class instance without invoking + its __init__() method (pickle has waffled on this over the years; not + calling __init__() is current wisdom). In this case, an instance of + an old-style dummy class is created, and then we try to rebind its + __class__ attribute to the desired class object. If this succeeds, + the new instance object is pushed on the stack, and we're done. + + Else (the argtuple is not empty, it's not an old-style class object, + or the class object does have a __getinitargs__ attribute), the code + first insists that the class object have a __safe_for_unpickling__ + attribute. Unlike as for the __safe_for_unpickling__ check in REDUCE, + it doesn't matter whether this attribute has a true or false value, it + only matters whether it exists (XXX this is a bug; cPickle + requires the attribute to be true). If __safe_for_unpickling__ + doesn't exist, UnpicklingError is raised. + + Else (the class object does have a __safe_for_unpickling__ attr), + the class object obtained from INST's arguments is applied to the + argtuple obtained from the stack, and the resulting instance object + is pushed on the stack. + + NOTE: checks for __safe_for_unpickling__ went away in Python 2.3. + """), + + I(name='OBJ', + code='o', + arg=None, + stack_before=[markobject, anyobject, stackslice], + stack_after=[anyobject], + proto=1, + doc="""Build a class instance. + + This is the protocol 1 version of protocol 0's INST opcode, and is + very much like it. The major difference is that the class object + is taken off the stack, allowing it to be retrieved from the memo + repeatedly if several instances of the same class are created. This + can be much more efficient (in both time and space) than repeatedly + embedding the module and class names in INST opcodes. + + Unlike INST, OBJ takes no arguments from the opcode stream. Instead + the class object is taken off the stack, immediately above the + topmost markobject: + + Stack before: ... markobject classobject stackslice + Stack after: ... new_instance_object + + As for INST, the remainder of the stack above the markobject is + gathered into an argument tuple, and then the logic seems identical, + except that no __safe_for_unpickling__ check is done (XXX this is + a bug; cPickle does test __safe_for_unpickling__). See INST for + the gory details. + + NOTE: In Python 2.3, INST and OBJ are identical except for how they + get the class object. That was always the intent; the implementations + had diverged for accidental reasons. + """), + + I(name='NEWOBJ', + code='\x81', + arg=None, + stack_before=[anyobject, anyobject], + stack_after=[anyobject], + proto=2, + doc="""Build an object instance. + + The stack before should be thought of as containing a class + object followed by an argument tuple (the tuple being the stack + top). Call these cls and args. They are popped off the stack, + and the value returned by cls.__new__(cls, *args) is pushed back + onto the stack. + """), + + # Machine control. + + I(name='PROTO', + code='\x80', + arg=uint1, + stack_before=[], + stack_after=[], + proto=2, + doc="""Protocol version indicator. + + For protocol 2 and above, a pickle must start with this opcode. + The argument is the protocol version, an int in range(2, 256). + """), + + I(name='STOP', + code='.', + arg=None, + stack_before=[anyobject], + stack_after=[], + proto=0, + doc="""Stop the unpickling machine. + + Every pickle ends with this opcode. The object at the top of the stack + is popped, and that's the result of unpickling. The stack should be + empty then. + """), + + # Ways to deal with persistent IDs. + + I(name='PERSID', + code='P', + arg=stringnl_noescape, + stack_before=[], + stack_after=[anyobject], + proto=0, + doc="""Push an object identified by a persistent ID. + + The pickle module doesn't define what a persistent ID means. PERSID's + argument is a newline-terminated str-style (no embedded escapes, no + bracketing quote characters) string, which *is* "the persistent ID". + The unpickler passes this string to self.persistent_load(). Whatever + object that returns is pushed on the stack. There is no implementation + of persistent_load() in Python's unpickler: it must be supplied by an + unpickler subclass. + """), + + I(name='BINPERSID', + code='Q', + arg=None, + stack_before=[anyobject], + stack_after=[anyobject], + proto=1, + doc="""Push an object identified by a persistent ID. + + Like PERSID, except the persistent ID is popped off the stack (instead + of being a string embedded in the opcode bytestream). The persistent + ID is passed to self.persistent_load(), and whatever object that + returns is pushed on the stack. See PERSID for more detail. + """), +] +del I + +# Verify uniqueness of .name and .code members. +name2i = {} +code2i = {} + +for i, d in enumerate(opcodes): + if d.name in name2i: + raise ValueError("repeated name %r at indices %d and %d" % + (d.name, name2i[d.name], i)) + if d.code in code2i: + raise ValueError("repeated code %r at indices %d and %d" % + (d.code, code2i[d.code], i)) + + name2i[d.name] = i + code2i[d.code] = i + +del name2i, code2i, i, d + +############################################################################## +# Build a code2op dict, mapping opcode characters to OpcodeInfo records. +# Also ensure we've got the same stuff as pickle.py, although the +# introspection here is dicey. + +code2op = {} +for d in opcodes: + code2op[d.code] = d +del d + +def assure_pickle_consistency(verbose=False): + import pickle, re + + copy = code2op.copy() + for name in pickle.__all__: + if not re.match("[A-Z][A-Z0-9_]+$", name): + if verbose: + print("skipping %r: it doesn't look like an opcode name" % name) + continue + picklecode = getattr(pickle, name) + if not isinstance(picklecode, bytes) or len(picklecode) != 1: + if verbose: + print(("skipping %r: value %r doesn't look like a pickle " + "code" % (name, picklecode))) + continue + picklecode = picklecode.decode("latin-1") + if picklecode in copy: + if verbose: + print("checking name %r w/ code %r for consistency" % ( + name, picklecode)) + d = copy[picklecode] + if d.name != name: + raise ValueError("for pickle code %r, pickle.py uses name %r " + "but we're using name %r" % (picklecode, + name, + d.name)) + # Forget this one. Any left over in copy at the end are a problem + # of a different kind. + del copy[picklecode] + else: + raise ValueError("pickle.py appears to have a pickle opcode with " + "name %r and code %r, but we don't" % + (name, picklecode)) + if copy: + msg = ["we appear to have pickle opcodes that pickle.py doesn't have:"] + for code, d in copy.items(): + msg.append(" name %r with code %r" % (d.name, code)) + raise ValueError("\n".join(msg)) + +assure_pickle_consistency() +del assure_pickle_consistency + +############################################################################## +# A pickle opcode generator. + +def genops(pickle): + """Generate all the opcodes in a pickle. + + 'pickle' is a file-like object, or string, containing the pickle. + + Each opcode in the pickle is generated, from the current pickle position, + stopping after a STOP opcode is delivered. A triple is generated for + each opcode: + + opcode, arg, pos + + opcode is an OpcodeInfo record, describing the current opcode. + + If the opcode has an argument embedded in the pickle, arg is its decoded + value, as a Python object. If the opcode doesn't have an argument, arg + is None. + + If the pickle has a tell() method, pos was the value of pickle.tell() + before reading the current opcode. If the pickle is a string object, + it's wrapped in a StringIO object, and the latter's tell() result is + used. Else (the pickle doesn't have a tell(), and it's not obvious how + to query its current position) pos is None. + """ + + if isinstance(pickle, bytes): + import io + pickle = io.BytesIO(pickle) + + if hasattr(pickle, "tell"): + getpos = pickle.tell + else: + getpos = lambda: None + + while True: + pos = getpos() + code = pickle.read(1) + opcode = code2op.get(code.decode("latin-1")) + if opcode is None: + if code == b"": + raise ValueError("pickle exhausted before seeing STOP") + else: + raise ValueError("at position %s, opcode %r unknown" % ( + pos is None and "" or pos, + code)) + if opcode.arg is None: + arg = None + else: + arg = opcode.arg.reader(pickle) + yield opcode, arg, pos + if code == b'.': + assert opcode.name == 'STOP' + break + +############################################################################## +# A symbolic pickle disassembler. + +def dis(pickle, out=None, memo=None, indentlevel=4): + """Produce a symbolic disassembly of a pickle. + + 'pickle' is a file-like object, or string, containing a (at least one) + pickle. The pickle is disassembled from the current position, through + the first STOP opcode encountered. + + Optional arg 'out' is a file-like object to which the disassembly is + printed. It defaults to sys.stdout. + + Optional arg 'memo' is a Python dict, used as the pickle's memo. It + may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes. + Passing the same memo object to another dis() call then allows disassembly + to proceed across multiple pickles that were all created by the same + pickler with the same memo. Ordinarily you don't need to worry about this. + + Optional arg indentlevel is the number of blanks by which to indent + a new MARK level. It defaults to 4. + + In addition to printing the disassembly, some sanity checks are made: + + + All embedded opcode arguments "make sense". + + + Explicit and implicit pop operations have enough items on the stack. + + + When an opcode implicitly refers to a markobject, a markobject is + actually on the stack. + + + A memo entry isn't referenced before it's defined. + + + The markobject isn't stored in the memo. + + + A memo entry isn't redefined. + """ + + # Most of the hair here is for sanity checks, but most of it is needed + # anyway to detect when a protocol 0 POP takes a MARK off the stack + # (which in turn is needed to indent MARK blocks correctly). + + stack = [] # crude emulation of unpickler stack + if memo is None: + memo = {} # crude emulation of unpicker memo + maxproto = -1 # max protocol number seen + markstack = [] # bytecode positions of MARK opcodes + indentchunk = ' ' * indentlevel + errormsg = None + for opcode, arg, pos in genops(pickle): + if pos is not None: + print("%5d:" % pos, end=' ', file=out) + + line = "%-4s %s%s" % (repr(opcode.code)[1:-1], + indentchunk * len(markstack), + opcode.name) + + maxproto = max(maxproto, opcode.proto) + before = opcode.stack_before # don't mutate + after = opcode.stack_after # don't mutate + numtopop = len(before) + + # See whether a MARK should be popped. + markmsg = None + if markobject in before or (opcode.name == "POP" and + stack and + stack[-1] is markobject): + assert markobject not in after + if __debug__: + if markobject in before: + assert before[-1] is stackslice + if markstack: + markpos = markstack.pop() + if markpos is None: + markmsg = "(MARK at unknown opcode offset)" + else: + markmsg = "(MARK at %d)" % markpos + # Pop everything at and after the topmost markobject. + while stack[-1] is not markobject: + stack.pop() + stack.pop() + # Stop later code from popping too much. + try: + numtopop = before.index(markobject) + except ValueError: + assert opcode.name == "POP" + numtopop = 0 + else: + errormsg = markmsg = "no MARK exists on stack" + + # Check for correct memo usage. + if opcode.name in ("PUT", "BINPUT", "LONG_BINPUT"): + assert arg is not None + if arg in memo: + errormsg = "memo key %r already defined" % arg + elif not stack: + errormsg = "stack is empty -- can't store into memo" + elif stack[-1] is markobject: + errormsg = "can't store markobject in the memo" + else: + memo[arg] = stack[-1] + + elif opcode.name in ("GET", "BINGET", "LONG_BINGET"): + if arg in memo: + assert len(after) == 1 + after = [memo[arg]] # for better stack emulation + else: + errormsg = "memo key %r has never been stored into" % arg + + if arg is not None or markmsg: + # make a mild effort to align arguments + line += ' ' * (10 - len(opcode.name)) + if arg is not None: + line += ' ' + repr(arg) + if markmsg: + line += ' ' + markmsg + print(line, file=out) + + if errormsg: + # Note that we delayed complaining until the offending opcode + # was printed. + raise ValueError(errormsg) + + # Emulate the stack effects. + if len(stack) < numtopop: + raise ValueError("tries to pop %d items from stack with " + "only %d items" % (numtopop, len(stack))) + if numtopop: + del stack[-numtopop:] + if markobject in after: + assert markobject not in before + markstack.append(pos) + + stack.extend(after) + + print("highest protocol among opcodes =", maxproto, file=out) + if stack: + raise ValueError("stack not empty after STOP: %r" % stack) + +# For use in the doctest, simply as an example of a class to pickle. +class _Example: + def __init__(self, value): + self.value = value + +_dis_test = r""" +>>> import pickle +>>> x = [1, 2, (3, 4), {str8('abc'): "def"}] +>>> pkl = pickle.dumps(x, 0) +>>> dis(pkl) + 0: ( MARK + 1: l LIST (MARK at 0) + 2: p PUT 0 + 5: L LONG 1 + 8: a APPEND + 9: L LONG 2 + 12: a APPEND + 13: ( MARK + 14: L LONG 3 + 17: L LONG 4 + 20: t TUPLE (MARK at 13) + 21: p PUT 1 + 24: a APPEND + 25: ( MARK + 26: d DICT (MARK at 25) + 27: p PUT 2 + 30: S STRING 'abc' + 37: p PUT 3 + 40: V UNICODE 'def' + 45: p PUT 4 + 48: s SETITEM + 49: a APPEND + 50: . STOP +highest protocol among opcodes = 0 + +Try again with a "binary" pickle. + +>>> pkl = pickle.dumps(x, 1) +>>> dis(pkl) + 0: ] EMPTY_LIST + 1: q BINPUT 0 + 3: ( MARK + 4: K BININT1 1 + 6: K BININT1 2 + 8: ( MARK + 9: K BININT1 3 + 11: K BININT1 4 + 13: t TUPLE (MARK at 8) + 14: q BINPUT 1 + 16: } EMPTY_DICT + 17: q BINPUT 2 + 19: U SHORT_BINSTRING 'abc' + 24: q BINPUT 3 + 26: X BINUNICODE 'def' + 34: q BINPUT 4 + 36: s SETITEM + 37: e APPENDS (MARK at 3) + 38: . STOP +highest protocol among opcodes = 1 + +Exercise the INST/OBJ/BUILD family. + +>>> import random +>>> dis(pickle.dumps(random.getrandbits, 0)) + 0: c GLOBAL 'random getrandbits' + 20: p PUT 0 + 23: . STOP +highest protocol among opcodes = 0 + +>>> from pickletools import _Example +>>> x = [_Example(42)] * 2 +>>> dis(pickle.dumps(x, 0)) + 0: ( MARK + 1: l LIST (MARK at 0) + 2: p PUT 0 + 5: c GLOBAL 'copy_reg _reconstructor' + 30: p PUT 1 + 33: ( MARK + 34: c GLOBAL 'pickletools _Example' + 56: p PUT 2 + 59: c GLOBAL '__builtin__ object' + 79: p PUT 3 + 82: N NONE + 83: t TUPLE (MARK at 33) + 84: p PUT 4 + 87: R REDUCE + 88: p PUT 5 + 91: ( MARK + 92: d DICT (MARK at 91) + 93: p PUT 6 + 96: S STRING 'value' + 105: p PUT 7 + 108: L LONG 42 + 112: s SETITEM + 113: b BUILD + 114: a APPEND + 115: g GET 5 + 118: a APPEND + 119: . STOP +highest protocol among opcodes = 0 + +>>> dis(pickle.dumps(x, 1)) + 0: ] EMPTY_LIST + 1: q BINPUT 0 + 3: ( MARK + 4: c GLOBAL 'copy_reg _reconstructor' + 29: q BINPUT 1 + 31: ( MARK + 32: c GLOBAL 'pickletools _Example' + 54: q BINPUT 2 + 56: c GLOBAL '__builtin__ object' + 76: q BINPUT 3 + 78: N NONE + 79: t TUPLE (MARK at 31) + 80: q BINPUT 4 + 82: R REDUCE + 83: q BINPUT 5 + 85: } EMPTY_DICT + 86: q BINPUT 6 + 88: U SHORT_BINSTRING 'value' + 95: q BINPUT 7 + 97: K BININT1 42 + 99: s SETITEM + 100: b BUILD + 101: h BINGET 5 + 103: e APPENDS (MARK at 3) + 104: . STOP +highest protocol among opcodes = 1 + +Try "the canonical" recursive-object test. + +>>> L = [] +>>> T = L, +>>> L.append(T) +>>> L[0] is T +True +>>> T[0] is L +True +>>> L[0][0] is L +True +>>> T[0][0] is T +True +>>> dis(pickle.dumps(L, 0)) + 0: ( MARK + 1: l LIST (MARK at 0) + 2: p PUT 0 + 5: ( MARK + 6: g GET 0 + 9: t TUPLE (MARK at 5) + 10: p PUT 1 + 13: a APPEND + 14: . STOP +highest protocol among opcodes = 0 + +>>> dis(pickle.dumps(L, 1)) + 0: ] EMPTY_LIST + 1: q BINPUT 0 + 3: ( MARK + 4: h BINGET 0 + 6: t TUPLE (MARK at 3) + 7: q BINPUT 1 + 9: a APPEND + 10: . STOP +highest protocol among opcodes = 1 + +Note that, in the protocol 0 pickle of the recursive tuple, the disassembler +has to emulate the stack in order to realize that the POP opcode at 16 gets +rid of the MARK at 0. + +>>> dis(pickle.dumps(T, 0)) + 0: ( MARK + 1: ( MARK + 2: l LIST (MARK at 1) + 3: p PUT 0 + 6: ( MARK + 7: g GET 0 + 10: t TUPLE (MARK at 6) + 11: p PUT 1 + 14: a APPEND + 15: 0 POP + 16: 0 POP (MARK at 0) + 17: g GET 1 + 20: . STOP +highest protocol among opcodes = 0 + +>>> dis(pickle.dumps(T, 1)) + 0: ( MARK + 1: ] EMPTY_LIST + 2: q BINPUT 0 + 4: ( MARK + 5: h BINGET 0 + 7: t TUPLE (MARK at 4) + 8: q BINPUT 1 + 10: a APPEND + 11: 1 POP_MARK (MARK at 0) + 12: h BINGET 1 + 14: . STOP +highest protocol among opcodes = 1 + +Try protocol 2. + +>>> dis(pickle.dumps(L, 2)) + 0: \x80 PROTO 2 + 2: ] EMPTY_LIST + 3: q BINPUT 0 + 5: h BINGET 0 + 7: \x85 TUPLE1 + 8: q BINPUT 1 + 10: a APPEND + 11: . STOP +highest protocol among opcodes = 2 + +>>> dis(pickle.dumps(T, 2)) + 0: \x80 PROTO 2 + 2: ] EMPTY_LIST + 3: q BINPUT 0 + 5: h BINGET 0 + 7: \x85 TUPLE1 + 8: q BINPUT 1 + 10: a APPEND + 11: 0 POP + 12: h BINGET 1 + 14: . STOP +highest protocol among opcodes = 2 +""" + +_memo_test = r""" +>>> import pickle +>>> import io +>>> f = io.BytesIO() +>>> p = pickle.Pickler(f, 2) +>>> x = [1, 2, 3] +>>> p.dump(x) +>>> p.dump(x) +>>> f.seek(0) +0 +>>> memo = {} +>>> dis(f, memo=memo) + 0: \x80 PROTO 2 + 2: ] EMPTY_LIST + 3: q BINPUT 0 + 5: ( MARK + 6: K BININT1 1 + 8: K BININT1 2 + 10: K BININT1 3 + 12: e APPENDS (MARK at 5) + 13: . STOP +highest protocol among opcodes = 2 +>>> dis(f, memo=memo) + 14: \x80 PROTO 2 + 16: h BINGET 0 + 18: . STOP +highest protocol among opcodes = 2 +""" + +__test__ = {'disassembler_test': _dis_test, + 'disassembler_memo_test': _memo_test, + } + +def _test(): + import doctest + return doctest.testmod() + +if __name__ == "__main__": + _test() Added: sandbox/trunk/cpy_merge/Lib/profile.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/profile.py Wed May 23 03:45:28 2007 @@ -0,0 +1,619 @@ +#! /usr/bin/env python +# +# Class for profiling python code. rev 1.0 6/2/94 +# +# Based on prior profile module by Sjoerd Mullender... +# which was hacked somewhat by: Guido van Rossum + +"""Class for profiling Python code.""" + +# Copyright 1994, by InfoSeek Corporation, all rights reserved. +# Written by James Roskind +# +# Permission to use, copy, modify, and distribute this Python software +# and its associated documentation for any purpose (subject to the +# restriction in the following sentence) without fee is hereby granted, +# provided that the above copyright notice appears in all copies, and +# that both that copyright notice and this permission notice appear in +# supporting documentation, and that the name of InfoSeek not be used in +# advertising or publicity pertaining to distribution of the software +# without specific, written prior permission. This permission is +# explicitly restricted to the copying and modification of the software +# to remain in Python, compiled Python, or other languages (such as C) +# wherein the modified or derived code is exclusively imported into a +# Python module. +# +# INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS. IN NO EVENT SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY +# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER +# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + + +import sys +import os +import time +import marshal +from optparse import OptionParser + +__all__ = ["run", "runctx", "help", "Profile"] + +# Sample timer for use with +#i_count = 0 +#def integer_timer(): +# global i_count +# i_count = i_count + 1 +# return i_count +#itimes = integer_timer # replace with C coded timer returning integers + +#************************************************************************** +# The following are the static member functions for the profiler class +# Note that an instance of Profile() is *not* needed to call them. +#************************************************************************** + +def run(statement, filename=None, sort=-1): + """Run statement under profiler optionally saving results in filename + + This function takes a single argument that can be passed to the + "exec" statement, and an optional file name. In all cases this + routine attempts to "exec" its first argument and gather profiling + statistics from the execution. If no file name is present, then this + function automatically prints a simple profiling report, sorted by the + standard name string (file/line/function-name) that is presented in + each line. + """ + prof = Profile() + try: + prof = prof.run(statement) + except SystemExit: + pass + if filename is not None: + prof.dump_stats(filename) + else: + return prof.print_stats(sort) + +def runctx(statement, globals, locals, filename=None): + """Run statement under profiler, supplying your own globals and locals, + optionally saving results in filename. + + statement and filename have the same semantics as profile.run + """ + prof = Profile() + try: + prof = prof.runctx(statement, globals, locals) + except SystemExit: + pass + + if filename is not None: + prof.dump_stats(filename) + else: + return prof.print_stats() + +# Backwards compatibility. +def help(): + print("Documentation for the profile module can be found ") + print("in the Python Library Reference, section 'The Python Profiler'.") + +if os.name == "mac": + import MacOS + def _get_time_mac(timer=MacOS.GetTicks): + return timer() / 60.0 + +if hasattr(os, "times"): + def _get_time_times(timer=os.times): + t = timer() + return t[0] + t[1] + +# Using getrusage(3) is better than clock(3) if available: +# on some systems (e.g. FreeBSD), getrusage has a higher resolution +# Furthermore, on a POSIX system, returns microseconds, which +# wrap around after 36min. +_has_res = 0 +try: + import resource + resgetrusage = lambda: resource.getrusage(resource.RUSAGE_SELF) + def _get_time_resource(timer=resgetrusage): + t = timer() + return t[0] + t[1] + _has_res = 1 +except ImportError: + pass + +class Profile: + """Profiler class. + + self.cur is always a tuple. Each such tuple corresponds to a stack + frame that is currently active (self.cur[-2]). The following are the + definitions of its members. We use this external "parallel stack" to + avoid contaminating the program that we are profiling. (old profiler + used to write into the frames local dictionary!!) Derived classes + can change the definition of some entries, as long as they leave + [-2:] intact (frame and previous tuple). In case an internal error is + detected, the -3 element is used as the function name. + + [ 0] = Time that needs to be charged to the parent frame's function. + It is used so that a function call will not have to access the + timing data for the parent frame. + [ 1] = Total time spent in this frame's function, excluding time in + subfunctions (this latter is tallied in cur[2]). + [ 2] = Total time spent in subfunctions, excluding time executing the + frame's function (this latter is tallied in cur[1]). + [-3] = Name of the function that corresponds to this frame. + [-2] = Actual frame that we correspond to (used to sync exception handling). + [-1] = Our parent 6-tuple (corresponds to frame.f_back). + + Timing data for each function is stored as a 5-tuple in the dictionary + self.timings[]. The index is always the name stored in self.cur[-3]. + The following are the definitions of the members: + + [0] = The number of times this function was called, not counting direct + or indirect recursion, + [1] = Number of times this function appears on the stack, minus one + [2] = Total time spent internal to this function + [3] = Cumulative time that this function was present on the stack. In + non-recursive functions, this is the total execution time from start + to finish of each invocation of a function, including time spent in + all subfunctions. + [4] = A dictionary indicating for each function name, the number of times + it was called by us. + """ + + bias = 0 # calibration constant + + def __init__(self, timer=None, bias=None): + self.timings = {} + self.cur = None + self.cmd = "" + self.c_func_name = "" + + if bias is None: + bias = self.bias + self.bias = bias # Materialize in local dict for lookup speed. + + if not timer: + if _has_res: + self.timer = resgetrusage + self.dispatcher = self.trace_dispatch + self.get_time = _get_time_resource + elif os.name == 'mac': + self.timer = MacOS.GetTicks + self.dispatcher = self.trace_dispatch_mac + self.get_time = _get_time_mac + elif hasattr(time, 'clock'): + self.timer = self.get_time = time.clock + self.dispatcher = self.trace_dispatch_i + elif hasattr(os, 'times'): + self.timer = os.times + self.dispatcher = self.trace_dispatch + self.get_time = _get_time_times + else: + self.timer = self.get_time = time.time + self.dispatcher = self.trace_dispatch_i + else: + self.timer = timer + t = self.timer() # test out timer function + try: + length = len(t) + except TypeError: + self.get_time = timer + self.dispatcher = self.trace_dispatch_i + else: + if length == 2: + self.dispatcher = self.trace_dispatch + else: + self.dispatcher = self.trace_dispatch_l + # This get_time() implementation needs to be defined + # here to capture the passed-in timer in the parameter + # list (for performance). Note that we can't assume + # the timer() result contains two values in all + # cases. + def get_time_timer(timer=timer, sum=sum): + return sum(timer()) + self.get_time = get_time_timer + self.t = self.get_time() + self.simulate_call('profiler') + + # Heavily optimized dispatch routine for os.times() timer + + def trace_dispatch(self, frame, event, arg): + timer = self.timer + t = timer() + t = t[0] + t[1] - self.t - self.bias + + if event == "c_call": + self.c_func_name = arg.__name__ + + if self.dispatch[event](self, frame,t): + t = timer() + self.t = t[0] + t[1] + else: + r = timer() + self.t = r[0] + r[1] - t # put back unrecorded delta + + # Dispatch routine for best timer program (return = scalar, fastest if + # an integer but float works too -- and time.clock() relies on that). + + def trace_dispatch_i(self, frame, event, arg): + timer = self.timer + t = timer() - self.t - self.bias + + if event == "c_call": + self.c_func_name = arg.__name__ + + if self.dispatch[event](self, frame, t): + self.t = timer() + else: + self.t = timer() - t # put back unrecorded delta + + # Dispatch routine for macintosh (timer returns time in ticks of + # 1/60th second) + + def trace_dispatch_mac(self, frame, event, arg): + timer = self.timer + t = timer()/60.0 - self.t - self.bias + + if event == "c_call": + self.c_func_name = arg.__name__ + + if self.dispatch[event](self, frame, t): + self.t = timer()/60.0 + else: + self.t = timer()/60.0 - t # put back unrecorded delta + + # SLOW generic dispatch routine for timer returning lists of numbers + + def trace_dispatch_l(self, frame, event, arg): + get_time = self.get_time + t = get_time() - self.t - self.bias + + if event == "c_call": + self.c_func_name = arg.__name__ + + if self.dispatch[event](self, frame, t): + self.t = get_time() + else: + self.t = get_time() - t # put back unrecorded delta + + # In the event handlers, the first 3 elements of self.cur are unpacked + # into vrbls w/ 3-letter names. The last two characters are meant to be + # mnemonic: + # _pt self.cur[0] "parent time" time to be charged to parent frame + # _it self.cur[1] "internal time" time spent directly in the function + # _et self.cur[2] "external time" time spent in subfunctions + + def trace_dispatch_exception(self, frame, t): + rpt, rit, ret, rfn, rframe, rcur = self.cur + if (rframe is not frame) and rcur: + return self.trace_dispatch_return(rframe, t) + self.cur = rpt, rit+t, ret, rfn, rframe, rcur + return 1 + + + def trace_dispatch_call(self, frame, t): + if self.cur and frame.f_back is not self.cur[-2]: + rpt, rit, ret, rfn, rframe, rcur = self.cur + if not isinstance(rframe, Profile.fake_frame): + assert rframe.f_back is frame.f_back, ("Bad call", rfn, + rframe, rframe.f_back, + frame, frame.f_back) + self.trace_dispatch_return(rframe, 0) + assert (self.cur is None or \ + frame.f_back is self.cur[-2]), ("Bad call", + self.cur[-3]) + fcode = frame.f_code + fn = (fcode.co_filename, fcode.co_firstlineno, fcode.co_name) + self.cur = (t, 0, 0, fn, frame, self.cur) + timings = self.timings + if fn in timings: + cc, ns, tt, ct, callers = timings[fn] + timings[fn] = cc, ns + 1, tt, ct, callers + else: + timings[fn] = 0, 0, 0, 0, {} + return 1 + + def trace_dispatch_c_call (self, frame, t): + fn = ("", 0, self.c_func_name) + self.cur = (t, 0, 0, fn, frame, self.cur) + timings = self.timings + if fn in timings: + cc, ns, tt, ct, callers = timings[fn] + timings[fn] = cc, ns+1, tt, ct, callers + else: + timings[fn] = 0, 0, 0, 0, {} + return 1 + + def trace_dispatch_return(self, frame, t): + if frame is not self.cur[-2]: + assert frame is self.cur[-2].f_back, ("Bad return", self.cur[-3]) + self.trace_dispatch_return(self.cur[-2], 0) + + # Prefix "r" means part of the Returning or exiting frame. + # Prefix "p" means part of the Previous or Parent or older frame. + + rpt, rit, ret, rfn, frame, rcur = self.cur + rit = rit + t + frame_total = rit + ret + + ppt, pit, pet, pfn, pframe, pcur = rcur + self.cur = ppt, pit + rpt, pet + frame_total, pfn, pframe, pcur + + timings = self.timings + cc, ns, tt, ct, callers = timings[rfn] + if not ns: + # This is the only occurrence of the function on the stack. + # Else this is a (directly or indirectly) recursive call, and + # its cumulative time will get updated when the topmost call to + # it returns. + ct = ct + frame_total + cc = cc + 1 + + if pfn in callers: + callers[pfn] = callers[pfn] + 1 # hack: gather more + # stats such as the amount of time added to ct courtesy + # of this specific call, and the contribution to cc + # courtesy of this call. + else: + callers[pfn] = 1 + + timings[rfn] = cc, ns - 1, tt + rit, ct, callers + + return 1 + + + dispatch = { + "call": trace_dispatch_call, + "exception": trace_dispatch_exception, + "return": trace_dispatch_return, + "c_call": trace_dispatch_c_call, + "c_exception": trace_dispatch_return, # the C function returned + "c_return": trace_dispatch_return, + } + + + # The next few functions play with self.cmd. By carefully preloading + # our parallel stack, we can force the profiled result to include + # an arbitrary string as the name of the calling function. + # We use self.cmd as that string, and the resulting stats look + # very nice :-). + + def set_cmd(self, cmd): + if self.cur[-1]: return # already set + self.cmd = cmd + self.simulate_call(cmd) + + class fake_code: + def __init__(self, filename, line, name): + self.co_filename = filename + self.co_line = line + self.co_name = name + self.co_firstlineno = 0 + + def __repr__(self): + return repr((self.co_filename, self.co_line, self.co_name)) + + class fake_frame: + def __init__(self, code, prior): + self.f_code = code + self.f_back = prior + + def simulate_call(self, name): + code = self.fake_code('profile', 0, name) + if self.cur: + pframe = self.cur[-2] + else: + pframe = None + frame = self.fake_frame(code, pframe) + self.dispatch['call'](self, frame, 0) + + # collect stats from pending stack, including getting final + # timings for self.cmd frame. + + def simulate_cmd_complete(self): + get_time = self.get_time + t = get_time() - self.t + while self.cur[-1]: + # We *can* cause assertion errors here if + # dispatch_trace_return checks for a frame match! + self.dispatch['return'](self, self.cur[-2], t) + t = 0 + self.t = get_time() - t + + + def print_stats(self, sort=-1): + import pstats + pstats.Stats(self).strip_dirs().sort_stats(sort). \ + print_stats() + + def dump_stats(self, file): + f = open(file, 'wb') + self.create_stats() + marshal.dump(self.stats, f) + f.close() + + def create_stats(self): + self.simulate_cmd_complete() + self.snapshot_stats() + + def snapshot_stats(self): + self.stats = {} + for func, (cc, ns, tt, ct, callers) in self.timings.items(): + callers = callers.copy() + nc = 0 + for callcnt in callers.values(): + nc += callcnt + self.stats[func] = cc, nc, tt, ct, callers + + + # The following two methods can be called by clients to use + # a profiler to profile a statement, given as a string. + + def run(self, cmd): + import __main__ + dict = __main__.__dict__ + return self.runctx(cmd, dict, dict) + + def runctx(self, cmd, globals, locals): + self.set_cmd(cmd) + sys.setprofile(self.dispatcher) + try: + exec(cmd, globals, locals) + finally: + sys.setprofile(None) + return self + + # This method is more useful to profile a single function call. + def runcall(self, func, *args, **kw): + self.set_cmd(repr(func)) + sys.setprofile(self.dispatcher) + try: + return func(*args, **kw) + finally: + sys.setprofile(None) + + + #****************************************************************** + # The following calculates the overhead for using a profiler. The + # problem is that it takes a fair amount of time for the profiler + # to stop the stopwatch (from the time it receives an event). + # Similarly, there is a delay from the time that the profiler + # re-starts the stopwatch before the user's code really gets to + # continue. The following code tries to measure the difference on + # a per-event basis. + # + # Note that this difference is only significant if there are a lot of + # events, and relatively little user code per event. For example, + # code with small functions will typically benefit from having the + # profiler calibrated for the current platform. This *could* be + # done on the fly during init() time, but it is not worth the + # effort. Also note that if too large a value specified, then + # execution time on some functions will actually appear as a + # negative number. It is *normal* for some functions (with very + # low call counts) to have such negative stats, even if the + # calibration figure is "correct." + # + # One alternative to profile-time calibration adjustments (i.e., + # adding in the magic little delta during each event) is to track + # more carefully the number of events (and cumulatively, the number + # of events during sub functions) that are seen. If this were + # done, then the arithmetic could be done after the fact (i.e., at + # display time). Currently, we track only call/return events. + # These values can be deduced by examining the callees and callers + # vectors for each functions. Hence we *can* almost correct the + # internal time figure at print time (note that we currently don't + # track exception event processing counts). Unfortunately, there + # is currently no similar information for cumulative sub-function + # time. It would not be hard to "get all this info" at profiler + # time. Specifically, we would have to extend the tuples to keep + # counts of this in each frame, and then extend the defs of timing + # tuples to include the significant two figures. I'm a bit fearful + # that this additional feature will slow the heavily optimized + # event/time ratio (i.e., the profiler would run slower, fur a very + # low "value added" feature.) + #************************************************************** + + def calibrate(self, m, verbose=0): + if self.__class__ is not Profile: + raise TypeError("Subclasses must override .calibrate().") + + saved_bias = self.bias + self.bias = 0 + try: + return self._calibrate_inner(m, verbose) + finally: + self.bias = saved_bias + + def _calibrate_inner(self, m, verbose): + get_time = self.get_time + + # Set up a test case to be run with and without profiling. Include + # lots of calls, because we're trying to quantify stopwatch overhead. + # Do not raise any exceptions, though, because we want to know + # exactly how many profile events are generated (one call event, + + # one return event, per Python-level call). + + def f1(n): + for i in range(n): + x = 1 + + def f(m, f1=f1): + for i in range(m): + f1(100) + + f(m) # warm up the cache + + # elapsed_noprofile <- time f(m) takes without profiling. + t0 = get_time() + f(m) + t1 = get_time() + elapsed_noprofile = t1 - t0 + if verbose: + print("elapsed time without profiling =", elapsed_noprofile) + + # elapsed_profile <- time f(m) takes with profiling. The difference + # is profiling overhead, only some of which the profiler subtracts + # out on its own. + p = Profile() + t0 = get_time() + p.runctx('f(m)', globals(), locals()) + t1 = get_time() + elapsed_profile = t1 - t0 + if verbose: + print("elapsed time with profiling =", elapsed_profile) + + # reported_time <- "CPU seconds" the profiler charged to f and f1. + total_calls = 0.0 + reported_time = 0.0 + for (filename, line, funcname), (cc, ns, tt, ct, callers) in \ + p.timings.items(): + if funcname in ("f", "f1"): + total_calls += cc + reported_time += tt + + if verbose: + print("'CPU seconds' profiler reported =", reported_time) + print("total # calls =", total_calls) + if total_calls != m + 1: + raise ValueError("internal error: total calls = %d" % total_calls) + + # reported_time - elapsed_noprofile = overhead the profiler wasn't + # able to measure. Divide by twice the number of calls (since there + # are two profiler events per call in this test) to get the hidden + # overhead per event. + mean = (reported_time - elapsed_noprofile) / 2.0 / total_calls + if verbose: + print("mean stopwatch overhead per profile event =", mean) + return mean + +#**************************************************************************** +def Stats(*args): + print('Report generating functions are in the "pstats" module\a') + +def main(): + usage = "profile.py [-o output_file_path] [-s sort] scriptfile [arg] ..." + parser = OptionParser(usage=usage) + parser.allow_interspersed_args = False + parser.add_option('-o', '--outfile', dest="outfile", + help="Save stats to ", default=None) + parser.add_option('-s', '--sort', dest="sort", + help="Sort order when printing to stdout, based on pstats.Stats class", default=-1) + + if not sys.argv[1:]: + parser.print_usage() + sys.exit(2) + + (options, args) = parser.parse_args() + sys.argv[:] = args + + if (len(sys.argv) > 0): + sys.path.insert(0, os.path.dirname(sys.argv[0])) + run('execfile(%r)' % (sys.argv[0],), options.outfile, options.sort) + else: + parser.print_usage() + return parser + +# When invoked as main program, invoke the profiler on a script +if __name__ == '__main__': + main() Added: sandbox/trunk/cpy_merge/Lib/test/output/test_cProfile ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/test/output/test_cProfile Wed May 23 03:45:28 2007 @@ -0,0 +1,78 @@ +test_cProfile + 119 function calls (99 primitive calls) in 1.000 CPU seconds + + Ordered by: standard name + + ncalls tottime percall cumtime percall filename:lineno(function) + 1 0.000 0.000 1.000 1.000 :1() + 8 0.064 0.008 0.080 0.010 test_cProfile.py:103(subhelper) + 28 0.028 0.001 0.028 0.001 test_cProfile.py:115(__getattr__) + 1 0.270 0.270 1.000 1.000 test_cProfile.py:30(testfunc) + 23/3 0.150 0.007 0.170 0.057 test_cProfile.py:40(factorial) + 20 0.020 0.001 0.020 0.001 test_cProfile.py:53(mul) + 2 0.040 0.020 0.600 0.300 test_cProfile.py:60(helper) + 4 0.116 0.029 0.120 0.030 test_cProfile.py:78(helper1) + 2 0.000 0.000 0.140 0.070 test_cProfile.py:89(helper2_indirect) + 8 0.312 0.039 0.400 0.050 test_cProfile.py:93(helper2) + 1 0.000 0.000 1.000 1.000 {exec} + 12 0.000 0.000 0.012 0.001 {hasattr} + 4 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects} + 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} + 4 0.000 0.000 0.000 0.000 {sys.exc_info} + + + Ordered by: standard name + +Function called... + ncalls tottime cumtime +:1() -> 1 0.270 1.000 test_cProfile.py:30(testfunc) +test_cProfile.py:103(subhelper) -> 16 0.016 0.016 test_cProfile.py:115(__getattr__) +test_cProfile.py:115(__getattr__) -> +test_cProfile.py:30(testfunc) -> 1 0.014 0.130 test_cProfile.py:40(factorial) + 2 0.040 0.600 test_cProfile.py:60(helper) +test_cProfile.py:40(factorial) -> 20/3 0.130 0.147 test_cProfile.py:40(factorial) + 20 0.020 0.020 test_cProfile.py:53(mul) +test_cProfile.py:53(mul) -> +test_cProfile.py:60(helper) -> 4 0.116 0.120 test_cProfile.py:78(helper1) + 2 0.000 0.140 test_cProfile.py:89(helper2_indirect) + 6 0.234 0.300 test_cProfile.py:93(helper2) +test_cProfile.py:78(helper1) -> 4 0.000 0.004 {hasattr} + 4 0.000 0.000 {method 'append' of 'list' objects} + 4 0.000 0.000 {sys.exc_info} +test_cProfile.py:89(helper2_indirect) -> 2 0.006 0.040 test_cProfile.py:40(factorial) + 2 0.078 0.100 test_cProfile.py:93(helper2) +test_cProfile.py:93(helper2) -> 8 0.064 0.080 test_cProfile.py:103(subhelper) + 8 0.000 0.008 {hasattr} +{exec} -> 1 0.000 1.000 :1() +{hasattr} -> 12 0.012 0.012 test_cProfile.py:115(__getattr__) +{method 'append' of 'list' objects} -> +{method 'disable' of '_lsprof.Profiler' objects} -> +{sys.exc_info} -> + + + Ordered by: standard name + +Function was called by... + ncalls tottime cumtime +:1() <- 1 0.000 1.000 {exec} +test_cProfile.py:103(subhelper) <- 8 0.064 0.080 test_cProfile.py:93(helper2) +test_cProfile.py:115(__getattr__) <- 16 0.016 0.016 test_cProfile.py:103(subhelper) + 12 0.012 0.012 {hasattr} +test_cProfile.py:30(testfunc) <- 1 0.270 1.000 :1() +test_cProfile.py:40(factorial) <- 1 0.014 0.130 test_cProfile.py:30(testfunc) + 20/3 0.130 0.147 test_cProfile.py:40(factorial) + 2 0.006 0.040 test_cProfile.py:89(helper2_indirect) +test_cProfile.py:53(mul) <- 20 0.020 0.020 test_cProfile.py:40(factorial) +test_cProfile.py:60(helper) <- 2 0.040 0.600 test_cProfile.py:30(testfunc) +test_cProfile.py:78(helper1) <- 4 0.116 0.120 test_cProfile.py:60(helper) +test_cProfile.py:89(helper2_indirect) <- 2 0.000 0.140 test_cProfile.py:60(helper) +test_cProfile.py:93(helper2) <- 6 0.234 0.300 test_cProfile.py:60(helper) + 2 0.078 0.100 test_cProfile.py:89(helper2_indirect) +{exec} <- +{hasattr} <- 4 0.000 0.004 test_cProfile.py:78(helper1) + 8 0.000 0.008 test_cProfile.py:93(helper2) +{method 'append' of 'list' objects} <- 4 0.000 0.000 test_cProfile.py:78(helper1) +{method 'disable' of '_lsprof.Profiler' objects} <- +{sys.exc_info} <- 4 0.000 0.000 test_cProfile.py:78(helper1) + + Added: sandbox/trunk/cpy_merge/Lib/test/pickletester.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/test/pickletester.py Wed May 23 03:45:28 2007 @@ -0,0 +1,1006 @@ +import unittest +import pickle +try: + import cPickle +except ImportError: + cPickle = None +import pickletools +import copy_reg + +from test.test_support import TestFailed, have_unicode, TESTFN, \ + run_with_locale + +# Tests that try a number of pickle protocols should have a +# for proto in protocols: +# kind of outer loop. +if cPickle is not None: + assert pickle.HIGHEST_PROTOCOL == cPickle.HIGHEST_PROTOCOL == 2 +protocols = range(pickle.HIGHEST_PROTOCOL + 1) + + +# Return True if opcode code appears in the pickle, else False. +def opcode_in_pickle(code, pickle): + for op, dummy, dummy in pickletools.genops(pickle): + if op.code == code.decode("latin-1"): + return True + return False + +# Return the number of times opcode code appears in pickle. +def count_opcode(code, pickle): + n = 0 + for op, dummy, dummy in pickletools.genops(pickle): + if op.code == code.decode("latin-1"): + n += 1 + return n + +# We can't very well test the extension registry without putting known stuff +# in it, but we have to be careful to restore its original state. Code +# should do this: +# +# e = ExtensionSaver(extension_code) +# try: +# fiddle w/ the extension registry's stuff for extension_code +# finally: +# e.restore() + +class ExtensionSaver: + # Remember current registration for code (if any), and remove it (if + # there is one). + def __init__(self, code): + self.code = code + if code in copy_reg._inverted_registry: + self.pair = copy_reg._inverted_registry[code] + copy_reg.remove_extension(self.pair[0], self.pair[1], code) + else: + self.pair = None + + # Restore previous registration for code. + def restore(self): + code = self.code + curpair = copy_reg._inverted_registry.get(code) + if curpair is not None: + copy_reg.remove_extension(curpair[0], curpair[1], code) + pair = self.pair + if pair is not None: + copy_reg.add_extension(pair[0], pair[1], code) + +class C: + def __eq__(self, other): + return self.__dict__ == other.__dict__ + +import __main__ +__main__.C = C +C.__module__ = "__main__" + +class myint(int): + def __init__(self, x): + self.str = str(x) + +class initarg(C): + + def __init__(self, a, b): + self.a = a + self.b = b + + def __getinitargs__(self): + return self.a, self.b + +class metaclass(type): + pass + +class use_metaclass(object, metaclass=metaclass): + pass + +# DATA0 .. DATA2 are the pickles we expect under the various protocols, for +# the object returned by create_data(). + +# break into multiple strings to avoid confusing font-lock-mode +DATA0 = b"""(lp1 +I0 +aL1L +aF2 +ac__builtin__ +complex +p2 +""" + \ +b"""(F3 +F0 +tRp3 +aI1 +aI-1 +aI255 +aI-255 +aI-256 +aI65535 +aI-65535 +aI-65536 +aI2147483647 +aI-2147483647 +aI-2147483648 +a""" + \ +b"""(S'abc' +p4 +g4 +""" + \ +b"""(i__main__ +C +p5 +""" + \ +b"""(dp6 +S'foo' +p7 +I1 +sS'bar' +p8 +I2 +sbg5 +tp9 +ag9 +aI5 +a. +""" + +# Disassembly of DATA0. +DATA0_DIS = """\ + 0: ( MARK + 1: l LIST (MARK at 0) + 2: p PUT 1 + 5: I INT 0 + 8: a APPEND + 9: L LONG 1L + 13: a APPEND + 14: F FLOAT 2.0 + 17: a APPEND + 18: c GLOBAL '__builtin__ complex' + 39: p PUT 2 + 42: ( MARK + 43: F FLOAT 3.0 + 46: F FLOAT 0.0 + 49: t TUPLE (MARK at 42) + 50: R REDUCE + 51: p PUT 3 + 54: a APPEND + 55: I INT 1 + 58: a APPEND + 59: I INT -1 + 63: a APPEND + 64: I INT 255 + 69: a APPEND + 70: I INT -255 + 76: a APPEND + 77: I INT -256 + 83: a APPEND + 84: I INT 65535 + 91: a APPEND + 92: I INT -65535 + 100: a APPEND + 101: I INT -65536 + 109: a APPEND + 110: I INT 2147483647 + 122: a APPEND + 123: I INT -2147483647 + 136: a APPEND + 137: I INT -2147483648 + 150: a APPEND + 151: ( MARK + 152: S STRING 'abc' + 159: p PUT 4 + 162: g GET 4 + 165: ( MARK + 166: i INST '__main__ C' (MARK at 165) + 178: p PUT 5 + 181: ( MARK + 182: d DICT (MARK at 181) + 183: p PUT 6 + 186: S STRING 'foo' + 193: p PUT 7 + 196: I INT 1 + 199: s SETITEM + 200: S STRING 'bar' + 207: p PUT 8 + 210: I INT 2 + 213: s SETITEM + 214: b BUILD + 215: g GET 5 + 218: t TUPLE (MARK at 151) + 219: p PUT 9 + 222: a APPEND + 223: g GET 9 + 226: a APPEND + 227: I INT 5 + 230: a APPEND + 231: . STOP +highest protocol among opcodes = 0 +""" + +DATA1 = (b']q\x01(K\x00L1L\nG@\x00\x00\x00\x00\x00\x00\x00' + b'c__builtin__\ncomplex\nq\x02(G@\x08\x00\x00\x00\x00\x00' + b'\x00G\x00\x00\x00\x00\x00\x00\x00\x00tRq\x03K\x01J\xff\xff' + b'\xff\xffK\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xff' + b'J\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00' + b'\x00\x80J\x00\x00\x00\x80(U\x03abcq\x04h\x04(c__main__\n' + b'C\nq\x05oq\x06}q\x07(U\x03fooq\x08K\x01U\x03barq\tK\x02ubh' + b'\x06tq\nh\nK\x05e.' + ) + +# Disassembly of DATA1. +DATA1_DIS = """\ + 0: ] EMPTY_LIST + 1: q BINPUT 1 + 3: ( MARK + 4: K BININT1 0 + 6: L LONG 1L + 10: G BINFLOAT 2.0 + 19: c GLOBAL '__builtin__ complex' + 40: q BINPUT 2 + 42: ( MARK + 43: G BINFLOAT 3.0 + 52: G BINFLOAT 0.0 + 61: t TUPLE (MARK at 42) + 62: R REDUCE + 63: q BINPUT 3 + 65: K BININT1 1 + 67: J BININT -1 + 72: K BININT1 255 + 74: J BININT -255 + 79: J BININT -256 + 84: M BININT2 65535 + 87: J BININT -65535 + 92: J BININT -65536 + 97: J BININT 2147483647 + 102: J BININT -2147483647 + 107: J BININT -2147483648 + 112: ( MARK + 113: U SHORT_BINSTRING 'abc' + 118: q BINPUT 4 + 120: h BINGET 4 + 122: ( MARK + 123: c GLOBAL '__main__ C' + 135: q BINPUT 5 + 137: o OBJ (MARK at 122) + 138: q BINPUT 6 + 140: } EMPTY_DICT + 141: q BINPUT 7 + 143: ( MARK + 144: U SHORT_BINSTRING 'foo' + 149: q BINPUT 8 + 151: K BININT1 1 + 153: U SHORT_BINSTRING 'bar' + 158: q BINPUT 9 + 160: K BININT1 2 + 162: u SETITEMS (MARK at 143) + 163: b BUILD + 164: h BINGET 6 + 166: t TUPLE (MARK at 112) + 167: q BINPUT 10 + 169: h BINGET 10 + 171: K BININT1 5 + 173: e APPENDS (MARK at 3) + 174: . STOP +highest protocol among opcodes = 1 +""" + +DATA2 = (b'\x80\x02]q\x01(K\x00\x8a\x01\x01G@\x00\x00\x00\x00\x00\x00\x00' + b'c__builtin__\ncomplex\nq\x02G@\x08\x00\x00\x00\x00\x00\x00G\x00' + b'\x00\x00\x00\x00\x00\x00\x00\x86Rq\x03K\x01J\xff\xff\xff\xffK' + b'\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xffJ\x01\x00\xff\xff' + b'J\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00\x00\x80J\x00\x00\x00' + b'\x80(U\x03abcq\x04h\x04(c__main__\nC\nq\x05oq\x06}q\x07(U\x03foo' + b'q\x08K\x01U\x03barq\tK\x02ubh\x06tq\nh\nK\x05e.') + +# Disassembly of DATA2. +DATA2_DIS = """\ + 0: \x80 PROTO 2 + 2: ] EMPTY_LIST + 3: q BINPUT 1 + 5: ( MARK + 6: K BININT1 0 + 8: \x8a LONG1 1L + 11: G BINFLOAT 2.0 + 20: c GLOBAL '__builtin__ complex' + 41: q BINPUT 2 + 43: G BINFLOAT 3.0 + 52: G BINFLOAT 0.0 + 61: \x86 TUPLE2 + 62: R REDUCE + 63: q BINPUT 3 + 65: K BININT1 1 + 67: J BININT -1 + 72: K BININT1 255 + 74: J BININT -255 + 79: J BININT -256 + 84: M BININT2 65535 + 87: J BININT -65535 + 92: J BININT -65536 + 97: J BININT 2147483647 + 102: J BININT -2147483647 + 107: J BININT -2147483648 + 112: ( MARK + 113: U SHORT_BINSTRING 'abc' + 118: q BINPUT 4 + 120: h BINGET 4 + 122: ( MARK + 123: c GLOBAL '__main__ C' + 135: q BINPUT 5 + 137: o OBJ (MARK at 122) + 138: q BINPUT 6 + 140: } EMPTY_DICT + 141: q BINPUT 7 + 143: ( MARK + 144: U SHORT_BINSTRING 'foo' + 149: q BINPUT 8 + 151: K BININT1 1 + 153: U SHORT_BINSTRING 'bar' + 158: q BINPUT 9 + 160: K BININT1 2 + 162: u SETITEMS (MARK at 143) + 163: b BUILD + 164: h BINGET 6 + 166: t TUPLE (MARK at 112) + 167: q BINPUT 10 + 169: h BINGET 10 + 171: K BININT1 5 + 173: e APPENDS (MARK at 5) + 174: . STOP +highest protocol among opcodes = 2 +""" + +def create_data(): + c = C() + c.foo = 1 + c.bar = 2 + x = [0, 1, 2.0, 3.0+0j] + # Append some integer test cases at cPickle.c's internal size + # cutoffs. + uint1max = 0xff + uint2max = 0xffff + int4max = 0x7fffffff + x.extend([1, -1, + uint1max, -uint1max, -uint1max-1, + uint2max, -uint2max, -uint2max-1, + int4max, -int4max, -int4max-1]) + y = ('abc', 'abc', c, c) + x.append(y) + x.append(y) + x.append(5) + return x + +class AbstractPickleTests(unittest.TestCase): + # Subclass must define self.dumps, self.loads, self.error. + + _testdata = create_data() + + def setUp(self): + pass + + def test_misc(self): + # test various datatypes not tested by testdata + for proto in protocols: + x = myint(4) + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(x, y) + + x = (1, ()) + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(x, y) + + x = initarg(1, x) + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(x, y) + + # XXX test __reduce__ protocol? + + def test_roundtrip_equality(self): + expected = self._testdata + for proto in protocols: + s = self.dumps(expected, proto) + got = self.loads(s) + self.assertEqual(expected, got) + + def test_load_from_canned_string(self): + expected = self._testdata + for canned in DATA0, DATA1, DATA2: + got = self.loads(canned) + self.assertEqual(expected, got) + + # There are gratuitous differences between pickles produced by + # pickle and cPickle, largely because cPickle starts PUT indices at + # 1 and pickle starts them at 0. See XXX comment in cPickle's put2() -- + # there's a comment with an exclamation point there whose meaning + # is a mystery. cPickle also suppresses PUT for objects with a refcount + # of 1. + def dont_test_disassembly(self): + from cStringIO import StringIO + from pickletools import dis + + for proto, expected in (0, DATA0_DIS), (1, DATA1_DIS): + s = self.dumps(self._testdata, proto) + filelike = StringIO() + dis(s, out=filelike) + got = filelike.getvalue() + self.assertEqual(expected, got) + + def test_recursive_list(self): + l = [] + l.append(l) + for proto in protocols: + s = self.dumps(l, proto) + x = self.loads(s) + self.assertEqual(len(x), 1) + self.assert_(x is x[0]) + + def test_recursive_dict(self): + d = {} + d[1] = d + for proto in protocols: + s = self.dumps(d, proto) + x = self.loads(s) + self.assertEqual(list(x.keys()), [1]) + self.assert_(x[1] is x) + + def test_recursive_inst(self): + i = C() + i.attr = i + for proto in protocols: + s = self.dumps(i, 2) + x = self.loads(s) + self.assertEqual(dir(x), dir(i)) + self.assert_(x.attr is x) + + def test_recursive_multi(self): + l = [] + d = {1:l} + i = C() + i.attr = d + l.append(i) + for proto in protocols: + s = self.dumps(l, proto) + x = self.loads(s) + self.assertEqual(len(x), 1) + self.assertEqual(dir(x[0]), dir(i)) + self.assertEqual(list(x[0].attr.keys()), [1]) + self.assert_(x[0].attr[1] is x) + + def test_garyp(self): + self.assertRaises(self.error, self.loads, b'garyp') + + def test_insecure_strings(self): + insecure = ["abc", "2 + 2", # not quoted + #"'abc' + 'def'", # not a single quoted string + "'abc", # quote is not closed + "'abc\"", # open quote and close quote don't match + "'abc' ?", # junk after close quote + "'\\'", # trailing backslash + # some tests of the quoting rules + #"'abc\"\''", + #"'\\\\a\'\'\'\\\'\\\\\''", + ] + for s in insecure: + buf = b"S" + bytes(s) + b"\012p0\012." + self.assertRaises(ValueError, self.loads, buf) + + if have_unicode: + def test_unicode(self): + endcases = [str(''), str('<\\u>'), str('<\\\u1234>'), + str('<\n>'), str('<\\>')] + for proto in protocols: + for u in endcases: + p = self.dumps(u, proto) + u2 = self.loads(p) + self.assertEqual(u2, u) + + def test_ints(self): + import sys + for proto in protocols: + n = sys.maxint + while n: + for expected in (-n, n): + s = self.dumps(expected, proto) + n2 = self.loads(s) + self.assertEqual(expected, n2) + n = n >> 1 + + def test_maxint64(self): + maxint64 = (1 << 63) - 1 + data = b'I' + bytes(str(maxint64)) + b'\n.' + got = self.loads(data) + self.assertEqual(got, maxint64) + + # Try too with a bogus literal. + data = b'I' + bytes(str(maxint64)) + b'JUNK\n.' + self.assertRaises(ValueError, self.loads, data) + + def test_long(self): + for proto in protocols: + # 256 bytes is where LONG4 begins. + for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257: + nbase = 1 << nbits + for npos in nbase-1, nbase, nbase+1: + for n in npos, -npos: + pickle = self.dumps(n, proto) + got = self.loads(pickle) + self.assertEqual(n, got) + # Try a monster. This is quadratic-time in protos 0 & 1, so don't + # bother with those. + nbase = int("deadbeeffeedface", 16) + nbase += nbase << 1000000 + for n in nbase, -nbase: + p = self.dumps(n, 2) + got = self.loads(p) + self.assertEqual(n, got) + + @run_with_locale('LC_ALL', 'de_DE', 'fr_FR') + def test_float_format(self): + # make sure that floats are formatted locale independent + self.assertEqual(self.dumps(1.2)[0:3], b'F1.') + + def test_reduce(self): + pass + + def test_getinitargs(self): + pass + + def test_metaclass(self): + a = use_metaclass() + for proto in protocols: + s = self.dumps(a, proto) + b = self.loads(s) + self.assertEqual(a.__class__, b.__class__) + + def test_structseq(self): + import time + import os + + t = time.localtime() + for proto in protocols: + s = self.dumps(t, proto) + u = self.loads(s) + self.assertEqual(t, u) + if hasattr(os, "stat"): + t = os.stat(os.curdir) + s = self.dumps(t, proto) + u = self.loads(s) + self.assertEqual(t, u) + if hasattr(os, "statvfs"): + t = os.statvfs(os.curdir) + s = self.dumps(t, proto) + u = self.loads(s) + self.assertEqual(t, u) + + # Tests for protocol 2 + + def test_proto(self): + build_none = pickle.NONE + pickle.STOP + for proto in protocols: + expected = build_none + if proto >= 2: + expected = pickle.PROTO + bytes([proto]) + expected + p = self.dumps(None, proto) + self.assertEqual(p, expected) + + oob = protocols[-1] + 1 # a future protocol + badpickle = pickle.PROTO + bytes([oob]) + build_none + try: + self.loads(badpickle) + except ValueError as detail: + self.failUnless(str(detail).startswith( + "unsupported pickle protocol")) + else: + self.fail("expected bad protocol number to raise ValueError") + + def test_long1(self): + x = 12345678910111213141516178920 + for proto in protocols: + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(x, y) + self.assertEqual(opcode_in_pickle(pickle.LONG1, s), proto >= 2) + + def test_long4(self): + x = 12345678910111213141516178920 << (256*8) + for proto in protocols: + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(x, y) + self.assertEqual(opcode_in_pickle(pickle.LONG4, s), proto >= 2) + + def test_short_tuples(self): + # Map (proto, len(tuple)) to expected opcode. + expected_opcode = {(0, 0): pickle.TUPLE, + (0, 1): pickle.TUPLE, + (0, 2): pickle.TUPLE, + (0, 3): pickle.TUPLE, + (0, 4): pickle.TUPLE, + + (1, 0): pickle.EMPTY_TUPLE, + (1, 1): pickle.TUPLE, + (1, 2): pickle.TUPLE, + (1, 3): pickle.TUPLE, + (1, 4): pickle.TUPLE, + + (2, 0): pickle.EMPTY_TUPLE, + (2, 1): pickle.TUPLE1, + (2, 2): pickle.TUPLE2, + (2, 3): pickle.TUPLE3, + (2, 4): pickle.TUPLE, + } + a = () + b = (1,) + c = (1, 2) + d = (1, 2, 3) + e = (1, 2, 3, 4) + for proto in protocols: + for x in a, b, c, d, e: + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(x, y, (proto, x, s, y)) + expected = expected_opcode[proto, len(x)] + self.assertEqual(opcode_in_pickle(expected, s), True) + + def test_singletons(self): + # Map (proto, singleton) to expected opcode. + expected_opcode = {(0, None): pickle.NONE, + (1, None): pickle.NONE, + (2, None): pickle.NONE, + + (0, True): pickle.INT, + (1, True): pickle.INT, + (2, True): pickle.NEWTRUE, + + (0, False): pickle.INT, + (1, False): pickle.INT, + (2, False): pickle.NEWFALSE, + } + for proto in protocols: + for x in None, False, True: + s = self.dumps(x, proto) + y = self.loads(s) + self.assert_(x is y, (proto, x, s, y)) + expected = expected_opcode[proto, x] + self.assertEqual(opcode_in_pickle(expected, s), True) + + def test_newobj_tuple(self): + x = MyTuple([1, 2, 3]) + x.foo = 42 + x.bar = "hello" + for proto in protocols: + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(tuple(x), tuple(y)) + self.assertEqual(x.__dict__, y.__dict__) + + def test_newobj_list(self): + x = MyList([1, 2, 3]) + x.foo = 42 + x.bar = "hello" + for proto in protocols: + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(list(x), list(y)) + self.assertEqual(x.__dict__, y.__dict__) + + def test_newobj_generic(self): + for proto in protocols: + for C in myclasses: + B = C.__base__ + x = C(C.sample) + x.foo = 42 + s = self.dumps(x, proto) + y = self.loads(s) + detail = (proto, C, B, x, y, type(y)) + self.assertEqual(B(x), B(y), detail) + self.assertEqual(x.__dict__, y.__dict__, detail) + + # Register a type with copy_reg, with extension code extcode. Pickle + # an object of that type. Check that the resulting pickle uses opcode + # (EXT[124]) under proto 2, and not in proto 1. + + def produce_global_ext(self, extcode, opcode): + e = ExtensionSaver(extcode) + try: + copy_reg.add_extension(__name__, "MyList", extcode) + x = MyList([1, 2, 3]) + x.foo = 42 + x.bar = "hello" + + # Dump using protocol 1 for comparison. + s1 = self.dumps(x, 1) + self.assert_(bytes(__name__) in s1) + self.assert_(b"MyList" in s1) + self.assertEqual(opcode_in_pickle(opcode, s1), False) + + y = self.loads(s1) + self.assertEqual(list(x), list(y)) + self.assertEqual(x.__dict__, y.__dict__) + + # Dump using protocol 2 for test. + s2 = self.dumps(x, 2) + self.assert_(bytes(__name__) not in s2) + self.assert_(b"MyList" not in s2) + self.assertEqual(opcode_in_pickle(opcode, s2), True, repr(s2)) + + y = self.loads(s2) + self.assertEqual(list(x), list(y)) + self.assertEqual(x.__dict__, y.__dict__) + + finally: + e.restore() + + def test_global_ext1(self): + self.produce_global_ext(0x00000001, pickle.EXT1) # smallest EXT1 code + self.produce_global_ext(0x000000ff, pickle.EXT1) # largest EXT1 code + + def test_global_ext2(self): + self.produce_global_ext(0x00000100, pickle.EXT2) # smallest EXT2 code + self.produce_global_ext(0x0000ffff, pickle.EXT2) # largest EXT2 code + self.produce_global_ext(0x0000abcd, pickle.EXT2) # check endianness + + def test_global_ext4(self): + self.produce_global_ext(0x00010000, pickle.EXT4) # smallest EXT4 code + self.produce_global_ext(0x7fffffff, pickle.EXT4) # largest EXT4 code + self.produce_global_ext(0x12abcdef, pickle.EXT4) # check endianness + + def test_list_chunking(self): + n = 10 # too small to chunk + x = list(range(n)) + for proto in protocols: + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(x, y) + num_appends = count_opcode(pickle.APPENDS, s) + self.assertEqual(num_appends, proto > 0) + + n = 2500 # expect at least two chunks when proto > 0 + x = list(range(n)) + for proto in protocols: + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(x, y) + num_appends = count_opcode(pickle.APPENDS, s) + if proto == 0: + self.assertEqual(num_appends, 0) + else: + self.failUnless(num_appends >= 2) + + def test_dict_chunking(self): + n = 10 # too small to chunk + x = dict.fromkeys(range(n)) + for proto in protocols: + s = self.dumps(x, proto) + assert isinstance(s, bytes) + y = self.loads(s) + self.assertEqual(x, y) + num_setitems = count_opcode(pickle.SETITEMS, s) + self.assertEqual(num_setitems, proto > 0) + + n = 2500 # expect at least two chunks when proto > 0 + x = dict.fromkeys(range(n)) + for proto in protocols: + s = self.dumps(x, proto) + y = self.loads(s) + self.assertEqual(x, y) + num_setitems = count_opcode(pickle.SETITEMS, s) + if proto == 0: + self.assertEqual(num_setitems, 0) + else: + self.failUnless(num_setitems >= 2) + + def test_simple_newobj(self): + x = object.__new__(SimpleNewObj) # avoid __init__ + x.abc = 666 + for proto in protocols: + s = self.dumps(x, proto) + self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), proto >= 2) + y = self.loads(s) # will raise TypeError if __init__ called + self.assertEqual(y.abc, 666) + self.assertEqual(x.__dict__, y.__dict__) + + def test_newobj_list_slots(self): + x = SlotList([1, 2, 3]) + x.foo = 42 + x.bar = "hello" + s = self.dumps(x, 2) + y = self.loads(s) + self.assertEqual(list(x), list(y)) + self.assertEqual(x.__dict__, y.__dict__) + self.assertEqual(x.foo, y.foo) + self.assertEqual(x.bar, y.bar) + + def test_reduce_overrides_default_reduce_ex(self): + for proto in 0, 1, 2: + x = REX_one() + self.assertEqual(x._reduce_called, 0) + s = self.dumps(x, proto) + self.assertEqual(x._reduce_called, 1) + y = self.loads(s) + self.assertEqual(y._reduce_called, 0) + + def test_reduce_ex_called(self): + for proto in 0, 1, 2: + x = REX_two() + self.assertEqual(x._proto, None) + s = self.dumps(x, proto) + self.assertEqual(x._proto, proto) + y = self.loads(s) + self.assertEqual(y._proto, None) + + def test_reduce_ex_overrides_reduce(self): + for proto in 0, 1, 2: + x = REX_three() + self.assertEqual(x._proto, None) + s = self.dumps(x, proto) + self.assertEqual(x._proto, proto) + y = self.loads(s) + self.assertEqual(y._proto, None) + + def test_reduce_ex_calls_base(self): + for proto in 0, 1, 2: + x = REX_four() + self.assertEqual(x._proto, None) + s = self.dumps(x, proto) + self.assertEqual(x._proto, proto) + y = self.loads(s) + self.assertEqual(y._proto, proto) + + def test_reduce_calls_base(self): + for proto in 0, 1, 2: + x = REX_five() + self.assertEqual(x._reduce_called, 0) + s = self.dumps(x, proto) + self.assertEqual(x._reduce_called, 1) + y = self.loads(s) + self.assertEqual(y._reduce_called, 1) + +# Test classes for reduce_ex + +class REX_one(object): + _reduce_called = 0 + def __reduce__(self): + self._reduce_called = 1 + return REX_one, () + # No __reduce_ex__ here, but inheriting it from object + +class REX_two(object): + _proto = None + def __reduce_ex__(self, proto): + self._proto = proto + return REX_two, () + # No __reduce__ here, but inheriting it from object + +class REX_three(object): + _proto = None + def __reduce_ex__(self, proto): + self._proto = proto + return REX_two, () + def __reduce__(self): + raise TestFailed, "This __reduce__ shouldn't be called" + +class REX_four(object): + _proto = None + def __reduce_ex__(self, proto): + self._proto = proto + return object.__reduce_ex__(self, proto) + # Calling base class method should succeed + +class REX_five(object): + _reduce_called = 0 + def __reduce__(self): + self._reduce_called = 1 + return object.__reduce__(self) + # This one used to fail with infinite recursion + +# Test classes for newobj + +class MyInt(int): + sample = 1 + +class MyLong(int): + sample = 1 + +class MyFloat(float): + sample = 1.0 + +class MyComplex(complex): + sample = 1.0 + 0.0j + +class MyStr(str): + sample = "hello" + +class MyUnicode(str): + sample = "hello \u1234" + +class MyTuple(tuple): + sample = (1, 2, 3) + +class MyList(list): + sample = [1, 2, 3] + +class MyDict(dict): + sample = {"a": 1, "b": 2} + +myclasses = [MyInt, MyLong, MyFloat, + MyComplex, + MyStr, MyUnicode, + MyTuple, MyList, MyDict] + + +class SlotList(MyList): + __slots__ = ["foo"] + +class SimpleNewObj(object): + def __init__(self, a, b, c): + # raise an error, to make sure this isn't called + raise TypeError("SimpleNewObj.__init__() didn't expect to get called") + +class AbstractPickleModuleTests(unittest.TestCase): + + def test_dump_closed_file(self): + import os + f = open(TESTFN, "w") + try: + f.close() + self.assertRaises(ValueError, self.module.dump, 123, f) + finally: + os.remove(TESTFN) + + def test_load_closed_file(self): + import os + f = open(TESTFN, "w") + try: + f.close() + self.assertRaises(ValueError, self.module.dump, 123, f) + finally: + os.remove(TESTFN) + + def test_highest_protocol(self): + # Of course this needs to be changed when HIGHEST_PROTOCOL changes. + self.assertEqual(self.module.HIGHEST_PROTOCOL, 2) + + def test_callapi(self): + from cStringIO import StringIO + f = StringIO() + # With and without keyword arguments + self.module.dump(123, f, -1) + self.module.dump(123, file=f, protocol=-1) + self.module.dumps(123, -1) + self.module.dumps(123, protocol=-1) + self.module.Pickler(f, -1) + self.module.Pickler(f, protocol=-1) + +class AbstractPersistentPicklerTests(unittest.TestCase): + + # This class defines persistent_id() and persistent_load() + # functions that should be used by the pickler. All even integers + # are pickled using persistent ids. + + def persistent_id(self, object): + if isinstance(object, int) and object % 2 == 0: + self.id_count += 1 + return str(object) + else: + return None + + def persistent_load(self, oid): + self.load_count += 1 + object = int(oid) + assert object % 2 == 0 + return object + + def test_persistence(self): + self.id_count = 0 + self.load_count = 0 + L = list(range(10)) + self.assertEqual(self.loads(self.dumps(L)), L) + self.assertEqual(self.id_count, 5) + self.assertEqual(self.load_count, 5) + + def test_bin_persistence(self): + self.id_count = 0 + self.load_count = 0 + L = list(range(10)) + self.assertEqual(self.loads(self.dumps(L, 1)), L) + self.assertEqual(self.id_count, 5) + self.assertEqual(self.load_count, 5) Added: sandbox/trunk/cpy_merge/Lib/test/regrtest.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/test/regrtest.py Wed May 23 03:45:28 2007 @@ -0,0 +1,1275 @@ +#! /usr/bin/env python + +"""Regression test. + +This will find all modules whose name is "test_*" in the test +directory, and run them. Various command line options provide +additional facilities. + +Command line options: + +-v: verbose -- run tests in verbose mode with output to stdout +-w: verbose2 -- re-run failed tests in verbose mode +-d: debug -- print traceback for failed tests +-q: quiet -- don't print anything except if a test fails +-g: generate -- write the output file for a test instead of comparing it +-x: exclude -- arguments are tests to *exclude* +-s: single -- run only a single test (see below) +-r: random -- randomize test execution order +-f: fromfile -- read names of tests to run from a file (see below) +-l: findleaks -- if GC is available detect tests that leak memory +-u: use -- specify which special resource intensive tests to run +-h: help -- print this text and exit +-t: threshold -- call gc.set_threshold(N) +-T: coverage -- turn on code coverage using the trace module +-D: coverdir -- Directory where coverage files are put +-N: nocoverdir -- Put coverage files alongside modules +-L: runleaks -- run the leaks(1) command just before exit +-R: huntrleaks -- search for reference leaks (needs debug build, v. slow) +-M: memlimit -- run very large memory-consuming tests + +If non-option arguments are present, they are names for tests to run, +unless -x is given, in which case they are names for tests not to run. +If no test names are given, all tests are run. + +-v is incompatible with -g and does not compare test output files. + +-T turns on code coverage tracing with the trace module. + +-D specifies the directory where coverage files are put. + +-N Put coverage files alongside modules. + +-s means to run only a single test and exit. This is useful when +doing memory analysis on the Python interpreter (which tend to consume +too many resources to run the full regression test non-stop). The +file /tmp/pynexttest is read to find the next test to run. If this +file is missing, the first test_*.py file in testdir or on the command +line is used. (actually tempfile.gettempdir() is used instead of +/tmp). + +-f reads the names of tests from the file given as f's argument, one +or more test names per line. Whitespace is ignored. Blank lines and +lines beginning with '#' are ignored. This is especially useful for +whittling down failures involving interactions among tests. + +-L causes the leaks(1) command to be run just before exit if it exists. +leaks(1) is available on Mac OS X and presumably on some other +FreeBSD-derived systems. + +-R runs each test several times and examines sys.gettotalrefcount() to +see if the test appears to be leaking references. The argument should +be of the form stab:run:fname where 'stab' is the number of times the +test is run to let gettotalrefcount settle down, 'run' is the number +of times further it is run and 'fname' is the name of the file the +reports are written to. These parameters all have defaults (5, 4 and +"reflog.txt" respectively), so the minimal invocation is '-R ::'. + +-M runs tests that require an exorbitant amount of memory. These tests +typically try to ascertain containers keep working when containing more than +2 billion objects, which only works on 64-bit systems. There are also some +tests that try to exhaust the address space of the process, which only makes +sense on 32-bit systems with at least 2Gb of memory. The passed-in memlimit, +which is a string in the form of '2.5Gb', determines howmuch memory the +tests will limit themselves to (but they may go slightly over.) The number +shouldn't be more memory than the machine has (including swap memory). You +should also keep in mind that swap memory is generally much, much slower +than RAM, and setting memlimit to all available RAM or higher will heavily +tax the machine. On the other hand, it is no use running these tests with a +limit of less than 2.5Gb, and many require more than 20Gb. Tests that expect +to use more than memlimit memory will be skipped. The big-memory tests +generally run very, very long. + +-u is used to specify which special resource intensive tests to run, +such as those requiring large file support or network connectivity. +The argument is a comma-separated list of words indicating the +resources to test. Currently only the following are defined: + + all - Enable all special resources. + + audio - Tests that use the audio device. (There are known + cases of broken audio drivers that can crash Python or + even the Linux kernel.) + + curses - Tests that use curses and will modify the terminal's + state and output modes. + + largefile - It is okay to run some test that may create huge + files. These tests can take a long time and may + consume >2GB of disk space temporarily. + + network - It is okay to run tests that use external network + resource, e.g. testing SSL support for sockets. + + bsddb - It is okay to run the bsddb testsuite, which takes + a long time to complete. + + decimal - Test the decimal module against a large suite that + verifies compliance with standards. + + compiler - Allow test_tokenize to verify round-trip lexing on + every file in the test library. + + subprocess Run all tests for the subprocess module. + + urlfetch - It is okay to download files required on testing. + +To enable all resources except one, use '-uall,-'. For +example, to run all the tests except for the bsddb tests, give the +option '-uall,-bsddb'. +""" + +import os +import sys +import getopt +import random +import warnings +import re +import StringIO +import traceback + +# I see no other way to suppress these warnings; +# putting them in test_grammar.py has no effect: +warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, + ".*test.test_grammar$") +if sys.maxint > 0x7fffffff: + # Also suppress them in , because for 64-bit platforms, + # that's where test_grammar.py hides them. + warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, + "") + +# Ignore ImportWarnings that only occur in the source tree, +# (because of modules with the same name as source-directories in Modules/) +for mod in ("ctypes", "gzip", "zipfile", "tarfile", "encodings.zlib_codec", + "test.test_zipimport", "test.test_zlib", "test.test_zipfile", + "test.test_codecs", "test.string_tests"): + warnings.filterwarnings(module=".*%s$" % (mod,), + action="ignore", category=ImportWarning) + +# MacOSX (a.k.a. Darwin) has a default stack size that is too small +# for deeply recursive regular expressions. We see this as crashes in +# the Python test suite when running test_re.py and test_sre.py. The +# fix is to set the stack limit to 2048. +# This approach may also be useful for other Unixy platforms that +# suffer from small default stack limits. +if sys.platform == 'darwin': + try: + import resource + except ImportError: + pass + else: + soft, hard = resource.getrlimit(resource.RLIMIT_STACK) + newsoft = min(hard, max(soft, 1024*2048)) + resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard)) + +from test import test_support + +RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb', + 'decimal', 'compiler', 'subprocess', 'urlfetch') + + +def usage(code, msg=''): + print(__doc__) + if msg: print(msg) + sys.exit(code) + + +def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, + exclude=False, single=False, randomize=False, fromfile=None, + findleaks=False, use_resources=None, trace=False, coverdir='coverage', + runleaks=False, huntrleaks=False, verbose2=False, debug=False): + """Execute a test suite. + + This also parses command-line options and modifies its behavior + accordingly. + + tests -- a list of strings containing test names (optional) + testdir -- the directory in which to look for tests (optional) + + Users other than the Python test suite will certainly want to + specify testdir; if it's omitted, the directory containing the + Python test suite is searched for. + + If the tests argument is omitted, the tests listed on the + command-line will be used. If that's empty, too, then all *.py + files beginning with test_ will be used. + + The other default arguments (verbose, quiet, generate, exclude, single, + randomize, findleaks, use_resources, trace and coverdir) allow programmers + calling main() directly to set the values that would normally be set by + flags on the command line. + """ + + test_support.record_original_stdout(sys.stdout) + try: + opts, args = getopt.getopt(sys.argv[1:], 'dhvgqxsrf:lu:t:TD:NLR:wM:', + ['help', 'verbose', 'quiet', 'generate', + 'exclude', 'single', 'random', 'fromfile', + 'findleaks', 'use=', 'threshold=', 'trace', + 'coverdir=', 'nocoverdir', 'runleaks', + 'huntrleaks=', 'verbose2', 'memlimit=', + 'debug', + ]) + except getopt.error as msg: + usage(2, msg) + + # Defaults + if use_resources is None: + use_resources = [] + for o, a in opts: + if o in ('-h', '--help'): + usage(0) + elif o in ('-v', '--verbose'): + verbose += 1 + elif o in ('-w', '--verbose2'): + verbose2 = True + elif o in ('-d', '--debug'): + debug = True + elif o in ('-q', '--quiet'): + quiet = True; + verbose = 0 + elif o in ('-g', '--generate'): + generate = True + elif o in ('-x', '--exclude'): + exclude = True + elif o in ('-s', '--single'): + single = True + elif o in ('-r', '--randomize'): + randomize = True + elif o in ('-f', '--fromfile'): + fromfile = a + elif o in ('-l', '--findleaks'): + findleaks = True + elif o in ('-L', '--runleaks'): + runleaks = True + elif o in ('-t', '--threshold'): + import gc + gc.set_threshold(int(a)) + elif o in ('-T', '--coverage'): + trace = True + elif o in ('-D', '--coverdir'): + coverdir = os.path.join(os.getcwd(), a) + elif o in ('-N', '--nocoverdir'): + coverdir = None + elif o in ('-R', '--huntrleaks'): + huntrleaks = a.split(':') + if len(huntrleaks) != 3: + print(a, huntrleaks) + usage(2, '-R takes three colon-separated arguments') + if len(huntrleaks[0]) == 0: + huntrleaks[0] = 5 + else: + huntrleaks[0] = int(huntrleaks[0]) + if len(huntrleaks[1]) == 0: + huntrleaks[1] = 4 + else: + huntrleaks[1] = int(huntrleaks[1]) + if len(huntrleaks[2]) == 0: + huntrleaks[2] = "reflog.txt" + elif o in ('-M', '--memlimit'): + test_support.set_memlimit(a) + elif o in ('-u', '--use'): + u = [x.lower() for x in a.split(',')] + for r in u: + if r == 'all': + use_resources[:] = RESOURCE_NAMES + continue + remove = False + if r[0] == '-': + remove = True + r = r[1:] + if r not in RESOURCE_NAMES: + usage(1, 'Invalid -u/--use option: ' + a) + if remove: + if r in use_resources: + use_resources.remove(r) + elif r not in use_resources: + use_resources.append(r) + if generate and verbose: + usage(2, "-g and -v don't go together!") + if single and fromfile: + usage(2, "-s and -f don't go together!") + + good = [] + bad = [] + skipped = [] + resource_denieds = [] + + if findleaks: + try: + import gc + except ImportError: + print('No GC available, disabling findleaks.') + findleaks = False + else: + # Uncomment the line below to report garbage that is not + # freeable by reference counting alone. By default only + # garbage that is not collectable by the GC is reported. + #gc.set_debug(gc.DEBUG_SAVEALL) + found_garbage = [] + + if single: + from tempfile import gettempdir + filename = os.path.join(gettempdir(), 'pynexttest') + try: + fp = open(filename, 'r') + next = fp.read().strip() + tests = [next] + fp.close() + except IOError: + pass + + if fromfile: + tests = [] + fp = open(fromfile) + for line in fp: + guts = line.split() # assuming no test has whitespace in its name + if guts and not guts[0].startswith('#'): + tests.extend(guts) + fp.close() + + # Strip .py extensions. + if args: + args = map(removepy, args) + if tests: + tests = map(removepy, tests) + + stdtests = STDTESTS[:] + nottests = NOTTESTS[:] + if exclude: + for arg in args: + if arg in stdtests: + stdtests.remove(arg) + nottests[:0] = args + args = [] + tests = tests or args or findtests(testdir, stdtests, nottests) + if single: + tests = tests[:1] + if randomize: + random.shuffle(tests) + if trace: + import trace + tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix], + trace=False, count=True) + test_support.verbose = verbose # Tell tests to be moderately quiet + test_support.use_resources = use_resources + save_modules = sys.modules.keys() + for test in tests: + if not quiet: + print(test) + sys.stdout.flush() + if trace: + # If we're tracing code coverage, then we don't exit with status + # if on a false return value from main. + tracer.runctx('runtest(test, generate, verbose, quiet, testdir)', + globals=globals(), locals=vars()) + else: + try: + ok = runtest(test, generate, verbose, quiet, testdir, + huntrleaks) + except KeyboardInterrupt: + # print a newline separate from the ^C + print() + break + except: + raise + if ok > 0: + good.append(test) + elif ok == 0: + bad.append(test) + else: + skipped.append(test) + if ok == -2: + resource_denieds.append(test) + if findleaks: + gc.collect() + if gc.garbage: + print("Warning: test created", len(gc.garbage), end=' ') + print("uncollectable object(s).") + # move the uncollectable objects somewhere so we don't see + # them again + found_garbage.extend(gc.garbage) + del gc.garbage[:] + # Unload the newly imported modules (best effort finalization) + for module in sys.modules.keys(): + if module not in save_modules and module.startswith("test."): + test_support.unload(module) + + # The lists won't be sorted if running with -r + good.sort() + bad.sort() + skipped.sort() + + if good and not quiet: + if not bad and not skipped and len(good) > 1: + print("All", end=' ') + print(count(len(good), "test"), "OK.") + if verbose: + print("CAUTION: stdout isn't compared in verbose mode:") + print("a test that passes in verbose mode may fail without it.") + if bad: + print(count(len(bad), "test"), "failed:") + printlist(bad) + if skipped and not quiet: + print(count(len(skipped), "test"), "skipped:") + printlist(skipped) + + e = _ExpectedSkips() + plat = sys.platform + if e.isvalid(): + surprise = set(skipped) - e.getexpected() - set(resource_denieds) + if surprise: + print(count(len(surprise), "skip"), \ + "unexpected on", plat + ":") + printlist(surprise) + else: + print("Those skips are all expected on", plat + ".") + else: + print("Ask someone to teach regrtest.py about which tests are") + print("expected to get skipped on", plat + ".") + + if verbose2 and bad: + print("Re-running failed tests in verbose mode") + for test in bad: + print("Re-running test %r in verbose mode" % test) + sys.stdout.flush() + try: + test_support.verbose = 1 + ok = runtest(test, generate, 1, quiet, testdir, + huntrleaks, debug) + except KeyboardInterrupt: + # print a newline separate from the ^C + print() + break + except: + raise + + if single: + alltests = findtests(testdir, stdtests, nottests) + for i in range(len(alltests)): + if tests[0] == alltests[i]: + if i == len(alltests) - 1: + os.unlink(filename) + else: + fp = open(filename, 'w') + fp.write(alltests[i+1] + '\n') + fp.close() + break + else: + os.unlink(filename) + + if trace: + r = tracer.results() + r.write_results(show_missing=True, summary=True, coverdir=coverdir) + + if runleaks: + os.system("leaks %d" % os.getpid()) + + sys.exit(len(bad) > 0) + + +STDTESTS = [ + 'test_grammar', + 'test_opcodes', + 'test_dict', + 'test_builtin', + 'test_exceptions', + 'test_types', + 'test_unittest', + 'test_doctest', + 'test_doctest2', + ] + +NOTTESTS = [ + 'test_support', + 'test_future1', + 'test_future2', + 'test_future3', + ] + +def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS): + """Return a list of all applicable test modules.""" + if not testdir: testdir = findtestdir() + names = os.listdir(testdir) + tests = [] + for name in names: + if name[:5] == "test_" and name[-3:] == os.extsep+"py": + modname = name[:-3] + if modname not in stdtests and modname not in nottests: + tests.append(modname) + tests.sort() + return stdtests + tests + +def runtest(test, generate, verbose, quiet, testdir=None, + huntrleaks=False, debug=False): + """Run a single test. + + test -- the name of the test + generate -- if true, generate output, instead of running the test + and comparing it to a previously created output file + verbose -- if true, print more messages + quiet -- if true, don't print 'skipped' messages (probably redundant) + testdir -- test directory + huntrleaks -- run multiple times to test for leaks; requires a debug + build; a triple corresponding to -R's three arguments + debug -- if true, print tracebacks for failed tests regardless of + verbose setting + Return: + -2 test skipped because resource denied + -1 test skipped for some other reason + 0 test failed + 1 test passed + """ + + try: + return runtest_inner(test, generate, verbose, quiet, testdir, + huntrleaks, debug) + finally: + cleanup_test_droppings(test, verbose) + +def runtest_inner(test, generate, verbose, quiet, + testdir=None, huntrleaks=False, debug=False): + test_support.unload(test) + if not testdir: + testdir = findtestdir() + outputdir = os.path.join(testdir, "output") + outputfile = os.path.join(outputdir, test) + if verbose: + cfp = None + else: + cfp = StringIO.StringIO() # XXX Should use io.StringIO() + + try: + save_stdout = sys.stdout + try: + if cfp: + sys.stdout = cfp + print(test) # Output file starts with test name + if test.startswith('test.'): + abstest = test + else: + # Always import it from the test package + abstest = 'test.' + test + the_package = __import__(abstest, globals(), locals(), []) + the_module = getattr(the_package, test) + # Most tests run to completion simply as a side-effect of + # being imported. For the benefit of tests that can't run + # that way (like test_threaded_import), explicitly invoke + # their test_main() function (if it exists). + indirect_test = getattr(the_module, "test_main", None) + if indirect_test is not None: + indirect_test() + if huntrleaks: + dash_R(the_module, test, indirect_test, huntrleaks) + finally: + sys.stdout = save_stdout + except test_support.ResourceDenied as msg: + if not quiet: + print(test, "skipped --", msg) + sys.stdout.flush() + return -2 + except (ImportError, test_support.TestSkipped) as msg: + if not quiet: + print(test, "skipped --", msg) + sys.stdout.flush() + return -1 + except KeyboardInterrupt: + raise + except test_support.TestFailed as msg: + print("test", test, "failed --", msg) + sys.stdout.flush() + return 0 + except: + type, value = sys.exc_info()[:2] + print("test", test, "crashed --", str(type) + ":", value) + sys.stdout.flush() + if verbose or debug: + traceback.print_exc(file=sys.stdout) + sys.stdout.flush() + return 0 + else: + if not cfp: + return 1 + output = cfp.getvalue() + if generate: + if output == test + "\n": + if os.path.exists(outputfile): + # Write it since it already exists (and the contents + # may have changed), but let the user know it isn't + # needed: + print("output file", outputfile, \ + "is no longer needed; consider removing it") + else: + # We don't need it, so don't create it. + return 1 + fp = open(outputfile, "w") + fp.write(output) + fp.close() + return 1 + if os.path.exists(outputfile): + fp = open(outputfile, "r") + expected = fp.read() + fp.close() + else: + expected = test + "\n" + if output == expected or huntrleaks: + return 1 + print("test", test, "produced unexpected output:") + sys.stdout.flush() + reportdiff(expected, output) + sys.stdout.flush() + return 0 + +def cleanup_test_droppings(testname, verbose): + import shutil + + # Try to clean up junk commonly left behind. While tests shouldn't leave + # any files or directories behind, when a test fails that can be tedious + # for it to arrange. The consequences can be especially nasty on Windows, + # since if a test leaves a file open, it cannot be deleted by name (while + # there's nothing we can do about that here either, we can display the + # name of the offending test, which is a real help). + for name in (test_support.TESTFN, + "db_home", + ): + if not os.path.exists(name): + continue + + if os.path.isdir(name): + kind, nuker = "directory", shutil.rmtree + elif os.path.isfile(name): + kind, nuker = "file", os.unlink + else: + raise SystemError("os.path says %r exists but is neither " + "directory nor file" % name) + + if verbose: + print("%r left behind %s %r" % (testname, kind, name)) + try: + nuker(name) + except Exception as msg: + print(("%r left behind %s %r and it couldn't be " + "removed: %s" % (testname, kind, name, msg)), file=sys.stderr) + +def dash_R(the_module, test, indirect_test, huntrleaks): + # This code is hackish and inelegant, but it seems to do the job. + import copy_reg + + if not hasattr(sys, 'gettotalrefcount'): + raise Exception("Tracking reference leaks requires a debug build " + "of Python") + + # Save current values for dash_R_cleanup() to restore. + fs = warnings.filters[:] + ps = copy_reg.dispatch_table.copy() + pic = sys.path_importer_cache.copy() + + if indirect_test: + def run_the_test(): + indirect_test() + else: + def run_the_test(): + reload(the_module) + + deltas = [] + nwarmup, ntracked, fname = huntrleaks + repcount = nwarmup + ntracked + print("beginning", repcount, "repetitions", file=sys.stderr) + print(("1234567890"*(repcount//10 + 1))[:repcount], file=sys.stderr) + dash_R_cleanup(fs, ps, pic) + for i in range(repcount): + rc = sys.gettotalrefcount() + run_the_test() + sys.stderr.write('.') + dash_R_cleanup(fs, ps, pic) + if i >= nwarmup: + deltas.append(sys.gettotalrefcount() - rc - 2) + print(file=sys.stderr) + if any(deltas): + msg = '%s leaked %s references, sum=%s' % (test, deltas, sum(deltas)) + print(msg, file=sys.stderr) + refrep = open(fname, "a") + print(msg, file=refrep) + refrep.close() + +def dash_R_cleanup(fs, ps, pic): + import gc, copy_reg + import _strptime, linecache, dircache + import urlparse, urllib, urllib2, mimetypes, doctest + import struct, filecmp + from distutils.dir_util import _path_created + + # Restore some original values. + warnings.filters[:] = fs + copy_reg.dispatch_table.clear() + copy_reg.dispatch_table.update(ps) + sys.path_importer_cache.clear() + sys.path_importer_cache.update(pic) + + # Clear assorted module caches. + _path_created.clear() + re.purge() + _strptime._regex_cache.clear() + urlparse.clear_cache() + urllib.urlcleanup() + urllib2.install_opener(None) + dircache.reset() + linecache.clearcache() + mimetypes._default_mime_types() + struct._cache.clear() + filecmp._cache.clear() + doctest.master = None + + # Collect cyclic trash. + gc.collect() + +def reportdiff(expected, output): + import difflib + print("*" * 70) + a = expected.splitlines(1) + b = output.splitlines(1) + sm = difflib.SequenceMatcher(a=a, b=b) + tuples = sm.get_opcodes() + + def pair(x0, x1): + # x0:x1 are 0-based slice indices; convert to 1-based line indices. + x0 += 1 + if x0 >= x1: + return "line " + str(x0) + else: + return "lines %d-%d" % (x0, x1) + + for op, a0, a1, b0, b1 in tuples: + if op == 'equal': + pass + + elif op == 'delete': + print("***", pair(a0, a1), "of expected output missing:") + for line in a[a0:a1]: + print("-", line, end='') + + elif op == 'replace': + print("*** mismatch between", pair(a0, a1), "of expected", \ + "output and", pair(b0, b1), "of actual output:") + for line in difflib.ndiff(a[a0:a1], b[b0:b1]): + print(line, end='') + + elif op == 'insert': + print("***", pair(b0, b1), "of actual output doesn't appear", \ + "in expected output after line", str(a1)+":") + for line in b[b0:b1]: + print("+", line, end='') + + else: + print("get_opcodes() returned bad tuple?!?!", (op, a0, a1, b0, b1)) + + print("*" * 70) + +def findtestdir(): + if __name__ == '__main__': + file = sys.argv[0] + else: + file = __file__ + testdir = os.path.dirname(file) or os.curdir + return testdir + +def removepy(name): + if name.endswith(os.extsep + "py"): + name = name[:-3] + return name + +def count(n, word): + if n == 1: + return "%d %s" % (n, word) + else: + return "%d %ss" % (n, word) + +def printlist(x, width=70, indent=4): + """Print the elements of iterable x to stdout. + + Optional arg width (default 70) is the maximum line length. + Optional arg indent (default 4) is the number of blanks with which to + begin each line. + """ + + from textwrap import fill + blanks = ' ' * indent + print(fill(' '.join(map(str, x)), width, + initial_indent=blanks, subsequent_indent=blanks)) + +# Map sys.platform to a string containing the basenames of tests +# expected to be skipped on that platform. +# +# Special cases: +# test_pep277 +# The _ExpectedSkips constructor adds this to the set of expected +# skips if not os.path.supports_unicode_filenames. +# test_socket_ssl +# Controlled by test_socket_ssl.skip_expected. Requires the network +# resource, and a socket module with ssl support. +# test_timeout +# Controlled by test_timeout.skip_expected. Requires the network +# resource and a socket module. + +_expectations = { + 'win32': + """ + test__locale + test_applesingle + test_bsddb3 + test_commands + test_crypt + test_curses + test_dbm + test_dl + test_fcntl + test_fork1 + test_gdbm + test_grp + test_ioctl + test_largefile + test_linuxaudiodev + test_mhlib + test_nis + test_openpty + test_ossaudiodev + test_poll + test_posix + test_pty + test_pwd + test_resource + test_signal + test_sunaudiodev + test_threadsignals + test_timing + test_wait3 + test_wait4 + """, + 'linux2': + """ + test_applesingle + test_curses + test_dl + test_largefile + test_linuxaudiodev + test_nis + test_ntpath + test_ossaudiodev + test_sqlite + test_startfile + test_sunaudiodev + """, + 'mac': + """ + test_atexit + test_bsddb + test_bsddb3 + test_bz2 + test_commands + test_crypt + test_curses + test_dbm + test_dl + test_fcntl + test_fork1 + test_grp + test_ioctl + test_largefile + test_linuxaudiodev + test_locale + test_mmap + test_nis + test_ntpath + test_openpty + test_ossaudiodev + test_poll + test_popen + test_posix + test_pty + test_pwd + test_resource + test_signal + test_sqlite + test_startfile + test_sunaudiodev + test_sundry + test_tarfile + test_timing + """, + 'unixware7': + """ + test_applesingle + test_bsddb + test_dl + test_largefile + test_linuxaudiodev + test_minidom + test_nis + test_ntpath + test_openpty + test_pyexpat + test_sax + test_startfile + test_sqlite + test_sunaudiodev + test_sundry + """, + 'openunix8': + """ + test_applesingle + test_bsddb + test_dl + test_largefile + test_linuxaudiodev + test_minidom + test_nis + test_ntpath + test_openpty + test_pyexpat + test_sax + test_sqlite + test_startfile + test_sunaudiodev + test_sundry + """, + 'sco_sv3': + """ + test_applesingle + test_asynchat + test_bsddb + test_dl + test_fork1 + test_gettext + test_largefile + test_linuxaudiodev + test_locale + test_minidom + test_nis + test_ntpath + test_openpty + test_pyexpat + test_queue + test_sax + test_sqlite + test_startfile + test_sunaudiodev + test_sundry + test_thread + test_threaded_import + test_threadedtempfile + test_threading + """, + 'riscos': + """ + test_applesingle + test_asynchat + test_atexit + test_bsddb + test_bsddb3 + test_commands + test_crypt + test_dbm + test_dl + test_fcntl + test_fork1 + test_gdbm + test_grp + test_largefile + test_linuxaudiodev + test_locale + test_mmap + test_nis + test_ntpath + test_openpty + test_poll + test_pty + test_pwd + test_sqlite + test_startfile + test_sunaudiodev + test_sundry + test_thread + test_threaded_import + test_threadedtempfile + test_threading + test_timing + """, + 'darwin': + """ + test_gdbm + test_largefile + test_linuxaudiodev + test_locale + test_nis + test_ossaudiodev + test_startfile + test_sunaudiodev + """, + 'sunos5': + """ + test_applesingle + test_bsddb + test_curses + test_dbm + test_gdbm + test_gzip + test_linuxaudiodev + test_openpty + test_sqlite + test_startfile + test_zipfile + test_zlib + """, + 'hp-ux11': + """ + test_applesingle + test_bsddb + test_curses + test_dl + test_gdbm + test_gzip + test_largefile + test_linuxaudiodev + test_locale + test_minidom + test_nis + test_ntpath + test_openpty + test_pyexpat + test_sax + test_sqlite + test_startfile + test_sunaudiodev + test_zipfile + test_zlib + """, + 'atheos': + """ + test_applesingle + test_curses + test_dl + test_gdbm + test_largefile + test_linuxaudiodev + test_locale + test_mhlib + test_mmap + test_nis + test_poll + test_resource + test_sqlite + test_startfile + test_sunaudiodev + """, + 'cygwin': + """ + test_applesingle + test_bsddb3 + test_curses + test_dbm + test_ioctl + test_largefile + test_linuxaudiodev + test_locale + test_nis + test_ossaudiodev + test_socketserver + test_sqlite + test_sunaudiodev + """, + 'os2emx': + """ + test_applesingle + test_audioop + test_bsddb3 + test_commands + test_curses + test_dl + test_largefile + test_linuxaudiodev + test_mhlib + test_mmap + test_nis + test_openpty + test_ossaudiodev + test_pty + test_resource + test_signal + test_sqlite + test_startfile + test_sunaudiodev + """, + 'freebsd4': + """ + test_aepack + test_applesingle + test_bsddb + test_bsddb3 + test_gdbm + test_linuxaudiodev + test_locale + test_macostools + test_nis + test_ossaudiodev + test_pep277 + test_plistlib + test_pty + test_scriptpackages + test_socket_ssl + test_socketserver + test_sqlite + test_startfile + test_sunaudiodev + test_tcl + test_timeout + test_unicode_file + test_urllibnet + test_winreg + test_winsound + """, + 'aix5': + """ + test_aepack + test_applesingle + test_bsddb + test_bsddb3 + test_bz2 + test_dl + test_gdbm + test_gzip + test_linuxaudiodev + test_macostools + test_nis + test_ossaudiodev + test_sqlite + test_startfile + test_sunaudiodev + test_tcl + test_winreg + test_winsound + test_zipimport + test_zlib + """, + 'openbsd3': + """ + test_aepack + test_applesingle + test_bsddb + test_bsddb3 + test_ctypes + test_dl + test_gdbm + test_linuxaudiodev + test_locale + test_macostools + test_nis + test_normalization + test_ossaudiodev + test_pep277 + test_plistlib + test_scriptpackages + test_tcl + test_sqlite + test_startfile + test_sunaudiodev + test_unicode_file + test_winreg + test_winsound + """, + 'netbsd3': + """ + test_aepack + test_applesingle + test_bsddb + test_bsddb3 + test_ctypes + test_curses + test_dl + test_gdbm + test_linuxaudiodev + test_locale + test_macostools + test_nis + test_ossaudiodev + test_pep277 + test_sqlite + test_startfile + test_sunaudiodev + test_tcl + test_unicode_file + test_winreg + test_winsound + """, +} +_expectations['freebsd5'] = _expectations['freebsd4'] +_expectations['freebsd6'] = _expectations['freebsd4'] +_expectations['freebsd7'] = _expectations['freebsd4'] + +class _ExpectedSkips: + def __init__(self): + import os.path + from test import test_socket_ssl + from test import test_timeout + + self.valid = False + if sys.platform in _expectations: + s = _expectations[sys.platform] + self.expected = set(s.split()) + + if not os.path.supports_unicode_filenames: + self.expected.add('test_pep277') + + if test_socket_ssl.skip_expected: + self.expected.add('test_socket_ssl') + + if test_timeout.skip_expected: + self.expected.add('test_timeout') + + if not sys.platform in ("mac", "darwin"): + MAC_ONLY = ["test_macostools", "test_aepack", + "test_plistlib", "test_scriptpackages"] + for skip in MAC_ONLY: + self.expected.add(skip) + + if sys.platform != "win32": + WIN_ONLY = ["test_unicode_file", "test_winreg", + "test_winsound"] + for skip in WIN_ONLY: + self.expected.add(skip) + + if sys.platform != 'irix': + IRIX_ONLY =["test_imageop"] + for skip in IRIX_ONLY: + self.expected.add(skip) + + self.valid = True + + def isvalid(self): + "Return true iff _ExpectedSkips knows about the current platform." + return self.valid + + def getexpected(self): + """Return set of test names we expect to skip on current platform. + + self.isvalid() must be true. + """ + + assert self.isvalid() + return self.expected + +if __name__ == '__main__': + # Remove regrtest.py's own directory from the module search path. This + # prevents relative imports from working, and relative imports will screw + # up the testing framework. E.g. if both test.test_support and + # test_support are imported, they will not contain the same globals, and + # much of the testing framework relies on the globals in the + # test.test_support module. + mydir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0]))) + i = pathlen = len(sys.path) + while i >= 0: + i -= 1 + if os.path.abspath(os.path.normpath(sys.path[i])) == mydir: + del sys.path[i] + if len(sys.path) == pathlen: + print('Could not find %r in sys.path to remove it' % mydir) + main() Added: sandbox/trunk/cpy_merge/Lib/test/test_StringIO.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/test/test_StringIO.py Wed May 23 03:45:28 2007 @@ -0,0 +1,172 @@ +# Tests StringIO and cStringIO + +import sys +import unittest +import StringIO +import cStringIO +from test import test_support + + +class TestGenericStringIO: + # use a class variable MODULE to define which module is being tested + + # Line of data to test as string + _line = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!' + + # Constructor to use for the test data (._line is passed to this + # constructor) + constructor = str + + def setUp(self): + self._line = self.constructor(self._line) + self._lines = self.constructor((self._line + '\n') * 5) + self._fp = self.MODULE.StringIO(self._lines) + + def test_reads(self): + eq = self.assertEqual + self.assertRaises(TypeError, self._fp.seek) + eq(self._fp.read(10), self._line[:10]) + eq(self._fp.readline(), self._line[10:] + '\n') + eq(len(self._fp.readlines(60)), 2) + + def test_writes(self): + f = self.MODULE.StringIO() + self.assertRaises(TypeError, f.seek) + f.write(self._line[:6]) + f.seek(3) + f.write(self._line[20:26]) + f.write(self._line[52]) + self.assertEqual(f.getvalue(), 'abcuvwxyz!') + + def test_writelines(self): + f = self.MODULE.StringIO() + f.writelines([self._line[0], self._line[1], self._line[2]]) + f.seek(0) + self.assertEqual(f.getvalue(), 'abc') + + def test_writelines_error(self): + def errorGen(): + yield 'a' + raise KeyboardInterrupt() + f = self.MODULE.StringIO() + self.assertRaises(KeyboardInterrupt, f.writelines, errorGen()) + + def test_truncate(self): + eq = self.assertEqual + f = self.MODULE.StringIO() + f.write(self._lines) + f.seek(10) + f.truncate() + eq(f.getvalue(), 'abcdefghij') + f.truncate(5) + eq(f.getvalue(), 'abcde') + f.write('xyz') + eq(f.getvalue(), 'abcdexyz') + self.assertRaises(IOError, f.truncate, -1) + f.close() + self.assertRaises(ValueError, f.write, 'frobnitz') + + def test_closed_flag(self): + f = self.MODULE.StringIO() + self.assertEqual(f.closed, False) + f.close() + self.assertEqual(f.closed, True) + f = self.MODULE.StringIO(self.constructor("abc")) + self.assertEqual(f.closed, False) + f.close() + self.assertEqual(f.closed, True) + + def test_isatty(self): + f = self.MODULE.StringIO() + self.assertRaises(TypeError, f.isatty, None) + self.assertEqual(f.isatty(), False) + f.close() + self.assertRaises(ValueError, f.isatty) + + def test_iterator(self): + eq = self.assertEqual + unless = self.failUnless + eq(iter(self._fp), self._fp) + # Does this object support the iteration protocol? + unless(hasattr(self._fp, '__iter__')) + unless(hasattr(self._fp, '__next__')) + i = 0 + for line in self._fp: + eq(line, self._line + '\n') + i += 1 + eq(i, 5) + self._fp.close() + self.assertRaises(ValueError, next, self._fp) + +class TestStringIO(TestGenericStringIO, unittest.TestCase): + MODULE = StringIO + + def test_unicode(self): + + if not test_support.have_unicode: return + + # The StringIO module also supports concatenating Unicode + # snippets to larger Unicode strings. This is tested by this + # method. Note that cStringIO does not support this extension. + + f = self.MODULE.StringIO() + f.write(self._line[:6]) + f.seek(3) + f.write(str(self._line[20:26])) + f.write(str(self._line[52])) + s = f.getvalue() + self.assertEqual(s, str('abcuvwxyz!')) + self.assertEqual(type(s), str) + +class TestcStringIO(TestGenericStringIO, unittest.TestCase): + MODULE = cStringIO + constructor = str8 + + def test_unicode(self): + + if not test_support.have_unicode: return + + # The cStringIO module converts Unicode strings to character + # strings when writing them to cStringIO objects. + # Check that this works. + + f = self.MODULE.StringIO() + f.write(str(self._line[:5])) + s = f.getvalue() + self.assertEqual(s, 'abcde') + self.assertEqual(type(s), str8) + + f = self.MODULE.StringIO(str(self._line[:5])) + s = f.getvalue() + self.assertEqual(s, 'abcde') + self.assertEqual(type(s), str8) + + # XXX This no longer fails -- the default encoding is always UTF-8. + ##self.assertRaises(UnicodeDecodeError, self.MODULE.StringIO, '\xf4') + +class TestBufferStringIO(TestStringIO): + + def constructor(self, s): + return buffer(str8(s)) + +class TestBuffercStringIO(TestcStringIO): + + def constructor(self, s): + return buffer(str8(s)) + + +def test_main(): + classes = [ + TestStringIO, + TestcStringIO, + ] + if not sys.platform.startswith('java'): + classes.extend([ + TestBufferStringIO, + TestBuffercStringIO + ]) + test_support.run_unittest(*classes) + + +if __name__ == '__main__': + unittest.main() Added: sandbox/trunk/cpy_merge/Lib/test/test_cProfile.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/test/test_cProfile.py Wed May 23 03:45:28 2007 @@ -0,0 +1,123 @@ +"""Test suite for the cProfile module.""" + +import cProfile, pstats, sys + +# In order to have reproducible time, we simulate a timer in the global +# variable 'ticks', which represents simulated time in milliseconds. +# (We can't use a helper function increment the timer since it would be +# included in the profile and would appear to consume all the time.) +ticks = 0 + +# IMPORTANT: this is an output test. *ALL* NUMBERS in the expected +# output are relevant. If you change the formatting of pstats, +# please don't just regenerate output/test_cProfile without checking +# very carefully that not a single number has changed. + +def test_main(): + global ticks + ticks = 42000 + prof = cProfile.Profile(timer, 0.001) + prof.runctx("testfunc()", globals(), locals()) + assert ticks == 43000, ticks + st = pstats.Stats(prof) + st.strip_dirs().sort_stats('stdname').print_stats() + st.print_callees() + st.print_callers() + +def timer(): + return ticks + +def testfunc(): + # 1 call + # 1000 ticks total: 270 ticks local, 730 ticks in subfunctions + global ticks + ticks += 99 + helper() # 300 + helper() # 300 + ticks += 171 + factorial(14) # 130 + +def factorial(n): + # 23 calls total + # 170 ticks total, 150 ticks local + # 3 primitive calls, 130, 20 and 20 ticks total + # including 116, 17, 17 ticks local + global ticks + if n > 0: + ticks += n + return mul(n, factorial(n-1)) + else: + ticks += 11 + return 1 + +def mul(a, b): + # 20 calls + # 1 tick, local + global ticks + ticks += 1 + return a * b + +def helper(): + # 2 calls + # 300 ticks total: 20 ticks local, 260 ticks in subfunctions + global ticks + ticks += 1 + helper1() # 30 + ticks += 2 + helper1() # 30 + ticks += 6 + helper2() # 50 + ticks += 3 + helper2() # 50 + ticks += 2 + helper2() # 50 + ticks += 5 + helper2_indirect() # 70 + ticks += 1 + +def helper1(): + # 4 calls + # 30 ticks total: 29 ticks local, 1 tick in subfunctions + global ticks + ticks += 10 + hasattr(C(), "foo") # 1 + ticks += 19 + lst = [] + lst.append(42) # 0 + sys.exc_info() # 0 + +def helper2_indirect(): + helper2() # 50 + factorial(3) # 20 + +def helper2(): + # 8 calls + # 50 ticks local: 39 ticks local, 11 ticks in subfunctions + global ticks + ticks += 11 + hasattr(C(), "bar") # 1 + ticks += 13 + subhelper() # 10 + ticks += 15 + +def subhelper(): + # 8 calls + # 10 ticks total: 8 ticks local, 2 ticks in subfunctions + global ticks + ticks += 2 + for i in range(2): # 0 + try: + C().foo # 1 x 2 + except AttributeError: + ticks += 3 # 3 x 2 + +class C: + def __getattr__(self, name): + # 28 calls + # 1 tick, local + global ticks + ticks += 1 + raise AttributeError + +if __name__ == "__main__": + test_main() Added: sandbox/trunk/cpy_merge/Lib/test/test_copy_reg.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/test/test_copy_reg.py Wed May 23 03:45:28 2007 @@ -0,0 +1,121 @@ +import copy_reg +import unittest + +from test import test_support +from test.pickletester import ExtensionSaver + +class C: + pass + + +class WithoutSlots(object): + pass + +class WithWeakref(object): + __slots__ = ('__weakref__',) + +class WithPrivate(object): + __slots__ = ('__spam',) + +class WithSingleString(object): + __slots__ = 'spam' + +class WithInherited(WithSingleString): + __slots__ = ('eggs',) + + +class CopyRegTestCase(unittest.TestCase): + + def test_class(self): + self.assertRaises(TypeError, copy_reg.pickle, + C, None, None) + + def test_noncallable_reduce(self): + self.assertRaises(TypeError, copy_reg.pickle, + type(1), "not a callable") + + def test_noncallable_constructor(self): + self.assertRaises(TypeError, copy_reg.pickle, + type(1), int, "not a callable") + + def test_bool(self): + import copy + self.assertEquals(True, copy.copy(True)) + + def test_extension_registry(self): + mod, func, code = 'junk1 ', ' junk2', 0xabcd + e = ExtensionSaver(code) + try: + # Shouldn't be in registry now. + self.assertRaises(ValueError, copy_reg.remove_extension, + mod, func, code) + copy_reg.add_extension(mod, func, code) + # Should be in the registry. + self.assert_(copy_reg._extension_registry[mod, func] == code) + self.assert_(copy_reg._inverted_registry[code] == (mod, func)) + # Shouldn't be in the cache. + self.assert_(code not in copy_reg._extension_cache) + # Redundant registration should be OK. + copy_reg.add_extension(mod, func, code) # shouldn't blow up + # Conflicting code. + self.assertRaises(ValueError, copy_reg.add_extension, + mod, func, code + 1) + self.assertRaises(ValueError, copy_reg.remove_extension, + mod, func, code + 1) + # Conflicting module name. + self.assertRaises(ValueError, copy_reg.add_extension, + mod[1:], func, code ) + self.assertRaises(ValueError, copy_reg.remove_extension, + mod[1:], func, code ) + # Conflicting function name. + self.assertRaises(ValueError, copy_reg.add_extension, + mod, func[1:], code) + self.assertRaises(ValueError, copy_reg.remove_extension, + mod, func[1:], code) + # Can't remove one that isn't registered at all. + if code + 1 not in copy_reg._inverted_registry: + self.assertRaises(ValueError, copy_reg.remove_extension, + mod[1:], func[1:], code + 1) + + finally: + e.restore() + + # Shouldn't be there anymore. + self.assert_((mod, func) not in copy_reg._extension_registry) + # The code *may* be in copy_reg._extension_registry, though, if + # we happened to pick on a registered code. So don't check for + # that. + + # Check valid codes at the limits. + for code in 1, 0x7fffffff: + e = ExtensionSaver(code) + try: + copy_reg.add_extension(mod, func, code) + copy_reg.remove_extension(mod, func, code) + finally: + e.restore() + + # Ensure invalid codes blow up. + for code in -1, 0, 0x80000000: + self.assertRaises(ValueError, copy_reg.add_extension, + mod, func, code) + + def test_slotnames(self): + self.assertEquals(copy_reg._slotnames(WithoutSlots), []) + self.assertEquals(copy_reg._slotnames(WithWeakref), []) + expected = ['_WithPrivate__spam'] + self.assertEquals(copy_reg._slotnames(WithPrivate), expected) + self.assertEquals(copy_reg._slotnames(WithSingleString), ['spam']) + expected = ['eggs', 'spam'] + expected.sort() + result = copy_reg._slotnames(WithInherited) + result.sort() + self.assertEquals(result, expected) + + +def test_main(): + test_support.run_unittest(CopyRegTestCase) + + +if __name__ == "__main__": + test_main() Added: sandbox/trunk/cpy_merge/Lib/test/test_cpickle.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/test/test_cpickle.py Wed May 23 03:45:28 2007 @@ -0,0 +1,103 @@ +import cPickle +import unittest +from cStringIO import StringIO +from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests +from test import test_support + +class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): + + def setUp(self): + self.dumps = cPickle.dumps + self.loads = cPickle.loads + + error = cPickle.BadPickleGet + module = cPickle + +class cPicklePicklerTests(AbstractPickleTests): + + def dumps(self, arg, proto=0): + f = StringIO() + p = cPickle.Pickler(f, proto) + p.dump(arg) + f.seek(0) + return f.read() + + def loads(self, buf): + f = StringIO(buf) + p = cPickle.Unpickler(f) + return p.load() + + error = cPickle.BadPickleGet + +class cPickleListPicklerTests(AbstractPickleTests): + + def dumps(self, arg, proto=0): + p = cPickle.Pickler(proto) + p.dump(arg) + return p.getvalue() + + def loads(self, *args): + f = StringIO(args[0]) + p = cPickle.Unpickler(f) + return p.load() + + error = cPickle.BadPickleGet + +class cPickleFastPicklerTests(AbstractPickleTests): + + def dumps(self, arg, proto=0): + f = StringIO() + p = cPickle.Pickler(f, proto) + p.fast = 1 + p.dump(arg) + f.seek(0) + return f.read() + + def loads(self, *args): + f = StringIO(args[0]) + p = cPickle.Unpickler(f) + return p.load() + + error = cPickle.BadPickleGet + + def test_recursive_list(self): + self.assertRaises(ValueError, + AbstractPickleTests.test_recursive_list, + self) + + def test_recursive_inst(self): + self.assertRaises(ValueError, + AbstractPickleTests.test_recursive_inst, + self) + + def test_recursive_dict(self): + self.assertRaises(ValueError, + AbstractPickleTests.test_recursive_dict, + self) + + def test_recursive_multi(self): + self.assertRaises(ValueError, + AbstractPickleTests.test_recursive_multi, + self) + + def test_nonrecursive_deep(self): + # If it's not cyclic, it should pickle OK even if the nesting + # depth exceeds PY_CPICKLE_FAST_LIMIT. That happens to be + # 50 today. Jack Jansen reported stack overflow on Mac OS 9 + # at 64. + a = [] + for i in range(60): + a = [a] + b = self.loads(self.dumps(a)) + self.assertEqual(a, b) + +def test_main(): + test_support.run_unittest( + cPickleTests, + cPicklePicklerTests, + cPickleListPicklerTests, + cPickleFastPicklerTests + ) + +if __name__ == "__main__": + test_main() Added: sandbox/trunk/cpy_merge/Lib/test/test_pickle.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/test/test_pickle.py Wed May 23 03:45:28 2007 @@ -0,0 +1,73 @@ +import pickle +import unittest +import io + +from test import test_support + +from test.pickletester import AbstractPickleTests +from test.pickletester import AbstractPickleModuleTests +from test.pickletester import AbstractPersistentPicklerTests + +class PickleTests(AbstractPickleTests, AbstractPickleModuleTests): + + def dumps(self, arg, proto=0, fast=0): + # Ignore fast + return pickle.dumps(arg, proto) + + def loads(self, buf): + # Ignore fast + return pickle.loads(buf) + + module = pickle + error = KeyError + +class PicklerTests(AbstractPickleTests): + + error = KeyError + + def dumps(self, arg, proto=0, fast=0): + f = io.BytesIO() + p = pickle.Pickler(f, proto) + if fast: + p.fast = fast + p.dump(arg) + f.seek(0) + return bytes(f.read()) + + def loads(self, buf): + f = io.BytesIO(buf) + u = pickle.Unpickler(f) + return u.load() + +class PersPicklerTests(AbstractPersistentPicklerTests): + + def dumps(self, arg, proto=0, fast=0): + class PersPickler(pickle.Pickler): + def persistent_id(subself, obj): + return self.persistent_id(obj) + f = io.BytesIO() + p = PersPickler(f, proto) + if fast: + p.fast = fast + p.dump(arg) + f.seek(0) + return f.read() + + def loads(self, buf): + class PersUnpickler(pickle.Unpickler): + def persistent_load(subself, obj): + return self.persistent_load(obj) + f = io.BytesIO(buf) + u = PersUnpickler(f) + return u.load() + +def test_main(): + test_support.run_unittest( + PickleTests, + PicklerTests, + PersPicklerTests + ) + test_support.run_doctest(pickle) + +if __name__ == "__main__": + test_main() Added: sandbox/trunk/cpy_merge/Lib/test/test_pickletools.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Lib/test/test_pickletools.py Wed May 23 03:45:28 2007 @@ -0,0 +1,3 @@ +import pickletools +from test import test_support +test_support.run_doctest(pickletools) Added: sandbox/trunk/cpy_merge/Modules/_lsprof.c ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Modules/_lsprof.c Wed May 23 03:45:28 2007 @@ -0,0 +1,875 @@ +#include "Python.h" +#include "compile.h" +#include "frameobject.h" +#include "structseq.h" +#include "rotatingtree.h" + +#if !defined(HAVE_LONG_LONG) +#error "This module requires long longs!" +#endif + +/*** Selection of a high-precision timer ***/ + +#ifdef MS_WINDOWS + +#include + +static PY_LONG_LONG +hpTimer(void) +{ + LARGE_INTEGER li; + QueryPerformanceCounter(&li); + return li.QuadPart; +} + +static double +hpTimerUnit(void) +{ + LARGE_INTEGER li; + if (QueryPerformanceFrequency(&li)) + return 1.0 / li.QuadPart; + else + return 0.000001; /* unlikely */ +} + +#else /* !MS_WINDOWS */ + +#ifndef HAVE_GETTIMEOFDAY +#error "This module requires gettimeofday() on non-Windows platforms!" +#endif + +#if (defined(PYOS_OS2) && defined(PYCC_GCC)) +#include +#else +#include +#include +#endif + +static PY_LONG_LONG +hpTimer(void) +{ + struct timeval tv; + PY_LONG_LONG ret; +#ifdef GETTIMEOFDAY_NO_TZ + gettimeofday(&tv); +#else + gettimeofday(&tv, (struct timezone *)NULL); +#endif + ret = tv.tv_sec; + ret = ret * 1000000 + tv.tv_usec; + return ret; +} + +static double +hpTimerUnit(void) +{ + return 0.000001; +} + +#endif /* MS_WINDOWS */ + +/************************************************************/ +/* Written by Brett Rosen and Ted Czotter */ + +struct _ProfilerEntry; + +/* represents a function called from another function */ +typedef struct _ProfilerSubEntry { + rotating_node_t header; + PY_LONG_LONG tt; + PY_LONG_LONG it; + long callcount; + long recursivecallcount; + long recursionLevel; +} ProfilerSubEntry; + +/* represents a function or user defined block */ +typedef struct _ProfilerEntry { + rotating_node_t header; + PyObject *userObj; /* PyCodeObject, or a descriptive str for builtins */ + PY_LONG_LONG tt; /* total time in this entry */ + PY_LONG_LONG it; /* inline time in this entry (not in subcalls) */ + long callcount; /* how many times this was called */ + long recursivecallcount; /* how many times called recursively */ + long recursionLevel; + rotating_node_t *calls; +} ProfilerEntry; + +typedef struct _ProfilerContext { + PY_LONG_LONG t0; + PY_LONG_LONG subt; + struct _ProfilerContext *previous; + ProfilerEntry *ctxEntry; +} ProfilerContext; + +typedef struct { + PyObject_HEAD + rotating_node_t *profilerEntries; + ProfilerContext *currentProfilerContext; + ProfilerContext *freelistProfilerContext; + int flags; + PyObject *externalTimer; + double externalTimerUnit; +} ProfilerObject; + +#define POF_ENABLED 0x001 +#define POF_SUBCALLS 0x002 +#define POF_BUILTINS 0x004 +#define POF_NOMEMORY 0x100 + +static PyTypeObject PyProfiler_Type; + +#define PyProfiler_Check(op) PyObject_TypeCheck(op, &PyProfiler_Type) +#define PyProfiler_CheckExact(op) ((op)->ob_type == &PyProfiler_Type) + +/*** External Timers ***/ + +#define DOUBLE_TIMER_PRECISION 4294967296.0 +static PyObject *empty_tuple; + +static PY_LONG_LONG CallExternalTimer(ProfilerObject *pObj) +{ + PY_LONG_LONG result; + PyObject *o = PyObject_Call(pObj->externalTimer, empty_tuple, NULL); + if (o == NULL) { + PyErr_WriteUnraisable(pObj->externalTimer); + return 0; + } + if (pObj->externalTimerUnit > 0.0) { + /* interpret the result as an integer that will be scaled + in profiler_getstats() */ + result = PyLong_AsLongLong(o); + } + else { + /* interpret the result as a double measured in seconds. + As the profiler works with PY_LONG_LONG internally + we convert it to a large integer */ + double val = PyFloat_AsDouble(o); + /* error handling delayed to the code below */ + result = (PY_LONG_LONG) (val * DOUBLE_TIMER_PRECISION); + } + Py_DECREF(o); + if (PyErr_Occurred()) { + PyErr_WriteUnraisable((PyObject *) pObj); + return 0; + } + return result; +} + +#define CALL_TIMER(pObj) ((pObj)->externalTimer ? \ + CallExternalTimer(pObj) : \ + hpTimer()) + +/*** ProfilerObject ***/ + +static PyObject * +normalizeUserObj(PyObject *obj) +{ + PyCFunctionObject *fn; + if (!PyCFunction_Check(obj)) { + Py_INCREF(obj); + return obj; + } + /* Replace built-in function objects with a descriptive string + because of built-in methods -- keeping a reference to + __self__ is probably not a good idea. */ + fn = (PyCFunctionObject *)obj; + + if (fn->m_self == NULL) { + /* built-in function: look up the module name */ + PyObject *mod = fn->m_module; + char *modname; + if (mod && PyString_Check(mod)) { + modname = PyString_AS_STRING(mod); + } + else if (mod && PyModule_Check(mod)) { + modname = PyModule_GetName(mod); + if (modname == NULL) { + PyErr_Clear(); + modname = "__builtin__"; + } + } + else { + modname = "__builtin__"; + } + if (strcmp(modname, "__builtin__") != 0) + return PyString_FromFormat("<%s.%s>", + modname, + fn->m_ml->ml_name); + else + return PyString_FromFormat("<%s>", + fn->m_ml->ml_name); + } + else { + /* built-in method: try to return + repr(getattr(type(__self__), __name__)) + */ + PyObject *self = fn->m_self; + PyObject *name = PyString_FromString(fn->m_ml->ml_name); + if (name != NULL) { + PyObject *mo = _PyType_Lookup(self->ob_type, name); + Py_XINCREF(mo); + Py_DECREF(name); + if (mo != NULL) { + PyObject *res = PyObject_Repr(mo); + Py_DECREF(mo); + if (res != NULL) + return res; + } + } + PyErr_Clear(); + return PyString_FromFormat("", + fn->m_ml->ml_name); + } +} + +static ProfilerEntry* +newProfilerEntry(ProfilerObject *pObj, void *key, PyObject *userObj) +{ + ProfilerEntry *self; + self = (ProfilerEntry*) malloc(sizeof(ProfilerEntry)); + if (self == NULL) { + pObj->flags |= POF_NOMEMORY; + return NULL; + } + userObj = normalizeUserObj(userObj); + if (userObj == NULL) { + PyErr_Clear(); + free(self); + pObj->flags |= POF_NOMEMORY; + return NULL; + } + self->header.key = key; + self->userObj = userObj; + self->tt = 0; + self->it = 0; + self->callcount = 0; + self->recursivecallcount = 0; + self->recursionLevel = 0; + self->calls = EMPTY_ROTATING_TREE; + RotatingTree_Add(&pObj->profilerEntries, &self->header); + return self; +} + +static ProfilerEntry* +getEntry(ProfilerObject *pObj, void *key) +{ + return (ProfilerEntry*) RotatingTree_Get(&pObj->profilerEntries, key); +} + +static ProfilerSubEntry * +getSubEntry(ProfilerObject *pObj, ProfilerEntry *caller, ProfilerEntry* entry) +{ + return (ProfilerSubEntry*) RotatingTree_Get(&caller->calls, + (void *)entry); +} + +static ProfilerSubEntry * +newSubEntry(ProfilerObject *pObj, ProfilerEntry *caller, ProfilerEntry* entry) +{ + ProfilerSubEntry *self; + self = (ProfilerSubEntry*) malloc(sizeof(ProfilerSubEntry)); + if (self == NULL) { + pObj->flags |= POF_NOMEMORY; + return NULL; + } + self->header.key = (void *)entry; + self->tt = 0; + self->it = 0; + self->callcount = 0; + self->recursivecallcount = 0; + self->recursionLevel = 0; + RotatingTree_Add(&caller->calls, &self->header); + return self; +} + +static int freeSubEntry(rotating_node_t *header, void *arg) +{ + ProfilerSubEntry *subentry = (ProfilerSubEntry*) header; + free(subentry); + return 0; +} + +static int freeEntry(rotating_node_t *header, void *arg) +{ + ProfilerEntry *entry = (ProfilerEntry*) header; + RotatingTree_Enum(entry->calls, freeSubEntry, NULL); + Py_DECREF(entry->userObj); + free(entry); + return 0; +} + +static void clearEntries(ProfilerObject *pObj) +{ + RotatingTree_Enum(pObj->profilerEntries, freeEntry, NULL); + pObj->profilerEntries = EMPTY_ROTATING_TREE; + /* release the memory hold by the free list of ProfilerContexts */ + while (pObj->freelistProfilerContext) { + ProfilerContext *c = pObj->freelistProfilerContext; + pObj->freelistProfilerContext = c->previous; + free(c); + } +} + +static void +initContext(ProfilerObject *pObj, ProfilerContext *self, ProfilerEntry *entry) +{ + self->ctxEntry = entry; + self->subt = 0; + self->previous = pObj->currentProfilerContext; + pObj->currentProfilerContext = self; + ++entry->recursionLevel; + if ((pObj->flags & POF_SUBCALLS) && self->previous) { + /* find or create an entry for me in my caller's entry */ + ProfilerEntry *caller = self->previous->ctxEntry; + ProfilerSubEntry *subentry = getSubEntry(pObj, caller, entry); + if (subentry == NULL) + subentry = newSubEntry(pObj, caller, entry); + if (subentry) + ++subentry->recursionLevel; + } + self->t0 = CALL_TIMER(pObj); +} + +static void +Stop(ProfilerObject *pObj, ProfilerContext *self, ProfilerEntry *entry) +{ + PY_LONG_LONG tt = CALL_TIMER(pObj) - self->t0; + PY_LONG_LONG it = tt - self->subt; + if (self->previous) + self->previous->subt += tt; + pObj->currentProfilerContext = self->previous; + if (--entry->recursionLevel == 0) + entry->tt += tt; + else + ++entry->recursivecallcount; + entry->it += it; + entry->callcount++; + if ((pObj->flags & POF_SUBCALLS) && self->previous) { + /* find or create an entry for me in my caller's entry */ + ProfilerEntry *caller = self->previous->ctxEntry; + ProfilerSubEntry *subentry = getSubEntry(pObj, caller, entry); + if (subentry) { + if (--subentry->recursionLevel == 0) + subentry->tt += tt; + else + ++subentry->recursivecallcount; + subentry->it += it; + ++subentry->callcount; + } + } +} + +static void +ptrace_enter_call(PyObject *self, void *key, PyObject *userObj) +{ + /* entering a call to the function identified by 'key' + (which can be a PyCodeObject or a PyMethodDef pointer) */ + ProfilerObject *pObj = (ProfilerObject*)self; + ProfilerEntry *profEntry; + ProfilerContext *pContext; + + profEntry = getEntry(pObj, key); + if (profEntry == NULL) { + profEntry = newProfilerEntry(pObj, key, userObj); + if (profEntry == NULL) + return; + } + /* grab a ProfilerContext out of the free list */ + pContext = pObj->freelistProfilerContext; + if (pContext) { + pObj->freelistProfilerContext = pContext->previous; + } + else { + /* free list exhausted, allocate a new one */ + pContext = (ProfilerContext*) + malloc(sizeof(ProfilerContext)); + if (pContext == NULL) { + pObj->flags |= POF_NOMEMORY; + return; + } + } + initContext(pObj, pContext, profEntry); +} + +static void +ptrace_leave_call(PyObject *self, void *key) +{ + /* leaving a call to the function identified by 'key' */ + ProfilerObject *pObj = (ProfilerObject*)self; + ProfilerEntry *profEntry; + ProfilerContext *pContext; + + pContext = pObj->currentProfilerContext; + if (pContext == NULL) + return; + profEntry = getEntry(pObj, key); + if (profEntry) { + Stop(pObj, pContext, profEntry); + } + else { + pObj->currentProfilerContext = pContext->previous; + } + /* put pContext into the free list */ + pContext->previous = pObj->freelistProfilerContext; + pObj->freelistProfilerContext = pContext; +} + +static int +profiler_callback(PyObject *self, PyFrameObject *frame, int what, + PyObject *arg) +{ + switch (what) { + + /* the 'frame' of a called function is about to start its execution */ + case PyTrace_CALL: + ptrace_enter_call(self, (void *)frame->f_code, + (PyObject *)frame->f_code); + break; + + /* the 'frame' of a called function is about to finish + (either normally or with an exception) */ + case PyTrace_RETURN: + ptrace_leave_call(self, (void *)frame->f_code); + break; + + /* case PyTrace_EXCEPTION: + If the exception results in the function exiting, a + PyTrace_RETURN event will be generated, so we don't need to + handle it. */ + +#ifdef PyTrace_C_CALL /* not defined in Python <= 2.3 */ + /* the Python function 'frame' is issuing a call to the built-in + function 'arg' */ + case PyTrace_C_CALL: + if ((((ProfilerObject *)self)->flags & POF_BUILTINS) + && PyCFunction_Check(arg)) { + ptrace_enter_call(self, + ((PyCFunctionObject *)arg)->m_ml, + arg); + } + break; + + /* the call to the built-in function 'arg' is returning into its + caller 'frame' */ + case PyTrace_C_RETURN: /* ...normally */ + case PyTrace_C_EXCEPTION: /* ...with an exception set */ + if ((((ProfilerObject *)self)->flags & POF_BUILTINS) + && PyCFunction_Check(arg)) { + ptrace_leave_call(self, + ((PyCFunctionObject *)arg)->m_ml); + } + break; +#endif + + default: + break; + } + return 0; +} + +static int +pending_exception(ProfilerObject *pObj) +{ + if (pObj->flags & POF_NOMEMORY) { + pObj->flags -= POF_NOMEMORY; + PyErr_SetString(PyExc_MemoryError, + "memory was exhausted while profiling"); + return -1; + } + return 0; +} + +/************************************************************/ + +static PyStructSequence_Field profiler_entry_fields[] = { + {"code", "code object or built-in function name"}, + {"callcount", "how many times this was called"}, + {"reccallcount", "how many times called recursively"}, + {"totaltime", "total time in this entry"}, + {"inlinetime", "inline time in this entry (not in subcalls)"}, + {"calls", "details of the calls"}, + {0} +}; + +static PyStructSequence_Field profiler_subentry_fields[] = { + {"code", "called code object or built-in function name"}, + {"callcount", "how many times this is called"}, + {"reccallcount", "how many times this is called recursively"}, + {"totaltime", "total time spent in this call"}, + {"inlinetime", "inline time (not in further subcalls)"}, + {0} +}; + +static PyStructSequence_Desc profiler_entry_desc = { + "_lsprof.profiler_entry", /* name */ + NULL, /* doc */ + profiler_entry_fields, + 6 +}; + +static PyStructSequence_Desc profiler_subentry_desc = { + "_lsprof.profiler_subentry", /* name */ + NULL, /* doc */ + profiler_subentry_fields, + 5 +}; + +static int initialized; +static PyTypeObject StatsEntryType; +static PyTypeObject StatsSubEntryType; + + +typedef struct { + PyObject *list; + PyObject *sublist; + double factor; +} statscollector_t; + +static int statsForSubEntry(rotating_node_t *node, void *arg) +{ + ProfilerSubEntry *sentry = (ProfilerSubEntry*) node; + statscollector_t *collect = (statscollector_t*) arg; + ProfilerEntry *entry = (ProfilerEntry*) sentry->header.key; + int err; + PyObject *sinfo; + sinfo = PyObject_CallFunction((PyObject*) &StatsSubEntryType, + "((Olldd))", + entry->userObj, + sentry->callcount, + sentry->recursivecallcount, + collect->factor * sentry->tt, + collect->factor * sentry->it); + if (sinfo == NULL) + return -1; + err = PyList_Append(collect->sublist, sinfo); + Py_DECREF(sinfo); + return err; +} + +static int statsForEntry(rotating_node_t *node, void *arg) +{ + ProfilerEntry *entry = (ProfilerEntry*) node; + statscollector_t *collect = (statscollector_t*) arg; + PyObject *info; + int err; + if (entry->callcount == 0) + return 0; /* skip */ + + if (entry->calls != EMPTY_ROTATING_TREE) { + collect->sublist = PyList_New(0); + if (collect->sublist == NULL) + return -1; + if (RotatingTree_Enum(entry->calls, + statsForSubEntry, collect) != 0) { + Py_DECREF(collect->sublist); + return -1; + } + } + else { + Py_INCREF(Py_None); + collect->sublist = Py_None; + } + + info = PyObject_CallFunction((PyObject*) &StatsEntryType, + "((OllddO))", + entry->userObj, + entry->callcount, + entry->recursivecallcount, + collect->factor * entry->tt, + collect->factor * entry->it, + collect->sublist); + Py_DECREF(collect->sublist); + if (info == NULL) + return -1; + err = PyList_Append(collect->list, info); + Py_DECREF(info); + return err; +} + +PyDoc_STRVAR(getstats_doc, "\ +getstats() -> list of profiler_entry objects\n\ +\n\ +Return all information collected by the profiler.\n\ +Each profiler_entry is a tuple-like object with the\n\ +following attributes:\n\ +\n\ + code code object\n\ + callcount how many times this was called\n\ + reccallcount how many times called recursively\n\ + totaltime total time in this entry\n\ + inlinetime inline time in this entry (not in subcalls)\n\ + calls details of the calls\n\ +\n\ +The calls attribute is either None or a list of\n\ +profiler_subentry objects:\n\ +\n\ + code called code object\n\ + callcount how many times this is called\n\ + reccallcount how many times this is called recursively\n\ + totaltime total time spent in this call\n\ + inlinetime inline time (not in further subcalls)\n\ +"); + +static PyObject* +profiler_getstats(ProfilerObject *pObj, PyObject* noarg) +{ + statscollector_t collect; + if (pending_exception(pObj)) + return NULL; + if (!pObj->externalTimer) + collect.factor = hpTimerUnit(); + else if (pObj->externalTimerUnit > 0.0) + collect.factor = pObj->externalTimerUnit; + else + collect.factor = 1.0 / DOUBLE_TIMER_PRECISION; + collect.list = PyList_New(0); + if (collect.list == NULL) + return NULL; + if (RotatingTree_Enum(pObj->profilerEntries, statsForEntry, &collect) + != 0) { + Py_DECREF(collect.list); + return NULL; + } + return collect.list; +} + +static int +setSubcalls(ProfilerObject *pObj, int nvalue) +{ + if (nvalue == 0) + pObj->flags &= ~POF_SUBCALLS; + else if (nvalue > 0) + pObj->flags |= POF_SUBCALLS; + return 0; +} + +static int +setBuiltins(ProfilerObject *pObj, int nvalue) +{ + if (nvalue == 0) + pObj->flags &= ~POF_BUILTINS; + else if (nvalue > 0) { +#ifndef PyTrace_C_CALL + PyErr_SetString(PyExc_ValueError, + "builtins=True requires Python >= 2.4"); + return -1; +#else + pObj->flags |= POF_BUILTINS; +#endif + } + return 0; +} + +PyDoc_STRVAR(enable_doc, "\ +enable(subcalls=True, builtins=True)\n\ +\n\ +Start collecting profiling information.\n\ +If 'subcalls' is True, also records for each function\n\ +statistics separated according to its current caller.\n\ +If 'builtins' is True, records the time spent in\n\ +built-in functions separately from their caller.\n\ +"); + +static PyObject* +profiler_enable(ProfilerObject *self, PyObject *args, PyObject *kwds) +{ + int subcalls = -1; + int builtins = -1; + static char *kwlist[] = {"subcalls", "builtins", 0}; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|ii:enable", + kwlist, &subcalls, &builtins)) + return NULL; + if (setSubcalls(self, subcalls) < 0 || setBuiltins(self, builtins) < 0) + return NULL; + PyEval_SetProfile(profiler_callback, (PyObject*)self); + self->flags |= POF_ENABLED; + Py_INCREF(Py_None); + return Py_None; +} + +static void +flush_unmatched(ProfilerObject *pObj) +{ + while (pObj->currentProfilerContext) { + ProfilerContext *pContext = pObj->currentProfilerContext; + ProfilerEntry *profEntry= pContext->ctxEntry; + if (profEntry) + Stop(pObj, pContext, profEntry); + else + pObj->currentProfilerContext = pContext->previous; + if (pContext) + free(pContext); + } + +} + +PyDoc_STRVAR(disable_doc, "\ +disable()\n\ +\n\ +Stop collecting profiling information.\n\ +"); + +static PyObject* +profiler_disable(ProfilerObject *self, PyObject* noarg) +{ + self->flags &= ~POF_ENABLED; + PyEval_SetProfile(NULL, NULL); + flush_unmatched(self); + if (pending_exception(self)) + return NULL; + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(clear_doc, "\ +clear()\n\ +\n\ +Clear all profiling information collected so far.\n\ +"); + +static PyObject* +profiler_clear(ProfilerObject *pObj, PyObject* noarg) +{ + clearEntries(pObj); + Py_INCREF(Py_None); + return Py_None; +} + +static void +profiler_dealloc(ProfilerObject *op) +{ + if (op->flags & POF_ENABLED) + PyEval_SetProfile(NULL, NULL); + flush_unmatched(op); + clearEntries(op); + Py_XDECREF(op->externalTimer); + op->ob_type->tp_free(op); +} + +static int +profiler_init(ProfilerObject *pObj, PyObject *args, PyObject *kw) +{ + PyObject *o; + PyObject *timer = NULL; + double timeunit = 0.0; + int subcalls = 1; +#ifdef PyTrace_C_CALL + int builtins = 1; +#else + int builtins = 0; +#endif + static char *kwlist[] = {"timer", "timeunit", + "subcalls", "builtins", 0}; + + if (!PyArg_ParseTupleAndKeywords(args, kw, "|Odii:Profiler", kwlist, + &timer, &timeunit, + &subcalls, &builtins)) + return -1; + + if (setSubcalls(pObj, subcalls) < 0 || setBuiltins(pObj, builtins) < 0) + return -1; + o = pObj->externalTimer; + pObj->externalTimer = timer; + Py_XINCREF(timer); + Py_XDECREF(o); + pObj->externalTimerUnit = timeunit; + return 0; +} + +static PyMethodDef profiler_methods[] = { + {"getstats", (PyCFunction)profiler_getstats, + METH_NOARGS, getstats_doc}, + {"enable", (PyCFunction)profiler_enable, + METH_VARARGS | METH_KEYWORDS, enable_doc}, + {"disable", (PyCFunction)profiler_disable, + METH_NOARGS, disable_doc}, + {"clear", (PyCFunction)profiler_clear, + METH_NOARGS, clear_doc}, + {NULL, NULL} +}; + +PyDoc_STRVAR(profiler_doc, "\ +Profiler(custom_timer=None, time_unit=None, subcalls=True, builtins=True)\n\ +\n\ + Builds a profiler object using the specified timer function.\n\ + The default timer is a fast built-in one based on real time.\n\ + For custom timer functions returning integers, time_unit can\n\ + be a float specifying a scale (i.e. how long each integer unit\n\ + is, in seconds).\n\ +"); + +static PyTypeObject PyProfiler_Type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "_lsprof.Profiler", /* tp_name */ + sizeof(ProfilerObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)profiler_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + profiler_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + profiler_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)profiler_init, /* tp_init */ + PyType_GenericAlloc, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ + PyObject_Del, /* tp_free */ +}; + +static PyMethodDef moduleMethods[] = { + {NULL, NULL} +}; + +PyMODINIT_FUNC +init_lsprof(void) +{ + PyObject *module, *d; + module = Py_InitModule3("_lsprof", moduleMethods, "Fast profiler"); + if (module == NULL) + return; + d = PyModule_GetDict(module); + if (PyType_Ready(&PyProfiler_Type) < 0) + return; + PyDict_SetItemString(d, "Profiler", (PyObject *)&PyProfiler_Type); + + if (!initialized) { + PyStructSequence_InitType(&StatsEntryType, + &profiler_entry_desc); + PyStructSequence_InitType(&StatsSubEntryType, + &profiler_subentry_desc); + } + Py_INCREF((PyObject*) &StatsEntryType); + Py_INCREF((PyObject*) &StatsSubEntryType); + PyModule_AddObject(module, "profiler_entry", + (PyObject*) &StatsEntryType); + PyModule_AddObject(module, "profiler_subentry", + (PyObject*) &StatsSubEntryType); + empty_tuple = PyTuple_New(0); + initialized = 1; +} Added: sandbox/trunk/cpy_merge/Modules/cPickle.c ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Modules/cPickle.c Wed May 23 03:45:28 2007 @@ -0,0 +1,5583 @@ +#include "Python.h" +#include "cStringIO.h" +#include "structmember.h" + +PyDoc_STRVAR(cPickle_module_documentation, +"C implementation and optimization of the Python pickle module."); + +#ifndef Py_eval_input +#include +#define Py_eval_input eval_input +#endif /* Py_eval_input */ + +#define DEL_LIST_SLICE(list, from, to) (PyList_SetSlice(list, from, to, NULL)) + +#define WRITE_BUF_SIZE 256 + +/* Bump this when new opcodes are added to the pickle protocol. */ +#define HIGHEST_PROTOCOL 2 + +/* + * Pickle opcodes. These must be kept in synch with pickle.py. Extensive + * docs are in pickletools.py. + */ +#define MARK '(' +#define STOP '.' +#define POP '0' +#define POP_MARK '1' +#define DUP '2' +#define FLOAT 'F' +#define BINFLOAT 'G' +#define INT 'I' +#define BININT 'J' +#define BININT1 'K' +#define LONG 'L' +#define BININT2 'M' +#define NONE 'N' +#define PERSID 'P' +#define BINPERSID 'Q' +#define REDUCE 'R' +#define STRING 'S' +#define BINSTRING 'T' +#define SHORT_BINSTRING 'U' +#define UNICODE 'V' +#define BINUNICODE 'X' +#define APPEND 'a' +#define BUILD 'b' +#define GLOBAL 'c' +#define DICT 'd' +#define EMPTY_DICT '}' +#define APPENDS 'e' +#define GET 'g' +#define BINGET 'h' +#define INST 'i' +#define LONG_BINGET 'j' +#define LIST 'l' +#define EMPTY_LIST ']' +#define OBJ 'o' +#define PUT 'p' +#define BINPUT 'q' +#define LONG_BINPUT 'r' +#define SETITEM 's' +#define TUPLE 't' +#define EMPTY_TUPLE ')' +#define SETITEMS 'u' + +/* Protocol 2. */ +#define PROTO '\x80' /* identify pickle protocol */ +#define NEWOBJ '\x81' /* build object by applying cls.__new__ to argtuple */ +#define EXT1 '\x82' /* push object from extension registry; 1-byte index */ +#define EXT2 '\x83' /* ditto, but 2-byte index */ +#define EXT4 '\x84' /* ditto, but 4-byte index */ +#define TUPLE1 '\x85' /* build 1-tuple from stack top */ +#define TUPLE2 '\x86' /* build 2-tuple from two topmost stack items */ +#define TUPLE3 '\x87' /* build 3-tuple from three topmost stack items */ +#define NEWTRUE '\x88' /* push True */ +#define NEWFALSE '\x89' /* push False */ +#define LONG1 '\x8a' /* push long from < 256 bytes */ +#define LONG4 '\x8b' /* push really big long */ + +/* There aren't opcodes -- they're ways to pickle bools before protocol 2, + * so that unpicklers written before bools were introduced unpickle them + * as ints, but unpicklers after can recognize that bools were intended. + * Note that protocol 2 added direct ways to pickle bools. + */ +#undef TRUE +#define TRUE "I01\n" +#undef FALSE +#define FALSE "I00\n" + +/* Keep in synch with pickle.Pickler._BATCHSIZE. This is how many elements + * batch_list/dict() pumps out before doing APPENDS/SETITEMS. Nothing will + * break if this gets out of synch with pickle.py, but it's unclear that + * would help anything either. + */ +#define BATCHSIZE 1000 + +static char MARKv = MARK; + +static PyObject *PickleError; +static PyObject *PicklingError; +static PyObject *UnpickleableError; +static PyObject *UnpicklingError; +static PyObject *BadPickleGet; + +/* As the name says, an empty tuple. */ +static PyObject *empty_tuple; + +/* copy_reg.dispatch_table, {type_object: pickling_function} */ +static PyObject *dispatch_table; + +/* For EXT[124] opcodes. */ +/* copy_reg._extension_registry, {(module_name, function_name): code} */ +static PyObject *extension_registry; +/* copy_reg._inverted_registry, {code: (module_name, function_name)} */ +static PyObject *inverted_registry; +/* copy_reg._extension_cache, {code: object} */ +static PyObject *extension_cache; + +/* For looking up name pairs in copy_reg._extension_registry. */ +static PyObject *two_tuple; + +static PyObject *__class___str, *__getinitargs___str, *__dict___str, + *__getstate___str, *__setstate___str, *__name___str, *__reduce___str, + *__reduce_ex___str, + *write_str, *append_str, + *read_str, *readline_str, *__main___str, + *copy_reg_str, *dispatch_table_str; + +/************************************************************************* + Internal Data type for pickle data. */ + +typedef struct { + PyObject_HEAD + int length; /* number of initial slots in data currently used */ + int size; /* number of slots in data allocated */ + PyObject **data; +} Pdata; + +static void +Pdata_dealloc(Pdata *self) +{ + int i; + PyObject **p; + + for (i = self->length, p = self->data; --i >= 0; p++) { + Py_DECREF(*p); + } + if (self->data) + free(self->data); + PyObject_Del(self); +} + +static PyTypeObject PdataType = { + PyObject_HEAD_INIT(NULL) 0, "cPickle.Pdata", sizeof(Pdata), 0, + (destructor)Pdata_dealloc, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0L,0L,0L,0L, "" +}; + +#define Pdata_Check(O) ((O)->ob_type == &PdataType) + +static PyObject * +Pdata_New(void) +{ + Pdata *self; + + if (!(self = PyObject_New(Pdata, &PdataType))) + return NULL; + self->size = 8; + self->length = 0; + self->data = malloc(self->size * sizeof(PyObject*)); + if (self->data) + return (PyObject*)self; + Py_DECREF(self); + return PyErr_NoMemory(); +} + +static int +stackUnderflow(void) +{ + PyErr_SetString(UnpicklingError, "unpickling stack underflow"); + return -1; +} + +/* Retain only the initial clearto items. If clearto >= the current + * number of items, this is a (non-erroneous) NOP. + */ +static int +Pdata_clear(Pdata *self, int clearto) +{ + int i; + PyObject **p; + + if (clearto < 0) return stackUnderflow(); + if (clearto >= self->length) return 0; + + for (i = self->length, p = self->data + clearto; + --i >= clearto; + p++) { + Py_CLEAR(*p); + } + self->length = clearto; + + return 0; +} + +static int +Pdata_grow(Pdata *self) +{ + int bigger; + size_t nbytes; + PyObject **tmp; + + bigger = self->size << 1; + if (bigger <= 0) /* was 0, or new value overflows */ + goto nomemory; + if ((int)(size_t)bigger != bigger) + goto nomemory; + nbytes = (size_t)bigger * sizeof(PyObject *); + if (nbytes / sizeof(PyObject *) != (size_t)bigger) + goto nomemory; + tmp = realloc(self->data, nbytes); + if (tmp == NULL) + goto nomemory; + self->data = tmp; + self->size = bigger; + return 0; + + nomemory: + PyErr_NoMemory(); + return -1; +} + +/* D is a Pdata*. Pop the topmost element and store it into V, which + * must be an lvalue holding PyObject*. On stack underflow, UnpicklingError + * is raised and V is set to NULL. D and V may be evaluated several times. + */ +#define PDATA_POP(D, V) { \ + if ((D)->length) \ + (V) = (D)->data[--((D)->length)]; \ + else { \ + PyErr_SetString(UnpicklingError, "bad pickle data"); \ + (V) = NULL; \ + } \ +} + +/* PDATA_PUSH and PDATA_APPEND both push rvalue PyObject* O on to Pdata* + * D. If the Pdata stack can't be grown to hold the new value, both + * raise MemoryError and execute "return ER". The difference is in ownership + * of O after: _PUSH transfers ownership of O from the caller to the stack + * (no incref of O is done, and in case of error O is decrefed), while + * _APPEND pushes a new reference. + */ + +/* Push O on stack D, giving ownership of O to the stack. */ +#define PDATA_PUSH(D, O, ER) { \ + if (((Pdata*)(D))->length == ((Pdata*)(D))->size && \ + Pdata_grow((Pdata*)(D)) < 0) { \ + Py_DECREF(O); \ + return ER; \ + } \ + ((Pdata*)(D))->data[((Pdata*)(D))->length++] = (O); \ +} + +/* Push O on stack D, pushing a new reference. */ +#define PDATA_APPEND(D, O, ER) { \ + if (((Pdata*)(D))->length == ((Pdata*)(D))->size && \ + Pdata_grow((Pdata*)(D)) < 0) \ + return ER; \ + Py_INCREF(O); \ + ((Pdata*)(D))->data[((Pdata*)(D))->length++] = (O); \ +} + + +static PyObject * +Pdata_popTuple(Pdata *self, int start) +{ + PyObject *r; + int i, j, l; + + l = self->length-start; + r = PyTuple_New(l); + if (r == NULL) + return NULL; + for (i = start, j = 0 ; j < l; i++, j++) + PyTuple_SET_ITEM(r, j, self->data[i]); + + self->length = start; + return r; +} + +static PyObject * +Pdata_popList(Pdata *self, int start) +{ + PyObject *r; + int i, j, l; + + l=self->length-start; + if (!( r=PyList_New(l))) return NULL; + for (i=start, j=0 ; j < l; i++, j++) + PyList_SET_ITEM(r, j, self->data[i]); + + self->length=start; + return r; +} + +/*************************************************************************/ + +#define ARG_TUP(self, o) { \ + if (self->arg || (self->arg=PyTuple_New(1))) { \ + Py_XDECREF(PyTuple_GET_ITEM(self->arg,0)); \ + PyTuple_SET_ITEM(self->arg,0,o); \ + } \ + else { \ + Py_DECREF(o); \ + } \ +} + +#define FREE_ARG_TUP(self) { \ + if (self->arg->ob_refcnt > 1) { \ + Py_DECREF(self->arg); \ + self->arg=NULL; \ + } \ + } + +typedef struct Picklerobject { + PyObject_HEAD + FILE *fp; + PyObject *write; + PyObject *file; + PyObject *memo; + PyObject *arg; + PyObject *pers_func; + PyObject *inst_pers_func; + + /* pickle protocol number, >= 0 */ + int proto; + + /* bool, true if proto > 0 */ + int bin; + + int fast; /* Fast mode doesn't save in memo, don't use if circ ref */ + int nesting; + int (*write_func)(struct Picklerobject *, const char *, Py_ssize_t); + char *write_buf; + int buf_size; + PyObject *dispatch_table; + int fast_container; /* count nested container dumps */ + PyObject *fast_memo; +} Picklerobject; + +#ifndef PY_CPICKLE_FAST_LIMIT +#define PY_CPICKLE_FAST_LIMIT 50 +#endif + +static PyTypeObject Picklertype; + +typedef struct Unpicklerobject { + PyObject_HEAD + FILE *fp; + PyObject *file; + PyObject *readline; + PyObject *read; + PyObject *memo; + PyObject *arg; + Pdata *stack; + PyObject *mark; + PyObject *pers_func; + PyObject *last_string; + int *marks; + int num_marks; + int marks_size; + Py_ssize_t (*read_func)(struct Unpicklerobject *, char **, Py_ssize_t); + Py_ssize_t (*readline_func)(struct Unpicklerobject *, char **); + int buf_size; + char *buf; + PyObject *find_class; +} Unpicklerobject; + +static PyTypeObject Unpicklertype; + +/* Forward decls that need the above structs */ +static int save(Picklerobject *, PyObject *, int); +static int put2(Picklerobject *, PyObject *); + +static +PyObject * +cPickle_ErrFormat(PyObject *ErrType, char *stringformat, char *format, ...) +{ + va_list va; + PyObject *args=0, *retval=0; + va_start(va, format); + + if (format) args = Py_VaBuildValue(format, va); + va_end(va); + if (format && ! args) return NULL; + if (stringformat && !(retval=PyString_FromString(stringformat))) + return NULL; + + if (retval) { + if (args) { + PyObject *v; + v=PyString_Format(retval, args); + Py_DECREF(retval); + Py_DECREF(args); + if (! v) return NULL; + retval=v; + } + } + else + if (args) retval=args; + else { + PyErr_SetObject(ErrType,Py_None); + return NULL; + } + PyErr_SetObject(ErrType,retval); + Py_DECREF(retval); + return NULL; +} + +static int +write_file(Picklerobject *self, const char *s, Py_ssize_t n) +{ + size_t nbyteswritten; + + if (s == NULL) { + return 0; + } + + if (n > INT_MAX) { + /* String too large */ + return -1; + } + + Py_BEGIN_ALLOW_THREADS + nbyteswritten = fwrite(s, sizeof(char), n, self->fp); + Py_END_ALLOW_THREADS + if (nbyteswritten != (size_t)n) { + PyErr_SetFromErrno(PyExc_IOError); + return -1; + } + + return (int)n; +} + +static int +write_cStringIO(Picklerobject *self, const char *s, Py_ssize_t n) +{ + if (s == NULL) { + return 0; + } + + if (PycStringIO->cwrite((PyObject *)self->file, s, n) != n) { + return -1; + } + + return (int)n; +} + +static int +write_none(Picklerobject *self, const char *s, Py_ssize_t n) +{ + if (s == NULL) return 0; + if (n > INT_MAX) return -1; + return (int)n; +} + +static int +write_other(Picklerobject *self, const char *s, Py_ssize_t _n) +{ + PyObject *py_str = 0, *junk = 0; + int n; + + if (_n > INT_MAX) + return -1; + n = (int)_n; + if (s == NULL) { + if (!( self->buf_size )) return 0; + py_str = PyString_FromStringAndSize(self->write_buf, + self->buf_size); + if (!py_str) + return -1; + } + else { + if (self->buf_size && (n + self->buf_size) > WRITE_BUF_SIZE) { + if (write_other(self, NULL, 0) < 0) + return -1; + } + + if (n > WRITE_BUF_SIZE) { + if (!( py_str = + PyString_FromStringAndSize(s, n))) + return -1; + } + else { + memcpy(self->write_buf + self->buf_size, s, n); + self->buf_size += n; + return n; + } + } + + if (self->write) { + /* object with write method */ + ARG_TUP(self, py_str); + if (self->arg) { + junk = PyObject_Call(self->write, self->arg, NULL); + FREE_ARG_TUP(self); + } + if (junk) Py_DECREF(junk); + else return -1; + } + else + PDATA_PUSH(self->file, py_str, -1); + + self->buf_size = 0; + return n; +} + + +static Py_ssize_t +read_file(Unpicklerobject *self, char **s, Py_ssize_t n) +{ + size_t nbytesread; + + if (self->buf_size == 0) { + int size; + + size = ((n < 32) ? 32 : n); + if (!( self->buf = (char *)malloc(size))) { + PyErr_NoMemory(); + return -1; + } + + self->buf_size = size; + } + else if (n > self->buf_size) { + char *newbuf = (char *)realloc(self->buf, n); + if (!newbuf) { + PyErr_NoMemory(); + return -1; + } + self->buf = newbuf; + self->buf_size = n; + } + + Py_BEGIN_ALLOW_THREADS + nbytesread = fread(self->buf, sizeof(char), n, self->fp); + Py_END_ALLOW_THREADS + if (nbytesread != (size_t)n) { + if (feof(self->fp)) { + PyErr_SetNone(PyExc_EOFError); + return -1; + } + + PyErr_SetFromErrno(PyExc_IOError); + return -1; + } + + *s = self->buf; + + return n; +} + + +static Py_ssize_t +readline_file(Unpicklerobject *self, char **s) +{ + int i; + + if (self->buf_size == 0) { + if (!( self->buf = (char *)malloc(40))) { + PyErr_NoMemory(); + return -1; + } + self->buf_size = 40; + } + + i = 0; + while (1) { + int bigger; + char *newbuf; + for (; i < (self->buf_size - 1); i++) { + if (feof(self->fp) || + (self->buf[i] = getc(self->fp)) == '\n') { + self->buf[i + 1] = '\0'; + *s = self->buf; + return i + 1; + } + } + bigger = self->buf_size << 1; + if (bigger <= 0) { /* overflow */ + PyErr_NoMemory(); + return -1; + } + newbuf = (char *)realloc(self->buf, bigger); + if (!newbuf) { + PyErr_NoMemory(); + return -1; + } + self->buf = newbuf; + self->buf_size = bigger; + } +} + + +static Py_ssize_t +read_cStringIO(Unpicklerobject *self, char **s, Py_ssize_t n) +{ + char *ptr; + + if (PycStringIO->cread((PyObject *)self->file, &ptr, n) != n) { + PyErr_SetNone(PyExc_EOFError); + return -1; + } + + *s = ptr; + + return n; +} + + +static Py_ssize_t +readline_cStringIO(Unpicklerobject *self, char **s) +{ + Py_ssize_t n; + char *ptr; + + if ((n = PycStringIO->creadline((PyObject *)self->file, &ptr)) < 0) { + return -1; + } + + *s = ptr; + + return n; +} + + +static Py_ssize_t +read_other(Unpicklerobject *self, char **s, Py_ssize_t n) +{ + PyObject *bytes, *str=0; + + if (!( bytes = PyInt_FromSsize_t(n))) return -1; + + ARG_TUP(self, bytes); + if (self->arg) { + str = PyObject_Call(self->read, self->arg, NULL); + FREE_ARG_TUP(self); + } + if (! str) return -1; + + Py_XDECREF(self->last_string); + self->last_string = str; + + if (! (*s = PyString_AsString(str))) return -1; + return n; +} + + +static Py_ssize_t +readline_other(Unpicklerobject *self, char **s) +{ + PyObject *str; + Py_ssize_t str_size; + + if (!( str = PyObject_CallObject(self->readline, empty_tuple))) { + return -1; + } + + if ((str_size = PyString_Size(str)) < 0) + return -1; + + Py_XDECREF(self->last_string); + self->last_string = str; + + if (! (*s = PyString_AsString(str))) + return -1; + + return str_size; +} + +/* Copy the first n bytes from s into newly malloc'ed memory, plus a + * trailing 0 byte. Return a pointer to that, or NULL if out of memory. + * The caller is responsible for free()'ing the return value. + */ +static char * +pystrndup(const char *s, int n) +{ + char *r = (char *)malloc(n+1); + if (r == NULL) + return (char*)PyErr_NoMemory(); + memcpy(r, s, n); + r[n] = 0; + return r; +} + + +static int +get(Picklerobject *self, PyObject *id) +{ + PyObject *value, *mv; + long c_value; + char s[30]; + size_t len; + + if (!( mv = PyDict_GetItem(self->memo, id))) { + PyErr_SetObject(PyExc_KeyError, id); + return -1; + } + + if (!( value = PyTuple_GetItem(mv, 0))) + return -1; + + if (!( PyInt_Check(value))) { + PyErr_SetString(PicklingError, "no int where int expected in memo"); + return -1; + } + c_value = PyInt_AsLong(value); + if (c_value == -1 && PyErr_Occurred()) + return -1; + + if (!self->bin) { + s[0] = GET; + PyOS_snprintf(s + 1, sizeof(s) - 1, "%ld\n", c_value); + len = strlen(s); + } + else if (Pdata_Check(self->file)) { + if (write_other(self, NULL, 0) < 0) return -1; + PDATA_APPEND(self->file, mv, -1); + return 0; + } + else { + if (c_value < 256) { + s[0] = BINGET; + s[1] = (int)(c_value & 0xff); + len = 2; + } + else { + s[0] = LONG_BINGET; + s[1] = (int)(c_value & 0xff); + s[2] = (int)((c_value >> 8) & 0xff); + s[3] = (int)((c_value >> 16) & 0xff); + s[4] = (int)((c_value >> 24) & 0xff); + len = 5; + } + } + + if (self->write_func(self, s, len) < 0) + return -1; + + return 0; +} + + +static int +put(Picklerobject *self, PyObject *ob) +{ + if (ob->ob_refcnt < 2 || self->fast) + return 0; + + return put2(self, ob); +} + + +static int +put2(Picklerobject *self, PyObject *ob) +{ + char c_str[30]; + int p; + size_t len; + int res = -1; + PyObject *py_ob_id = 0, *memo_len = 0, *t = 0; + + if (self->fast) + return 0; + + if ((p = PyDict_Size(self->memo)) < 0) + goto finally; + + /* Make sure memo keys are positive! */ + /* XXX Why? + * XXX And does "positive" really mean non-negative? + * XXX pickle.py starts with PUT index 0, not 1. This makes for + * XXX gratuitous differences between the pickling modules. + */ + p++; + + if (!( py_ob_id = PyLong_FromVoidPtr(ob))) + goto finally; + + if (!( memo_len = PyInt_FromLong(p))) + goto finally; + + if (!( t = PyTuple_New(2))) + goto finally; + + PyTuple_SET_ITEM(t, 0, memo_len); + Py_INCREF(memo_len); + PyTuple_SET_ITEM(t, 1, ob); + Py_INCREF(ob); + + if (PyDict_SetItem(self->memo, py_ob_id, t) < 0) + goto finally; + + if (!self->bin) { + c_str[0] = PUT; + PyOS_snprintf(c_str + 1, sizeof(c_str) - 1, "%d\n", p); + len = strlen(c_str); + } + else if (Pdata_Check(self->file)) { + if (write_other(self, NULL, 0) < 0) return -1; + PDATA_APPEND(self->file, memo_len, -1); + res=0; /* Job well done ;) */ + goto finally; + } + else { + if (p >= 256) { + c_str[0] = LONG_BINPUT; + c_str[1] = (int)(p & 0xff); + c_str[2] = (int)((p >> 8) & 0xff); + c_str[3] = (int)((p >> 16) & 0xff); + c_str[4] = (int)((p >> 24) & 0xff); + len = 5; + } + else { + c_str[0] = BINPUT; + c_str[1] = p; + len = 2; + } + } + + if (self->write_func(self, c_str, len) < 0) + goto finally; + + res = 0; + + finally: + Py_XDECREF(py_ob_id); + Py_XDECREF(memo_len); + Py_XDECREF(t); + + return res; +} + +static PyObject * +whichmodule(PyObject *global, PyObject *global_name) +{ + Py_ssize_t i, j; + PyObject *module = 0, *modules_dict = 0, + *global_name_attr = 0, *name = 0; + + module = PyObject_GetAttrString(global, "__module__"); + if (module) + return module; + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + return NULL; + + if (!( modules_dict = PySys_GetObject("modules"))) + return NULL; + + i = 0; + while ((j = PyDict_Next(modules_dict, &i, &name, &module))) { + + if (PyObject_Compare(name, __main___str)==0) continue; + + global_name_attr = PyObject_GetAttr(module, global_name); + if (!global_name_attr) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + return NULL; + continue; + } + + if (global_name_attr != global) { + Py_DECREF(global_name_attr); + continue; + } + + Py_DECREF(global_name_attr); + + break; + } + + /* The following implements the rule in pickle.py added in 1.5 + that used __main__ if no module is found. I don't actually + like this rule. jlf + */ + if (!j) { + j=1; + name=__main___str; + } + + Py_INCREF(name); + return name; +} + + +static int +fast_save_enter(Picklerobject *self, PyObject *obj) +{ + /* if fast_container < 0, we're doing an error exit. */ + if (++self->fast_container >= PY_CPICKLE_FAST_LIMIT) { + PyObject *key = NULL; + if (self->fast_memo == NULL) { + self->fast_memo = PyDict_New(); + if (self->fast_memo == NULL) { + self->fast_container = -1; + return 0; + } + } + key = PyLong_FromVoidPtr(obj); + if (key == NULL) + return 0; + if (PyDict_GetItem(self->fast_memo, key)) { + Py_DECREF(key); + PyErr_Format(PyExc_ValueError, + "fast mode: can't pickle cyclic objects " + "including object type %s at %p", + obj->ob_type->tp_name, obj); + self->fast_container = -1; + return 0; + } + if (PyDict_SetItem(self->fast_memo, key, Py_None) < 0) { + Py_DECREF(key); + self->fast_container = -1; + return 0; + } + Py_DECREF(key); + } + return 1; +} + +int +fast_save_leave(Picklerobject *self, PyObject *obj) +{ + if (self->fast_container-- >= PY_CPICKLE_FAST_LIMIT) { + PyObject *key = PyLong_FromVoidPtr(obj); + if (key == NULL) + return 0; + if (PyDict_DelItem(self->fast_memo, key) < 0) { + Py_DECREF(key); + return 0; + } + Py_DECREF(key); + } + return 1; +} + +static int +save_none(Picklerobject *self, PyObject *args) +{ + static char none = NONE; + if (self->write_func(self, &none, 1) < 0) + return -1; + + return 0; +} + +static int +save_bool(Picklerobject *self, PyObject *args) +{ + static const char *buf[2] = {FALSE, TRUE}; + static char len[2] = {sizeof(FALSE)-1, sizeof(TRUE)-1}; + long l = args == Py_True; + + if (self->proto >= 2) { + char opcode = l ? NEWTRUE : NEWFALSE; + if (self->write_func(self, &opcode, 1) < 0) + return -1; + } + else if (self->write_func(self, buf[l], len[l]) < 0) + return -1; + return 0; +} + +static int +save_int(Picklerobject *self, long l) +{ + char c_str[32]; + int len = 0; + + if (!self->bin +#if SIZEOF_LONG > 4 + || l > 0x7fffffffL + || l < -0x80000000L +#endif + ) { + /* Text-mode pickle, or long too big to fit in the 4-byte + * signed BININT format: store as a string. + */ + c_str[0] = INT; + PyOS_snprintf(c_str + 1, sizeof(c_str) - 1, "%ld\n", l); + if (self->write_func(self, c_str, strlen(c_str)) < 0) + return -1; + } + else { + /* Binary pickle and l fits in a signed 4-byte int. */ + c_str[1] = (int)( l & 0xff); + c_str[2] = (int)((l >> 8) & 0xff); + c_str[3] = (int)((l >> 16) & 0xff); + c_str[4] = (int)((l >> 24) & 0xff); + + if ((c_str[4] == 0) && (c_str[3] == 0)) { + if (c_str[2] == 0) { + c_str[0] = BININT1; + len = 2; + } + else { + c_str[0] = BININT2; + len = 3; + } + } + else { + c_str[0] = BININT; + len = 5; + } + + if (self->write_func(self, c_str, len) < 0) + return -1; + } + + return 0; +} + + +static int +save_long(Picklerobject *self, PyObject *args) +{ + Py_ssize_t size; + int res = -1; + PyObject *repr = NULL; + long val = PyInt_AsLong(args); + static char l = LONG; + + if (val == -1 && PyErr_Occurred()) { + /* out of range for int pickling */ + PyErr_Clear(); + } + else + return save_int(self, val); + + if (self->proto >= 2) { + /* Linear-time pickling. */ + size_t nbits; + size_t nbytes; + unsigned char *pdata; + char c_str[5]; + int i; + int sign = _PyLong_Sign(args); + + if (sign == 0) { + /* It's 0 -- an empty bytestring. */ + c_str[0] = LONG1; + c_str[1] = 0; + i = self->write_func(self, c_str, 2); + if (i < 0) goto finally; + res = 0; + goto finally; + } + nbits = _PyLong_NumBits(args); + if (nbits == (size_t)-1 && PyErr_Occurred()) + goto finally; + /* How many bytes do we need? There are nbits >> 3 full + * bytes of data, and nbits & 7 leftover bits. If there + * are any leftover bits, then we clearly need another + * byte. Wnat's not so obvious is that we *probably* + * need another byte even if there aren't any leftovers: + * the most-significant bit of the most-significant byte + * acts like a sign bit, and it's usually got a sense + * opposite of the one we need. The exception is longs + * of the form -(2**(8*j-1)) for j > 0. Such a long is + * its own 256's-complement, so has the right sign bit + * even without the extra byte. That's a pain to check + * for in advance, though, so we always grab an extra + * byte at the start, and cut it back later if possible. + */ + nbytes = (nbits >> 3) + 1; + if (nbytes > INT_MAX) { + PyErr_SetString(PyExc_OverflowError, "long too large " + "to pickle"); + goto finally; + } + repr = PyString_FromStringAndSize(NULL, (int)nbytes); + if (repr == NULL) goto finally; + pdata = (unsigned char *)PyString_AS_STRING(repr); + i = _PyLong_AsByteArray((PyLongObject *)args, + pdata, nbytes, + 1 /* little endian */, 1 /* signed */); + if (i < 0) goto finally; + /* If the long is negative, this may be a byte more than + * needed. This is so iff the MSB is all redundant sign + * bits. + */ + if (sign < 0 && nbytes > 1 && pdata[nbytes - 1] == 0xff && + (pdata[nbytes - 2] & 0x80) != 0) + --nbytes; + + if (nbytes < 256) { + c_str[0] = LONG1; + c_str[1] = (char)nbytes; + size = 2; + } + else { + c_str[0] = LONG4; + size = (int)nbytes; + for (i = 1; i < 5; i++) { + c_str[i] = (char)(size & 0xff); + size >>= 8; + } + size = 5; + } + i = self->write_func(self, c_str, size); + if (i < 0) goto finally; + i = self->write_func(self, (char *)pdata, (int)nbytes); + if (i < 0) goto finally; + res = 0; + goto finally; + } + + /* proto < 2: write the repr and newline. This is quadratic-time + * (in the number of digits), in both directions. + */ + if (!( repr = PyObject_Repr(args))) + goto finally; + + if ((size = PyString_Size(repr)) < 0) + goto finally; + + if (self->write_func(self, &l, 1) < 0) + goto finally; + + if (self->write_func(self, + PyString_AS_STRING((PyStringObject *)repr), + size) < 0) + goto finally; + + if (self->write_func(self, "\n", 1) < 0) + goto finally; + + res = 0; + + finally: + Py_XDECREF(repr); + return res; +} + + +static int +save_float(Picklerobject *self, PyObject *args) +{ + double x = PyFloat_AS_DOUBLE((PyFloatObject *)args); + + if (self->bin) { + char str[9]; + str[0] = BINFLOAT; + if (_PyFloat_Pack8(x, (unsigned char *)&str[1], 0) < 0) + return -1; + if (self->write_func(self, str, 9) < 0) + return -1; + } + else { + char c_str[250]; + c_str[0] = FLOAT; + PyOS_ascii_formatd(c_str + 1, sizeof(c_str) - 2, "%.17g", x); + /* Extend the formatted string with a newline character */ + strcat(c_str, "\n"); + + if (self->write_func(self, c_str, strlen(c_str)) < 0) + return -1; + } + + return 0; +} + + +static int +save_string(Picklerobject *self, PyObject *args, int doput) +{ + int size, len; + PyObject *repr=0; + + if ((size = PyString_Size(args)) < 0) + return -1; + + if (!self->bin) { + char *repr_str; + + static char string = STRING; + + if (!( repr = PyObject_Repr(args))) + return -1; + + if ((len = PyString_Size(repr)) < 0) + goto err; + repr_str = PyString_AS_STRING((PyStringObject *)repr); + + if (self->write_func(self, &string, 1) < 0) + goto err; + + if (self->write_func(self, repr_str, len) < 0) + goto err; + + if (self->write_func(self, "\n", 1) < 0) + goto err; + + Py_XDECREF(repr); + } + else { + int i; + char c_str[5]; + + if ((size = PyString_Size(args)) < 0) + return -1; + + if (size < 256) { + c_str[0] = SHORT_BINSTRING; + c_str[1] = size; + len = 2; + } + else if (size <= INT_MAX) { + c_str[0] = BINSTRING; + for (i = 1; i < 5; i++) + c_str[i] = (int)(size >> ((i - 1) * 8)); + len = 5; + } + else + return -1; /* string too large */ + + if (self->write_func(self, c_str, len) < 0) + return -1; + + if (size > 128 && Pdata_Check(self->file)) { + if (write_other(self, NULL, 0) < 0) return -1; + PDATA_APPEND(self->file, args, -1); + } + else { + if (self->write_func(self, + PyString_AS_STRING( + (PyStringObject *)args), + size) < 0) + return -1; + } + } + + if (doput) + if (put(self, args) < 0) + return -1; + + return 0; + + err: + Py_XDECREF(repr); + return -1; +} + + +#ifdef Py_USING_UNICODE +/* A copy of PyUnicode_EncodeRawUnicodeEscape() that also translates + backslash and newline characters to \uXXXX escapes. */ +static PyObject * +modified_EncodeRawUnicodeEscape(const Py_UNICODE *s, int size) +{ + PyObject *repr; + char *p; + char *q; + + static const char *hexdigit = "0123456789ABCDEF"; + + repr = PyString_FromStringAndSize(NULL, 6 * size); + if (repr == NULL) + return NULL; + if (size == 0) + return repr; + + p = q = PyString_AS_STRING(repr); + while (size-- > 0) { + Py_UNICODE ch = *s++; + /* Map 16-bit characters to '\uxxxx' */ + if (ch >= 256 || ch == '\\' || ch == '\n') { + *p++ = '\\'; + *p++ = 'u'; + *p++ = hexdigit[(ch >> 12) & 0xf]; + *p++ = hexdigit[(ch >> 8) & 0xf]; + *p++ = hexdigit[(ch >> 4) & 0xf]; + *p++ = hexdigit[ch & 15]; + } + /* Copy everything else as-is */ + else + *p++ = (char) ch; + } + *p = '\0'; + _PyString_Resize(&repr, p - q); + return repr; +} + + +static int +save_unicode(Picklerobject *self, PyObject *args, int doput) +{ + Py_ssize_t size, len; + PyObject *repr=0; + + if (!PyUnicode_Check(args)) + return -1; + + if (!self->bin) { + char *repr_str; + static char string = UNICODE; + + repr = modified_EncodeRawUnicodeEscape( + PyUnicode_AS_UNICODE(args), PyUnicode_GET_SIZE(args)); + if (!repr) + return -1; + + if ((len = PyString_Size(repr)) < 0) + goto err; + repr_str = PyString_AS_STRING((PyStringObject *)repr); + + if (self->write_func(self, &string, 1) < 0) + goto err; + + if (self->write_func(self, repr_str, len) < 0) + goto err; + + if (self->write_func(self, "\n", 1) < 0) + goto err; + + Py_XDECREF(repr); + } + else { + int i; + char c_str[5]; + + if (!( repr = PyUnicode_AsUTF8String(args))) + return -1; + + if ((size = PyString_Size(repr)) < 0) + goto err; + if (size > INT_MAX) + return -1; /* string too large */ + + c_str[0] = BINUNICODE; + for (i = 1; i < 5; i++) + c_str[i] = (int)(size >> ((i - 1) * 8)); + len = 5; + + if (self->write_func(self, c_str, len) < 0) + goto err; + + if (size > 128 && Pdata_Check(self->file)) { + if (write_other(self, NULL, 0) < 0) + goto err; + PDATA_APPEND(self->file, repr, -1); + } + else { + if (self->write_func(self, PyString_AS_STRING(repr), + size) < 0) + goto err; + } + + Py_DECREF(repr); + } + + if (doput) + if (put(self, args) < 0) + return -1; + + return 0; + + err: + Py_XDECREF(repr); + return -1; +} +#endif + +/* A helper for save_tuple. Push the len elements in tuple t on the stack. */ +static int +store_tuple_elements(Picklerobject *self, PyObject *t, int len) +{ + int i; + int res = -1; /* guilty until proved innocent */ + + assert(PyTuple_Size(t) == len); + + for (i = 0; i < len; i++) { + PyObject *element = PyTuple_GET_ITEM(t, i); + + if (element == NULL) + goto finally; + if (save(self, element, 0) < 0) + goto finally; + } + res = 0; + + finally: + return res; +} + +/* Tuples are ubiquitous in the pickle protocols, so many techniques are + * used across protocols to minimize the space needed to pickle them. + * Tuples are also the only builtin immutable type that can be recursive + * (a tuple can be reached from itself), and that requires some subtle + * magic so that it works in all cases. IOW, this is a long routine. + */ +static int +save_tuple(Picklerobject *self, PyObject *args) +{ + PyObject *py_tuple_id = NULL; + int len, i; + int res = -1; + + static char tuple = TUPLE; + static char pop = POP; + static char pop_mark = POP_MARK; + static char len2opcode[] = {EMPTY_TUPLE, TUPLE1, TUPLE2, TUPLE3}; + + if ((len = PyTuple_Size(args)) < 0) + goto finally; + + if (len == 0) { + char c_str[2]; + + if (self->proto) { + c_str[0] = EMPTY_TUPLE; + len = 1; + } + else { + c_str[0] = MARK; + c_str[1] = TUPLE; + len = 2; + } + if (self->write_func(self, c_str, len) >= 0) + res = 0; + /* Don't memoize an empty tuple. */ + goto finally; + } + + /* A non-empty tuple. */ + + /* id(tuple) isn't in the memo now. If it shows up there after + * saving the tuple elements, the tuple must be recursive, in + * which case we'll pop everything we put on the stack, and fetch + * its value from the memo. + */ + py_tuple_id = PyLong_FromVoidPtr(args); + if (py_tuple_id == NULL) + goto finally; + + if (len <= 3 && self->proto >= 2) { + /* Use TUPLE{1,2,3} opcodes. */ + if (store_tuple_elements(self, args, len) < 0) + goto finally; + if (PyDict_GetItem(self->memo, py_tuple_id)) { + /* pop the len elements */ + for (i = 0; i < len; ++i) + if (self->write_func(self, &pop, 1) < 0) + goto finally; + /* fetch from memo */ + if (get(self, py_tuple_id) < 0) + goto finally; + res = 0; + goto finally; + } + /* Not recursive. */ + if (self->write_func(self, len2opcode + len, 1) < 0) + goto finally; + goto memoize; + } + + /* proto < 2 and len > 0, or proto >= 2 and len > 3. + * Generate MARK elt1 elt2 ... TUPLE + */ + if (self->write_func(self, &MARKv, 1) < 0) + goto finally; + + if (store_tuple_elements(self, args, len) < 0) + goto finally; + + if (PyDict_GetItem(self->memo, py_tuple_id)) { + /* pop the stack stuff we pushed */ + if (self->bin) { + if (self->write_func(self, &pop_mark, 1) < 0) + goto finally; + } + else { + /* Note that we pop one more than len, to remove + * the MARK too. + */ + for (i = 0; i <= len; i++) + if (self->write_func(self, &pop, 1) < 0) + goto finally; + } + /* fetch from memo */ + if (get(self, py_tuple_id) >= 0) + res = 0; + goto finally; + } + + /* Not recursive. */ + if (self->write_func(self, &tuple, 1) < 0) + goto finally; + + memoize: + if (put(self, args) >= 0) + res = 0; + + finally: + Py_XDECREF(py_tuple_id); + return res; +} + +/* iter is an iterator giving items, and we batch up chunks of + * MARK item item ... item APPENDS + * opcode sequences. Calling code should have arranged to first create an + * empty list, or list-like object, for the APPENDS to operate on. + * Returns 0 on success, <0 on error. + */ +static int +batch_list(Picklerobject *self, PyObject *iter) +{ + PyObject *obj; + PyObject *slice[BATCHSIZE]; + int i, n; + + static char append = APPEND; + static char appends = APPENDS; + + assert(iter != NULL); + + if (self->proto == 0) { + /* APPENDS isn't available; do one at a time. */ + for (;;) { + obj = PyIter_Next(iter); + if (obj == NULL) { + if (PyErr_Occurred()) + return -1; + break; + } + i = save(self, obj, 0); + Py_DECREF(obj); + if (i < 0) + return -1; + if (self->write_func(self, &append, 1) < 0) + return -1; + } + return 0; + } + + /* proto > 0: write in batches of BATCHSIZE. */ + do { + /* Get next group of (no more than) BATCHSIZE elements. */ + for (n = 0; n < BATCHSIZE; ++n) { + obj = PyIter_Next(iter); + if (obj == NULL) { + if (PyErr_Occurred()) + goto BatchFailed; + break; + } + slice[n] = obj; + } + + if (n > 1) { + /* Pump out MARK, slice[0:n], APPENDS. */ + if (self->write_func(self, &MARKv, 1) < 0) + goto BatchFailed; + for (i = 0; i < n; ++i) { + if (save(self, slice[i], 0) < 0) + goto BatchFailed; + } + if (self->write_func(self, &appends, 1) < 0) + goto BatchFailed; + } + else if (n == 1) { + if (save(self, slice[0], 0) < 0) + goto BatchFailed; + if (self->write_func(self, &append, 1) < 0) + goto BatchFailed; + } + + for (i = 0; i < n; ++i) { + Py_DECREF(slice[i]); + } + } while (n == BATCHSIZE); + return 0; + +BatchFailed: + while (--n >= 0) { + Py_DECREF(slice[n]); + } + return -1; +} + +static int +save_list(Picklerobject *self, PyObject *args) +{ + int res = -1; + char s[3]; + int len; + PyObject *iter; + + if (self->fast && !fast_save_enter(self, args)) + goto finally; + + /* Create an empty list. */ + if (self->bin) { + s[0] = EMPTY_LIST; + len = 1; + } + else { + s[0] = MARK; + s[1] = LIST; + len = 2; + } + + if (self->write_func(self, s, len) < 0) + goto finally; + + /* Get list length, and bow out early if empty. */ + if ((len = PyList_Size(args)) < 0) + goto finally; + + /* Memoize. */ + if (len == 0) { + if (put(self, args) >= 0) + res = 0; + goto finally; + } + if (put2(self, args) < 0) + goto finally; + + /* Materialize the list elements. */ + iter = PyObject_GetIter(args); + if (iter == NULL) + goto finally; + res = batch_list(self, iter); + Py_DECREF(iter); + + finally: + if (self->fast && !fast_save_leave(self, args)) + res = -1; + + return res; +} + + +/* iter is an iterator giving (key, value) pairs, and we batch up chunks of + * MARK key value ... key value SETITEMS + * opcode sequences. Calling code should have arranged to first create an + * empty dict, or dict-like object, for the SETITEMS to operate on. + * Returns 0 on success, <0 on error. + * + * This is very much like batch_list(). The difference between saving + * elements directly, and picking apart two-tuples, is so long-winded at + * the C level, though, that attempts to combine these routines were too + * ugly to bear. + */ +static int +batch_dict(Picklerobject *self, PyObject *iter) +{ + PyObject *p; + PyObject *slice[BATCHSIZE]; + int i, n; + + static char setitem = SETITEM; + static char setitems = SETITEMS; + + assert(iter != NULL); + + if (self->proto == 0) { + /* SETITEMS isn't available; do one at a time. */ + for (;;) { + p = PyIter_Next(iter); + if (p == NULL) { + if (PyErr_Occurred()) + return -1; + break; + } + if (!PyTuple_Check(p) || PyTuple_Size(p) != 2) { + PyErr_SetString(PyExc_TypeError, "dict items " + "iterator must return 2-tuples"); + return -1; + } + i = save(self, PyTuple_GET_ITEM(p, 0), 0); + if (i >= 0) + i = save(self, PyTuple_GET_ITEM(p, 1), 0); + Py_DECREF(p); + if (i < 0) + return -1; + if (self->write_func(self, &setitem, 1) < 0) + return -1; + } + return 0; + } + + /* proto > 0: write in batches of BATCHSIZE. */ + do { + /* Get next group of (no more than) BATCHSIZE elements. */ + for (n = 0; n < BATCHSIZE; ++n) { + p = PyIter_Next(iter); + if (p == NULL) { + if (PyErr_Occurred()) + goto BatchFailed; + break; + } + if (!PyTuple_Check(p) || PyTuple_Size(p) != 2) { + PyErr_SetString(PyExc_TypeError, "dict items " + "iterator must return 2-tuples"); + goto BatchFailed; + } + slice[n] = p; + } + + if (n > 1) { + /* Pump out MARK, slice[0:n], SETITEMS. */ + if (self->write_func(self, &MARKv, 1) < 0) + goto BatchFailed; + for (i = 0; i < n; ++i) { + p = slice[i]; + if (save(self, PyTuple_GET_ITEM(p, 0), 0) < 0) + goto BatchFailed; + if (save(self, PyTuple_GET_ITEM(p, 1), 0) < 0) + goto BatchFailed; + } + if (self->write_func(self, &setitems, 1) < 0) + goto BatchFailed; + } + else if (n == 1) { + p = slice[0]; + if (save(self, PyTuple_GET_ITEM(p, 0), 0) < 0) + goto BatchFailed; + if (save(self, PyTuple_GET_ITEM(p, 1), 0) < 0) + goto BatchFailed; + if (self->write_func(self, &setitem, 1) < 0) + goto BatchFailed; + } + + for (i = 0; i < n; ++i) { + Py_DECREF(slice[i]); + } + } while (n == BATCHSIZE); + return 0; + +BatchFailed: + while (--n >= 0) { + Py_DECREF(slice[n]); + } + return -1; +} + +static int +save_dict(Picklerobject *self, PyObject *args) +{ + int res = -1; + char s[3]; + int len; + PyObject *items, *iter; + + if (self->fast && !fast_save_enter(self, args)) + goto finally; + + /* Create an empty dict. */ + if (self->bin) { + s[0] = EMPTY_DICT; + len = 1; + } + else { + s[0] = MARK; + s[1] = DICT; + len = 2; + } + + if (self->write_func(self, s, len) < 0) + goto finally; + + /* Get dict size, and bow out early if empty. */ + if ((len = PyDict_Size(args)) < 0) + goto finally; + + if (len == 0) { + if (put(self, args) >= 0) + res = 0; + goto finally; + } + if (put2(self, args) < 0) + goto finally; + + /* Materialize the dict items. */ + items = PyObject_CallMethod(args, "items", "()"); + if (items == NULL) + goto finally; + iter = PyObject_GetIter(items); + Py_DECREF(items); + if (iter == NULL) + goto finally; + res = batch_dict(self, iter); + Py_DECREF(iter); + + finally: + if (self->fast && !fast_save_leave(self, args)) + res = -1; + + return res; +} + + +static int +save_global(Picklerobject *self, PyObject *args, PyObject *name) +{ + PyObject *global_name = 0, *module = 0, *mod = 0, *klass = 0; + char *name_str, *module_str; + int module_size, name_size, res = -1; + + static char global = GLOBAL; + + if (name) { + global_name = name; + Py_INCREF(global_name); + } + else { + if (!( global_name = PyObject_GetAttr(args, __name___str))) + goto finally; + } + + if (!( module = whichmodule(args, global_name))) + goto finally; + + if ((module_size = PyString_Size(module)) < 0 || + (name_size = PyString_Size(global_name)) < 0) + goto finally; + + module_str = PyString_AS_STRING((PyStringObject *)module); + name_str = PyString_AS_STRING((PyStringObject *)global_name); + + /* XXX This can be doing a relative import. Clearly it shouldn't, + but I don't know how to stop it. :-( */ + mod = PyImport_ImportModule(module_str); + if (mod == NULL) { + cPickle_ErrFormat(PicklingError, + "Can't pickle %s: import of module %s " + "failed", + "OS", args, module); + goto finally; + } + klass = PyObject_GetAttrString(mod, name_str); + if (klass == NULL) { + cPickle_ErrFormat(PicklingError, + "Can't pickle %s: attribute lookup %s.%s " + "failed", + "OSS", args, module, global_name); + goto finally; + } + if (klass != args) { + Py_DECREF(klass); + cPickle_ErrFormat(PicklingError, + "Can't pickle %s: it's not the same object " + "as %s.%s", + "OSS", args, module, global_name); + goto finally; + } + Py_DECREF(klass); + + if (self->proto >= 2) { + /* See whether this is in the extension registry, and if + * so generate an EXT opcode. + */ + PyObject *py_code; /* extension code as Python object */ + long code; /* extension code as C value */ + char c_str[5]; + int n; + + PyTuple_SET_ITEM(two_tuple, 0, module); + PyTuple_SET_ITEM(two_tuple, 1, global_name); + py_code = PyDict_GetItem(extension_registry, two_tuple); + if (py_code == NULL) + goto gen_global; /* not registered */ + + /* Verify py_code has the right type and value. */ + if (!PyInt_Check(py_code)) { + cPickle_ErrFormat(PicklingError, "Can't pickle %s: " + "extension code %s isn't an integer", + "OO", args, py_code); + goto finally; + } + code = PyInt_AS_LONG(py_code); + if (code <= 0 || code > 0x7fffffffL) { + cPickle_ErrFormat(PicklingError, "Can't pickle %s: " + "extension code %ld is out of range", + "Ol", args, code); + goto finally; + } + + /* Generate an EXT opcode. */ + if (code <= 0xff) { + c_str[0] = EXT1; + c_str[1] = (char)code; + n = 2; + } + else if (code <= 0xffff) { + c_str[0] = EXT2; + c_str[1] = (char)(code & 0xff); + c_str[2] = (char)((code >> 8) & 0xff); + n = 3; + } + else { + c_str[0] = EXT4; + c_str[1] = (char)(code & 0xff); + c_str[2] = (char)((code >> 8) & 0xff); + c_str[3] = (char)((code >> 16) & 0xff); + c_str[4] = (char)((code >> 24) & 0xff); + n = 5; + } + + if (self->write_func(self, c_str, n) >= 0) + res = 0; + goto finally; /* and don't memoize */ + } + + gen_global: + if (self->write_func(self, &global, 1) < 0) + goto finally; + + if (self->write_func(self, module_str, module_size) < 0) + goto finally; + + if (self->write_func(self, "\n", 1) < 0) + goto finally; + + if (self->write_func(self, name_str, name_size) < 0) + goto finally; + + if (self->write_func(self, "\n", 1) < 0) + goto finally; + + if (put(self, args) < 0) + goto finally; + + res = 0; + + finally: + Py_XDECREF(module); + Py_XDECREF(global_name); + Py_XDECREF(mod); + + return res; +} + +static int +save_pers(Picklerobject *self, PyObject *args, PyObject *f) +{ + PyObject *pid = 0; + int size, res = -1; + + static char persid = PERSID, binpersid = BINPERSID; + + Py_INCREF(args); + ARG_TUP(self, args); + if (self->arg) { + pid = PyObject_Call(f, self->arg, NULL); + FREE_ARG_TUP(self); + } + if (! pid) return -1; + + if (pid != Py_None) { + if (!self->bin) { + if (!PyString_Check(pid)) { + PyErr_SetString(PicklingError, + "persistent id must be string"); + goto finally; + } + + if (self->write_func(self, &persid, 1) < 0) + goto finally; + + if ((size = PyString_Size(pid)) < 0) + goto finally; + + if (self->write_func(self, + PyString_AS_STRING( + (PyStringObject *)pid), + size) < 0) + goto finally; + + if (self->write_func(self, "\n", 1) < 0) + goto finally; + + res = 1; + goto finally; + } + else if (save(self, pid, 1) >= 0) { + if (self->write_func(self, &binpersid, 1) < 0) + res = -1; + else + res = 1; + } + + goto finally; + } + + res = 0; + + finally: + Py_XDECREF(pid); + + return res; +} + +/* We're saving ob, and args is the 2-thru-5 tuple returned by the + * appropriate __reduce__ method for ob. + */ +static int +save_reduce(Picklerobject *self, PyObject *args, PyObject *ob) +{ + PyObject *callable; + PyObject *argtup; + PyObject *state = NULL; + PyObject *listitems = NULL; + PyObject *dictitems = NULL; + + int use_newobj = self->proto >= 2; + + static char reduce = REDUCE; + static char build = BUILD; + static char newobj = NEWOBJ; + + if (! PyArg_UnpackTuple(args, "save_reduce", 2, 5, + &callable, + &argtup, + &state, + &listitems, + &dictitems)) + return -1; + + if (!PyTuple_Check(argtup)) { + PyErr_SetString(PicklingError, + "args from reduce() should be a tuple"); + return -1; + } + + if (state == Py_None) + state = NULL; + if (listitems == Py_None) + listitems = NULL; + if (dictitems == Py_None) + dictitems = NULL; + + /* Protocol 2 special case: if callable's name is __newobj__, use + * NEWOBJ. This consumes a lot of code. + */ + if (use_newobj) { + PyObject *temp = PyObject_GetAttr(callable, __name___str); + + if (temp == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + return -1; + use_newobj = 0; + } + else { + use_newobj = PyString_Check(temp) && + strcmp(PyString_AS_STRING(temp), + "__newobj__") == 0; + Py_DECREF(temp); + } + } + if (use_newobj) { + PyObject *cls; + PyObject *newargtup; + int n, i; + + /* Sanity checks. */ + n = PyTuple_Size(argtup); + if (n < 1) { + PyErr_SetString(PicklingError, "__newobj__ arglist " + "is empty"); + return -1; + } + + cls = PyTuple_GET_ITEM(argtup, 0); + if (! PyObject_HasAttrString(cls, "__new__")) { + PyErr_SetString(PicklingError, "args[0] from " + "__newobj__ args has no __new__"); + return -1; + } + + /* XXX How could ob be NULL? */ + if (ob != NULL) { + PyObject *ob_dot_class; + + ob_dot_class = PyObject_GetAttr(ob, __class___str); + if (ob_dot_class == NULL) { + if (PyErr_ExceptionMatches( + PyExc_AttributeError)) + PyErr_Clear(); + else + return -1; + } + i = ob_dot_class != cls; /* true iff a problem */ + Py_XDECREF(ob_dot_class); + if (i) { + PyErr_SetString(PicklingError, "args[0] from " + "__newobj__ args has the wrong class"); + return -1; + } + } + + /* Save the class and its __new__ arguments. */ + if (save(self, cls, 0) < 0) + return -1; + + newargtup = PyTuple_New(n-1); /* argtup[1:] */ + if (newargtup == NULL) + return -1; + for (i = 1; i < n; ++i) { + PyObject *temp = PyTuple_GET_ITEM(argtup, i); + Py_INCREF(temp); + PyTuple_SET_ITEM(newargtup, i-1, temp); + } + i = save(self, newargtup, 0) < 0; + Py_DECREF(newargtup); + if (i < 0) + return -1; + + /* Add NEWOBJ opcode. */ + if (self->write_func(self, &newobj, 1) < 0) + return -1; + } + else { + /* Not using NEWOBJ. */ + if (save(self, callable, 0) < 0 || + save(self, argtup, 0) < 0 || + self->write_func(self, &reduce, 1) < 0) + return -1; + } + + /* Memoize. */ + /* XXX How can ob be NULL? */ + if (ob != NULL) { + if (state && !PyDict_Check(state)) { + if (put2(self, ob) < 0) + return -1; + } + else if (put(self, ob) < 0) + return -1; + } + + + if (listitems && batch_list(self, listitems) < 0) + return -1; + + if (dictitems && batch_dict(self, dictitems) < 0) + return -1; + + if (state) { + if (save(self, state, 0) < 0 || + self->write_func(self, &build, 1) < 0) + return -1; + } + + return 0; +} + +static int +save(Picklerobject *self, PyObject *args, int pers_save) +{ + PyTypeObject *type; + PyObject *py_ob_id = 0, *__reduce__ = 0, *t = 0; + PyObject *arg_tup; + int res = -1; + int tmp, size; + + if (self->nesting++ > Py_GetRecursionLimit()){ + PyErr_SetString(PyExc_RuntimeError, + "maximum recursion depth exceeded"); + goto finally; + } + + if (!pers_save && self->pers_func) { + if ((tmp = save_pers(self, args, self->pers_func)) != 0) { + res = tmp; + goto finally; + } + } + + if (args == Py_None) { + res = save_none(self, args); + goto finally; + } + + type = args->ob_type; + + switch (type->tp_name[0]) { + case 'b': + if (args == Py_False || args == Py_True) { + res = save_bool(self, args); + goto finally; + } + break; + case 'i': + if (type == &PyLong_Type) { + res = save_long(self, args); + goto finally; + } + break; + + case 'f': + if (type == &PyFloat_Type) { + res = save_float(self, args); + goto finally; + } + break; + + case 't': + if (type == &PyTuple_Type && PyTuple_Size(args) == 0) { + res = save_tuple(self, args); + goto finally; + } + break; + + case 's': + if ((type == &PyString_Type) && (PyString_GET_SIZE(args) < 2)) { + res = save_string(self, args, 0); + goto finally; + } + +#ifdef Py_USING_UNICODE + case 'u': + if ((type == &PyUnicode_Type) && (PyString_GET_SIZE(args) < 2)) { + res = save_unicode(self, args, 0); + goto finally; + } +#endif + } + + if (args->ob_refcnt > 1) { + if (!( py_ob_id = PyLong_FromVoidPtr(args))) + goto finally; + + if (PyDict_GetItem(self->memo, py_ob_id)) { + if (get(self, py_ob_id) < 0) + goto finally; + + res = 0; + goto finally; + } + } + + switch (type->tp_name[0]) { + case 's': + if (type == &PyString_Type) { + res = save_string(self, args, 1); + goto finally; + } + break; + +#ifdef Py_USING_UNICODE + case 'u': + if (type == &PyUnicode_Type) { + res = save_unicode(self, args, 1); + goto finally; + } + break; +#endif + + case 't': + if (type == &PyTuple_Type) { + res = save_tuple(self, args); + goto finally; + } + if (type == &PyType_Type) { + res = save_global(self, args, NULL); + goto finally; + } + break; + + case 'l': + if (type == &PyList_Type) { + res = save_list(self, args); + goto finally; + } + break; + + case 'd': + if (type == &PyDict_Type) { + res = save_dict(self, args); + goto finally; + } + break; + + case 'i': + break; + + case 'c': + break; + + case 'f': + if (type == &PyFunction_Type) { + res = save_global(self, args, NULL); + if (res && PyErr_ExceptionMatches(PickleError)) { + /* fall back to reduce */ + PyErr_Clear(); + break; + } + goto finally; + } + break; + + case 'b': + if (type == &PyCFunction_Type) { + res = save_global(self, args, NULL); + goto finally; + } + } + + if (!pers_save && self->inst_pers_func) { + if ((tmp = save_pers(self, args, self->inst_pers_func)) != 0) { + res = tmp; + goto finally; + } + } + + if (PyType_IsSubtype(type, &PyType_Type)) { + res = save_global(self, args, NULL); + goto finally; + } + + /* Get a reduction callable, and call it. This may come from + * copy_reg.dispatch_table, the object's __reduce_ex__ method, + * or the object's __reduce__ method. + */ + __reduce__ = PyDict_GetItem(dispatch_table, (PyObject *)type); + if (__reduce__ != NULL) { + Py_INCREF(__reduce__); + Py_INCREF(args); + ARG_TUP(self, args); + if (self->arg) { + t = PyObject_Call(__reduce__, self->arg, NULL); + FREE_ARG_TUP(self); + } + } + else { + /* Check for a __reduce_ex__ method. */ + __reduce__ = PyObject_GetAttr(args, __reduce_ex___str); + if (__reduce__ != NULL) { + t = PyInt_FromLong(self->proto); + if (t != NULL) { + ARG_TUP(self, t); + t = NULL; + if (self->arg) { + t = PyObject_Call(__reduce__, + self->arg, NULL); + FREE_ARG_TUP(self); + } + } + } + else { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + goto finally; + /* Check for a __reduce__ method. */ + __reduce__ = PyObject_GetAttr(args, __reduce___str); + if (__reduce__ != NULL) { + t = PyObject_Call(__reduce__, + empty_tuple, NULL); + } + else { + PyErr_SetObject(UnpickleableError, args); + goto finally; + } + } + } + + if (t == NULL) + goto finally; + + if (PyString_Check(t)) { + res = save_global(self, args, t); + goto finally; + } + + if (! PyTuple_Check(t)) { + cPickle_ErrFormat(PicklingError, "Value returned by " + "%s must be string or tuple", + "O", __reduce__); + goto finally; + } + + size = PyTuple_Size(t); + if (size < 2 || size > 5) { + cPickle_ErrFormat(PicklingError, "tuple returned by " + "%s must contain 2 through 5 elements", + "O", __reduce__); + goto finally; + } + + arg_tup = PyTuple_GET_ITEM(t, 1); + if (!(PyTuple_Check(arg_tup) || arg_tup == Py_None)) { + cPickle_ErrFormat(PicklingError, "Second element of " + "tuple returned by %s must be a tuple", + "O", __reduce__); + goto finally; + } + + res = save_reduce(self, t, args); + + finally: + self->nesting--; + Py_XDECREF(py_ob_id); + Py_XDECREF(__reduce__); + Py_XDECREF(t); + + return res; +} + + +static int +dump(Picklerobject *self, PyObject *args) +{ + static char stop = STOP; + + if (self->proto >= 2) { + char bytes[2]; + + bytes[0] = PROTO; + assert(self->proto >= 0 && self->proto < 256); + bytes[1] = (char)self->proto; + if (self->write_func(self, bytes, 2) < 0) + return -1; + } + + if (save(self, args, 0) < 0) + return -1; + + if (self->write_func(self, &stop, 1) < 0) + return -1; + + if (self->write_func(self, NULL, 0) < 0) + return -1; + + return 0; +} + +static PyObject * +Pickle_clear_memo(Picklerobject *self, PyObject *args) +{ + if (self->memo) + PyDict_Clear(self->memo); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +Pickle_getvalue(Picklerobject *self, PyObject *args) +{ + int l, i, rsize, ssize, clear=1, lm; + long ik; + PyObject *k, *r; + char *s, *p, *have_get; + Pdata *data; + + /* Can be called by Python code or C code */ + if (args && !PyArg_ParseTuple(args, "|i:getvalue", &clear)) + return NULL; + + /* Check to make sure we are based on a list */ + if (! Pdata_Check(self->file)) { + PyErr_SetString(PicklingError, + "Attempt to getvalue() a non-list-based pickler"); + return NULL; + } + + /* flush write buffer */ + if (write_other(self, NULL, 0) < 0) return NULL; + + data=(Pdata*)self->file; + l=data->length; + + /* set up an array to hold get/put status */ + lm = PyDict_Size(self->memo); + if (lm < 0) return NULL; + lm++; + have_get = malloc(lm); + if (have_get == NULL) return PyErr_NoMemory(); + memset(have_get, 0, lm); + + /* Scan for gets. */ + for (rsize = 0, i = l; --i >= 0; ) { + k = data->data[i]; + + if (PyString_Check(k)) + rsize += PyString_GET_SIZE(k); + + else if (PyInt_Check(k)) { /* put */ + ik = PyInt_AsLong(k); + if (ik == -1 && PyErr_Occurred()) + goto err; + if (ik >= lm || ik == 0) { + PyErr_SetString(PicklingError, + "Invalid get data"); + goto err; + } + if (have_get[ik]) /* with matching get */ + rsize += ik < 256 ? 2 : 5; + } + + else if (! (PyTuple_Check(k) && + PyTuple_GET_SIZE(k) == 2 && + PyInt_Check((k = PyTuple_GET_ITEM(k, 0)))) + ) { + PyErr_SetString(PicklingError, + "Unexpected data in internal list"); + goto err; + } + + else { /* put */ + ik = PyInt_AsLong(k); + if (ik == -1 && PyErr_Occurred()) + goto err; + if (ik >= lm || ik == 0) { + PyErr_SetString(PicklingError, + "Invalid get data"); + return NULL; + } + have_get[ik] = 1; + rsize += ik < 256 ? 2 : 5; + } + } + + /* Now generate the result */ + r = PyString_FromStringAndSize(NULL, rsize); + if (r == NULL) goto err; + s = PyString_AS_STRING((PyStringObject *)r); + + for (i = 0; i < l; i++) { + k = data->data[i]; + + if (PyString_Check(k)) { + ssize = PyString_GET_SIZE(k); + if (ssize) { + p=PyString_AS_STRING((PyStringObject *)k); + while (--ssize >= 0) + *s++ = *p++; + } + } + + else if (PyTuple_Check(k)) { /* get */ + ik = PyLong_AsLong(PyTuple_GET_ITEM(k, 0)); + if (ik == -1 && PyErr_Occurred()) + goto err; + if (ik < 256) { + *s++ = BINGET; + *s++ = (int)(ik & 0xff); + } + else { + *s++ = LONG_BINGET; + *s++ = (int)(ik & 0xff); + *s++ = (int)((ik >> 8) & 0xff); + *s++ = (int)((ik >> 16) & 0xff); + *s++ = (int)((ik >> 24) & 0xff); + } + } + + else { /* put */ + ik = PyLong_AsLong(k); + if (ik == -1 && PyErr_Occurred()) + goto err; + + if (have_get[ik]) { /* with matching get */ + if (ik < 256) { + *s++ = BINPUT; + *s++ = (int)(ik & 0xff); + } + else { + *s++ = LONG_BINPUT; + *s++ = (int)(ik & 0xff); + *s++ = (int)((ik >> 8) & 0xff); + *s++ = (int)((ik >> 16) & 0xff); + *s++ = (int)((ik >> 24) & 0xff); + } + } + } + } + + if (clear) { + PyDict_Clear(self->memo); + Pdata_clear(data, 0); + } + + free(have_get); + return r; + err: + free(have_get); + return NULL; +} + +static PyObject * +Pickler_dump(Picklerobject *self, PyObject *args) +{ + PyObject *ob; + int get=0; + + if (!( PyArg_ParseTuple(args, "O|i:dump", &ob, &get))) + return NULL; + + if (dump(self, ob) < 0) + return NULL; + + if (get) return Pickle_getvalue(self, NULL); + + /* XXX Why does dump() return self? */ + Py_INCREF(self); + return (PyObject*)self; +} + + +static struct PyMethodDef Pickler_methods[] = +{ + {"dump", (PyCFunction)Pickler_dump, METH_VARARGS, + PyDoc_STR("dump(object) -- " + "Write an object in pickle format to the object's pickle stream")}, + {"clear_memo", (PyCFunction)Pickle_clear_memo, METH_NOARGS, + PyDoc_STR("clear_memo() -- Clear the picklers memo")}, + {"getvalue", (PyCFunction)Pickle_getvalue, METH_VARARGS, + PyDoc_STR("getvalue() -- Finish picking a list-based pickle")}, + {NULL, NULL} /* sentinel */ +}; + + +static Picklerobject * +newPicklerobject(PyObject *file, int proto) +{ + Picklerobject *self; + + if (proto < 0) + proto = HIGHEST_PROTOCOL; + if (proto > HIGHEST_PROTOCOL) { + PyErr_Format(PyExc_ValueError, "pickle protocol %d asked for; " + "the highest available protocol is %d", + proto, HIGHEST_PROTOCOL); + return NULL; + } + + self = PyObject_GC_New(Picklerobject, &Picklertype); + if (self == NULL) + return NULL; + self->proto = proto; + self->bin = proto > 0; + self->fp = NULL; + self->write = NULL; + self->memo = NULL; + self->arg = NULL; + self->pers_func = NULL; + self->inst_pers_func = NULL; + self->write_buf = NULL; + self->fast = 0; + self->nesting = 0; + self->fast_container = 0; + self->fast_memo = NULL; + self->buf_size = 0; + self->dispatch_table = NULL; + + self->file = NULL; + if (file) + Py_INCREF(file); + else { + file = Pdata_New(); + if (file == NULL) + goto err; + } + self->file = file; + + if (!( self->memo = PyDict_New())) + goto err; + + if (PyFile_Check(file)) { + self->fp = PyFile_AsFile(file); + if (self->fp == NULL) { + PyErr_SetString(PyExc_ValueError, + "I/O operation on closed file"); + goto err; + } + self->write_func = write_file; + } + else if (PycStringIO_OutputCheck(file)) { + self->write_func = write_cStringIO; + } + else if (file == Py_None) { + self->write_func = write_none; + } + else { + self->write_func = write_other; + + if (! Pdata_Check(file)) { + self->write = PyObject_GetAttr(file, write_str); + if (!self->write) { + PyErr_Clear(); + PyErr_SetString(PyExc_TypeError, + "argument must have 'write' " + "attribute"); + goto err; + } + } + + self->write_buf = (char *)PyMem_Malloc(WRITE_BUF_SIZE); + if (self->write_buf == NULL) { + PyErr_NoMemory(); + goto err; + } + } + + self->dispatch_table = dispatch_table; + Py_INCREF(dispatch_table); + PyObject_GC_Track(self); + + return self; + + err: + Py_DECREF(self); + return NULL; +} + + +static PyObject * +get_Pickler(PyObject *self, PyObject *args, PyObject *kwds) +{ + static char *kwlist[] = {"file", "protocol", NULL}; + PyObject *file = NULL; + int proto = 0; + + /* XXX + * The documented signature is Pickler(file, protocol=0), but this + * accepts Pickler() and Pickler(integer) too. The meaning then + * is clear as mud, undocumented, and not supported by pickle.py. + * I'm told Zope uses this, but I haven't traced into this code + * far enough to figure out what it means. + */ + if (!PyArg_ParseTuple(args, "|i:Pickler", &proto)) { + PyErr_Clear(); + proto = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|i:Pickler", + kwlist, &file, &proto)) + return NULL; + } + return (PyObject *)newPicklerobject(file, proto); +} + + +static void +Pickler_dealloc(Picklerobject *self) +{ + PyObject_GC_UnTrack(self); + Py_XDECREF(self->write); + Py_XDECREF(self->memo); + Py_XDECREF(self->fast_memo); + Py_XDECREF(self->arg); + Py_XDECREF(self->file); + Py_XDECREF(self->pers_func); + Py_XDECREF(self->inst_pers_func); + Py_XDECREF(self->dispatch_table); + PyMem_Free(self->write_buf); + self->ob_type->tp_free((PyObject *)self); +} + +static int +Pickler_traverse(Picklerobject *self, visitproc visit, void *arg) +{ + Py_VISIT(self->write); + Py_VISIT(self->memo); + Py_VISIT(self->fast_memo); + Py_VISIT(self->arg); + Py_VISIT(self->file); + Py_VISIT(self->pers_func); + Py_VISIT(self->inst_pers_func); + Py_VISIT(self->dispatch_table); + return 0; +} + +static int +Pickler_clear(Picklerobject *self) +{ + Py_CLEAR(self->write); + Py_CLEAR(self->memo); + Py_CLEAR(self->fast_memo); + Py_CLEAR(self->arg); + Py_CLEAR(self->file); + Py_CLEAR(self->pers_func); + Py_CLEAR(self->inst_pers_func); + Py_CLEAR(self->dispatch_table); + return 0; +} + +static PyObject * +Pickler_get_pers_func(Picklerobject *p) +{ + if (p->pers_func == NULL) + PyErr_SetString(PyExc_AttributeError, "persistent_id"); + else + Py_INCREF(p->pers_func); + return p->pers_func; +} + +static int +Pickler_set_pers_func(Picklerobject *p, PyObject *v) +{ + if (v == NULL) { + PyErr_SetString(PyExc_TypeError, + "attribute deletion is not supported"); + return -1; + } + Py_XDECREF(p->pers_func); + Py_INCREF(v); + p->pers_func = v; + return 0; +} + +static int +Pickler_set_inst_pers_func(Picklerobject *p, PyObject *v) +{ + if (v == NULL) { + PyErr_SetString(PyExc_TypeError, + "attribute deletion is not supported"); + return -1; + } + Py_XDECREF(p->inst_pers_func); + Py_INCREF(v); + p->inst_pers_func = v; + return 0; +} + +static PyObject * +Pickler_get_memo(Picklerobject *p) +{ + if (p->memo == NULL) + PyErr_SetString(PyExc_AttributeError, "memo"); + else + Py_INCREF(p->memo); + return p->memo; +} + +static int +Pickler_set_memo(Picklerobject *p, PyObject *v) +{ + if (v == NULL) { + PyErr_SetString(PyExc_TypeError, + "attribute deletion is not supported"); + return -1; + } + if (!PyDict_Check(v)) { + PyErr_SetString(PyExc_TypeError, "memo must be a dictionary"); + return -1; + } + Py_XDECREF(p->memo); + Py_INCREF(v); + p->memo = v; + return 0; +} + +static PyObject * +Pickler_get_error(Picklerobject *p) +{ + /* why is this an attribute on the Pickler? */ + Py_INCREF(PicklingError); + return PicklingError; +} + +static PyMemberDef Pickler_members[] = { + {"binary", T_INT, offsetof(Picklerobject, bin)}, + {"fast", T_INT, offsetof(Picklerobject, fast)}, + {NULL} +}; + +static PyGetSetDef Pickler_getsets[] = { + {"persistent_id", (getter)Pickler_get_pers_func, + (setter)Pickler_set_pers_func}, + {"inst_persistent_id", NULL, (setter)Pickler_set_inst_pers_func}, + {"memo", (getter)Pickler_get_memo, (setter)Pickler_set_memo}, + {"PicklingError", (getter)Pickler_get_error, NULL}, + {NULL} +}; + +PyDoc_STRVAR(Picklertype__doc__, +"Objects that know how to pickle objects\n"); + +static PyTypeObject Picklertype = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "cPickle.Pickler", /*tp_name*/ + sizeof(Picklerobject), /*tp_basicsize*/ + 0, + (destructor)Pickler_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + PyObject_GenericSetAttr, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + Picklertype__doc__, /* tp_doc */ + (traverseproc)Pickler_traverse, /* tp_traverse */ + (inquiry)Pickler_clear, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + Pickler_methods, /* tp_methods */ + Pickler_members, /* tp_members */ + Pickler_getsets, /* tp_getset */ +}; + +static PyObject * +find_class(PyObject *py_module_name, PyObject *py_global_name, PyObject *fc) +{ + PyObject *global = 0, *module; + + if (fc) { + if (fc==Py_None) { + PyErr_SetString(UnpicklingError, "Global and instance " + "pickles are not supported."); + return NULL; + } + return PyObject_CallFunctionObjArgs(fc, py_module_name, + py_global_name, NULL); + } + + module = PySys_GetObject("modules"); + if (module == NULL) + return NULL; + + module = PyDict_GetItem(module, py_module_name); + if (module == NULL) { + module = PyImport_Import(py_module_name); + if (!module) + return NULL; + global = PyObject_GetAttr(module, py_global_name); + Py_DECREF(module); + } + else + global = PyObject_GetAttr(module, py_global_name); + return global; +} + +static int +marker(Unpicklerobject *self) +{ + if (self->num_marks < 1) { + PyErr_SetString(UnpicklingError, "could not find MARK"); + return -1; + } + + return self->marks[--self->num_marks]; +} + + +static int +load_none(Unpicklerobject *self) +{ + PDATA_APPEND(self->stack, Py_None, -1); + return 0; +} + +static int +bad_readline(void) +{ + PyErr_SetString(UnpicklingError, "pickle data was truncated"); + return -1; +} + +static int +load_int(Unpicklerobject *self) +{ + PyObject *py_int = 0; + char *endptr, *s; + int len, res = -1; + long l; + + if ((len = self->readline_func(self, &s)) < 0) return -1; + if (len < 2) return bad_readline(); + if (!( s=pystrndup(s,len))) return -1; + + errno = 0; + l = strtol(s, &endptr, 0); + + if (errno || (*endptr != '\n') || (endptr[1] != '\0')) { + /* Hm, maybe we've got something long. Let's try reading + it as a Python long object. */ + errno = 0; + py_int = PyLong_FromString(s, NULL, 0); + if (py_int == NULL) { + PyErr_SetString(PyExc_ValueError, + "could not convert string to int"); + goto finally; + } + } + else { + if (len == 3 && (l == 0 || l == 1)) { + if (!( py_int = PyBool_FromLong(l))) goto finally; + } + else { + if (!( py_int = PyInt_FromLong(l))) goto finally; + } + } + + free(s); + PDATA_PUSH(self->stack, py_int, -1); + return 0; + + finally: + free(s); + + return res; +} + +static int +load_bool(Unpicklerobject *self, PyObject *boolean) +{ + assert(boolean == Py_True || boolean == Py_False); + PDATA_APPEND(self->stack, boolean, -1); + return 0; +} + +/* s contains x bytes of a little-endian integer. Return its value as a + * C int. Obscure: when x is 1 or 2, this is an unsigned little-endian + * int, but when x is 4 it's a signed one. This is an historical source + * of x-platform bugs. + */ +static long +calc_binint(char *s, int x) +{ + unsigned char c; + int i; + long l; + + for (i = 0, l = 0L; i < x; i++) { + c = (unsigned char)s[i]; + l |= (long)c << (i * 8); + } +#if SIZEOF_LONG > 4 + /* Unlike BININT1 and BININT2, BININT (more accurately BININT4) + * is signed, so on a box with longs bigger than 4 bytes we need + * to extend a BININT's sign bit to the full width. + */ + if (x == 4 && l & (1L << 31)) + l |= (~0L) << 32; +#endif + return l; +} + + +static int +load_binintx(Unpicklerobject *self, char *s, int x) +{ + PyObject *py_int = 0; + long l; + + l = calc_binint(s, x); + + if (!( py_int = PyInt_FromLong(l))) + return -1; + + PDATA_PUSH(self->stack, py_int, -1); + return 0; +} + + +static int +load_binint(Unpicklerobject *self) +{ + char *s; + + if (self->read_func(self, &s, 4) < 0) + return -1; + + return load_binintx(self, s, 4); +} + + +static int +load_binint1(Unpicklerobject *self) +{ + char *s; + + if (self->read_func(self, &s, 1) < 0) + return -1; + + return load_binintx(self, s, 1); +} + + +static int +load_binint2(Unpicklerobject *self) +{ + char *s; + + if (self->read_func(self, &s, 2) < 0) + return -1; + + return load_binintx(self, s, 2); +} + +static int +load_long(Unpicklerobject *self) +{ + PyObject *l = 0; + char *end, *s; + int len, res = -1; + + if ((len = self->readline_func(self, &s)) < 0) return -1; + if (len < 2) return bad_readline(); + if (!( s=pystrndup(s,len))) return -1; + + if (!( l = PyLong_FromString(s, &end, 0))) + goto finally; + + free(s); + PDATA_PUSH(self->stack, l, -1); + return 0; + + finally: + free(s); + + return res; +} + +/* 'size' bytes contain the # of bytes of little-endian 256's-complement + * data following. + */ +static int +load_counted_long(Unpicklerobject *self, int size) +{ + Py_ssize_t i; + char *nbytes; + unsigned char *pdata; + PyObject *along; + + assert(size == 1 || size == 4); + i = self->read_func(self, &nbytes, size); + if (i < 0) return -1; + + size = calc_binint(nbytes, size); + if (size < 0) { + /* Corrupt or hostile pickle -- we never write one like + * this. + */ + PyErr_SetString(UnpicklingError, "LONG pickle has negative " + "byte count"); + return -1; + } + + if (size == 0) + along = PyLong_FromLong(0L); + else { + /* Read the raw little-endian bytes & convert. */ + i = self->read_func(self, (char **)&pdata, size); + if (i < 0) return -1; + along = _PyLong_FromByteArray(pdata, (size_t)size, + 1 /* little endian */, 1 /* signed */); + } + if (along == NULL) + return -1; + PDATA_PUSH(self->stack, along, -1); + return 0; +} + +static int +load_float(Unpicklerobject *self) +{ + PyObject *py_float = 0; + char *endptr, *s; + int len, res = -1; + double d; + + if ((len = self->readline_func(self, &s)) < 0) return -1; + if (len < 2) return bad_readline(); + if (!( s=pystrndup(s,len))) return -1; + + errno = 0; + d = PyOS_ascii_strtod(s, &endptr); + + if (errno || (endptr[0] != '\n') || (endptr[1] != '\0')) { + PyErr_SetString(PyExc_ValueError, + "could not convert string to float"); + goto finally; + } + + if (!( py_float = PyFloat_FromDouble(d))) + goto finally; + + free(s); + PDATA_PUSH(self->stack, py_float, -1); + return 0; + + finally: + free(s); + + return res; +} + +static int +load_binfloat(Unpicklerobject *self) +{ + PyObject *py_float; + double x; + char *p; + + if (self->read_func(self, &p, 8) < 0) + return -1; + + x = _PyFloat_Unpack8((unsigned char *)p, 0); + if (x == -1.0 && PyErr_Occurred()) + return -1; + + py_float = PyFloat_FromDouble(x); + if (py_float == NULL) + return -1; + + PDATA_PUSH(self->stack, py_float, -1); + return 0; +} + +static int +load_string(Unpicklerobject *self) +{ + PyObject *str = 0; + int len, res = -1; + char *s, *p; + + if ((len = self->readline_func(self, &s)) < 0) return -1; + if (len < 2) return bad_readline(); + if (!( s=pystrndup(s,len))) return -1; + + + /* Strip outermost quotes */ + while (s[len-1] <= ' ') + len--; + if(s[0]=='"' && s[len-1]=='"'){ + s[len-1] = '\0'; + p = s + 1 ; + len -= 2; + } else if(s[0]=='\'' && s[len-1]=='\''){ + s[len-1] = '\0'; + p = s + 1 ; + len -= 2; + } else + goto insecure; + /********************************************/ + + str = PyString_DecodeEscape(p, len, NULL, 0, NULL); + free(s); + if (str) { + PDATA_PUSH(self->stack, str, -1); + res = 0; + } + return res; + + insecure: + free(s); + PyErr_SetString(PyExc_ValueError,"insecure string pickle"); + return -1; +} + + +static int +load_binstring(Unpicklerobject *self) +{ + PyObject *py_string = 0; + long l; + char *s; + + if (self->read_func(self, &s, 4) < 0) return -1; + + l = calc_binint(s, 4); + + if (self->read_func(self, &s, l) < 0) + return -1; + + if (!( py_string = PyString_FromStringAndSize(s, l))) + return -1; + + PDATA_PUSH(self->stack, py_string, -1); + return 0; +} + + +static int +load_short_binstring(Unpicklerobject *self) +{ + PyObject *py_string = 0; + unsigned char l; + char *s; + + if (self->read_func(self, &s, 1) < 0) + return -1; + + l = (unsigned char)s[0]; + + if (self->read_func(self, &s, l) < 0) return -1; + + if (!( py_string = PyString_FromStringAndSize(s, l))) return -1; + + PDATA_PUSH(self->stack, py_string, -1); + return 0; +} + + +#ifdef Py_USING_UNICODE +static int +load_unicode(Unpicklerobject *self) +{ + PyObject *str = 0; + int len, res = -1; + char *s; + + if ((len = self->readline_func(self, &s)) < 0) return -1; + if (len < 1) return bad_readline(); + + if (!( str = PyUnicode_DecodeRawUnicodeEscape(s, len - 1, NULL))) + goto finally; + + PDATA_PUSH(self->stack, str, -1); + return 0; + + finally: + return res; +} +#endif + + +#ifdef Py_USING_UNICODE +static int +load_binunicode(Unpicklerobject *self) +{ + PyObject *unicode; + long l; + char *s; + + if (self->read_func(self, &s, 4) < 0) return -1; + + l = calc_binint(s, 4); + + if (self->read_func(self, &s, l) < 0) + return -1; + + if (!( unicode = PyUnicode_DecodeUTF8(s, l, NULL))) + return -1; + + PDATA_PUSH(self->stack, unicode, -1); + return 0; +} +#endif + + +static int +load_tuple(Unpicklerobject *self) +{ + PyObject *tup; + int i; + + if ((i = marker(self)) < 0) return -1; + if (!( tup=Pdata_popTuple(self->stack, i))) return -1; + PDATA_PUSH(self->stack, tup, -1); + return 0; +} + +static int +load_counted_tuple(Unpicklerobject *self, int len) +{ + PyObject *tup = PyTuple_New(len); + + if (tup == NULL) + return -1; + + while (--len >= 0) { + PyObject *element; + + PDATA_POP(self->stack, element); + if (element == NULL) + return -1; + PyTuple_SET_ITEM(tup, len, element); + } + PDATA_PUSH(self->stack, tup, -1); + return 0; +} + +static int +load_empty_list(Unpicklerobject *self) +{ + PyObject *list; + + if (!( list=PyList_New(0))) return -1; + PDATA_PUSH(self->stack, list, -1); + return 0; +} + +static int +load_empty_dict(Unpicklerobject *self) +{ + PyObject *dict; + + if (!( dict=PyDict_New())) return -1; + PDATA_PUSH(self->stack, dict, -1); + return 0; +} + + +static int +load_list(Unpicklerobject *self) +{ + PyObject *list = 0; + int i; + + if ((i = marker(self)) < 0) return -1; + if (!( list=Pdata_popList(self->stack, i))) return -1; + PDATA_PUSH(self->stack, list, -1); + return 0; +} + +static int +load_dict(Unpicklerobject *self) +{ + PyObject *dict, *key, *value; + int i, j, k; + + if ((i = marker(self)) < 0) return -1; + j=self->stack->length; + + if (!( dict = PyDict_New())) return -1; + + for (k = i+1; k < j; k += 2) { + key =self->stack->data[k-1]; + value=self->stack->data[k ]; + if (PyDict_SetItem(dict, key, value) < 0) { + Py_DECREF(dict); + return -1; + } + } + Pdata_clear(self->stack, i); + PDATA_PUSH(self->stack, dict, -1); + return 0; +} + +static PyObject * +Instance_New(PyObject *cls, PyObject *args) +{ + PyObject *r = 0; + + if ((r=PyObject_CallObject(cls, args))) return r; + + { + PyObject *tp, *v, *tb, *tmp_value; + + PyErr_Fetch(&tp, &v, &tb); + tmp_value = v; + /* NULL occurs when there was a KeyboardInterrupt */ + if (tmp_value == NULL) + tmp_value = Py_None; + if ((r = PyTuple_Pack(3, tmp_value, cls, args))) { + Py_XDECREF(v); + v=r; + } + PyErr_Restore(tp,v,tb); + } + return NULL; +} + + +static int +load_obj(Unpicklerobject *self) +{ + PyObject *class, *tup, *obj=0; + int i; + + if ((i = marker(self)) < 0) return -1; + if (!( tup=Pdata_popTuple(self->stack, i+1))) return -1; + PDATA_POP(self->stack, class); + if (class) { + obj = Instance_New(class, tup); + Py_DECREF(class); + } + Py_DECREF(tup); + + if (! obj) return -1; + PDATA_PUSH(self->stack, obj, -1); + return 0; +} + + +static int +load_inst(Unpicklerobject *self) +{ + PyObject *tup, *class=0, *obj=0, *module_name, *class_name; + int i, len; + char *s; + + if ((i = marker(self)) < 0) return -1; + + if ((len = self->readline_func(self, &s)) < 0) return -1; + if (len < 2) return bad_readline(); + module_name = PyString_FromStringAndSize(s, len - 1); + if (!module_name) return -1; + + if ((len = self->readline_func(self, &s)) >= 0) { + if (len < 2) return bad_readline(); + if ((class_name = PyString_FromStringAndSize(s, len - 1))) { + class = find_class(module_name, class_name, + self->find_class); + Py_DECREF(class_name); + } + } + Py_DECREF(module_name); + + if (! class) return -1; + + if ((tup=Pdata_popTuple(self->stack, i))) { + obj = Instance_New(class, tup); + Py_DECREF(tup); + } + Py_DECREF(class); + + if (! obj) return -1; + + PDATA_PUSH(self->stack, obj, -1); + return 0; +} + +static int +load_newobj(Unpicklerobject *self) +{ + PyObject *args = NULL; + PyObject *clsraw = NULL; + PyTypeObject *cls; /* clsraw cast to its true type */ + PyObject *obj; + + /* Stack is ... cls argtuple, and we want to call + * cls.__new__(cls, *argtuple). + */ + PDATA_POP(self->stack, args); + if (args == NULL) goto Fail; + if (! PyTuple_Check(args)) { + PyErr_SetString(UnpicklingError, "NEWOBJ expected an arg " + "tuple."); + goto Fail; + } + + PDATA_POP(self->stack, clsraw); + cls = (PyTypeObject *)clsraw; + if (cls == NULL) goto Fail; + if (! PyType_Check(cls)) { + PyErr_SetString(UnpicklingError, "NEWOBJ class argument " + "isn't a type object"); + goto Fail; + } + if (cls->tp_new == NULL) { + PyErr_SetString(UnpicklingError, "NEWOBJ class argument " + "has NULL tp_new"); + goto Fail; + } + + /* Call __new__. */ + obj = cls->tp_new(cls, args, NULL); + if (obj == NULL) goto Fail; + + Py_DECREF(args); + Py_DECREF(clsraw); + PDATA_PUSH(self->stack, obj, -1); + return 0; + + Fail: + Py_XDECREF(args); + Py_XDECREF(clsraw); + return -1; +} + +static int +load_global(Unpicklerobject *self) +{ + PyObject *class = 0, *module_name = 0, *class_name = 0; + int len; + char *s; + + if ((len = self->readline_func(self, &s)) < 0) return -1; + if (len < 2) return bad_readline(); + module_name = PyString_FromStringAndSize(s, len - 1); + if (!module_name) return -1; + + if ((len = self->readline_func(self, &s)) >= 0) { + if (len < 2) { + Py_DECREF(module_name); + return bad_readline(); + } + if ((class_name = PyString_FromStringAndSize(s, len - 1))) { + class = find_class(module_name, class_name, + self->find_class); + Py_DECREF(class_name); + } + } + Py_DECREF(module_name); + + if (! class) return -1; + PDATA_PUSH(self->stack, class, -1); + return 0; +} + + +static int +load_persid(Unpicklerobject *self) +{ + PyObject *pid = 0; + int len; + char *s; + + if (self->pers_func) { + if ((len = self->readline_func(self, &s)) < 0) return -1; + if (len < 2) return bad_readline(); + + pid = PyString_FromStringAndSize(s, len - 1); + if (!pid) return -1; + + if (PyList_Check(self->pers_func)) { + if (PyList_Append(self->pers_func, pid) < 0) { + Py_DECREF(pid); + return -1; + } + } + else { + ARG_TUP(self, pid); + if (self->arg) { + pid = PyObject_Call(self->pers_func, self->arg, + NULL); + FREE_ARG_TUP(self); + } + } + + if (! pid) return -1; + + PDATA_PUSH(self->stack, pid, -1); + return 0; + } + else { + PyErr_SetString(UnpicklingError, + "A load persistent id instruction was encountered,\n" + "but no persistent_load function was specified."); + return -1; + } +} + +static int +load_binpersid(Unpicklerobject *self) +{ + PyObject *pid = 0; + + if (self->pers_func) { + PDATA_POP(self->stack, pid); + if (! pid) return -1; + + if (PyList_Check(self->pers_func)) { + if (PyList_Append(self->pers_func, pid) < 0) { + Py_DECREF(pid); + return -1; + } + } + else { + ARG_TUP(self, pid); + if (self->arg) { + pid = PyObject_Call(self->pers_func, self->arg, + NULL); + FREE_ARG_TUP(self); + } + if (! pid) return -1; + } + + PDATA_PUSH(self->stack, pid, -1); + return 0; + } + else { + PyErr_SetString(UnpicklingError, + "A load persistent id instruction was encountered,\n" + "but no persistent_load function was specified."); + return -1; + } +} + + +static int +load_pop(Unpicklerobject *self) +{ + int len; + + if (!( (len=self->stack->length) > 0 )) return stackUnderflow(); + + /* Note that we split the (pickle.py) stack into two stacks, + an object stack and a mark stack. We have to be clever and + pop the right one. We do this by looking at the top of the + mark stack. + */ + + if ((self->num_marks > 0) && + (self->marks[self->num_marks - 1] == len)) + self->num_marks--; + else { + len--; + Py_DECREF(self->stack->data[len]); + self->stack->length=len; + } + + return 0; +} + + +static int +load_pop_mark(Unpicklerobject *self) +{ + int i; + + if ((i = marker(self)) < 0) + return -1; + + Pdata_clear(self->stack, i); + + return 0; +} + + +static int +load_dup(Unpicklerobject *self) +{ + PyObject *last; + int len; + + if ((len = self->stack->length) <= 0) return stackUnderflow(); + last=self->stack->data[len-1]; + Py_INCREF(last); + PDATA_PUSH(self->stack, last, -1); + return 0; +} + + +static int +load_get(Unpicklerobject *self) +{ + PyObject *py_str = 0, *value = 0; + int len; + char *s; + int rc; + + if ((len = self->readline_func(self, &s)) < 0) return -1; + if (len < 2) return bad_readline(); + + if (!( py_str = PyString_FromStringAndSize(s, len - 1))) return -1; + + value = PyDict_GetItem(self->memo, py_str); + if (! value) { + PyErr_SetObject(BadPickleGet, py_str); + rc = -1; + } + else { + PDATA_APPEND(self->stack, value, -1); + rc = 0; + } + + Py_DECREF(py_str); + return rc; +} + + +static int +load_binget(Unpicklerobject *self) +{ + PyObject *py_key = 0, *value = 0; + unsigned char key; + char *s; + int rc; + + if (self->read_func(self, &s, 1) < 0) return -1; + + key = (unsigned char)s[0]; + if (!( py_key = PyInt_FromLong((long)key))) return -1; + + value = PyDict_GetItem(self->memo, py_key); + if (! value) { + PyErr_SetObject(BadPickleGet, py_key); + rc = -1; + } + else { + PDATA_APPEND(self->stack, value, -1); + rc = 0; + } + + Py_DECREF(py_key); + return rc; +} + + +static int +load_long_binget(Unpicklerobject *self) +{ + PyObject *py_key = 0, *value = 0; + unsigned char c; + char *s; + long key; + int rc; + + if (self->read_func(self, &s, 4) < 0) return -1; + + c = (unsigned char)s[0]; + key = (long)c; + c = (unsigned char)s[1]; + key |= (long)c << 8; + c = (unsigned char)s[2]; + key |= (long)c << 16; + c = (unsigned char)s[3]; + key |= (long)c << 24; + + if (!( py_key = PyInt_FromLong((long)key))) return -1; + + value = PyDict_GetItem(self->memo, py_key); + if (! value) { + PyErr_SetObject(BadPickleGet, py_key); + rc = -1; + } + else { + PDATA_APPEND(self->stack, value, -1); + rc = 0; + } + + Py_DECREF(py_key); + return rc; +} + +/* Push an object from the extension registry (EXT[124]). nbytes is + * the number of bytes following the opcode, holding the index (code) value. + */ +static int +load_extension(Unpicklerobject *self, int nbytes) +{ + char *codebytes; /* the nbytes bytes after the opcode */ + long code; /* calc_binint returns long */ + PyObject *py_code; /* code as a Python int */ + PyObject *obj; /* the object to push */ + PyObject *pair; /* (module_name, class_name) */ + PyObject *module_name, *class_name; + + assert(nbytes == 1 || nbytes == 2 || nbytes == 4); + if (self->read_func(self, &codebytes, nbytes) < 0) return -1; + code = calc_binint(codebytes, nbytes); + if (code <= 0) { /* note that 0 is forbidden */ + /* Corrupt or hostile pickle. */ + PyErr_SetString(UnpicklingError, "EXT specifies code <= 0"); + return -1; + } + + /* Look for the code in the cache. */ + py_code = PyInt_FromLong(code); + if (py_code == NULL) return -1; + obj = PyDict_GetItem(extension_cache, py_code); + if (obj != NULL) { + /* Bingo. */ + Py_DECREF(py_code); + PDATA_APPEND(self->stack, obj, -1); + return 0; + } + + /* Look up the (module_name, class_name) pair. */ + pair = PyDict_GetItem(inverted_registry, py_code); + if (pair == NULL) { + Py_DECREF(py_code); + PyErr_Format(PyExc_ValueError, "unregistered extension " + "code %ld", code); + return -1; + } + /* Since the extension registry is manipulable via Python code, + * confirm that pair is really a 2-tuple of strings. + */ + if (!PyTuple_Check(pair) || PyTuple_Size(pair) != 2 || + !PyString_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || + !PyString_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { + Py_DECREF(py_code); + PyErr_Format(PyExc_ValueError, "_inverted_registry[%ld] " + "isn't a 2-tuple of strings", code); + return -1; + } + /* Load the object. */ + obj = find_class(module_name, class_name, self->find_class); + if (obj == NULL) { + Py_DECREF(py_code); + return -1; + } + /* Cache code -> obj. */ + code = PyDict_SetItem(extension_cache, py_code, obj); + Py_DECREF(py_code); + if (code < 0) { + Py_DECREF(obj); + return -1; + } + PDATA_PUSH(self->stack, obj, -1); + return 0; +} + +static int +load_put(Unpicklerobject *self) +{ + PyObject *py_str = 0, *value = 0; + int len, l; + char *s; + + if ((l = self->readline_func(self, &s)) < 0) return -1; + if (l < 2) return bad_readline(); + if (!( len=self->stack->length )) return stackUnderflow(); + if (!( py_str = PyString_FromStringAndSize(s, l - 1))) return -1; + value=self->stack->data[len-1]; + l=PyDict_SetItem(self->memo, py_str, value); + Py_DECREF(py_str); + return l; +} + + +static int +load_binput(Unpicklerobject *self) +{ + PyObject *py_key = 0, *value = 0; + unsigned char key; + char *s; + int len; + + if (self->read_func(self, &s, 1) < 0) return -1; + if (!( (len=self->stack->length) > 0 )) return stackUnderflow(); + + key = (unsigned char)s[0]; + + if (!( py_key = PyInt_FromLong((long)key))) return -1; + value=self->stack->data[len-1]; + len=PyDict_SetItem(self->memo, py_key, value); + Py_DECREF(py_key); + return len; +} + + +static int +load_long_binput(Unpicklerobject *self) +{ + PyObject *py_key = 0, *value = 0; + long key; + unsigned char c; + char *s; + int len; + + if (self->read_func(self, &s, 4) < 0) return -1; + if (!( len=self->stack->length )) return stackUnderflow(); + + c = (unsigned char)s[0]; + key = (long)c; + c = (unsigned char)s[1]; + key |= (long)c << 8; + c = (unsigned char)s[2]; + key |= (long)c << 16; + c = (unsigned char)s[3]; + key |= (long)c << 24; + + if (!( py_key = PyInt_FromLong(key))) return -1; + value=self->stack->data[len-1]; + len=PyDict_SetItem(self->memo, py_key, value); + Py_DECREF(py_key); + return len; +} + + +static int +do_append(Unpicklerobject *self, int x) +{ + PyObject *value = 0, *list = 0, *append_method = 0; + int len, i; + + len=self->stack->length; + if (!( len >= x && x > 0 )) return stackUnderflow(); + /* nothing to do */ + if (len==x) return 0; + + list=self->stack->data[x-1]; + + if (PyList_Check(list)) { + PyObject *slice; + int list_len; + + slice=Pdata_popList(self->stack, x); + if (! slice) return -1; + list_len = PyList_GET_SIZE(list); + i=PyList_SetSlice(list, list_len, list_len, slice); + Py_DECREF(slice); + return i; + } + else { + + if (!( append_method = PyObject_GetAttr(list, append_str))) + return -1; + + for (i = x; i < len; i++) { + PyObject *junk; + + value=self->stack->data[i]; + junk=0; + ARG_TUP(self, value); + if (self->arg) { + junk = PyObject_Call(append_method, self->arg, + NULL); + FREE_ARG_TUP(self); + } + if (! junk) { + Pdata_clear(self->stack, i+1); + self->stack->length=x; + Py_DECREF(append_method); + return -1; + } + Py_DECREF(junk); + } + self->stack->length=x; + Py_DECREF(append_method); + } + + return 0; +} + + +static int +load_append(Unpicklerobject *self) +{ + return do_append(self, self->stack->length - 1); +} + + +static int +load_appends(Unpicklerobject *self) +{ + return do_append(self, marker(self)); +} + + +static int +do_setitems(Unpicklerobject *self, int x) +{ + PyObject *value = 0, *key = 0, *dict = 0; + int len, i, r=0; + + if (!( (len=self->stack->length) >= x + && x > 0 )) return stackUnderflow(); + + dict=self->stack->data[x-1]; + + for (i = x+1; i < len; i += 2) { + key =self->stack->data[i-1]; + value=self->stack->data[i ]; + if (PyObject_SetItem(dict, key, value) < 0) { + r=-1; + break; + } + } + + Pdata_clear(self->stack, x); + + return r; +} + + +static int +load_setitem(Unpicklerobject *self) +{ + return do_setitems(self, self->stack->length - 2); +} + +static int +load_setitems(Unpicklerobject *self) +{ + return do_setitems(self, marker(self)); +} + + +static int +load_build(Unpicklerobject *self) +{ + PyObject *state, *inst, *slotstate; + PyObject *__setstate__; + PyObject *d_key, *d_value; + Py_ssize_t i; + int res = -1; + + /* Stack is ... instance, state. We want to leave instance at + * the stack top, possibly mutated via instance.__setstate__(state). + */ + if (self->stack->length < 2) + return stackUnderflow(); + PDATA_POP(self->stack, state); + if (state == NULL) + return -1; + inst = self->stack->data[self->stack->length - 1]; + + __setstate__ = PyObject_GetAttr(inst, __setstate___str); + if (__setstate__ != NULL) { + PyObject *junk = NULL; + + /* The explicit __setstate__ is responsible for everything. */ + ARG_TUP(self, state); + if (self->arg) { + junk = PyObject_Call(__setstate__, self->arg, NULL); + FREE_ARG_TUP(self); + } + Py_DECREF(__setstate__); + if (junk == NULL) + return -1; + Py_DECREF(junk); + return 0; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + return -1; + PyErr_Clear(); + + /* A default __setstate__. First see whether state embeds a + * slot state dict too (a proto 2 addition). + */ + if (PyTuple_Check(state) && PyTuple_Size(state) == 2) { + PyObject *temp = state; + state = PyTuple_GET_ITEM(temp, 0); + slotstate = PyTuple_GET_ITEM(temp, 1); + Py_INCREF(state); + Py_INCREF(slotstate); + Py_DECREF(temp); + } + else + slotstate = NULL; + + /* Set inst.__dict__ from the state dict (if any). */ + if (state != Py_None) { + PyObject *dict; + if (! PyDict_Check(state)) { + PyErr_SetString(UnpicklingError, "state is not a " + "dictionary"); + goto finally; + } + dict = PyObject_GetAttr(inst, __dict___str); + if (dict == NULL) + goto finally; + + i = 0; + while (PyDict_Next(state, &i, &d_key, &d_value)) { + if (PyObject_SetItem(dict, d_key, d_value) < 0) + goto finally; + } + Py_DECREF(dict); + } + + /* Also set instance attributes from the slotstate dict (if any). */ + if (slotstate != NULL) { + if (! PyDict_Check(slotstate)) { + PyErr_SetString(UnpicklingError, "slot state is not " + "a dictionary"); + goto finally; + } + i = 0; + while (PyDict_Next(slotstate, &i, &d_key, &d_value)) { + if (PyObject_SetAttr(inst, d_key, d_value) < 0) + goto finally; + } + } + res = 0; + + finally: + Py_DECREF(state); + Py_XDECREF(slotstate); + return res; +} + + +static int +load_mark(Unpicklerobject *self) +{ + int s; + + /* Note that we split the (pickle.py) stack into two stacks, an + object stack and a mark stack. Here we push a mark onto the + mark stack. + */ + + if ((self->num_marks + 1) >= self->marks_size) { + int *marks; + s=self->marks_size+20; + if (s <= self->num_marks) s=self->num_marks + 1; + if (self->marks == NULL) + marks=(int *)malloc(s * sizeof(int)); + else + marks=(int *)realloc(self->marks, + s * sizeof(int)); + if (!marks) { + PyErr_NoMemory(); + return -1; + } + self->marks = marks; + self->marks_size = s; + } + + self->marks[self->num_marks++] = self->stack->length; + + return 0; +} + +static int +load_reduce(Unpicklerobject *self) +{ + PyObject *callable = 0, *arg_tup = 0, *ob = 0; + + PDATA_POP(self->stack, arg_tup); + if (! arg_tup) return -1; + PDATA_POP(self->stack, callable); + if (callable) { + ob = Instance_New(callable, arg_tup); + Py_DECREF(callable); + } + Py_DECREF(arg_tup); + + if (! ob) return -1; + + PDATA_PUSH(self->stack, ob, -1); + return 0; +} + +/* Just raises an error if we don't know the protocol specified. PROTO + * is the first opcode for protocols >= 2. + */ +static int +load_proto(Unpicklerobject *self) +{ + int i; + char *protobyte; + + i = self->read_func(self, &protobyte, 1); + if (i < 0) + return -1; + + i = calc_binint(protobyte, 1); + /* No point checking for < 0, since calc_binint returns an unsigned + * int when chewing on 1 byte. + */ + assert(i >= 0); + if (i <= HIGHEST_PROTOCOL) + return 0; + + PyErr_Format(PyExc_ValueError, "unsupported pickle protocol: %d", i); + return -1; +} + +static PyObject * +load(Unpicklerobject *self) +{ + PyObject *err = 0, *val = 0; + char *s; + + self->num_marks = 0; + if (self->stack->length) Pdata_clear(self->stack, 0); + + while (1) { + if (self->read_func(self, &s, 1) < 0) + break; + + switch (s[0]) { + case NONE: + if (load_none(self) < 0) + break; + continue; + + case BININT: + if (load_binint(self) < 0) + break; + continue; + + case BININT1: + if (load_binint1(self) < 0) + break; + continue; + + case BININT2: + if (load_binint2(self) < 0) + break; + continue; + + case INT: + if (load_int(self) < 0) + break; + continue; + + case LONG: + if (load_long(self) < 0) + break; + continue; + + case LONG1: + if (load_counted_long(self, 1) < 0) + break; + continue; + + case LONG4: + if (load_counted_long(self, 4) < 0) + break; + continue; + + case FLOAT: + if (load_float(self) < 0) + break; + continue; + + case BINFLOAT: + if (load_binfloat(self) < 0) + break; + continue; + + case BINSTRING: + if (load_binstring(self) < 0) + break; + continue; + + case SHORT_BINSTRING: + if (load_short_binstring(self) < 0) + break; + continue; + + case STRING: + if (load_string(self) < 0) + break; + continue; + +#ifdef Py_USING_UNICODE + case UNICODE: + if (load_unicode(self) < 0) + break; + continue; + + case BINUNICODE: + if (load_binunicode(self) < 0) + break; + continue; +#endif + + case EMPTY_TUPLE: + if (load_counted_tuple(self, 0) < 0) + break; + continue; + + case TUPLE1: + if (load_counted_tuple(self, 1) < 0) + break; + continue; + + case TUPLE2: + if (load_counted_tuple(self, 2) < 0) + break; + continue; + + case TUPLE3: + if (load_counted_tuple(self, 3) < 0) + break; + continue; + + case TUPLE: + if (load_tuple(self) < 0) + break; + continue; + + case EMPTY_LIST: + if (load_empty_list(self) < 0) + break; + continue; + + case LIST: + if (load_list(self) < 0) + break; + continue; + + case EMPTY_DICT: + if (load_empty_dict(self) < 0) + break; + continue; + + case DICT: + if (load_dict(self) < 0) + break; + continue; + + case OBJ: + if (load_obj(self) < 0) + break; + continue; + + case INST: + if (load_inst(self) < 0) + break; + continue; + + case NEWOBJ: + if (load_newobj(self) < 0) + break; + continue; + + case GLOBAL: + if (load_global(self) < 0) + break; + continue; + + case APPEND: + if (load_append(self) < 0) + break; + continue; + + case APPENDS: + if (load_appends(self) < 0) + break; + continue; + + case BUILD: + if (load_build(self) < 0) + break; + continue; + + case DUP: + if (load_dup(self) < 0) + break; + continue; + + case BINGET: + if (load_binget(self) < 0) + break; + continue; + + case LONG_BINGET: + if (load_long_binget(self) < 0) + break; + continue; + + case GET: + if (load_get(self) < 0) + break; + continue; + + case EXT1: + if (load_extension(self, 1) < 0) + break; + continue; + + case EXT2: + if (load_extension(self, 2) < 0) + break; + continue; + + case EXT4: + if (load_extension(self, 4) < 0) + break; + continue; + case MARK: + if (load_mark(self) < 0) + break; + continue; + + case BINPUT: + if (load_binput(self) < 0) + break; + continue; + + case LONG_BINPUT: + if (load_long_binput(self) < 0) + break; + continue; + + case PUT: + if (load_put(self) < 0) + break; + continue; + + case POP: + if (load_pop(self) < 0) + break; + continue; + + case POP_MARK: + if (load_pop_mark(self) < 0) + break; + continue; + + case SETITEM: + if (load_setitem(self) < 0) + break; + continue; + + case SETITEMS: + if (load_setitems(self) < 0) + break; + continue; + + case STOP: + break; + + case PERSID: + if (load_persid(self) < 0) + break; + continue; + + case BINPERSID: + if (load_binpersid(self) < 0) + break; + continue; + + case REDUCE: + if (load_reduce(self) < 0) + break; + continue; + + case PROTO: + if (load_proto(self) < 0) + break; + continue; + + case NEWTRUE: + if (load_bool(self, Py_True) < 0) + break; + continue; + + case NEWFALSE: + if (load_bool(self, Py_False) < 0) + break; + continue; + + case '\0': + /* end of file */ + PyErr_SetNone(PyExc_EOFError); + break; + + default: + cPickle_ErrFormat(UnpicklingError, + "invalid load key, '%s'.", + "c", s[0]); + return NULL; + } + + break; + } + + if ((err = PyErr_Occurred())) { + if (err == PyExc_EOFError) { + PyErr_SetNone(PyExc_EOFError); + } + return NULL; + } + + PDATA_POP(self->stack, val); + return val; +} + + +/* No-load functions to support noload, which is used to + find persistent references. */ + +static int +noload_obj(Unpicklerobject *self) +{ + int i; + + if ((i = marker(self)) < 0) return -1; + return Pdata_clear(self->stack, i+1); +} + + +static int +noload_inst(Unpicklerobject *self) +{ + int i; + char *s; + + if ((i = marker(self)) < 0) return -1; + Pdata_clear(self->stack, i); + if (self->readline_func(self, &s) < 0) return -1; + if (self->readline_func(self, &s) < 0) return -1; + PDATA_APPEND(self->stack, Py_None, -1); + return 0; +} + +static int +noload_newobj(Unpicklerobject *self) +{ + PyObject *obj; + + PDATA_POP(self->stack, obj); /* pop argtuple */ + if (obj == NULL) return -1; + Py_DECREF(obj); + + PDATA_POP(self->stack, obj); /* pop cls */ + if (obj == NULL) return -1; + Py_DECREF(obj); + + PDATA_APPEND(self->stack, Py_None, -1); + return 0; +} + +static int +noload_global(Unpicklerobject *self) +{ + char *s; + + if (self->readline_func(self, &s) < 0) return -1; + if (self->readline_func(self, &s) < 0) return -1; + PDATA_APPEND(self->stack, Py_None,-1); + return 0; +} + +static int +noload_reduce(Unpicklerobject *self) +{ + + if (self->stack->length < 2) return stackUnderflow(); + Pdata_clear(self->stack, self->stack->length-2); + PDATA_APPEND(self->stack, Py_None,-1); + return 0; +} + +static int +noload_build(Unpicklerobject *self) { + + if (self->stack->length < 1) return stackUnderflow(); + Pdata_clear(self->stack, self->stack->length-1); + return 0; +} + +static int +noload_extension(Unpicklerobject *self, int nbytes) +{ + char *codebytes; + + assert(nbytes == 1 || nbytes == 2 || nbytes == 4); + if (self->read_func(self, &codebytes, nbytes) < 0) return -1; + PDATA_APPEND(self->stack, Py_None, -1); + return 0; +} + + +static PyObject * +noload(Unpicklerobject *self) +{ + PyObject *err = 0, *val = 0; + char *s; + + self->num_marks = 0; + Pdata_clear(self->stack, 0); + + while (1) { + if (self->read_func(self, &s, 1) < 0) + break; + + switch (s[0]) { + case NONE: + if (load_none(self) < 0) + break; + continue; + + case BININT: + if (load_binint(self) < 0) + break; + continue; + + case BININT1: + if (load_binint1(self) < 0) + break; + continue; + + case BININT2: + if (load_binint2(self) < 0) + break; + continue; + + case INT: + if (load_int(self) < 0) + break; + continue; + + case LONG: + if (load_long(self) < 0) + break; + continue; + + case LONG1: + if (load_counted_long(self, 1) < 0) + break; + continue; + + case LONG4: + if (load_counted_long(self, 4) < 0) + break; + continue; + + case FLOAT: + if (load_float(self) < 0) + break; + continue; + + case BINFLOAT: + if (load_binfloat(self) < 0) + break; + continue; + + case BINSTRING: + if (load_binstring(self) < 0) + break; + continue; + + case SHORT_BINSTRING: + if (load_short_binstring(self) < 0) + break; + continue; + + case STRING: + if (load_string(self) < 0) + break; + continue; + +#ifdef Py_USING_UNICODE + case UNICODE: + if (load_unicode(self) < 0) + break; + continue; + + case BINUNICODE: + if (load_binunicode(self) < 0) + break; + continue; +#endif + + case EMPTY_TUPLE: + if (load_counted_tuple(self, 0) < 0) + break; + continue; + + case TUPLE1: + if (load_counted_tuple(self, 1) < 0) + break; + continue; + + case TUPLE2: + if (load_counted_tuple(self, 2) < 0) + break; + continue; + + case TUPLE3: + if (load_counted_tuple(self, 3) < 0) + break; + continue; + + case TUPLE: + if (load_tuple(self) < 0) + break; + continue; + + case EMPTY_LIST: + if (load_empty_list(self) < 0) + break; + continue; + + case LIST: + if (load_list(self) < 0) + break; + continue; + + case EMPTY_DICT: + if (load_empty_dict(self) < 0) + break; + continue; + + case DICT: + if (load_dict(self) < 0) + break; + continue; + + case OBJ: + if (noload_obj(self) < 0) + break; + continue; + + case INST: + if (noload_inst(self) < 0) + break; + continue; + + case NEWOBJ: + if (noload_newobj(self) < 0) + break; + continue; + + case GLOBAL: + if (noload_global(self) < 0) + break; + continue; + + case APPEND: + if (load_append(self) < 0) + break; + continue; + + case APPENDS: + if (load_appends(self) < 0) + break; + continue; + + case BUILD: + if (noload_build(self) < 0) + break; + continue; + + case DUP: + if (load_dup(self) < 0) + break; + continue; + + case BINGET: + if (load_binget(self) < 0) + break; + continue; + + case LONG_BINGET: + if (load_long_binget(self) < 0) + break; + continue; + + case GET: + if (load_get(self) < 0) + break; + continue; + + case EXT1: + if (noload_extension(self, 1) < 0) + break; + continue; + + case EXT2: + if (noload_extension(self, 2) < 0) + break; + continue; + + case EXT4: + if (noload_extension(self, 4) < 0) + break; + continue; + + case MARK: + if (load_mark(self) < 0) + break; + continue; + + case BINPUT: + if (load_binput(self) < 0) + break; + continue; + + case LONG_BINPUT: + if (load_long_binput(self) < 0) + break; + continue; + + case PUT: + if (load_put(self) < 0) + break; + continue; + + case POP: + if (load_pop(self) < 0) + break; + continue; + + case POP_MARK: + if (load_pop_mark(self) < 0) + break; + continue; + + case SETITEM: + if (load_setitem(self) < 0) + break; + continue; + + case SETITEMS: + if (load_setitems(self) < 0) + break; + continue; + + case STOP: + break; + + case PERSID: + if (load_persid(self) < 0) + break; + continue; + + case BINPERSID: + if (load_binpersid(self) < 0) + break; + continue; + + case REDUCE: + if (noload_reduce(self) < 0) + break; + continue; + + case PROTO: + if (load_proto(self) < 0) + break; + continue; + + case NEWTRUE: + if (load_bool(self, Py_True) < 0) + break; + continue; + + case NEWFALSE: + if (load_bool(self, Py_False) < 0) + break; + continue; + default: + cPickle_ErrFormat(UnpicklingError, + "invalid load key, '%s'.", + "c", s[0]); + return NULL; + } + + break; + } + + if ((err = PyErr_Occurred())) { + if (err == PyExc_EOFError) { + PyErr_SetNone(PyExc_EOFError); + } + return NULL; + } + + PDATA_POP(self->stack, val); + return val; +} + + +static PyObject * +Unpickler_load(Unpicklerobject *self, PyObject *unused) +{ + return load(self); +} + +static PyObject * +Unpickler_noload(Unpicklerobject *self, PyObject *unused) +{ + return noload(self); +} + + +static struct PyMethodDef Unpickler_methods[] = { + {"load", (PyCFunction)Unpickler_load, METH_NOARGS, + PyDoc_STR("load() -- Load a pickle") + }, + {"noload", (PyCFunction)Unpickler_noload, METH_NOARGS, + PyDoc_STR( + "noload() -- not load a pickle, but go through most of the motions\n" + "\n" + "This function can be used to read past a pickle without instantiating\n" + "any objects or importing any modules. It can also be used to find all\n" + "persistent references without instantiating any objects or importing\n" + "any modules.\n") + }, + {NULL, NULL} /* sentinel */ +}; + + +static Unpicklerobject * +newUnpicklerobject(PyObject *f) +{ + Unpicklerobject *self; + + if (!( self = PyObject_GC_New(Unpicklerobject, &Unpicklertype))) + return NULL; + + self->file = NULL; + self->arg = NULL; + self->stack = (Pdata*)Pdata_New(); + self->pers_func = NULL; + self->last_string = NULL; + self->marks = NULL; + self->num_marks = 0; + self->marks_size = 0; + self->buf_size = 0; + self->read = NULL; + self->readline = NULL; + self->find_class = NULL; + + if (!( self->memo = PyDict_New())) + goto err; + + if (!self->stack) + goto err; + + Py_INCREF(f); + self->file = f; + + /* Set read, readline based on type of f */ + if (PyFile_Check(f)) { + self->fp = PyFile_AsFile(f); + if (self->fp == NULL) { + PyErr_SetString(PyExc_ValueError, + "I/O operation on closed file"); + goto err; + } + self->read_func = read_file; + self->readline_func = readline_file; + } + else if (PycStringIO_InputCheck(f)) { + self->fp = NULL; + self->read_func = read_cStringIO; + self->readline_func = readline_cStringIO; + } + else { + + self->fp = NULL; + self->read_func = read_other; + self->readline_func = readline_other; + + if (!( (self->readline = PyObject_GetAttr(f, readline_str)) && + (self->read = PyObject_GetAttr(f, read_str)))) { + PyErr_Clear(); + PyErr_SetString( PyExc_TypeError, + "argument must have 'read' and " + "'readline' attributes" ); + goto err; + } + } + PyObject_GC_Track(self); + + return self; + + err: + Py_DECREF((PyObject *)self); + return NULL; +} + + +static PyObject * +get_Unpickler(PyObject *self, PyObject *file) +{ + return (PyObject *)newUnpicklerobject(file); +} + + +static void +Unpickler_dealloc(Unpicklerobject *self) +{ + PyObject_GC_UnTrack((PyObject *)self); + Py_XDECREF(self->readline); + Py_XDECREF(self->read); + Py_XDECREF(self->file); + Py_XDECREF(self->memo); + Py_XDECREF(self->stack); + Py_XDECREF(self->pers_func); + Py_XDECREF(self->arg); + Py_XDECREF(self->last_string); + Py_XDECREF(self->find_class); + + if (self->marks) { + free(self->marks); + } + + if (self->buf_size) { + free(self->buf); + } + + self->ob_type->tp_free((PyObject *)self); +} + +static int +Unpickler_traverse(Unpicklerobject *self, visitproc visit, void *arg) +{ + Py_VISIT(self->readline); + Py_VISIT(self->read); + Py_VISIT(self->file); + Py_VISIT(self->memo); + Py_VISIT(self->stack); + Py_VISIT(self->pers_func); + Py_VISIT(self->arg); + Py_VISIT(self->last_string); + Py_VISIT(self->find_class); + return 0; +} + +static int +Unpickler_clear(Unpicklerobject *self) +{ + Py_CLEAR(self->readline); + Py_CLEAR(self->read); + Py_CLEAR(self->file); + Py_CLEAR(self->memo); + Py_CLEAR(self->stack); + Py_CLEAR(self->pers_func); + Py_CLEAR(self->arg); + Py_CLEAR(self->last_string); + Py_CLEAR(self->find_class); + return 0; +} + +static PyObject * +Unpickler_getattr(Unpicklerobject *self, char *name) +{ + if (!strcmp(name, "persistent_load")) { + if (!self->pers_func) { + PyErr_SetString(PyExc_AttributeError, name); + return NULL; + } + + Py_INCREF(self->pers_func); + return self->pers_func; + } + + if (!strcmp(name, "find_global")) { + if (!self->find_class) { + PyErr_SetString(PyExc_AttributeError, name); + return NULL; + } + + Py_INCREF(self->find_class); + return self->find_class; + } + + if (!strcmp(name, "memo")) { + if (!self->memo) { + PyErr_SetString(PyExc_AttributeError, name); + return NULL; + } + + Py_INCREF(self->memo); + return self->memo; + } + + if (!strcmp(name, "UnpicklingError")) { + Py_INCREF(UnpicklingError); + return UnpicklingError; + } + + return Py_FindMethod(Unpickler_methods, (PyObject *)self, name); +} + + +static int +Unpickler_setattr(Unpicklerobject *self, char *name, PyObject *value) +{ + + if (!strcmp(name, "persistent_load")) { + Py_XDECREF(self->pers_func); + self->pers_func = value; + Py_XINCREF(value); + return 0; + } + + if (!strcmp(name, "find_global")) { + Py_XDECREF(self->find_class); + self->find_class = value; + Py_XINCREF(value); + return 0; + } + + if (! value) { + PyErr_SetString(PyExc_TypeError, + "attribute deletion is not supported"); + return -1; + } + + if (strcmp(name, "memo") == 0) { + if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "memo must be a dictionary"); + return -1; + } + Py_XDECREF(self->memo); + self->memo = value; + Py_INCREF(value); + return 0; + } + + PyErr_SetString(PyExc_AttributeError, name); + return -1; +} + +/* --------------------------------------------------------------------------- + * Module-level functions. + */ + +/* dump(obj, file, protocol=0). */ +static PyObject * +cpm_dump(PyObject *self, PyObject *args, PyObject *kwds) +{ + static char *kwlist[] = {"obj", "file", "protocol", NULL}; + PyObject *ob, *file, *res = NULL; + Picklerobject *pickler = 0; + int proto = 0; + + if (!( PyArg_ParseTupleAndKeywords(args, kwds, "OO|i", kwlist, + &ob, &file, &proto))) + goto finally; + + if (!( pickler = newPicklerobject(file, proto))) + goto finally; + + if (dump(pickler, ob) < 0) + goto finally; + + Py_INCREF(Py_None); + res = Py_None; + + finally: + Py_XDECREF(pickler); + + return res; +} + + +/* dumps(obj, protocol=0). */ +static PyObject * +cpm_dumps(PyObject *self, PyObject *args, PyObject *kwds) +{ + static char *kwlist[] = {"obj", "protocol", NULL}; + PyObject *ob, *file = 0, *res = NULL; + Picklerobject *pickler = 0; + int proto = 0; + + if (!( PyArg_ParseTupleAndKeywords(args, kwds, "O|i:dumps", kwlist, + &ob, &proto))) + goto finally; + + if (!( file = PycStringIO->NewOutput(128))) + goto finally; + + if (!( pickler = newPicklerobject(file, proto))) + goto finally; + + if (dump(pickler, ob) < 0) + goto finally; + + res = PycStringIO->cgetvalue(file); + + finally: + Py_XDECREF(pickler); + Py_XDECREF(file); + + return res; +} + + +/* load(fileobj). */ +static PyObject * +cpm_load(PyObject *self, PyObject *ob) +{ + Unpicklerobject *unpickler = 0; + PyObject *res = NULL; + + if (!( unpickler = newUnpicklerobject(ob))) + goto finally; + + res = load(unpickler); + + finally: + Py_XDECREF(unpickler); + + return res; +} + + +/* loads(string) */ +static PyObject * +cpm_loads(PyObject *self, PyObject *args) +{ + PyObject *ob, *file = 0, *res = NULL; + Unpicklerobject *unpickler = 0; + + if (!( PyArg_ParseTuple(args, "S:loads", &ob))) + goto finally; + + if (!( file = PycStringIO->NewInput(ob))) + goto finally; + + if (!( unpickler = newUnpicklerobject(file))) + goto finally; + + res = load(unpickler); + + finally: + Py_XDECREF(file); + Py_XDECREF(unpickler); + + return res; +} + + +PyDoc_STRVAR(Unpicklertype__doc__, +"Objects that know how to unpickle"); + +static PyTypeObject Unpicklertype = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "cPickle.Unpickler", /*tp_name*/ + sizeof(Unpicklerobject), /*tp_basicsize*/ + 0, + (destructor)Unpickler_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + (getattrfunc)Unpickler_getattr, /* tp_getattr */ + (setattrfunc)Unpickler_setattr, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + Unpicklertype__doc__, /* tp_doc */ + (traverseproc)Unpickler_traverse, /* tp_traverse */ + (inquiry)Unpickler_clear, /* tp_clear */ +}; + +static struct PyMethodDef cPickle_methods[] = { + {"dump", (PyCFunction)cpm_dump, METH_VARARGS | METH_KEYWORDS, + PyDoc_STR("dump(obj, file, protocol=0) -- " + "Write an object in pickle format to the given file.\n" + "\n" + "See the Pickler docstring for the meaning of optional argument proto.") + }, + + {"dumps", (PyCFunction)cpm_dumps, METH_VARARGS | METH_KEYWORDS, + PyDoc_STR("dumps(obj, protocol=0) -- " + "Return a string containing an object in pickle format.\n" + "\n" + "See the Pickler docstring for the meaning of optional argument proto.") + }, + + {"load", (PyCFunction)cpm_load, METH_O, + PyDoc_STR("load(file) -- Load a pickle from the given file")}, + + {"loads", (PyCFunction)cpm_loads, METH_VARARGS, + PyDoc_STR("loads(string) -- Load a pickle from the given string")}, + + {"Pickler", (PyCFunction)get_Pickler, METH_VARARGS | METH_KEYWORDS, + PyDoc_STR("Pickler(file, protocol=0) -- Create a pickler.\n" + "\n" + "This takes a file-like object for writing a pickle data stream.\n" + "The optional proto argument tells the pickler to use the given\n" + "protocol; supported protocols are 0, 1, 2. The default\n" + "protocol is 0, to be backwards compatible. (Protocol 0 is the\n" + "only protocol that can be written to a file opened in text\n" + "mode and read back successfully. When using a protocol higher\n" + "than 0, make sure the file is opened in binary mode, both when\n" + "pickling and unpickling.)\n" + "\n" + "Protocol 1 is more efficient than protocol 0; protocol 2 is\n" + "more efficient than protocol 1.\n" + "\n" + "Specifying a negative protocol version selects the highest\n" + "protocol version supported. The higher the protocol used, the\n" + "more recent the version of Python needed to read the pickle\n" + "produced.\n" + "\n" + "The file parameter must have a write() method that accepts a single\n" + "string argument. It can thus be an open file object, a StringIO\n" + "object, or any other custom object that meets this interface.\n") + }, + + {"Unpickler", (PyCFunction)get_Unpickler, METH_O, + PyDoc_STR("Unpickler(file) -- Create an unpickler.")}, + + { NULL, NULL } +}; + +static int +init_stuff(PyObject *module_dict) +{ + PyObject *copy_reg, *t, *r; + +#define INIT_STR(S) if (!( S ## _str=PyString_InternFromString(#S))) return -1; + + if (PyType_Ready(&Unpicklertype) < 0) + return -1; + if (PyType_Ready(&Picklertype) < 0) + return -1; + + INIT_STR(__class__); + INIT_STR(__getinitargs__); + INIT_STR(__dict__); + INIT_STR(__getstate__); + INIT_STR(__setstate__); + INIT_STR(__name__); + INIT_STR(__main__); + INIT_STR(__reduce__); + INIT_STR(__reduce_ex__); + INIT_STR(write); + INIT_STR(append); + INIT_STR(read); + INIT_STR(readline); + INIT_STR(copy_reg); + INIT_STR(dispatch_table); + + if (!( copy_reg = PyImport_ImportModule("copy_reg"))) + return -1; + + /* This is special because we want to use a different + one in restricted mode. */ + dispatch_table = PyObject_GetAttr(copy_reg, dispatch_table_str); + if (!dispatch_table) return -1; + + extension_registry = PyObject_GetAttrString(copy_reg, + "_extension_registry"); + if (!extension_registry) return -1; + + inverted_registry = PyObject_GetAttrString(copy_reg, + "_inverted_registry"); + if (!inverted_registry) return -1; + + extension_cache = PyObject_GetAttrString(copy_reg, + "_extension_cache"); + if (!extension_cache) return -1; + + Py_DECREF(copy_reg); + + if (!(empty_tuple = PyTuple_New(0))) + return -1; + + two_tuple = PyTuple_New(2); + if (two_tuple == NULL) + return -1; + /* We use this temp container with no regard to refcounts, or to + * keeping containees alive. Exempt from GC, because we don't + * want anything looking at two_tuple() by magic. + */ + PyObject_GC_UnTrack(two_tuple); + + /* Ugh */ + if (!( t=PyImport_ImportModule("__builtin__"))) return -1; + if (PyDict_SetItemString(module_dict, "__builtins__", t) < 0) + return -1; + + if (!( t=PyDict_New())) return -1; + if (!( r=PyRun_String( + "def __str__(self):\n" + " return self.args and ('%s' % self.args[0]) or '(what)'\n", + Py_file_input, + module_dict, t) )) return -1; + Py_DECREF(r); + + PickleError = PyErr_NewException("cPickle.PickleError", NULL, t); + if (!PickleError) + return -1; + + Py_DECREF(t); + + PicklingError = PyErr_NewException("cPickle.PicklingError", + PickleError, NULL); + if (!PicklingError) + return -1; + + if (!( t=PyDict_New())) return -1; + if (!( r=PyRun_String( + "def __str__(self):\n" + " a=self.args\n" + " a=a and type(a[0]) or '(what)'\n" + " return 'Cannot pickle %s objects' % a\n" + , Py_file_input, + module_dict, t) )) return -1; + Py_DECREF(r); + + if (!( UnpickleableError = PyErr_NewException( + "cPickle.UnpickleableError", PicklingError, t))) + return -1; + + Py_DECREF(t); + + if (!( UnpicklingError = PyErr_NewException("cPickle.UnpicklingError", + PickleError, NULL))) + return -1; + + if (!( BadPickleGet = PyErr_NewException("cPickle.BadPickleGet", + UnpicklingError, NULL))) + return -1; + + if (PyDict_SetItemString(module_dict, "PickleError", + PickleError) < 0) + return -1; + + if (PyDict_SetItemString(module_dict, "PicklingError", + PicklingError) < 0) + return -1; + + if (PyDict_SetItemString(module_dict, "UnpicklingError", + UnpicklingError) < 0) + return -1; + + if (PyDict_SetItemString(module_dict, "UnpickleableError", + UnpickleableError) < 0) + return -1; + + if (PyDict_SetItemString(module_dict, "BadPickleGet", + BadPickleGet) < 0) + return -1; + + PycString_IMPORT; + + return 0; +} + +#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ +#define PyMODINIT_FUNC void +#endif +PyMODINIT_FUNC +initcPickle(void) +{ + PyObject *m, *d, *di, *v, *k; + Py_ssize_t i; + char *rev = "1.71"; /* XXX when does this change? */ + PyObject *format_version; + PyObject *compatible_formats; + + Picklertype.ob_type = &PyType_Type; + Unpicklertype.ob_type = &PyType_Type; + PdataType.ob_type = &PyType_Type; + + /* Initialize some pieces. We need to do this before module creation, + * so we're forced to use a temporary dictionary. :( + */ + di = PyDict_New(); + if (!di) return; + if (init_stuff(di) < 0) return; + + /* Create the module and add the functions */ + m = Py_InitModule4("cPickle", cPickle_methods, + cPickle_module_documentation, + (PyObject*)NULL,PYTHON_API_VERSION); + if (m == NULL) + return; + + /* Add some symbolic constants to the module */ + d = PyModule_GetDict(m); + v = PyString_FromString(rev); + PyDict_SetItemString(d, "__version__", v); + Py_XDECREF(v); + + /* Copy data from di. Waaa. */ + for (i=0; PyDict_Next(di, &i, &k, &v); ) { + if (PyObject_SetItem(d, k, v) < 0) { + Py_DECREF(di); + return; + } + } + Py_DECREF(di); + + i = PyModule_AddIntConstant(m, "HIGHEST_PROTOCOL", HIGHEST_PROTOCOL); + if (i < 0) + return; + + /* These are purely informational; no code uses them. */ + /* File format version we write. */ + format_version = PyString_FromString("2.0"); + /* Format versions we can read. */ + compatible_formats = Py_BuildValue("[sssss]", + "1.0", /* Original protocol 0 */ + "1.1", /* Protocol 0 + INST */ + "1.2", /* Original protocol 1 */ + "1.3", /* Protocol 1 + BINFLOAT */ + "2.0"); /* Original protocol 2 */ + PyDict_SetItemString(d, "format_version", format_version); + PyDict_SetItemString(d, "compatible_formats", compatible_formats); + Py_XDECREF(format_version); + Py_XDECREF(compatible_formats); +} Added: sandbox/trunk/cpy_merge/Modules/cStringIO.c ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Modules/cStringIO.c Wed May 23 03:45:28 2007 @@ -0,0 +1,754 @@ + +#include "Python.h" +#include "import.h" +#include "cStringIO.h" +#include "structmember.h" + +PyDoc_STRVAR(cStringIO_module_documentation, +"A simple fast partial StringIO replacement.\n" +"\n" +"This module provides a simple useful replacement for\n" +"the StringIO module that is written in C. It does not provide the\n" +"full generality of StringIO, but it provides enough for most\n" +"applications and is especially useful in conjunction with the\n" +"pickle module.\n" +"\n" +"Usage:\n" +"\n" +" from cStringIO import StringIO\n" +"\n" +" an_output_stream=StringIO()\n" +" an_output_stream.write(some_stuff)\n" +" ...\n" +" value=an_output_stream.getvalue()\n" +"\n" +" an_input_stream=StringIO(a_string)\n" +" spam=an_input_stream.readline()\n" +" spam=an_input_stream.read(5)\n" +" an_input_stream.seek(0) # OK, start over\n" +" spam=an_input_stream.read() # and read it all\n" +" \n" +"If someone else wants to provide a more complete implementation,\n" +"go for it. :-) \n" +"\n" +"cStringIO.c,v 1.29 1999/06/15 14:10:27 jim Exp\n"); + +/* Declaration for file-like objects that manage data as strings + + The IOobject type should be though of as a common base type for + Iobjects, which provide input (read-only) StringIO objects and + Oobjects, which provide read-write objects. Most of the methods + depend only on common data. +*/ + +typedef struct { + PyObject_HEAD + char *buf; + Py_ssize_t pos, string_size; +} IOobject; + +#define IOOOBJECT(O) ((IOobject*)(O)) + +/* Declarations for objects of type StringO */ + +typedef struct { /* Subtype of IOobject */ + PyObject_HEAD + char *buf; + Py_ssize_t pos, string_size; + + Py_ssize_t buf_size; +} Oobject; + +/* Declarations for objects of type StringI */ + +typedef struct { /* Subtype of IOobject */ + PyObject_HEAD + char *buf; + Py_ssize_t pos, string_size; + /* We store a reference to the object here in order to keep + the buffer alive during the lifetime of the Iobject. */ + PyObject *pbuf; +} Iobject; + +/* IOobject (common) methods */ + +PyDoc_STRVAR(IO_flush__doc__, "flush(): does nothing."); + +static int +IO__opencheck(IOobject *self) { + if (!self->buf) { + PyErr_SetString(PyExc_ValueError, + "I/O operation on closed file"); + return 0; + } + return 1; +} + +static PyObject * +IO_get_closed(IOobject *self, void *closure) +{ + PyObject *result = Py_False; + + if (self->buf == NULL) + result = Py_True; + Py_INCREF(result); + return result; +} + +static PyGetSetDef file_getsetlist[] = { + {"closed", (getter)IO_get_closed, NULL, "True if the file is closed"}, + {0}, +}; + +static PyObject * +IO_flush(IOobject *self, PyObject *unused) { + + if (!IO__opencheck(self)) return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(IO_getval__doc__, +"getvalue([use_pos]) -- Get the string value." +"\n" +"If use_pos is specified and is a true value, then the string returned\n" +"will include only the text up to the current file position.\n"); + +static PyObject * +IO_cgetval(PyObject *self) { + if (!IO__opencheck(IOOOBJECT(self))) return NULL; + return PyString_FromStringAndSize(((IOobject*)self)->buf, + ((IOobject*)self)->pos); +} + +static PyObject * +IO_getval(IOobject *self, PyObject *args) { + PyObject *use_pos=Py_None; + Py_ssize_t s; + + if (!IO__opencheck(self)) return NULL; + if (!PyArg_UnpackTuple(args,"getval", 0, 1,&use_pos)) return NULL; + + if (PyObject_IsTrue(use_pos)) { + s=self->pos; + if (s > self->string_size) s=self->string_size; + } + else + s=self->string_size; + return PyString_FromStringAndSize(self->buf, s); +} + +PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); + +static PyObject * +IO_isatty(IOobject *self, PyObject *unused) { + if (!IO__opencheck(self)) return NULL; + Py_INCREF(Py_False); + return Py_False; +} + +PyDoc_STRVAR(IO_read__doc__, +"read([s]) -- Read s characters, or the rest of the string"); + +static int +IO_cread(PyObject *self, char **output, Py_ssize_t n) { + Py_ssize_t l; + + if (!IO__opencheck(IOOOBJECT(self))) return -1; + l = ((IOobject*)self)->string_size - ((IOobject*)self)->pos; + if (n < 0 || n > l) { + n = l; + if (n < 0) n=0; + } + + *output=((IOobject*)self)->buf + ((IOobject*)self)->pos; + ((IOobject*)self)->pos += n; + return n; +} + +static PyObject * +IO_read(IOobject *self, PyObject *args) { + Py_ssize_t n = -1; + char *output = NULL; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) return NULL; + + if ( (n=IO_cread((PyObject*)self,&output,n)) < 0) return NULL; + + return PyString_FromStringAndSize(output, n); +} + +PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); + +static int +IO_creadline(PyObject *self, char **output) { + char *n, *s; + Py_ssize_t l; + + if (!IO__opencheck(IOOOBJECT(self))) return -1; + + for (n = ((IOobject*)self)->buf + ((IOobject*)self)->pos, + s = ((IOobject*)self)->buf + ((IOobject*)self)->string_size; + n < s && *n != '\n'; n++); + if (n < s) n++; + + *output=((IOobject*)self)->buf + ((IOobject*)self)->pos; + l = n - ((IOobject*)self)->buf - ((IOobject*)self)->pos; + assert(((IOobject*)self)->pos + l < INT_MAX); + ((IOobject*)self)->pos += (int)l; + return (int)l; +} + +static PyObject * +IO_readline(IOobject *self, PyObject *args) { + int n, m=-1; + char *output; + + if (args) + if (!PyArg_ParseTuple(args, "|i:readline", &m)) return NULL; + + if( (n=IO_creadline((PyObject*)self,&output)) < 0) return NULL; + if (m >= 0 && m < n) { + m = n - m; + n -= m; + self->pos -= m; + } + return PyString_FromStringAndSize(output, n); +} + +PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); + +static PyObject * +IO_readlines(IOobject *self, PyObject *args) { + int n; + char *output; + PyObject *result, *line; + int hint = 0, length = 0; + + if (!PyArg_ParseTuple(args, "|i:readlines", &hint)) return NULL; + + result = PyList_New(0); + if (!result) + return NULL; + + while (1){ + if ( (n = IO_creadline((PyObject*)self,&output)) < 0) + goto err; + if (n == 0) + break; + line = PyString_FromStringAndSize (output, n); + if (!line) + goto err; + if (PyList_Append (result, line) == -1) { + Py_DECREF (line); + goto err; + } + Py_DECREF (line); + length += n; + if (hint > 0 && length >= hint) + break; + } + return result; + err: + Py_DECREF(result); + return NULL; +} + +PyDoc_STRVAR(IO_reset__doc__, +"reset() -- Reset the file position to the beginning"); + +static PyObject * +IO_reset(IOobject *self, PyObject *unused) { + + if (!IO__opencheck(self)) return NULL; + + self->pos = 0; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position."); + +static PyObject * +IO_tell(IOobject *self, PyObject *unused) { + + if (!IO__opencheck(self)) return NULL; + + return PyInt_FromSsize_t(self->pos); +} + +PyDoc_STRVAR(IO_truncate__doc__, +"truncate(): truncate the file at the current position."); + +static PyObject * +IO_truncate(IOobject *self, PyObject *args) { + Py_ssize_t pos = -1; + + if (!IO__opencheck(self)) return NULL; + if (!PyArg_ParseTuple(args, "|n:truncate", &pos)) return NULL; + + if (PyTuple_Size(args) == 0) { + /* No argument passed, truncate to current position */ + pos = self->pos; + } + + if (pos < 0) { + errno = EINVAL; + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + + if (self->string_size > pos) self->string_size = pos; + self->pos = self->string_size; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +IO_iternext(Iobject *self) +{ + PyObject *next; + next = IO_readline((IOobject *)self, NULL); + if (!next) + return NULL; + if (!PyString_GET_SIZE(next)) { + Py_DECREF(next); + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + return next; +} + + + + +/* Read-write object methods */ + +PyDoc_STRVAR(O_seek__doc__, +"seek(position) -- set the current position\n" +"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"); + +static PyObject * +O_seek(Oobject *self, PyObject *args) { + Py_ssize_t position; + int mode = 0; + + if (!IO__opencheck(IOOOBJECT(self))) return NULL; + if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) + return NULL; + + if (mode == 2) { + position += self->string_size; + } + else if (mode == 1) { + position += self->pos; + } + + if (position > self->buf_size) { + char *newbuf; + self->buf_size*=2; + if (self->buf_size <= position) self->buf_size=position+1; + newbuf = (char*) realloc(self->buf,self->buf_size); + if (!newbuf) { + free(self->buf); + self->buf = 0; + self->buf_size=self->pos=0; + return PyErr_NoMemory(); + } + self->buf = newbuf; + } + else if (position < 0) position=0; + + self->pos=position; + + while (--position >= self->string_size) self->buf[position]=0; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(O_write__doc__, +"write(s) -- Write a string to the file" +"\n\nNote (hack:) writing None resets the buffer"); + + +static int +O_cwrite(PyObject *self, const char *c, Py_ssize_t l) { + Py_ssize_t newl; + Oobject *oself; + char *newbuf; + + if (!IO__opencheck(IOOOBJECT(self))) return -1; + oself = (Oobject *)self; + + newl = oself->pos+l; + if (newl >= oself->buf_size) { + oself->buf_size *= 2; + if (oself->buf_size <= newl) { + assert(newl + 1 < INT_MAX); + oself->buf_size = (int)(newl+1); + } + newbuf = (char*)realloc(oself->buf, oself->buf_size); + if (!newbuf) { + PyErr_SetString(PyExc_MemoryError,"out of memory"); + free(oself->buf); + oself->buf = 0; + oself->buf_size = oself->pos = 0; + return -1; + } + oself->buf = newbuf; + } + + memcpy(oself->buf+oself->pos,c,l); + + assert(oself->pos + l < INT_MAX); + oself->pos += (int)l; + + if (oself->string_size < oself->pos) { + oself->string_size = oself->pos; + } + + return (int)l; +} + +static PyObject * +O_write(Oobject *self, PyObject *args) { + char *c; + int l; + + if (!PyArg_ParseTuple(args, "t#:write", &c, &l)) return NULL; + + if (O_cwrite((PyObject*)self,c,l) < 0) return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held."); + +static PyObject * +O_close(Oobject *self, PyObject *unused) { + if (self->buf != NULL) free(self->buf); + self->buf = NULL; + + self->pos = self->string_size = self->buf_size = 0; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(O_writelines__doc__, +"writelines(sequence_of_strings) -> None. Write the strings to the file.\n" +"\n" +"Note that newlines are not added. The sequence can be any iterable object\n" +"producing strings. This is equivalent to calling write() for each string."); +static PyObject * +O_writelines(Oobject *self, PyObject *args) { + PyObject *it, *s; + + it = PyObject_GetIter(args); + if (it == NULL) + return NULL; + while ((s = PyIter_Next(it)) != NULL) { + Py_ssize_t n; + char *c; + if (PyString_AsStringAndSize(s, &c, &n) == -1) { + Py_DECREF(it); + Py_DECREF(s); + return NULL; + } + if (O_cwrite((PyObject *)self, c, n) == -1) { + Py_DECREF(it); + Py_DECREF(s); + return NULL; + } + Py_DECREF(s); + } + + Py_DECREF(it); + + /* See if PyIter_Next failed */ + if (PyErr_Occurred()) + return NULL; + + Py_RETURN_NONE; +} +static struct PyMethodDef O_methods[] = { + /* Common methods: */ + {"flush", (PyCFunction)IO_flush, METH_NOARGS, IO_flush__doc__}, + {"getvalue", (PyCFunction)IO_getval, METH_VARARGS, IO_getval__doc__}, + {"isatty", (PyCFunction)IO_isatty, METH_NOARGS, IO_isatty__doc__}, + {"read", (PyCFunction)IO_read, METH_VARARGS, IO_read__doc__}, + {"readline", (PyCFunction)IO_readline, METH_VARARGS, IO_readline__doc__}, + {"readlines", (PyCFunction)IO_readlines,METH_VARARGS, IO_readlines__doc__}, + {"reset", (PyCFunction)IO_reset, METH_NOARGS, IO_reset__doc__}, + {"tell", (PyCFunction)IO_tell, METH_NOARGS, IO_tell__doc__}, + {"truncate", (PyCFunction)IO_truncate, METH_VARARGS, IO_truncate__doc__}, + + /* Read-write StringIO specific methods: */ + {"close", (PyCFunction)O_close, METH_NOARGS, O_close__doc__}, + {"seek", (PyCFunction)O_seek, METH_VARARGS, O_seek__doc__}, + {"write", (PyCFunction)O_write, METH_VARARGS, O_write__doc__}, + {"writelines", (PyCFunction)O_writelines, METH_O, O_writelines__doc__}, + {NULL, NULL} /* sentinel */ +}; + +static void +O_dealloc(Oobject *self) { + if (self->buf != NULL) + free(self->buf); + PyObject_Del(self); +} + +PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); + +static PyTypeObject Otype = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "cStringIO.StringO", /*tp_name*/ + sizeof(Oobject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)O_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr */ + 0, /*tp_setattr */ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0 , /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro */ + 0, /*tp_setattro */ + 0, /*tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + Otype__doc__, /*tp_doc */ + 0, /*tp_traverse */ + 0, /*tp_clear */ + 0, /*tp_richcompare */ + 0, /*tp_weaklistoffset */ + PyObject_SelfIter, /*tp_iter */ + (iternextfunc)IO_iternext, /*tp_iternext */ + O_methods, /*tp_methods */ + 0, /*tp_members */ + file_getsetlist, /*tp_getset */ +}; + +static PyObject * +newOobject(int size) { + Oobject *self; + + self = PyObject_New(Oobject, &Otype); + if (self == NULL) + return NULL; + self->pos=0; + self->string_size = 0; + + self->buf = (char *)malloc(size); + if (!self->buf) { + PyErr_SetString(PyExc_MemoryError,"out of memory"); + self->buf_size = 0; + Py_DECREF(self); + return NULL; + } + + self->buf_size=size; + return (PyObject*)self; +} + +/* End of code for StringO objects */ +/* -------------------------------------------------------- */ + +static PyObject * +I_close(Iobject *self, PyObject *unused) { + Py_XDECREF(self->pbuf); + self->pbuf = NULL; + self->buf = NULL; + + self->pos = self->string_size = 0; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +I_seek(Iobject *self, PyObject *args) { + Py_ssize_t position; + int mode = 0; + + if (!IO__opencheck(IOOOBJECT(self))) return NULL; + if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) + return NULL; + + if (mode == 2) position += self->string_size; + else if (mode == 1) position += self->pos; + + if (position < 0) position=0; + + self->pos=position; + + Py_INCREF(Py_None); + return Py_None; +} + +static struct PyMethodDef I_methods[] = { + /* Common methods: */ + {"flush", (PyCFunction)IO_flush, METH_NOARGS, IO_flush__doc__}, + {"getvalue", (PyCFunction)IO_getval, METH_VARARGS, IO_getval__doc__}, + {"isatty", (PyCFunction)IO_isatty, METH_NOARGS, IO_isatty__doc__}, + {"read", (PyCFunction)IO_read, METH_VARARGS, IO_read__doc__}, + {"readline", (PyCFunction)IO_readline, METH_VARARGS, IO_readline__doc__}, + {"readlines", (PyCFunction)IO_readlines,METH_VARARGS, IO_readlines__doc__}, + {"reset", (PyCFunction)IO_reset, METH_NOARGS, IO_reset__doc__}, + {"tell", (PyCFunction)IO_tell, METH_NOARGS, IO_tell__doc__}, + {"truncate", (PyCFunction)IO_truncate, METH_VARARGS, IO_truncate__doc__}, + + /* Read-only StringIO specific methods: */ + {"close", (PyCFunction)I_close, METH_NOARGS, O_close__doc__}, + {"seek", (PyCFunction)I_seek, METH_VARARGS, O_seek__doc__}, + {NULL, NULL} +}; + +static void +I_dealloc(Iobject *self) { + Py_XDECREF(self->pbuf); + PyObject_Del(self); +} + + +PyDoc_STRVAR(Itype__doc__, +"Simple type for treating strings as input file streams"); + +static PyTypeObject Itype = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "cStringIO.StringI", /*tp_name*/ + sizeof(Iobject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)I_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /* tp_getattr */ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + Itype__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)IO_iternext, /* tp_iternext */ + I_methods, /* tp_methods */ + 0, /* tp_members */ + file_getsetlist, /* tp_getset */ +}; + +static PyObject * +newIobject(PyObject *s) { + Iobject *self; + char *buf; + Py_ssize_t size; + + if (PyObject_AsCharBuffer(s, (const char **)&buf, &size) != 0) + return NULL; + + self = PyObject_New(Iobject, &Itype); + if (!self) return NULL; + Py_INCREF(s); + self->buf=buf; + self->string_size=size; + self->pbuf=s; + self->pos=0; + + return (PyObject*)self; +} + +/* End of code for StringI objects */ +/* -------------------------------------------------------- */ + + +PyDoc_STRVAR(IO_StringIO__doc__, +"StringIO([s]) -- Return a StringIO-like stream for reading or writing"); + +static PyObject * +IO_StringIO(PyObject *self, PyObject *args) { + PyObject *s=0; + + if (!PyArg_UnpackTuple(args, "StringIO", 0, 1, &s)) return NULL; + + if (s) return newIobject(s); + return newOobject(128); +} + +/* List of methods defined in the module */ + +static struct PyMethodDef IO_methods[] = { + {"StringIO", (PyCFunction)IO_StringIO, + METH_VARARGS, IO_StringIO__doc__}, + {NULL, NULL} /* sentinel */ +}; + + +/* Initialization function for the module (*must* be called initcStringIO) */ + +static struct PycStringIO_CAPI CAPI = { + IO_cread, + IO_creadline, + O_cwrite, + IO_cgetval, + newOobject, + newIobject, + &Itype, + &Otype, +}; + +#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ +#define PyMODINIT_FUNC void +#endif +PyMODINIT_FUNC +initcStringIO(void) { + PyObject *m, *d, *v; + + + /* Create the module and add the functions */ + m = Py_InitModule4("cStringIO", IO_methods, + cStringIO_module_documentation, + (PyObject*)NULL,PYTHON_API_VERSION); + if (m == NULL) return; + + /* Add some symbolic constants to the module */ + d = PyModule_GetDict(m); + + /* Export C API */ + Itype.ob_type=&PyType_Type; + Otype.ob_type=&PyType_Type; + if (PyType_Ready(&Otype) < 0) return; + if (PyType_Ready(&Itype) < 0) return; + PyDict_SetItemString(d,"cStringIO_CAPI", + v = PyCObject_FromVoidPtr(&CAPI,NULL)); + Py_XDECREF(v); + + /* Export Types */ + PyDict_SetItemString(d,"InputType", (PyObject*)&Itype); + PyDict_SetItemString(d,"OutputType", (PyObject*)&Otype); + + /* Maybe make certain warnings go away */ + if (0) PycString_IMPORT; +} Added: sandbox/trunk/cpy_merge/Modules/rotatingtree.c ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Modules/rotatingtree.c Wed May 23 03:45:28 2007 @@ -0,0 +1,121 @@ +#include "rotatingtree.h" + +#define KEY_LOWER_THAN(key1, key2) ((char*)(key1) < (char*)(key2)) + +/* The randombits() function below is a fast-and-dirty generator that + * is probably irregular enough for our purposes. Note that it's biased: + * I think that ones are slightly more probable than zeroes. It's not + * important here, though. + */ + +static unsigned int random_value = 1; +static unsigned int random_stream = 0; + +static int +randombits(int bits) +{ + int result; + if (random_stream < (1U << bits)) { + random_value *= 1082527; + random_stream = random_value; + } + result = random_stream & ((1<>= bits; + return result; +} + + +/* Insert a new node into the tree. + (*root) is modified to point to the new root. */ +void +RotatingTree_Add(rotating_node_t **root, rotating_node_t *node) +{ + while (*root != NULL) { + if (KEY_LOWER_THAN(node->key, (*root)->key)) + root = &((*root)->left); + else + root = &((*root)->right); + } + node->left = NULL; + node->right = NULL; + *root = node; +} + +/* Locate the node with the given key. This is the most complicated + function because it occasionally rebalances the tree to move the + resulting node closer to the root. */ +rotating_node_t * +RotatingTree_Get(rotating_node_t **root, void *key) +{ + if (randombits(3) != 4) { + /* Fast path, no rebalancing */ + rotating_node_t *node = *root; + while (node != NULL) { + if (node->key == key) + return node; + if (KEY_LOWER_THAN(key, node->key)) + node = node->left; + else + node = node->right; + } + return NULL; + } + else { + rotating_node_t **pnode = root; + rotating_node_t *node = *pnode; + rotating_node_t *next; + int rotate; + if (node == NULL) + return NULL; + while (1) { + if (node->key == key) + return node; + rotate = !randombits(1); + if (KEY_LOWER_THAN(key, node->key)) { + next = node->left; + if (next == NULL) + return NULL; + if (rotate) { + node->left = next->right; + next->right = node; + *pnode = next; + } + else + pnode = &(node->left); + } + else { + next = node->right; + if (next == NULL) + return NULL; + if (rotate) { + node->right = next->left; + next->left = node; + *pnode = next; + } + else + pnode = &(node->right); + } + node = next; + } + } +} + +/* Enumerate all nodes in the tree. The callback enumfn() should return + zero to continue the enumeration, or non-zero to interrupt it. + A non-zero value is directly returned by RotatingTree_Enum(). */ +int +RotatingTree_Enum(rotating_node_t *root, rotating_tree_enum_fn enumfn, + void *arg) +{ + int result; + rotating_node_t *node; + while (root != NULL) { + result = RotatingTree_Enum(root->left, enumfn, arg); + if (result != 0) return result; + node = root->right; + result = enumfn(root, arg); + if (result != 0) return result; + root = node; + } + return 0; +} Added: sandbox/trunk/cpy_merge/Modules/rotatingtree.h ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Modules/rotatingtree.h Wed May 23 03:45:28 2007 @@ -0,0 +1,27 @@ +/* "Rotating trees" (Armin Rigo) + * + * Google "splay trees" for the general idea. + * + * It's a dict-like data structure that works best when accesses are not + * random, but follow a strong pattern. The one implemented here is for + * access patterns where the same small set of keys is looked up over + * and over again, and this set of keys evolves slowly over time. + */ + +#include + +#define EMPTY_ROTATING_TREE ((rotating_node_t *)NULL) + +typedef struct rotating_node_s rotating_node_t; +typedef int (*rotating_tree_enum_fn) (rotating_node_t *node, void *arg); + +struct rotating_node_s { + void *key; + rotating_node_t *left; + rotating_node_t *right; +}; + +void RotatingTree_Add(rotating_node_t **root, rotating_node_t *node); +rotating_node_t* RotatingTree_Get(rotating_node_t **root, void *key); +int RotatingTree_Enum(rotating_node_t *root, rotating_tree_enum_fn enumfn, + void *arg); Added: sandbox/trunk/cpy_merge/README ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/README Wed May 23 03:45:28 2007 @@ -0,0 +1,8 @@ +This sandbox is for the merge of the modules with a dual C and Python +implementations -- i.e., cStringIO/StringIO, cPickle/pickle and +cProfile/profile. It contains the modules to be modified and their +respective test suite. + +The initial code was taken from the p3yk branch +(http://svn.python.org/projects/python/branches/p3yk) at +revision 55520. Added: sandbox/trunk/cpy_merge/setup.py ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/setup.py Wed May 23 03:45:28 2007 @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# A dumb and simple build script for the C extension modules + +from distutils.core import Extension, setup + +mod_dir = "Modules/" +inc_dir = ["./Include"] + +setup(name = "C/Python modules merge", + maintainer = "Alexandre Vassalotti", + maintainer_email = "alexandre at peadrop.com", + ext_modules=[ + Extension(name="_lsprof", + sources=[mod_dir + "_lsprof.c", + mod_dir + "rotatingtree.c"], + include_dirs=inc_dir), + Extension(name="cStringIO", + sources=[mod_dir + "cStringIO.c"]), + Extension(name="cPickle", + sources=[mod_dir + "cPickle.c"]) + ]) From python-checkins at python.org Wed May 23 04:04:32 2007 From: python-checkins at python.org (mark.hammond) Date: Wed, 23 May 2007 04:04:32 +0200 (CEST) Subject: [Python-checkins] r55522 - python/trunk/PC/pyconfig.h Message-ID: <20070523020432.90CD41E4003@bag.python.org> Author: mark.hammond Date: Wed May 23 04:04:28 2007 New Revision: 55522 Modified: python/trunk/PC/pyconfig.h Log: Remove definition of PY_UNICODE_TYPE from pyconfig.h, allowing the definition in unicodeobject.h to be used, giving us the desired wchar_t in place of 'unsigned short'. As discussed on python-dev. Modified: python/trunk/PC/pyconfig.h ============================================================================== --- python/trunk/PC/pyconfig.h (original) +++ python/trunk/PC/pyconfig.h Wed May 23 04:04:28 2007 @@ -491,22 +491,13 @@ /* Define if you want to have a Unicode type. */ #define Py_USING_UNICODE -/* Define as the integral type used for Unicode representation. */ -#define PY_UNICODE_TYPE unsigned short - /* Define as the size of the unicode type. */ -#define Py_UNICODE_SIZE SIZEOF_SHORT - -/* Define if you have a useable wchar_t type defined in wchar.h; useable - means wchar_t must be 16-bit unsigned type. (see - Include/unicodeobject.h). */ -#if Py_UNICODE_SIZE == 2 -#define HAVE_USABLE_WCHAR_T +/* This is enough for unicodeobject.h to do the "right thing" on Windows. */ +#define Py_UNICODE_SIZE 2 /* Define to indicate that the Python Unicode representation can be passed as-is to Win32 Wide API. */ #define Py_WIN_WIDE_FILENAMES -#endif /* Use Python's own small-block memory-allocator. */ #define WITH_PYMALLOC 1 From python-checkins at python.org Wed May 23 04:18:38 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 23 May 2007 04:18:38 +0200 (CEST) Subject: [Python-checkins] r55523 - sandbox/trunk/cpy_merge sandbox/trunk/cpy_merge/Makefile Message-ID: <20070523021838.A4E3C1E4003@bag.python.org> Author: alexandre.vassalotti Date: Wed May 23 04:18:37 2007 New Revision: 55523 Added: sandbox/trunk/cpy_merge/Makefile (contents, props changed) Modified: sandbox/trunk/cpy_merge/ (props changed) Log: * Added a simple makefile. * Set svn:ignore on TAGS Added: sandbox/trunk/cpy_merge/Makefile ============================================================================== --- (empty file) +++ sandbox/trunk/cpy_merge/Makefile Wed May 23 04:18:37 2007 @@ -0,0 +1,18 @@ +PYTHONPATH=./build/ + +all: build test + +build: clean + python3.0 setup.py build --build-lib build/ + +clean: + python3.0 setup.py clean --build-lib build/ + rm -rf build/ + +test: + python3.0 -tt ./Lib/test/regrtest.py -l + +# Create a tags file for GNU Emacs +TAGS: + etags Include/*.h + etags -a Modules/*.[ch] From buildbot at python.org Wed May 23 06:44:51 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 23 May 2007 04:44:51 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 2.5 Message-ID: <20070523044451.BB8B21E4003@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%25202.5/builds/357 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: The web-page 'force build' button was pressed by 'nnorwitz': old build failure Build Source Stamp: [branch release25-maint] HEAD Blamelist: BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Wed May 23 07:30:29 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 23 May 2007 07:30:29 +0200 (CEST) Subject: [Python-checkins] r55524 - peps/trunk/pep-3123.txt Message-ID: <20070523053029.17BF31E4003@bag.python.org> Author: neal.norwitz Date: Wed May 23 07:30:28 2007 New Revision: 55524 Modified: peps/trunk/pep-3123.txt Log: Add some spaces around {} Modified: peps/trunk/pep-3123.txt ============================================================================== --- peps/trunk/pep-3123.txt (original) +++ peps/trunk/pep-3123.txt Wed May 23 07:30:28 2007 @@ -70,11 +70,11 @@ to not list all fields anymore, but list a single field of type PyObject/PyVarObject:: - typedef struct _object{ + typedef struct _object { _PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt; struct _typeobject *ob_type; - }PyObject; + } PyObject; typedef struct { PyObject ob_base; @@ -87,7 +87,7 @@ Types defined as fixed-size structure will then include PyObject as its first field; variable-sized objects PyVarObject. E.g.:: - typedef struct{ + typedef struct { PyObject ob_base; PyObject *start, *stop, *step; } PySliceObject; From python-checkins at python.org Wed May 23 08:35:42 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 23 May 2007 08:35:42 +0200 (CEST) Subject: [Python-checkins] r55525 - in python/trunk: Include/pydebug.h Misc/NEWS Misc/cheatsheet Modules/main.c Objects/dictobject.c Objects/object.c Python/bltinmodule.c Message-ID: <20070523063542.402FC1E4003@bag.python.org> Author: neal.norwitz Date: Wed May 23 08:35:32 2007 New Revision: 55525 Modified: python/trunk/Include/pydebug.h python/trunk/Misc/NEWS python/trunk/Misc/cheatsheet python/trunk/Modules/main.c python/trunk/Objects/dictobject.c python/trunk/Objects/object.c python/trunk/Python/bltinmodule.c Log: Add -3 option to the interpreter to warn about features that are deprecated and will be changed/removed in Python 3.0. This patch is mostly from Anthony. I tweaked some format and added a little doc. Modified: python/trunk/Include/pydebug.h ============================================================================== --- python/trunk/Include/pydebug.h (original) +++ python/trunk/Include/pydebug.h Wed May 23 08:35:32 2007 @@ -21,6 +21,8 @@ on the command line, and is used in 2.2 by ceval.c to make all "/" divisions true divisions (which they will be in 3.0). */ PyAPI_DATA(int) _Py_QnewFlag; +/* Warn about 3.x issues */ +PyAPI_DATA(int) Py_Py3kWarningFlag; /* this is a wrapper around getenv() that pays attention to Py_IgnoreEnvironmentFlag. It should be used for getting variables like Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed May 23 08:35:32 2007 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Add -3 option to the interpreter to warn about features that are + deprecated and will be changed/removed in Python 3.0. + - Patch #1686487: you can now pass any mapping after '**' in function calls. Modified: python/trunk/Misc/cheatsheet ============================================================================== --- python/trunk/Misc/cheatsheet (original) +++ python/trunk/Misc/cheatsheet Wed May 23 08:35:32 2007 @@ -41,6 +41,7 @@ -h print this help message and exit -i Inspect interactively after running script (also PYTHONINSPECT=x) and force prompts, even if stdin appears not to be a terminal +-m mod run library module as a script (terminates option list -O optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x) -OO remove doc-strings in addition to the -O optimizations -Q arg division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew @@ -51,6 +52,7 @@ -W arg : warning control (arg is action:message:category:module:lineno) -x Skip first line of source, allowing use of non-unix Forms of #!cmd -? Help! +-3 warn about Python 3.x incompatibilities -c Specify the command to execute (see next section). This terminates the command option list (following options are passed as arguments to the command). the name of a python file (.py) to execute read from stdin. Modified: python/trunk/Modules/main.c ============================================================================== --- python/trunk/Modules/main.c (original) +++ python/trunk/Modules/main.c Wed May 23 08:35:32 2007 @@ -40,7 +40,7 @@ static int orig_argc; /* command line options */ -#define BASE_OPTS "c:dEhim:OQ:StuUvVW:xX?" +#define BASE_OPTS "3c:dEhim:OQ:StuUvVW:xX?" #ifndef RISCOS #define PROGRAM_OPTS BASE_OPTS @@ -82,6 +82,7 @@ -V : print the Python version number and exit (also --version)\n\ -W arg : warning control; arg is action:message:category:module:lineno\n\ -x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\ +-3 : warn about Python 3.x incompatibilities\n\ file : program read from script file\n\ - : program read from stdin (default; interactive mode if a tty)\n\ "; @@ -267,6 +268,10 @@ Py_DebugFlag++; break; + case '3': + Py_Py3kWarningFlag++; + break; + case 'Q': if (strcmp(_PyOS_optarg, "old") == 0) { Py_DivisionWarningFlag = 0; Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Wed May 23 08:35:32 2007 @@ -1688,7 +1688,7 @@ } static PyObject * -dict_has_key(register dictobject *mp, PyObject *key) +dict_contains(register dictobject *mp, PyObject *key) { long hash; dictentry *ep; @@ -1706,6 +1706,16 @@ } static PyObject * +dict_has_key(register dictobject *mp, PyObject *key) +{ + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "dict.has_key() not supported in 3.x") < 0) + return NULL; + return dict_contains(mp, key); +} + +static PyObject * dict_get(register dictobject *mp, PyObject *args) { PyObject *key; @@ -1978,7 +1988,7 @@ "D.iteritems() -> an iterator over the (key, value) items of D"); static PyMethodDef mapp_methods[] = { - {"__contains__",(PyCFunction)dict_has_key, METH_O | METH_COEXIST, + {"__contains__",(PyCFunction)dict_contains, METH_O | METH_COEXIST, contains__doc__}, {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST, getitem__doc__}, Modified: python/trunk/Objects/object.c ============================================================================== --- python/trunk/Objects/object.c (original) +++ python/trunk/Objects/object.c Wed May 23 08:35:32 2007 @@ -29,6 +29,7 @@ #endif /* Py_REF_DEBUG */ int Py_DivisionWarningFlag; +int Py_Py3kWarningFlag; /* Object allocation routines used by NEWOBJ and NEWVAROBJ macros. These are used by the individual routines for object creation. Modified: python/trunk/Python/bltinmodule.c ============================================================================== --- python/trunk/Python/bltinmodule.c (original) +++ python/trunk/Python/bltinmodule.c Wed May 23 08:35:32 2007 @@ -144,6 +144,11 @@ PyObject *func, *alist = NULL, *kwdict = NULL; PyObject *t = NULL, *retval = NULL; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "apply() not supported in 3.x") < 0) + return NULL; + if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict)) return NULL; if (alist != NULL) { From python-checkins at python.org Wed May 23 08:57:38 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 23 May 2007 08:57:38 +0200 (CEST) Subject: [Python-checkins] r55527 - python/trunk/Objects/dictobject.c Message-ID: <20070523065738.EBCA31E4003@bag.python.org> Author: neal.norwitz Date: Wed May 23 08:57:35 2007 New Revision: 55527 Modified: python/trunk/Objects/dictobject.c Log: Whitespace cleanup Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Wed May 23 08:57:35 2007 @@ -1988,7 +1988,7 @@ "D.iteritems() -> an iterator over the (key, value) items of D"); static PyMethodDef mapp_methods[] = { - {"__contains__",(PyCFunction)dict_contains, METH_O | METH_COEXIST, + {"__contains__",(PyCFunction)dict_contains, METH_O | METH_COEXIST, contains__doc__}, {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST, getitem__doc__}, From python-checkins at python.org Wed May 23 08:58:38 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 23 May 2007 08:58:38 +0200 (CEST) Subject: [Python-checkins] r55528 - python/trunk/Python/bltinmodule.c Message-ID: <20070523065838.B97051E4010@bag.python.org> Author: neal.norwitz Date: Wed May 23 08:58:36 2007 New Revision: 55528 Modified: python/trunk/Python/bltinmodule.c Log: Add a bunch more deprecation warnings for builtins that are going away in 3.0 Modified: python/trunk/Python/bltinmodule.c ============================================================================== --- python/trunk/Python/bltinmodule.c (original) +++ python/trunk/Python/bltinmodule.c Wed May 23 08:58:36 2007 @@ -191,6 +191,10 @@ static PyObject * builtin_callable(PyObject *self, PyObject *v) { + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "callable() not supported in 3.x") < 0) + return NULL; return PyBool_FromLong((long)PyCallable_Check(v)); } @@ -389,6 +393,11 @@ PyObject *v, *w; PyObject *res; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "coerce() not supported in 3.x") < 0) + return NULL; + if (!PyArg_UnpackTuple(args, "coerce", 2, 2, &v, &w)) return NULL; if (PyNumber_Coerce(&v, &w) < 0) @@ -631,6 +640,11 @@ PyCompilerFlags cf; int exists; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "execfile() not supported in 3.x") < 0) + return NULL; + if (!PyArg_ParseTuple(args, "s|O!O:execfile", &filename, &PyDict_Type, &globals, @@ -1800,6 +1814,11 @@ { PyObject *seq, *func, *result = NULL, *it; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "reduce() not supported in 3.x") < 0) + return NULL; + if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result)) return NULL; if (result != NULL) @@ -1872,6 +1891,11 @@ static PyObject * builtin_reload(PyObject *self, PyObject *v) { + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "reload() not supported in 3.x") < 0) + return NULL; + return PyImport_ReloadModule(v); } From buildbot at python.org Wed May 23 09:01:54 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 23 May 2007 07:01:54 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20070523070154.B028F1E4003@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/2049 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_tcl ====================================================================== ERROR: testLoadTk (test.test_tcl.TclTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_tcl.py", line 125, in testLoadTk tcl.loadtk() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib-tk/Tkinter.py", line 1642, in loadtk self.tk.loadtk() TclError: Calling Tk_Init again after a previous call failed might deadlock make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed May 23 09:20:00 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 23 May 2007 07:20:00 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070523072000.992C61E4003@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2034 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver sincerely, -The Buildbot From python-checkins at python.org Wed May 23 18:55:30 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 23 May 2007 18:55:30 +0200 (CEST) Subject: [Python-checkins] r55529 - python/branches/cpy_merge Message-ID: <20070523165530.4F7831E400C@bag.python.org> Author: alexandre.vassalotti Date: Wed May 23 18:55:27 2007 New Revision: 55529 Added: python/branches/cpy_merge/ - copied from r55528, python/branches/p3yk/ Log: New branch for the merge of the modules with a dual C and Python implementations, as recommended by Collin Winter. From python-checkins at python.org Wed May 23 19:07:49 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 23 May 2007 19:07:49 +0200 (CEST) Subject: [Python-checkins] r55530 - sandbox/trunk/cpy_merge Message-ID: <20070523170749.BD92C1E400F@bag.python.org> Author: alexandre.vassalotti Date: Wed May 23 19:07:46 2007 New Revision: 55530 Removed: sandbox/trunk/cpy_merge/ Log: Moved developement to the cpy_merge branch. From python-checkins at python.org Wed May 23 21:37:53 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 23 May 2007 21:37:53 +0200 (CEST) Subject: [Python-checkins] r55533 - python/branches/cpy_merge/Modules/cStringIO.c Message-ID: <20070523193753.4801B1E400C@bag.python.org> Author: alexandre.vassalotti Date: Wed May 23 21:37:48 2007 New Revision: 55533 Modified: python/branches/cpy_merge/Modules/cStringIO.c Log: Fix the indentation. Modified: python/branches/cpy_merge/Modules/cStringIO.c ============================================================================== --- python/branches/cpy_merge/Modules/cStringIO.c (original) +++ python/branches/cpy_merge/Modules/cStringIO.c Wed May 23 21:37:48 2007 @@ -1,4 +1,3 @@ - #include "Python.h" #include "import.h" #include "cStringIO.h" @@ -30,8 +29,7 @@ " \n" "If someone else wants to provide a more complete implementation,\n" "go for it. :-) \n" -"\n" -"cStringIO.c,v 1.29 1999/06/15 14:10:27 jim Exp\n"); +"\n" "cStringIO.c,v 1.29 1999/06/15 14:10:27 jim Exp\n"); /* Declaration for file-like objects that manage data as strings @@ -42,32 +40,28 @@ */ typedef struct { - PyObject_HEAD - char *buf; - Py_ssize_t pos, string_size; + PyObject_HEAD char *buf; + Py_ssize_t pos, string_size; } IOobject; #define IOOOBJECT(O) ((IOobject*)(O)) /* Declarations for objects of type StringO */ -typedef struct { /* Subtype of IOobject */ - PyObject_HEAD - char *buf; - Py_ssize_t pos, string_size; - - Py_ssize_t buf_size; +typedef struct { /* Subtype of IOobject */ + PyObject_HEAD char *buf; + Py_ssize_t pos, string_size; + Py_ssize_t buf_size; } Oobject; /* Declarations for objects of type StringI */ -typedef struct { /* Subtype of IOobject */ - PyObject_HEAD - char *buf; - Py_ssize_t pos, string_size; - /* We store a reference to the object here in order to keep - the buffer alive during the lifetime of the Iobject. */ - PyObject *pbuf; +typedef struct { /* Subtype of IOobject */ + PyObject_HEAD char *buf; + Py_ssize_t pos, string_size; + /* We store a reference to the object here in order to keep + * the buffer alive during the lifetime of the Iobject. */ + PyObject *pbuf; } Iobject; /* IOobject (common) methods */ @@ -75,17 +69,18 @@ PyDoc_STRVAR(IO_flush__doc__, "flush(): does nothing."); static int -IO__opencheck(IOobject *self) { - if (!self->buf) { - PyErr_SetString(PyExc_ValueError, - "I/O operation on closed file"); - return 0; - } - return 1; +IO__opencheck(IOobject * self) +{ + if (!self->buf) { + PyErr_SetString(PyExc_ValueError, + "I/O operation on closed file"); + return 0; + } + return 1; } static PyObject * -IO_get_closed(IOobject *self, void *closure) +IO_get_closed(IOobject * self, void *closure) { PyObject *result = Py_False; @@ -96,17 +91,19 @@ } static PyGetSetDef file_getsetlist[] = { - {"closed", (getter)IO_get_closed, NULL, "True if the file is closed"}, + {"closed", (getter) IO_get_closed, NULL, "True if the file is closed"}, {0}, }; static PyObject * -IO_flush(IOobject *self, PyObject *unused) { +IO_flush(IOobject * self, PyObject * unused) +{ - if (!IO__opencheck(self)) return NULL; + if (!IO__opencheck(self)) + return NULL; - Py_INCREF(Py_None); - return Py_None; + Py_INCREF(Py_None); + return Py_None; } PyDoc_STRVAR(IO_getval__doc__, @@ -116,202 +113,233 @@ "will include only the text up to the current file position.\n"); static PyObject * -IO_cgetval(PyObject *self) { - if (!IO__opencheck(IOOOBJECT(self))) return NULL; - return PyString_FromStringAndSize(((IOobject*)self)->buf, - ((IOobject*)self)->pos); +IO_cgetval(PyObject * self) +{ + if (!IO__opencheck(IOOOBJECT(self))) + return NULL; + return PyString_FromStringAndSize(((IOobject *) self)->buf, + ((IOobject *) self)->pos); } static PyObject * -IO_getval(IOobject *self, PyObject *args) { - PyObject *use_pos=Py_None; - Py_ssize_t s; - - if (!IO__opencheck(self)) return NULL; - if (!PyArg_UnpackTuple(args,"getval", 0, 1,&use_pos)) return NULL; - - if (PyObject_IsTrue(use_pos)) { - s=self->pos; - if (s > self->string_size) s=self->string_size; - } - else - s=self->string_size; - return PyString_FromStringAndSize(self->buf, s); +IO_getval(IOobject * self, PyObject * args) +{ + PyObject *use_pos = Py_None; + Py_ssize_t s; + + if (!IO__opencheck(self)) + return NULL; + if (!PyArg_UnpackTuple(args, "getval", 0, 1, &use_pos)) + return NULL; + + if (PyObject_IsTrue(use_pos)) { + s = self->pos; + if (s > self->string_size) + s = self->string_size; + } + else { + s = self->string_size; + } + return PyString_FromStringAndSize(self->buf, s); } PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); static PyObject * -IO_isatty(IOobject *self, PyObject *unused) { - if (!IO__opencheck(self)) return NULL; - Py_INCREF(Py_False); - return Py_False; +IO_isatty(IOobject * self, PyObject * unused) +{ + if (!IO__opencheck(self)) + return NULL; + Py_INCREF(Py_False); + return Py_False; } PyDoc_STRVAR(IO_read__doc__, "read([s]) -- Read s characters, or the rest of the string"); static int -IO_cread(PyObject *self, char **output, Py_ssize_t n) { - Py_ssize_t l; +IO_cread(PyObject * self, char **output, Py_ssize_t n) +{ + Py_ssize_t l; - if (!IO__opencheck(IOOOBJECT(self))) return -1; - l = ((IOobject*)self)->string_size - ((IOobject*)self)->pos; - if (n < 0 || n > l) { - n = l; - if (n < 0) n=0; - } + if (!IO__opencheck(IOOOBJECT(self))) + return -1; + l = ((IOobject *) self)->string_size - ((IOobject *) self)->pos; + if (n < 0 || n > l) { + n = l; + if (n < 0) + n = 0; + } - *output=((IOobject*)self)->buf + ((IOobject*)self)->pos; - ((IOobject*)self)->pos += n; - return n; + *output = ((IOobject *) self)->buf + ((IOobject *) self)->pos; + ((IOobject *) self)->pos += n; + return n; } static PyObject * -IO_read(IOobject *self, PyObject *args) { - Py_ssize_t n = -1; - char *output = NULL; +IO_read(IOobject * self, PyObject * args) +{ + Py_ssize_t n = -1; + char *output = NULL; - if (!PyArg_ParseTuple(args, "|n:read", &n)) return NULL; + if (!PyArg_ParseTuple(args, "|n:read", &n)) + return NULL; - if ( (n=IO_cread((PyObject*)self,&output,n)) < 0) return NULL; + if ((n = IO_cread((PyObject *) self, &output, n)) < 0) + return NULL; - return PyString_FromStringAndSize(output, n); + return PyString_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); static int -IO_creadline(PyObject *self, char **output) { - char *n, *s; - Py_ssize_t l; - - if (!IO__opencheck(IOOOBJECT(self))) return -1; - - for (n = ((IOobject*)self)->buf + ((IOobject*)self)->pos, - s = ((IOobject*)self)->buf + ((IOobject*)self)->string_size; - n < s && *n != '\n'; n++); - if (n < s) n++; - - *output=((IOobject*)self)->buf + ((IOobject*)self)->pos; - l = n - ((IOobject*)self)->buf - ((IOobject*)self)->pos; - assert(((IOobject*)self)->pos + l < INT_MAX); - ((IOobject*)self)->pos += (int)l; - return (int)l; +IO_creadline(PyObject * self, char **output) +{ + char *n, *s; + Py_ssize_t l; + + if (!IO__opencheck(IOOOBJECT(self))) + return -1; + + for (n = ((IOobject *) self)->buf + ((IOobject *) self)->pos, + s = ((IOobject *) self)->buf + ((IOobject *) self)->string_size; + n < s && *n != '\n'; n++); + if (n < s) + n++; + + *output = ((IOobject *) self)->buf + ((IOobject *) self)->pos; + l = n - ((IOobject *) self)->buf - ((IOobject *) self)->pos; + assert(((IOobject *) self)->pos + l < INT_MAX); + ((IOobject *) self)->pos += (int) l; + return (int) l; } static PyObject * -IO_readline(IOobject *self, PyObject *args) { - int n, m=-1; - char *output; - - if (args) - if (!PyArg_ParseTuple(args, "|i:readline", &m)) return NULL; - - if( (n=IO_creadline((PyObject*)self,&output)) < 0) return NULL; - if (m >= 0 && m < n) { - m = n - m; - n -= m; - self->pos -= m; - } - return PyString_FromStringAndSize(output, n); +IO_readline(IOobject * self, PyObject * args) +{ + int n, m = -1; + char *output; + + if (args) + if (!PyArg_ParseTuple(args, "|i:readline", &m)) + return NULL; + + if ((n = IO_creadline((PyObject *) self, &output)) < 0) + return NULL; + if (m >= 0 && m < n) { + m = n - m; + n -= m; + self->pos -= m; + } + return PyString_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); static PyObject * -IO_readlines(IOobject *self, PyObject *args) { +IO_readlines(IOobject * self, PyObject * args) +{ int n; char *output; PyObject *result, *line; - int hint = 0, length = 0; - - if (!PyArg_ParseTuple(args, "|i:readlines", &hint)) return NULL; + int hint = 0, length = 0; + + if (!PyArg_ParseTuple(args, "|i:readlines", &hint)) + return NULL; result = PyList_New(0); if (!result) return NULL; - while (1){ - if ( (n = IO_creadline((PyObject*)self,&output)) < 0) - goto err; + while (1) { + if ((n = IO_creadline((PyObject *) self, &output)) < 0) + goto err; if (n == 0) break; - line = PyString_FromStringAndSize (output, n); - if (!line) - goto err; - if (PyList_Append (result, line) == -1) { - Py_DECREF (line); + line = PyString_FromStringAndSize(output, n); + if (!line) + goto err; + if (PyList_Append(result, line) == -1) { + Py_DECREF(line); goto err; } - Py_DECREF (line); - length += n; - if (hint > 0 && length >= hint) + Py_DECREF(line); + length += n; + if (hint > 0 && length >= hint) break; } return result; - err: - Py_DECREF(result); - return NULL; + err: + Py_DECREF(result); + return NULL; } PyDoc_STRVAR(IO_reset__doc__, "reset() -- Reset the file position to the beginning"); static PyObject * -IO_reset(IOobject *self, PyObject *unused) { +IO_reset(IOobject * self, PyObject * unused) +{ - if (!IO__opencheck(self)) return NULL; + if (!IO__opencheck(self)) + return NULL; - self->pos = 0; + self->pos = 0; - Py_INCREF(Py_None); - return Py_None; + Py_INCREF(Py_None); + return Py_None; } PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position."); static PyObject * -IO_tell(IOobject *self, PyObject *unused) { +IO_tell(IOobject * self, PyObject * unused) +{ - if (!IO__opencheck(self)) return NULL; + if (!IO__opencheck(self)) + return NULL; - return PyInt_FromSsize_t(self->pos); + return PyInt_FromSsize_t(self->pos); } PyDoc_STRVAR(IO_truncate__doc__, "truncate(): truncate the file at the current position."); static PyObject * -IO_truncate(IOobject *self, PyObject *args) { - Py_ssize_t pos = -1; - - if (!IO__opencheck(self)) return NULL; - if (!PyArg_ParseTuple(args, "|n:truncate", &pos)) return NULL; +IO_truncate(IOobject * self, PyObject * args) +{ + Py_ssize_t pos = -1; + + if (!IO__opencheck(self)) + return NULL; + if (!PyArg_ParseTuple(args, "|n:truncate", &pos)) + return NULL; if (PyTuple_Size(args) == 0) { /* No argument passed, truncate to current position */ pos = self->pos; } - if (pos < 0) { + if (pos < 0) { errno = EINVAL; PyErr_SetFromErrno(PyExc_IOError); return NULL; } - if (self->string_size > pos) self->string_size = pos; - self->pos = self->string_size; + if (self->string_size > pos) + self->string_size = pos; + self->pos = self->string_size; - Py_INCREF(Py_None); - return Py_None; + Py_INCREF(Py_None); + return Py_None; } static PyObject * -IO_iternext(Iobject *self) +IO_iternext(Iobject * self) { PyObject *next; - next = IO_readline((IOobject *)self, NULL); + next = IO_readline((IOobject *) self, NULL); if (!next) return NULL; if (!PyString_GET_SIZE(next)) { @@ -332,42 +360,47 @@ "seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"); static PyObject * -O_seek(Oobject *self, PyObject *args) { +O_seek(Oobject * self, PyObject * args) +{ Py_ssize_t position; int mode = 0; - if (!IO__opencheck(IOOOBJECT(self))) return NULL; - if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) - return NULL; - - if (mode == 2) { - position += self->string_size; - } - else if (mode == 1) { - position += self->pos; - } - - if (position > self->buf_size) { - char *newbuf; - self->buf_size*=2; - if (self->buf_size <= position) self->buf_size=position+1; - newbuf = (char*) realloc(self->buf,self->buf_size); - if (!newbuf) { - free(self->buf); - self->buf = 0; - self->buf_size=self->pos=0; - return PyErr_NoMemory(); - } - self->buf = newbuf; - } - else if (position < 0) position=0; + if (!IO__opencheck(IOOOBJECT(self))) + return NULL; + if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) + return NULL; + + if (mode == 2) { + position += self->string_size; + } + else if (mode == 1) { + position += self->pos; + } + + if (position > self->buf_size) { + char *newbuf; + self->buf_size *= 2; + if (self->buf_size <= position) + self->buf_size = position + 1; + newbuf = (char *) realloc(self->buf, self->buf_size); + if (!newbuf) { + free(self->buf); + self->buf = 0; + self->buf_size = self->pos = 0; + return PyErr_NoMemory(); + } + self->buf = newbuf; + } + else if (position < 0) + position = 0; - self->pos=position; + self->pos = position; - while (--position >= self->string_size) self->buf[position]=0; + while (--position >= self->string_size) + self->buf[position] = 0; - Py_INCREF(Py_None); - return Py_None; + Py_INCREF(Py_None); + return Py_None; } PyDoc_STRVAR(O_write__doc__, @@ -376,68 +409,75 @@ static int -O_cwrite(PyObject *self, const char *c, Py_ssize_t l) { - Py_ssize_t newl; - Oobject *oself; - char *newbuf; - - if (!IO__opencheck(IOOOBJECT(self))) return -1; - oself = (Oobject *)self; - - newl = oself->pos+l; - if (newl >= oself->buf_size) { - oself->buf_size *= 2; - if (oself->buf_size <= newl) { - assert(newl + 1 < INT_MAX); - oself->buf_size = (int)(newl+1); - } - newbuf = (char*)realloc(oself->buf, oself->buf_size); - if (!newbuf) { - PyErr_SetString(PyExc_MemoryError,"out of memory"); - free(oself->buf); - oself->buf = 0; - oself->buf_size = oself->pos = 0; - return -1; - } - oself->buf = newbuf; - } +O_cwrite(PyObject * self, const char *c, Py_ssize_t l) +{ + Py_ssize_t newl; + Oobject *oself; + char *newbuf; + + if (!IO__opencheck(IOOOBJECT(self))) + return -1; + oself = (Oobject *) self; + + newl = oself->pos + l; + if (newl >= oself->buf_size) { + oself->buf_size *= 2; + if (oself->buf_size <= newl) { + assert(newl + 1 < INT_MAX); + oself->buf_size = (int) (newl + 1); + } + newbuf = (char *) realloc(oself->buf, oself->buf_size); + if (!newbuf) { + PyErr_SetString(PyExc_MemoryError, "out of memory"); + free(oself->buf); + oself->buf = 0; + oself->buf_size = oself->pos = 0; + return -1; + } + oself->buf = newbuf; + } - memcpy(oself->buf+oself->pos,c,l); + memcpy(oself->buf + oself->pos, c, l); assert(oself->pos + l < INT_MAX); - oself->pos += (int)l; + oself->pos += (int) l; - if (oself->string_size < oself->pos) { - oself->string_size = oself->pos; - } + if (oself->string_size < oself->pos) { + oself->string_size = oself->pos; + } - return (int)l; + return (int) l; } static PyObject * -O_write(Oobject *self, PyObject *args) { - char *c; - int l; +O_write(Oobject * self, PyObject * args) +{ + char *c; + int l; - if (!PyArg_ParseTuple(args, "t#:write", &c, &l)) return NULL; + if (!PyArg_ParseTuple(args, "t#:write", &c, &l)) + return NULL; - if (O_cwrite((PyObject*)self,c,l) < 0) return NULL; + if (O_cwrite((PyObject *) self, c, l) < 0) + return NULL; - Py_INCREF(Py_None); - return Py_None; + Py_INCREF(Py_None); + return Py_None; } PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held."); static PyObject * -O_close(Oobject *self, PyObject *unused) { - if (self->buf != NULL) free(self->buf); - self->buf = NULL; +O_close(Oobject * self, PyObject * unused) +{ + if (self->buf != NULL) + free(self->buf); + self->buf = NULL; - self->pos = self->string_size = self->buf_size = 0; + self->pos = self->string_size = self->buf_size = 0; - Py_INCREF(Py_None); - return Py_None; + Py_INCREF(Py_None); + return Py_None; } PyDoc_STRVAR(O_writelines__doc__, @@ -445,10 +485,13 @@ "\n" "Note that newlines are not added. The sequence can be any iterable object\n" "producing strings. This is equivalent to calling write() for each string."); + + static PyObject * -O_writelines(Oobject *self, PyObject *args) { +O_writelines(Oobject * self, PyObject * args) +{ PyObject *it, *s; - + it = PyObject_GetIter(args); if (it == NULL) return NULL; @@ -460,224 +503,243 @@ Py_DECREF(s); return NULL; } - if (O_cwrite((PyObject *)self, c, n) == -1) { + if (O_cwrite((PyObject *) self, c, n) == -1) { Py_DECREF(it); Py_DECREF(s); return NULL; - } - Py_DECREF(s); - } + } + Py_DECREF(s); + } - Py_DECREF(it); + Py_DECREF(it); - /* See if PyIter_Next failed */ - if (PyErr_Occurred()) - return NULL; + /* See if PyIter_Next failed */ + if (PyErr_Occurred()) + return NULL; - Py_RETURN_NONE; + Py_RETURN_NONE; } + static struct PyMethodDef O_methods[] = { - /* Common methods: */ - {"flush", (PyCFunction)IO_flush, METH_NOARGS, IO_flush__doc__}, - {"getvalue", (PyCFunction)IO_getval, METH_VARARGS, IO_getval__doc__}, - {"isatty", (PyCFunction)IO_isatty, METH_NOARGS, IO_isatty__doc__}, - {"read", (PyCFunction)IO_read, METH_VARARGS, IO_read__doc__}, - {"readline", (PyCFunction)IO_readline, METH_VARARGS, IO_readline__doc__}, - {"readlines", (PyCFunction)IO_readlines,METH_VARARGS, IO_readlines__doc__}, - {"reset", (PyCFunction)IO_reset, METH_NOARGS, IO_reset__doc__}, - {"tell", (PyCFunction)IO_tell, METH_NOARGS, IO_tell__doc__}, - {"truncate", (PyCFunction)IO_truncate, METH_VARARGS, IO_truncate__doc__}, - - /* Read-write StringIO specific methods: */ - {"close", (PyCFunction)O_close, METH_NOARGS, O_close__doc__}, - {"seek", (PyCFunction)O_seek, METH_VARARGS, O_seek__doc__}, - {"write", (PyCFunction)O_write, METH_VARARGS, O_write__doc__}, - {"writelines", (PyCFunction)O_writelines, METH_O, O_writelines__doc__}, - {NULL, NULL} /* sentinel */ + /* Common methods: */ + {"flush", (PyCFunction) IO_flush, METH_NOARGS, IO_flush__doc__}, + {"getvalue", (PyCFunction) IO_getval, METH_VARARGS, IO_getval__doc__}, + {"isatty", (PyCFunction) IO_isatty, METH_NOARGS, IO_isatty__doc__}, + {"read", (PyCFunction) IO_read, METH_VARARGS, IO_read__doc__}, + {"readline", (PyCFunction) IO_readline, METH_VARARGS, + IO_readline__doc__}, + {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, + IO_readlines__doc__}, + {"reset", (PyCFunction) IO_reset, METH_NOARGS, IO_reset__doc__}, + {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, + {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, + IO_truncate__doc__}, + + /* Read-write StringIO specific methods: */ + {"close", (PyCFunction) O_close, METH_NOARGS, O_close__doc__}, + {"seek", (PyCFunction) O_seek, METH_VARARGS, O_seek__doc__}, + {"write", (PyCFunction) O_write, METH_VARARGS, O_write__doc__}, + {"writelines", (PyCFunction) O_writelines, METH_O, + O_writelines__doc__}, + {NULL, NULL} /* sentinel */ }; static void -O_dealloc(Oobject *self) { - if (self->buf != NULL) - free(self->buf); - PyObject_Del(self); +O_dealloc(Oobject * self) +{ + if (self->buf != NULL) + free(self->buf); + PyObject_Del(self); } PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); static PyTypeObject Otype = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "cStringIO.StringO", /*tp_name*/ - sizeof(Oobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)O_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr */ - 0, /*tp_setattr */ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0 , /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro */ - 0, /*tp_setattro */ - 0, /*tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - Otype__doc__, /*tp_doc */ - 0, /*tp_traverse */ - 0, /*tp_clear */ - 0, /*tp_richcompare */ - 0, /*tp_weaklistoffset */ - PyObject_SelfIter, /*tp_iter */ - (iternextfunc)IO_iternext, /*tp_iternext */ - O_methods, /*tp_methods */ - 0, /*tp_members */ - file_getsetlist, /*tp_getset */ + PyObject_HEAD_INIT(NULL) + 0, /*ob_size */ + "cStringIO.StringO", /*tp_name */ + sizeof(Oobject), /*tp_basicsize */ + 0, /*tp_itemsize */ + /* methods */ + (destructor) O_dealloc, /*tp_dealloc */ + 0, /*tp_print */ + 0, /*tp_getattr */ + 0, /*tp_setattr */ + 0, /*tp_compare */ + 0, /*tp_repr */ + 0, /*tp_as_number */ + 0, /*tp_as_sequence */ + 0, /*tp_as_mapping */ + 0, /*tp_hash */ + 0, /*tp_call */ + 0, /*tp_str */ + 0, /*tp_getattro */ + 0, /*tp_setattro */ + 0, /*tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /*tp_flags */ + Otype__doc__, /*tp_doc */ + 0, /*tp_traverse */ + 0, /*tp_clear */ + 0, /*tp_richcompare */ + 0, /*tp_weaklistoffset */ + PyObject_SelfIter, /*tp_iter */ + (iternextfunc) IO_iternext, /*tp_iternext */ + O_methods, /*tp_methods */ + 0, /*tp_members */ + file_getsetlist, /*tp_getset */ }; static PyObject * -newOobject(int size) { - Oobject *self; +newOobject(int size) +{ + Oobject *self; - self = PyObject_New(Oobject, &Otype); - if (self == NULL) - return NULL; - self->pos=0; - self->string_size = 0; + self = PyObject_New(Oobject, &Otype); + if (self == NULL) + return NULL; + self->pos = 0; + self->string_size = 0; - self->buf = (char *)malloc(size); + self->buf = (char *) malloc(size); if (!self->buf) { - PyErr_SetString(PyExc_MemoryError,"out of memory"); - self->buf_size = 0; - Py_DECREF(self); - return NULL; - } + PyErr_SetString(PyExc_MemoryError, "out of memory"); + self->buf_size = 0; + Py_DECREF(self); + return NULL; + } - self->buf_size=size; - return (PyObject*)self; + self->buf_size = size; + return (PyObject *) self; } /* End of code for StringO objects */ /* -------------------------------------------------------- */ static PyObject * -I_close(Iobject *self, PyObject *unused) { - Py_XDECREF(self->pbuf); - self->pbuf = NULL; - self->buf = NULL; +I_close(Iobject * self, PyObject * unused) +{ + Py_XDECREF(self->pbuf); + self->pbuf = NULL; + self->buf = NULL; - self->pos = self->string_size = 0; + self->pos = self->string_size = 0; - Py_INCREF(Py_None); - return Py_None; + Py_INCREF(Py_None); + return Py_None; } static PyObject * -I_seek(Iobject *self, PyObject *args) { - Py_ssize_t position; +I_seek(Iobject * self, PyObject * args) +{ + Py_ssize_t position; int mode = 0; - if (!IO__opencheck(IOOOBJECT(self))) return NULL; - if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) - return NULL; + if (!IO__opencheck(IOOOBJECT(self))) + return NULL; + if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) + return NULL; - if (mode == 2) position += self->string_size; - else if (mode == 1) position += self->pos; + if (mode == 2) + position += self->string_size; + else if (mode == 1) + position += self->pos; - if (position < 0) position=0; + if (position < 0) + position = 0; - self->pos=position; + self->pos = position; - Py_INCREF(Py_None); - return Py_None; + Py_INCREF(Py_None); + return Py_None; } static struct PyMethodDef I_methods[] = { - /* Common methods: */ - {"flush", (PyCFunction)IO_flush, METH_NOARGS, IO_flush__doc__}, - {"getvalue", (PyCFunction)IO_getval, METH_VARARGS, IO_getval__doc__}, - {"isatty", (PyCFunction)IO_isatty, METH_NOARGS, IO_isatty__doc__}, - {"read", (PyCFunction)IO_read, METH_VARARGS, IO_read__doc__}, - {"readline", (PyCFunction)IO_readline, METH_VARARGS, IO_readline__doc__}, - {"readlines", (PyCFunction)IO_readlines,METH_VARARGS, IO_readlines__doc__}, - {"reset", (PyCFunction)IO_reset, METH_NOARGS, IO_reset__doc__}, - {"tell", (PyCFunction)IO_tell, METH_NOARGS, IO_tell__doc__}, - {"truncate", (PyCFunction)IO_truncate, METH_VARARGS, IO_truncate__doc__}, - - /* Read-only StringIO specific methods: */ - {"close", (PyCFunction)I_close, METH_NOARGS, O_close__doc__}, - {"seek", (PyCFunction)I_seek, METH_VARARGS, O_seek__doc__}, - {NULL, NULL} + /* Common methods: */ + {"flush", (PyCFunction) IO_flush, METH_NOARGS, IO_flush__doc__}, + {"getvalue", (PyCFunction) IO_getval, METH_VARARGS, IO_getval__doc__}, + {"isatty", (PyCFunction) IO_isatty, METH_NOARGS, IO_isatty__doc__}, + {"read", (PyCFunction) IO_read, METH_VARARGS, IO_read__doc__}, + {"readline", (PyCFunction) IO_readline, METH_VARARGS, + IO_readline__doc__}, + {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, + IO_readlines__doc__}, + {"reset", (PyCFunction) IO_reset, METH_NOARGS, IO_reset__doc__}, + {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, + {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, + IO_truncate__doc__}, + + /* Read-only StringIO specific methods: */ + {"close", (PyCFunction) I_close, METH_NOARGS, O_close__doc__}, + {"seek", (PyCFunction) I_seek, METH_VARARGS, O_seek__doc__}, + {NULL, NULL} }; static void -I_dealloc(Iobject *self) { - Py_XDECREF(self->pbuf); - PyObject_Del(self); +I_dealloc(Iobject * self) +{ + Py_XDECREF(self->pbuf); + PyObject_Del(self); } PyDoc_STRVAR(Itype__doc__, -"Simple type for treating strings as input file streams"); + "Simple type for treating strings as input file streams"); static PyTypeObject Itype = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "cStringIO.StringI", /*tp_name*/ - sizeof(Iobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)I_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /* tp_getattr */ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - Itype__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)IO_iternext, /* tp_iternext */ - I_methods, /* tp_methods */ - 0, /* tp_members */ - file_getsetlist, /* tp_getset */ + PyObject_HEAD_INIT(NULL) + 0, /*ob_size */ + "cStringIO.StringI", /*tp_name */ + sizeof(Iobject), /*tp_basicsize */ + 0, /*tp_itemsize */ + /* methods */ + (destructor) I_dealloc, /*tp_dealloc */ + 0, /*tp_print */ + 0, /* tp_getattr */ + 0, /*tp_setattr */ + 0, /*tp_compare */ + 0, /*tp_repr */ + 0, /*tp_as_number */ + 0, /*tp_as_sequence */ + 0, /*tp_as_mapping */ + 0, /*tp_hash */ + 0, /*tp_call */ + 0, /*tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + Itype__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc) IO_iternext, /* tp_iternext */ + I_methods, /* tp_methods */ + 0, /* tp_members */ + file_getsetlist, /* tp_getset */ }; static PyObject * -newIobject(PyObject *s) { - Iobject *self; - char *buf; - Py_ssize_t size; - - if (PyObject_AsCharBuffer(s, (const char **)&buf, &size) != 0) - return NULL; - - self = PyObject_New(Iobject, &Itype); - if (!self) return NULL; - Py_INCREF(s); - self->buf=buf; - self->string_size=size; - self->pbuf=s; - self->pos=0; - - return (PyObject*)self; +newIobject(PyObject * s) +{ + Iobject *self; + char *buf; + Py_ssize_t size; + + if (PyObject_AsCharBuffer(s, (const char **) &buf, &size) != 0) + return NULL; + + self = PyObject_New(Iobject, &Itype); + if (!self) + return NULL; + Py_INCREF(s); + self->buf = buf; + self->string_size = size; + self->pbuf = s; + self->pos = 0; + + return (PyObject *) self; } /* End of code for StringI objects */ @@ -688,67 +750,74 @@ "StringIO([s]) -- Return a StringIO-like stream for reading or writing"); static PyObject * -IO_StringIO(PyObject *self, PyObject *args) { - PyObject *s=0; +IO_StringIO(PyObject * self, PyObject * args) +{ + PyObject *s = 0; - if (!PyArg_UnpackTuple(args, "StringIO", 0, 1, &s)) return NULL; + if (!PyArg_UnpackTuple(args, "StringIO", 0, 1, &s)) + return NULL; - if (s) return newIobject(s); - return newOobject(128); + if (s) + return newIobject(s); + return newOobject(128); } /* List of methods defined in the module */ static struct PyMethodDef IO_methods[] = { - {"StringIO", (PyCFunction)IO_StringIO, - METH_VARARGS, IO_StringIO__doc__}, - {NULL, NULL} /* sentinel */ + {"StringIO", (PyCFunction) IO_StringIO, + METH_VARARGS, IO_StringIO__doc__}, + {NULL, NULL} /* sentinel */ }; /* Initialization function for the module (*must* be called initcStringIO) */ static struct PycStringIO_CAPI CAPI = { - IO_cread, - IO_creadline, - O_cwrite, - IO_cgetval, - newOobject, - newIobject, - &Itype, - &Otype, + IO_cread, + IO_creadline, + O_cwrite, + IO_cgetval, + newOobject, + newIobject, + &Itype, + &Otype, }; -#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ +#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ #define PyMODINIT_FUNC void #endif PyMODINIT_FUNC -initcStringIO(void) { - PyObject *m, *d, *v; - - - /* Create the module and add the functions */ - m = Py_InitModule4("cStringIO", IO_methods, - cStringIO_module_documentation, - (PyObject*)NULL,PYTHON_API_VERSION); - if (m == NULL) return; - - /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); - - /* Export C API */ - Itype.ob_type=&PyType_Type; - Otype.ob_type=&PyType_Type; - if (PyType_Ready(&Otype) < 0) return; - if (PyType_Ready(&Itype) < 0) return; - PyDict_SetItemString(d,"cStringIO_CAPI", - v = PyCObject_FromVoidPtr(&CAPI,NULL)); - Py_XDECREF(v); - - /* Export Types */ - PyDict_SetItemString(d,"InputType", (PyObject*)&Itype); - PyDict_SetItemString(d,"OutputType", (PyObject*)&Otype); +initcStringIO(void) +{ + PyObject *m, *d, *v; - /* Maybe make certain warnings go away */ - if (0) PycString_IMPORT; + /* Create the module and add the functions */ + m = Py_InitModule4("cStringIO", IO_methods, + cStringIO_module_documentation, + (PyObject *) NULL, PYTHON_API_VERSION); + if (m == NULL) + return; + + /* Add some symbolic constants to the module */ + d = PyModule_GetDict(m); + + /* Export C API */ + Itype.ob_type = &PyType_Type; + Otype.ob_type = &PyType_Type; + if (PyType_Ready(&Otype) < 0) + return; + if (PyType_Ready(&Itype) < 0) + return; + PyDict_SetItemString(d, "cStringIO_CAPI", + v = PyCObject_FromVoidPtr(&CAPI, NULL)); + Py_XDECREF(v); + + /* Export Types */ + PyDict_SetItemString(d, "InputType", (PyObject *) & Itype); + PyDict_SetItemString(d, "OutputType", (PyObject *) & Otype); + + /* Maybe make certain warnings go away */ + if (0) + PycString_IMPORT; } From python-checkins at python.org Wed May 23 22:02:36 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 23 May 2007 22:02:36 +0200 (CEST) Subject: [Python-checkins] r55534 - python/branches/cpy_merge/Modules/cStringIO.c Message-ID: <20070523200236.ACA7A1E4003@bag.python.org> Author: alexandre.vassalotti Date: Wed May 23 22:02:30 2007 New Revision: 55534 Modified: python/branches/cpy_merge/Modules/cStringIO.c Log: Fix the position of the pointers (*) in the declarations. Modified: python/branches/cpy_merge/Modules/cStringIO.c ============================================================================== --- python/branches/cpy_merge/Modules/cStringIO.c (original) +++ python/branches/cpy_merge/Modules/cStringIO.c Wed May 23 22:02:30 2007 @@ -69,7 +69,7 @@ PyDoc_STRVAR(IO_flush__doc__, "flush(): does nothing."); static int -IO__opencheck(IOobject * self) +IO__opencheck(IOobject *self) { if (!self->buf) { PyErr_SetString(PyExc_ValueError, @@ -80,7 +80,7 @@ } static PyObject * -IO_get_closed(IOobject * self, void *closure) +IO_get_closed(IOobject *self, void *closure) { PyObject *result = Py_False; @@ -96,7 +96,7 @@ }; static PyObject * -IO_flush(IOobject * self, PyObject * unused) +IO_flush(IOobject *self, PyObject *unused) { if (!IO__opencheck(self)) @@ -113,7 +113,7 @@ "will include only the text up to the current file position.\n"); static PyObject * -IO_cgetval(PyObject * self) +IO_cgetval(PyObject *self) { if (!IO__opencheck(IOOOBJECT(self))) return NULL; @@ -122,7 +122,7 @@ } static PyObject * -IO_getval(IOobject * self, PyObject * args) +IO_getval(IOobject *self, PyObject *args) { PyObject *use_pos = Py_None; Py_ssize_t s; @@ -146,7 +146,7 @@ PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); static PyObject * -IO_isatty(IOobject * self, PyObject * unused) +IO_isatty(IOobject *self, PyObject *unused) { if (!IO__opencheck(self)) return NULL; @@ -158,7 +158,7 @@ "read([s]) -- Read s characters, or the rest of the string"); static int -IO_cread(PyObject * self, char **output, Py_ssize_t n) +IO_cread(PyObject *self, char **output, Py_ssize_t n) { Py_ssize_t l; @@ -177,7 +177,7 @@ } static PyObject * -IO_read(IOobject * self, PyObject * args) +IO_read(IOobject *self, PyObject *args) { Py_ssize_t n = -1; char *output = NULL; @@ -194,7 +194,7 @@ PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); static int -IO_creadline(PyObject * self, char **output) +IO_creadline(PyObject *self, char **output) { char *n, *s; Py_ssize_t l; @@ -216,7 +216,7 @@ } static PyObject * -IO_readline(IOobject * self, PyObject * args) +IO_readline(IOobject *self, PyObject *args) { int n, m = -1; char *output; @@ -238,7 +238,7 @@ PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); static PyObject * -IO_readlines(IOobject * self, PyObject * args) +IO_readlines(IOobject *self, PyObject *args) { int n; char *output; @@ -279,7 +279,7 @@ "reset() -- Reset the file position to the beginning"); static PyObject * -IO_reset(IOobject * self, PyObject * unused) +IO_reset(IOobject *self, PyObject *unused) { if (!IO__opencheck(self)) @@ -294,7 +294,7 @@ PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position."); static PyObject * -IO_tell(IOobject * self, PyObject * unused) +IO_tell(IOobject *self, PyObject *unused) { if (!IO__opencheck(self)) @@ -307,7 +307,7 @@ "truncate(): truncate the file at the current position."); static PyObject * -IO_truncate(IOobject * self, PyObject * args) +IO_truncate(IOobject *self, PyObject *args) { Py_ssize_t pos = -1; @@ -336,7 +336,7 @@ } static PyObject * -IO_iternext(Iobject * self) +IO_iternext(Iobject *self) { PyObject *next; next = IO_readline((IOobject *) self, NULL); @@ -360,7 +360,7 @@ "seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"); static PyObject * -O_seek(Oobject * self, PyObject * args) +O_seek(Oobject *self, PyObject *args) { Py_ssize_t position; int mode = 0; @@ -409,7 +409,7 @@ static int -O_cwrite(PyObject * self, const char *c, Py_ssize_t l) +O_cwrite(PyObject *self, const char *c, Py_ssize_t l) { Py_ssize_t newl; Oobject *oself; @@ -450,7 +450,7 @@ } static PyObject * -O_write(Oobject * self, PyObject * args) +O_write(Oobject *self, PyObject *args) { char *c; int l; @@ -468,7 +468,7 @@ PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held."); static PyObject * -O_close(Oobject * self, PyObject * unused) +O_close(Oobject *self, PyObject *unused) { if (self->buf != NULL) free(self->buf); @@ -488,7 +488,7 @@ static PyObject * -O_writelines(Oobject * self, PyObject * args) +O_writelines(Oobject *self, PyObject *args) { PyObject *it, *s; @@ -545,7 +545,7 @@ }; static void -O_dealloc(Oobject * self) +O_dealloc(Oobject *self) { if (self->buf != NULL) free(self->buf); @@ -556,7 +556,7 @@ static PyTypeObject Otype = { PyObject_HEAD_INIT(NULL) - 0, /*ob_size */ + 0, /*ob_size */ "cStringIO.StringO", /*tp_name */ sizeof(Oobject), /*tp_basicsize */ 0, /*tp_itemsize */ @@ -616,7 +616,7 @@ /* -------------------------------------------------------- */ static PyObject * -I_close(Iobject * self, PyObject * unused) +I_close(Iobject *self, PyObject *unused) { Py_XDECREF(self->pbuf); self->pbuf = NULL; @@ -629,7 +629,7 @@ } static PyObject * -I_seek(Iobject * self, PyObject * args) +I_seek(Iobject *self, PyObject *args) { Py_ssize_t position; int mode = 0; @@ -675,7 +675,7 @@ }; static void -I_dealloc(Iobject * self) +I_dealloc(Iobject *self) { Py_XDECREF(self->pbuf); PyObject_Del(self); @@ -721,7 +721,7 @@ }; static PyObject * -newIobject(PyObject * s) +newIobject(PyObject *s) { Iobject *self; char *buf; @@ -750,7 +750,7 @@ "StringIO([s]) -- Return a StringIO-like stream for reading or writing"); static PyObject * -IO_StringIO(PyObject * self, PyObject * args) +IO_StringIO(PyObject *self, PyObject *args) { PyObject *s = 0; From python-checkins at python.org Thu May 24 02:12:47 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 24 May 2007 02:12:47 +0200 (CEST) Subject: [Python-checkins] r55541 - python/branches/cpy_merge/Modules/cStringIO.c Message-ID: <20070524001247.0485E1E4005@bag.python.org> Author: alexandre.vassalotti Date: Thu May 24 02:12:37 2007 New Revision: 55541 Modified: python/branches/cpy_merge/Modules/cStringIO.c Log: Moved the docstring after the function declarations. Modified: python/branches/cpy_merge/Modules/cStringIO.c ============================================================================== --- python/branches/cpy_merge/Modules/cStringIO.c (original) +++ python/branches/cpy_merge/Modules/cStringIO.c Thu May 24 02:12:37 2007 @@ -47,7 +47,6 @@ #define IOOOBJECT(O) ((IOobject*)(O)) /* Declarations for objects of type StringO */ - typedef struct { /* Subtype of IOobject */ PyObject_HEAD char *buf; Py_ssize_t pos, string_size; @@ -55,7 +54,6 @@ } Oobject; /* Declarations for objects of type StringI */ - typedef struct { /* Subtype of IOobject */ PyObject_HEAD char *buf; Py_ssize_t pos, string_size; @@ -64,6 +62,7 @@ PyObject *pbuf; } Iobject; + /* IOobject (common) methods */ PyDoc_STRVAR(IO_flush__doc__, "flush(): does nothing."); @@ -112,6 +111,7 @@ "If use_pos is specified and is a true value, then the string returned\n" "will include only the text up to the current file position.\n"); + static PyObject * IO_cgetval(PyObject *self) { @@ -140,11 +140,10 @@ else { s = self->string_size; } + return PyString_FromStringAndSize(self->buf, s); } -PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); - static PyObject * IO_isatty(IOobject *self, PyObject *unused) { @@ -154,8 +153,7 @@ return Py_False; } -PyDoc_STRVAR(IO_read__doc__, -"read([s]) -- Read s characters, or the rest of the string"); +PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); static int IO_cread(PyObject *self, char **output, Py_ssize_t n) @@ -191,7 +189,8 @@ return PyString_FromStringAndSize(output, n); } -PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); +PyDoc_STRVAR(IO_read__doc__, +"read([s]) -- Read s characters, or the rest of the string"); static int IO_creadline(PyObject *self, char **output) @@ -235,7 +234,7 @@ return PyString_FromStringAndSize(output, n); } -PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); +PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); static PyObject * IO_readlines(IOobject *self, PyObject *args) @@ -275,8 +274,7 @@ return NULL; } -PyDoc_STRVAR(IO_reset__doc__, -"reset() -- Reset the file position to the beginning"); +PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); static PyObject * IO_reset(IOobject *self, PyObject *unused) @@ -291,7 +289,8 @@ return Py_None; } -PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position."); +PyDoc_STRVAR(IO_reset__doc__, +"reset() -- Reset the file position to the beginning"); static PyObject * IO_tell(IOobject *self, PyObject *unused) @@ -303,8 +302,7 @@ return PyInt_FromSsize_t(self->pos); } -PyDoc_STRVAR(IO_truncate__doc__, -"truncate(): truncate the file at the current position."); +PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position."); static PyObject * IO_truncate(IOobject *self, PyObject *args) @@ -335,6 +333,9 @@ return Py_None; } +PyDoc_STRVAR(IO_truncate__doc__, +"truncate(): truncate the file at the current position."); + static PyObject * IO_iternext(Iobject *self) { @@ -351,14 +352,8 @@ } - - /* Read-write object methods */ -PyDoc_STRVAR(O_seek__doc__, -"seek(position) -- set the current position\n" -"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"); - static PyObject * O_seek(Oobject *self, PyObject *args) { @@ -403,10 +398,9 @@ return Py_None; } -PyDoc_STRVAR(O_write__doc__, -"write(s) -- Write a string to the file" -"\n\nNote (hack:) writing None resets the buffer"); - +PyDoc_STRVAR(O_seek__doc__, +"seek(position) -- set the current position\n" +"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"); static int O_cwrite(PyObject *self, const char *c, Py_ssize_t l) @@ -465,7 +459,9 @@ return Py_None; } -PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held."); +PyDoc_STRVAR(O_write__doc__, +"write(s) -- Write a string to the file" +"\n\nNote (hack:) writing None resets the buffer"); static PyObject * O_close(Oobject *self, PyObject *unused) @@ -480,12 +476,7 @@ return Py_None; } -PyDoc_STRVAR(O_writelines__doc__, -"writelines(sequence_of_strings) -> None. Write the strings to the file.\n" -"\n" -"Note that newlines are not added. The sequence can be any iterable object\n" -"producing strings. This is equivalent to calling write() for each string."); - +PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held."); static PyObject * O_writelines(Oobject *self, PyObject *args) @@ -520,6 +511,13 @@ Py_RETURN_NONE; } +PyDoc_STRVAR(O_writelines__doc__, +"writelines(sequence_of_strings) -> None. Write the strings to the file.\n" +"\n" +"Note that newlines are not added. The sequence can be any iterable object\n" +"producing strings. This is equivalent to calling write() for each string."); + + static struct PyMethodDef O_methods[] = { /* Common methods: */ {"flush", (PyCFunction) IO_flush, METH_NOARGS, IO_flush__doc__}, @@ -552,8 +550,6 @@ PyObject_Del(self); } -PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); - static PyTypeObject Otype = { PyObject_HEAD_INIT(NULL) 0, /*ob_size */ @@ -589,6 +585,8 @@ file_getsetlist, /*tp_getset */ }; +PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); + static PyObject * newOobject(int size) { @@ -681,10 +679,6 @@ PyObject_Del(self); } - -PyDoc_STRVAR(Itype__doc__, - "Simple type for treating strings as input file streams"); - static PyTypeObject Itype = { PyObject_HEAD_INIT(NULL) 0, /*ob_size */ @@ -720,6 +714,9 @@ file_getsetlist, /* tp_getset */ }; +PyDoc_STRVAR(Itype__doc__, + "Simple type for treating strings as input file streams"); + static PyObject * newIobject(PyObject *s) { @@ -745,10 +742,6 @@ /* End of code for StringI objects */ /* -------------------------------------------------------- */ - -PyDoc_STRVAR(IO_StringIO__doc__, -"StringIO([s]) -- Return a StringIO-like stream for reading or writing"); - static PyObject * IO_StringIO(PyObject *self, PyObject *args) { @@ -762,8 +755,10 @@ return newOobject(128); } -/* List of methods defined in the module */ +PyDoc_STRVAR(IO_StringIO__doc__, +"StringIO([s]) -- Return a StringIO-like stream for reading or writing"); +/* List of methods defined in the module */ static struct PyMethodDef IO_methods[] = { {"StringIO", (PyCFunction) IO_StringIO, METH_VARARGS, IO_StringIO__doc__}, @@ -772,7 +767,6 @@ /* Initialization function for the module (*must* be called initcStringIO) */ - static struct PycStringIO_CAPI CAPI = { IO_cread, IO_creadline, From python-checkins at python.org Thu May 24 02:20:50 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 24 May 2007 02:20:50 +0200 (CEST) Subject: [Python-checkins] r55542 - python/branches/cpy_merge/Modules/cStringIO.c Message-ID: <20070524002050.8DE771E4003@bag.python.org> Author: alexandre.vassalotti Date: Thu May 24 02:20:45 2007 New Revision: 55542 Modified: python/branches/cpy_merge/Modules/cStringIO.c Log: Fix a small build error due to the docstring move. (oops) Modified: python/branches/cpy_merge/Modules/cStringIO.c ============================================================================== --- python/branches/cpy_merge/Modules/cStringIO.c (original) +++ python/branches/cpy_merge/Modules/cStringIO.c Thu May 24 02:20:45 2007 @@ -124,24 +124,9 @@ static PyObject * IO_getval(IOobject *self, PyObject *args) { - PyObject *use_pos = Py_None; - Py_ssize_t s; - if (!IO__opencheck(self)) return NULL; - if (!PyArg_UnpackTuple(args, "getval", 0, 1, &use_pos)) - return NULL; - - if (PyObject_IsTrue(use_pos)) { - s = self->pos; - if (s > self->string_size) - s = self->string_size; - } - else { - s = self->string_size; - } - - return PyString_FromStringAndSize(self->buf, s); + return PyString_FromStringAndSize(self->buf, self->string_size); } static PyObject * @@ -550,6 +535,9 @@ PyObject_Del(self); } + +PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); + static PyTypeObject Otype = { PyObject_HEAD_INIT(NULL) 0, /*ob_size */ @@ -585,8 +573,6 @@ file_getsetlist, /*tp_getset */ }; -PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); - static PyObject * newOobject(int size) { @@ -679,6 +665,9 @@ PyObject_Del(self); } +PyDoc_STRVAR(Itype__doc__, + "Simple type for treating strings as input file streams"); + static PyTypeObject Itype = { PyObject_HEAD_INIT(NULL) 0, /*ob_size */ @@ -714,9 +703,6 @@ file_getsetlist, /* tp_getset */ }; -PyDoc_STRVAR(Itype__doc__, - "Simple type for treating strings as input file streams"); - static PyObject * newIobject(PyObject *s) { From alexandre at peadrop.com Thu May 24 02:31:59 2007 From: alexandre at peadrop.com (Alexandre Vassalotti) Date: Wed, 23 May 2007 20:31:59 -0400 Subject: [Python-checkins] r55542 - python/branches/cpy_merge/Modules/cStringIO.c In-Reply-To: <20070524002050.8DE771E4003@bag.python.org> References: <20070524002050.8DE771E4003@bag.python.org> Message-ID: > Author: alexandre.vassalotti > Date: Thu May 24 02:20:45 2007 > New Revision: 55542 > > Modified: > python/branches/cpy_merge/Modules/cStringIO.c > Log: > Fix a small build error due to the docstring move. (oops) > > Not again... I checked in a change to IO_getval by mistake, which was supposed to go in my next commit. I guess I will need to be more careful now. > Modified: python/branches/cpy_merge/Modules/cStringIO.c > ============================================================================== > --- python/branches/cpy_merge/Modules/cStringIO.c (original) > +++ python/branches/cpy_merge/Modules/cStringIO.c Thu May 24 02:20:45 2007 > @@ -124,24 +124,9 @@ > static PyObject * > IO_getval(IOobject *self, PyObject *args) > { > - PyObject *use_pos = Py_None; > - Py_ssize_t s; > - > if (!IO__opencheck(self)) > return NULL; > - if (!PyArg_UnpackTuple(args, "getval", 0, 1, &use_pos)) > - return NULL; > - > - if (PyObject_IsTrue(use_pos)) { > - s = self->pos; > - if (s > self->string_size) > - s = self->string_size; > - } > - else { > - s = self->string_size; > - } > - > - return PyString_FromStringAndSize(self->buf, s); > + return PyString_FromStringAndSize(self->buf, self->string_size); > } -- Alexandre From nnorwitz at gmail.com Thu May 24 11:07:32 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 24 May 2007 05:07:32 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20070524090732.GA14675@python.psfb.org> test_popen2 leaked [-26, 26, -26] references, sum=-26 From python-checkins at python.org Thu May 24 18:49:36 2007 From: python-checkins at python.org (georg.brandl) Date: Thu, 24 May 2007 18:49:36 +0200 (CEST) Subject: [Python-checkins] r55549 - in python/trunk: Doc/lib/libshlex.tex Lib/shlex.py Misc/NEWS Message-ID: <20070524164936.D39DE1E4005@bag.python.org> Author: georg.brandl Date: Thu May 24 18:49:29 2007 New Revision: 55549 Modified: python/trunk/Doc/lib/libshlex.tex python/trunk/Lib/shlex.py python/trunk/Misc/NEWS Log: shlex.split() now has an optional "posix" parameter. Modified: python/trunk/Doc/lib/libshlex.tex ============================================================================== --- python/trunk/Doc/lib/libshlex.tex (original) +++ python/trunk/Doc/lib/libshlex.tex Thu May 24 18:49:29 2007 @@ -19,13 +19,15 @@ The \module{shlex} module defines the following functions: -\begin{funcdesc}{split}{s\optional{, comments}} +\begin{funcdesc}{split}{s\optional{, comments\optional{, posix}}} Split the string \var{s} using shell-like syntax. If \var{comments} is \constant{False} (the default), the parsing of comments in the given string will be disabled (setting the \member{commenters} member of the \class{shlex} instance to the empty string). This function operates -in \POSIX{} mode. +in \POSIX{} mode by default, but uses non-\POSIX{} mode if the +\var{posix} argument is false. \versionadded{2.3} +\versionchanged[Added the \var{posix} parameter]{2.6} \end{funcdesc} The \module{shlex} module defines the following class: Modified: python/trunk/Lib/shlex.py ============================================================================== --- python/trunk/Lib/shlex.py (original) +++ python/trunk/Lib/shlex.py Thu May 24 18:49:29 2007 @@ -271,8 +271,8 @@ raise StopIteration return token -def split(s, comments=False): - lex = shlex(s, posix=True) +def split(s, comments=False, posix=True): + lex = shlex(s, posix) lex.whitespace_split = True if not comments: lex.commenters = '' Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu May 24 18:49:29 2007 @@ -217,6 +217,8 @@ Library ------- +- shlex.split() now has an optional "posix" parameter. + - The posixfile module now raises a DeprecationWarning. - Remove the gopherlib module. This also leads to the removal of gopher From buildbot at python.org Thu May 24 19:12:59 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 17:12:59 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20070524171300.125971E4005@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2215 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_shlex ====================================================================== FAIL: Test data splitting with posix parser ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_shlex.py", line 172, in testSplitPosix self.splitTest(self.posix_data, comments=True) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_shlex.py", line 159, in splitTest (data[i][0], l, data[i][1:])) AssertionError: \x bar: ['\\x', 'bar'] != ['x', 'bar'] make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu May 24 19:13:48 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 17:13:48 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-2 trunk Message-ID: <20070524171348.475C61E4006@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%2520trunk/builds/5 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_shlex ====================================================================== FAIL: Test data splitting with posix parser ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_shlex.py", line 172, in testSplitPosix self.splitTest(self.posix_data, comments=True) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_shlex.py", line 159, in splitTest (data[i][0], l, data[i][1:])) AssertionError: \x bar: ['\\x', 'bar'] != ['x', 'bar'] sincerely, -The Buildbot From buildbot at python.org Thu May 24 19:14:30 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 17:14:30 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070524171430.970511E4007@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/557 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_shlex ====================================================================== FAIL: Test data splitting with posix parser ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_shlex.py", line 172, in testSplitPosix self.splitTest(self.posix_data, comments=True) File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_shlex.py", line 159, in splitTest (data[i][0], l, data[i][1:])) AssertionError: \x bar: ['\\x', 'bar'] != ['x', 'bar'] make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu May 24 19:18:05 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 17:18:05 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070524171805.9E8C31E4005@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/304 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_shlex ====================================================================== FAIL: Test data splitting with posix parser ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_shlex.py", line 172, in testSplitPosix self.splitTest(self.posix_data, comments=True) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_shlex.py", line 159, in splitTest (data[i][0], l, data[i][1:])) AssertionError: \x bar: ['\\x', 'bar'] != ['x', 'bar'] sincerely, -The Buildbot From python-checkins at python.org Thu May 24 19:33:39 2007 From: python-checkins at python.org (georg.brandl) Date: Thu, 24 May 2007 19:33:39 +0200 (CEST) Subject: [Python-checkins] r55550 - python/trunk/Lib/shlex.py Message-ID: <20070524173339.341BA1E4005@bag.python.org> Author: georg.brandl Date: Thu May 24 19:33:33 2007 New Revision: 55550 Modified: python/trunk/Lib/shlex.py Log: Fix parameter passing. Modified: python/trunk/Lib/shlex.py ============================================================================== --- python/trunk/Lib/shlex.py (original) +++ python/trunk/Lib/shlex.py Thu May 24 19:33:33 2007 @@ -272,7 +272,7 @@ return token def split(s, comments=False, posix=True): - lex = shlex(s, posix) + lex = shlex(s, posix=posix) lex.whitespace_split = True if not comments: lex.commenters = '' From buildbot at python.org Thu May 24 19:34:38 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 17:34:38 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070524173438.F106F1E4005@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2036 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_shlex ====================================================================== FAIL: Test data splitting with posix parser ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_shlex.py", line 172, in testSplitPosix self.splitTest(self.posix_data, comments=True) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_shlex.py", line 159, in splitTest (data[i][0], l, data[i][1:])) AssertionError: \x bar: ['\\x', 'bar'] != ['x', 'bar'] sincerely, -The Buildbot From buildbot at python.org Thu May 24 19:38:02 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 17:38:02 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20070524173802.53E921E401D@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%2520osx.4%2520trunk/builds/2044 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_shlex ====================================================================== FAIL: Test data splitting with posix parser ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_shlex.py", line 172, in testSplitPosix self.splitTest(self.posix_data, comments=True) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_shlex.py", line 159, in splitTest (data[i][0], l, data[i][1:])) AssertionError: \x bar: ['\\x', 'bar'] != ['x', 'bar'] make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu May 24 19:43:54 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 17:43:54 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20070524174354.EDFC01E4019@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/674 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_shlex ====================================================================== FAIL: Test data splitting with posix parser ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_shlex.py", line 172, in testSplitPosix self.splitTest(self.posix_data, comments=True) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_shlex.py", line 159, in splitTest (data[i][0], l, data[i][1:])) AssertionError: \x bar: ['\\x', 'bar'] != ['x', 'bar'] make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu May 24 19:48:10 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 17:48:10 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20070524174810.2DD031E4033@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%2520trunk/builds/960 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_shlex ====================================================================== FAIL: Test data splitting with posix parser ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/test/test_shlex.py", line 172, in testSplitPosix self.splitTest(self.posix_data, comments=True) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/test/test_shlex.py", line 159, in splitTest (data[i][0], l, data[i][1:])) AssertionError: \x bar: ['\\x', 'bar'] != ['x', 'bar'] make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu May 24 19:50:58 2007 From: python-checkins at python.org (facundo.batista) Date: Thu, 24 May 2007 19:50:58 +0200 (CEST) Subject: [Python-checkins] r55555 - in python/trunk: Lib/test/test_urllib.py Lib/urllib.py Misc/NEWS Message-ID: <20070524175058.06E561E401C@bag.python.org> Author: facundo.batista Date: Thu May 24 19:50:54 2007 New Revision: 55555 Modified: python/trunk/Lib/test/test_urllib.py python/trunk/Lib/urllib.py python/trunk/Misc/NEWS Log: Added an optional timeout parameter to urllib.ftpwrapper, with tests (for this and a basic one, because there weren't any). Changed also NEWS, but didn't find documentation for this function, assumed it wasn't public... Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Thu May 24 19:50:54 2007 @@ -8,6 +8,10 @@ import mimetools import tempfile import StringIO +import ftplib +import threading +import socket +import time def hexescape(char): """Escape char as RFC 2396 specifies""" @@ -541,6 +545,66 @@ "url2pathname() failed; %s != %s" % (expect, result)) +def server(evt): + serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + serv.settimeout(3) + serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + serv.bind(("", 9091)) + serv.listen(5) + try: + conn, addr = serv.accept() + except socket.timeout: + pass + else: + conn.send("1 Hola mundo\n") + conn.recv(200) + conn.send("2 No more lines\n") + conn.close() + finally: + serv.close() + evt.set() + +class FTPWrapperTests(unittest.TestCase): + + def setUp(self): + ftplib.FTP.port = 9091 + self.evt = threading.Event() + threading.Thread(target=server, args=(self.evt,)).start() + time.sleep(.1) + + def tearDown(self): + self.evt.wait() + + def testBasic(self): + # connects + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) + ftp.ftp.sock.close() + + def testTimeoutDefault(self): + # default + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) + self.assertTrue(ftp.ftp.sock.gettimeout() is None) + ftp.ftp.sock.close() + + def testTimeoutValue(self): + # a value + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) + self.assertEqual(ftp.ftp.sock.gettimeout(), 30) + ftp.ftp.sock.close() + + + def testTimeoutNone(self): + # None, having other default + previous = socket.getdefaulttimeout() + socket.setdefaulttimeout(30) + try: + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) + finally: + socket.setdefaulttimeout(previous) + self.assertEqual(ftp.ftp.sock.gettimeout(), 30) + ftp.ftp.close() + + def test_main(): @@ -551,7 +615,8 @@ QuotingTests, UnquotingTests, urlencode_Tests, - Pathname_Tests + Pathname_Tests, + FTPWrapperTests, ) Modified: python/trunk/Lib/urllib.py ============================================================================== --- python/trunk/Lib/urllib.py (original) +++ python/trunk/Lib/urllib.py Thu May 24 19:50:54 2007 @@ -819,19 +819,20 @@ class ftpwrapper: """Class used by open_ftp() for cache of open FTP connections.""" - def __init__(self, user, passwd, host, port, dirs): + def __init__(self, user, passwd, host, port, dirs, timeout=None): self.user = user self.passwd = passwd self.host = host self.port = port self.dirs = dirs + self.timeout = timeout self.init() def init(self): import ftplib self.busy = 0 self.ftp = ftplib.FTP() - self.ftp.connect(self.host, self.port) + self.ftp.connect(self.host, self.port, self.timeout) self.ftp.login(self.user, self.passwd) for dir in self.dirs: self.ftp.cwd(dir) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu May 24 19:50:54 2007 @@ -217,6 +217,8 @@ Library ------- +- urllib.ftpwrapper class now accepts an optional timeout. + - shlex.split() now has an optional "posix" parameter. - The posixfile module now raises a DeprecationWarning. From buildbot at python.org Thu May 24 20:15:04 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 18:15:04 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-2 trunk Message-ID: <20070524181504.82BD61E4015@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%2520trunk/builds/7 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib ====================================================================== ERROR: testBasic (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_urllib.py", line 580, in testBasic ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\urllib.py", line 829, in __init__ self.init() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 241, in sendcmd return self.getresp() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 207, in getresp resp = self.getmultiline() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 193, in getmultiline line = self.getline() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 180, in getline line = self.file.readline() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (10054, 'Connection reset by peer') ====================================================================== ERROR: testTimeoutDefault (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_urllib.py", line 585, in testTimeoutDefault ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\urllib.py", line 829, in __init__ self.init() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 241, in sendcmd return self.getresp() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 207, in getresp resp = self.getmultiline() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 193, in getmultiline line = self.getline() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 180, in getline line = self.file.readline() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (10054, 'Connection reset by peer') ====================================================================== ERROR: testTimeoutValue (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_urllib.py", line 591, in testTimeoutValue ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\urllib.py", line 829, in __init__ self.init() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 241, in sendcmd return self.getresp() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 207, in getresp resp = self.getmultiline() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 193, in getmultiline line = self.getline() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\ftplib.py", line 180, in getline line = self.file.readline() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (10054, 'Connection reset by peer') Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\Code\bb_slave\trunk.peters-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') sincerely, -The Buildbot From buildbot at python.org Thu May 24 20:27:41 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 18:27:41 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070524182741.5DB151E402D@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/306 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib ====================================================================== ERROR: testBasic (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 580, in testBasic ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 829, in __init__ self.init() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 241, in sendcmd return self.getresp() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 207, in getresp resp = self.getmultiline() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 193, in getmultiline line = self.getline() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 180, in getline line = self.file.readline() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (10054, 'Connection reset by peer') ====================================================================== ERROR: testTimeoutDefault (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 585, in testTimeoutDefault ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 829, in __init__ self.init() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 241, in sendcmd return self.getresp() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 207, in getresp resp = self.getmultiline() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 193, in getmultiline line = self.getline() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 180, in getline line = self.file.readline() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (10054, 'Connection reset by peer') ====================================================================== ERROR: testTimeoutValue (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 591, in testTimeoutValue ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 829, in __init__ self.init() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 241, in sendcmd return self.getresp() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 207, in getresp resp = self.getmultiline() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 193, in getmultiline line = self.getline() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\ftplib.py", line 180, in getline line = self.file.readline() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (10054, 'Connection reset by peer') Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 460, in __bootstrap self.run() File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_urllib.py", line 560, in server conn.recv(200) error: (10035, 'The socket operation could not complete without blocking') sincerely, -The Buildbot From brett at python.org Thu May 24 20:30:15 2007 From: brett at python.org (Brett Cannon) Date: Thu, 24 May 2007 11:30:15 -0700 Subject: [Python-checkins] r55542 - python/branches/cpy_merge/Modules/cStringIO.c In-Reply-To: References: <20070524002050.8DE771E4003@bag.python.org> Message-ID: On 5/23/07, Alexandre Vassalotti wrote: > > > Author: alexandre.vassalotti > > Date: Thu May 24 02:20:45 2007 > > New Revision: 55542 > > > > Modified: > > python/branches/cpy_merge/Modules/cStringIO.c > > Log: > > Fix a small build error due to the docstring move. (oops) > > > > > > Not again... I checked in a change to IO_getval by mistake, which was > supposed to go in my next commit. I guess I will need to be more > careful now. =) This is why we work in branches. Plus you will just get in the habit of doing a lot of little commits. Otherwise just edit the log message (dev FAQ says how) and mention what you accidentally left out. -Brett > Modified: python/branches/cpy_merge/Modules/cStringIO.c > > > ============================================================================== > > --- python/branches/cpy_merge/Modules/cStringIO.c (original) > > +++ python/branches/cpy_merge/Modules/cStringIO.c Thu May 24 > 02:20:45 2007 > > @@ -124,24 +124,9 @@ > > static PyObject * > > IO_getval(IOobject *self, PyObject *args) > > { > > - PyObject *use_pos = Py_None; > > - Py_ssize_t s; > > - > > if (!IO__opencheck(self)) > > return NULL; > > - if (!PyArg_UnpackTuple(args, "getval", 0, 1, &use_pos)) > > - return NULL; > > - > > - if (PyObject_IsTrue(use_pos)) { > > - s = self->pos; > > - if (s > self->string_size) > > - s = self->string_size; > > - } > > - else { > > - s = self->string_size; > > - } > > - > > - return PyString_FromStringAndSize(self->buf, s); > > + return PyString_FromStringAndSize(self->buf, self->string_size); > > } > > -- Alexandre > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20070524/f6bc3e86/attachment.htm From python-checkins at python.org Thu May 24 20:44:05 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 24 May 2007 20:44:05 +0200 (CEST) Subject: [Python-checkins] r55542 - svn:log Message-ID: <20070524184405.160B41E4005@bag.python.org> Author: alexandre.vassalotti Revision: 55542 Property Name: svn:log New Property Value: Fix a small build error due to the docstring move. (oops) Remove the optional argument of IO_getval. From buildbot at python.org Thu May 24 20:53:59 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 18:53:59 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070524185359.681C31E4005@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2038 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (11, 'Resource temporarily unavailable') Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (11, 'Resource temporarily unavailable') Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (11, 'Resource temporarily unavailable') 1 test failed: test_urllib Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (11, 'Resource temporarily unavailable') Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (11, 'Resource temporarily unavailable') Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (11, 'Resource temporarily unavailable') ====================================================================== ERROR: testBasic (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 580, in testBasic ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 829, in __init__ self.init() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 183, in getline if not line: raise EOFError EOFError ====================================================================== ERROR: testTimeoutDefault (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 585, in testTimeoutDefault ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 829, in __init__ self.init() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 183, in getline if not line: raise EOFError EOFError ====================================================================== ERROR: testTimeoutValue (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 591, in testTimeoutValue ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 829, in __init__ self.init() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 183, in getline if not line: raise EOFError EOFError sincerely, -The Buildbot From buildbot at python.org Thu May 24 21:06:54 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 19:06:54 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20070524190654.633361E4005@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%2520osx.4%2520trunk/builds/2046 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (35, 'Resource temporarily unavailable') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (35, 'Resource temporarily unavailable') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (35, 'Resource temporarily unavailable') 1 test failed: test_urllib Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (35, 'Resource temporarily unavailable') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (35, 'Resource temporarily unavailable') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(200) error: (35, 'Resource temporarily unavailable') ====================================================================== ERROR: testBasic (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 580, in testBasic ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 829, in __init__ self.init() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 180, in getline line = self.file.readline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (54, 'Connection reset by peer') ====================================================================== ERROR: testTimeoutDefault (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 585, in testTimeoutDefault ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 829, in __init__ self.init() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 180, in getline line = self.file.readline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (54, 'Connection reset by peer') ====================================================================== ERROR: testTimeoutValue (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 591, in testTimeoutValue ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 829, in __init__ self.init() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 180, in getline line = self.file.readline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (54, 'Connection reset by peer') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu May 24 22:02:05 2007 From: python-checkins at python.org (facundo.batista) Date: Thu, 24 May 2007 22:02:05 +0200 (CEST) Subject: [Python-checkins] r55563 - python/trunk/Lib/test/test_urllib.py Message-ID: <20070524200205.EBDD31E4017@bag.python.org> Author: facundo.batista Date: Thu May 24 22:01:59 2007 New Revision: 55563 Modified: python/trunk/Lib/test/test_urllib.py Log: Removed the .recv() in the test, is not necessary, and was causing problems that didn't have anything to do with was actually being tested... Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Thu May 24 22:01:59 2007 @@ -557,7 +557,6 @@ pass else: conn.send("1 Hola mundo\n") - conn.recv(200) conn.send("2 No more lines\n") conn.close() finally: From buildbot at python.org Thu May 24 22:16:07 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 20:16:07 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian trunk Message-ID: <20070524201607.6007B1E4013@bag.python.org> The Buildbot has detected a new failure of MIPS Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%2520trunk/builds/833 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_shlex ====================================================================== FAIL: Test data splitting with posix parser ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-mips/build/Lib/test/test_shlex.py", line 172, in testSplitPosix self.splitTest(self.posix_data, comments=True) File "/home/pybot/buildarea/trunk.klose-debian-mips/build/Lib/test/test_shlex.py", line 159, in splitTest (data[i][0], l, data[i][1:])) AssertionError: \x bar: ['\\x', 'bar'] != ['x', 'bar'] make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu May 24 22:51:22 2007 From: python-checkins at python.org (facundo.batista) Date: Thu, 24 May 2007 22:51:22 +0200 (CEST) Subject: [Python-checkins] r55564 - python/trunk/Lib/test/test_urllib.py Message-ID: <20070524205122.692AA1E4005@bag.python.org> Author: facundo.batista Date: Thu May 24 22:51:19 2007 New Revision: 55564 Modified: python/trunk/Lib/test/test_urllib.py Log: Let's see if reading exactly what is written allow this live test to pass (now I know why there were so few tests in ftp, http, etc, :( ). Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Thu May 24 22:51:19 2007 @@ -557,6 +557,7 @@ pass else: conn.send("1 Hola mundo\n") + conn.recv(13) conn.send("2 No more lines\n") conn.close() finally: From buildbot at python.org Thu May 24 23:02:32 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 21:02:32 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20070524210232.29C961E4020@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2218 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_urllib.py", line 552, in server serv.bind(("", 9091)) File "", line 1, in bind error: (98, 'Address already in use') sincerely, -The Buildbot From buildbot at python.org Thu May 24 23:33:57 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 21:33:57 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070524213357.4483A1E4005@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2040 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (11, 'Resource temporarily unavailable') Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (11, 'Resource temporarily unavailable') Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (11, 'Resource temporarily unavailable') 1 test failed: test_urllib Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (11, 'Resource temporarily unavailable') Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (11, 'Resource temporarily unavailable') Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (11, 'Resource temporarily unavailable') ====================================================================== ERROR: testBasic (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 580, in testBasic ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 829, in __init__ self.init() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 183, in getline if not line: raise EOFError EOFError ====================================================================== ERROR: testTimeoutDefault (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 585, in testTimeoutDefault ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 829, in __init__ self.init() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 183, in getline if not line: raise EOFError EOFError ====================================================================== ERROR: testTimeoutValue (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_urllib.py", line 591, in testTimeoutValue ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 829, in __init__ self.init() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/ftplib.py", line 183, in getline if not line: raise EOFError EOFError sincerely, -The Buildbot From buildbot at python.org Thu May 24 23:41:01 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 24 May 2007 21:41:01 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20070524214102.1D3091E4005@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%2520osx.4%2520trunk/builds/2048 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (35, 'Resource temporarily unavailable') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (35, 'Resource temporarily unavailable') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (35, 'Resource temporarily unavailable') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '2003-2003-2003-2003-2003' Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '1006-1006-1006-1006-1006' Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '0005-0005-0005-0005-0005' 1 test failed: test_urllib Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (35, 'Resource temporarily unavailable') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (35, 'Resource temporarily unavailable') Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 560, in server conn.recv(13) error: (35, 'Resource temporarily unavailable') ====================================================================== ERROR: testBasic (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 580, in testBasic ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 829, in __init__ self.init() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 180, in getline line = self.file.readline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (54, 'Connection reset by peer') ====================================================================== ERROR: testTimeoutDefault (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 585, in testTimeoutDefault ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 829, in __init__ self.init() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 180, in getline line = self.file.readline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (54, 'Connection reset by peer') ====================================================================== ERROR: testTimeoutValue (test.test_urllib.FTPWrapperTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 591, in testTimeoutValue ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 829, in __init__ self.init() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 836, in init self.ftp.login(self.user, self.passwd) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 372, in login resp = self.sendcmd('USER ' + user) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 241, in sendcmd return self.getresp() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 207, in getresp resp = self.getmultiline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 193, in getmultiline line = self.getline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ftplib.py", line 180, in getline line = self.file.readline() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/socket.py", line 347, in readline data = self._sock.recv(self._rbufsize) error: (54, 'Connection reset by peer') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri May 25 02:01:48 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 25 May 2007 02:01:48 +0200 (CEST) Subject: [Python-checkins] r55566 - peps/trunk/pep-0000.txt peps/trunk/pep-3119.txt peps/trunk/pep-3133.txt Message-ID: <20070525000148.941541E4005@bag.python.org> Author: guido.van.rossum Date: Fri May 25 02:01:46 2007 New Revision: 55566 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3119.txt peps/trunk/pep-3133.txt Log: Accepting PEP 3119, rejecting its competitor PEP 3133. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 25 02:01:46 2007 @@ -80,6 +80,7 @@ SA 3111 Simple input built-in in Python 3000 Roberge SA 3112 Bytes literals in Python 3000 Orendorff SA 3115 Metaclasses in Python 3000 Talin + SA 3119 Introducing Abstract Base Classes GvR, Talin SA 3120 Using UTF-8 as the default source encoding von L?wis SA 3121 Extension Module Initialization & Finalization von L?wis SA 3123 Making PyObject_HEAD conform to standard C von L?wis @@ -102,9 +103,7 @@ S 3108 Standard Library Reorganization Cannon S 3116 New I/O Stutzbach, Verdone, GvR S 3118 Revising the buffer protocol Oliphant, Banks - S 3119 Introducing Abstract Base Classes GvR, Talin S 3124 Overloading, Generic Functions, Interfaces Eby - S 3133 Introducing Roles Winter S 3141 A Type Hierarchy for Numbers Yasskin Finished PEPs (done, implemented in Subversion) @@ -270,6 +269,7 @@ SR 3126 Remove Implicit String Concatenation Jewett SR 3128 BList: A Faster List-like Type Stutzbach SR 3130 Access to Current Module/Class/Function Jewett + SR 3133 Introducing Roles Winter Numerical Index @@ -489,7 +489,7 @@ S 3116 New I/O Stutzbach, Verdone, GvR SR 3117 Postfix Type Declarations Brandl S 3118 Revising the buffer protocol Oliphant, Banks - S 3119 Introducing Abstract Base Classes GvR, Talin + SA 3119 Introducing Abstract Base Classes GvR, Talin SA 3120 Using UTF-8 as the default source encoding von L?wis SA 3121 Extension Module Initialization & Finalization von L?wis SR 3122 Delineation of the main module Cannon @@ -503,7 +503,7 @@ SR 3130 Access to Current Module/Class/Function Jewett SA 3131 Supporting Non-ASCII Identifiers von L?wis SF 3132 Extended Iterable Unpacking Brandl - S 3133 Introducing Roles Winter + SR 3133 Introducing Roles Winter S 3141 A Type Hierarchy for Numbers Yasskin Modified: peps/trunk/pep-3119.txt ============================================================================== --- peps/trunk/pep-3119.txt (original) +++ peps/trunk/pep-3119.txt Fri May 25 02:01:46 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Guido van Rossum , Talin -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 18-Apr-2007 Modified: peps/trunk/pep-3133.txt ============================================================================== --- peps/trunk/pep-3133.txt (original) +++ peps/trunk/pep-3133.txt Fri May 25 02:01:46 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Collin Winter -Status: Draft +Status: Rejected Type: Standards Track Requires: 3115, 3129 Content-Type: text/x-rst @@ -12,6 +12,14 @@ Post-History: 13-May-2007 +Rejection Notice +================ + +This PEP has helped push PEP 3119 towards a saner, more minimalistic +approach. But given the latest version of PEP 3119 I much prefer +that. GvR. + + Abstract ======== From python-checkins at python.org Fri May 25 05:10:33 2007 From: python-checkins at python.org (facundo.batista) Date: Fri, 25 May 2007 05:10:33 +0200 (CEST) Subject: [Python-checkins] r55567 - python/trunk/Lib/test/test_urllib.py Message-ID: <20070525031033.A15071E4005@bag.python.org> Author: facundo.batista Date: Fri May 25 05:10:28 2007 New Revision: 55567 Modified: python/trunk/Lib/test/test_urllib.py Log: Trying to make the tests work in Windows and Solaris, everywhere else just works Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Fri May 25 05:10:28 2007 @@ -549,17 +549,20 @@ serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serv.settimeout(3) serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - serv.bind(("", 9091)) + serv.bind(("", 9093)) serv.listen(5) try: conn, addr = serv.accept() - except socket.timeout: - pass - else: conn.send("1 Hola mundo\n") - conn.recv(13) + cantdata = 0 + while cantdata < 13: + print "len:", cantdata + data = conn.recv(13-cantdata) + cantdata += len(data) conn.send("2 No more lines\n") conn.close() + except socket.timeout: + pass finally: serv.close() evt.set() @@ -567,7 +570,7 @@ class FTPWrapperTests(unittest.TestCase): def setUp(self): - ftplib.FTP.port = 9091 + ftplib.FTP.port = 9093 self.evt = threading.Event() threading.Thread(target=server, args=(self.evt,)).start() time.sleep(.1) @@ -577,28 +580,27 @@ def testBasic(self): # connects - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) ftp.ftp.sock.close() def testTimeoutDefault(self): # default - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) self.assertTrue(ftp.ftp.sock.gettimeout() is None) ftp.ftp.sock.close() def testTimeoutValue(self): # a value - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], timeout=30) self.assertEqual(ftp.ftp.sock.gettimeout(), 30) ftp.ftp.sock.close() - def testTimeoutNone(self): # None, having other default previous = socket.getdefaulttimeout() socket.setdefaulttimeout(30) try: - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) finally: socket.setdefaulttimeout(previous) self.assertEqual(ftp.ftp.sock.gettimeout(), 30) From buildbot at python.org Fri May 25 05:34:15 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 03:34:15 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20070525033416.1B5461E4005@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2220 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '0004-0004-0004-0004-0004' Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '1005-1005-1005-1005-1005' Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '2000-2000-2000-2000-2000' 1 test failed: test_urllib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri May 25 05:36:38 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 03:36:38 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070525033639.0EE001E4005@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/562 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri May 25 05:47:26 2007 From: python-checkins at python.org (facundo.batista) Date: Fri, 25 May 2007 05:47:26 +0200 (CEST) Subject: [Python-checkins] r55568 - python/trunk/Lib/test/test_urllib.py Message-ID: <20070525034726.331861E4005@bag.python.org> Author: facundo.batista Date: Fri May 25 05:47:19 2007 New Revision: 55568 Modified: python/trunk/Lib/test/test_urllib.py Log: Fixing stupid error, and introducing a sleep, to see if the other thread is awakened and finish sending data. Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Fri May 25 05:47:19 2007 @@ -556,9 +556,9 @@ conn.send("1 Hola mundo\n") cantdata = 0 while cantdata < 13: - print "len:", cantdata data = conn.recv(13-cantdata) cantdata += len(data) + time.sleep(.3) conn.send("2 No more lines\n") conn.close() except socket.timeout: From buildbot at python.org Fri May 25 06:03:57 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 04:03:57 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20070525040358.0DD741E4005@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/679 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri May 25 06:08:57 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 04:08:57 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20070525040857.7AF871E4005@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%2520trunk/builds/965 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri May 25 06:20:24 2007 From: python-checkins at python.org (facundo.batista) Date: Fri, 25 May 2007 06:20:24 +0200 (CEST) Subject: [Python-checkins] r55569 - python/trunk/Lib/test/test_urllib.py Message-ID: <20070525042024.EDE071E4005@bag.python.org> Author: facundo.batista Date: Fri May 25 06:20:22 2007 New Revision: 55569 Modified: python/trunk/Lib/test/test_urllib.py Log: Commenting out the tests until find out who can test them in one of the problematic enviroments. Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Fri May 25 06:20:22 2007 @@ -545,67 +545,75 @@ "url2pathname() failed; %s != %s" % (expect, result)) -def server(evt): - serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - serv.settimeout(3) - serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - serv.bind(("", 9093)) - serv.listen(5) - try: - conn, addr = serv.accept() - conn.send("1 Hola mundo\n") - cantdata = 0 - while cantdata < 13: - data = conn.recv(13-cantdata) - cantdata += len(data) - time.sleep(.3) - conn.send("2 No more lines\n") - conn.close() - except socket.timeout: - pass - finally: - serv.close() - evt.set() - -class FTPWrapperTests(unittest.TestCase): - - def setUp(self): - ftplib.FTP.port = 9093 - self.evt = threading.Event() - threading.Thread(target=server, args=(self.evt,)).start() - time.sleep(.1) - - def tearDown(self): - self.evt.wait() - - def testBasic(self): - # connects - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) - ftp.ftp.sock.close() - - def testTimeoutDefault(self): - # default - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) - self.assertTrue(ftp.ftp.sock.gettimeout() is None) - ftp.ftp.sock.close() - - def testTimeoutValue(self): - # a value - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], timeout=30) - self.assertEqual(ftp.ftp.sock.gettimeout(), 30) - ftp.ftp.sock.close() - - def testTimeoutNone(self): - # None, having other default - previous = socket.getdefaulttimeout() - socket.setdefaulttimeout(30) - try: - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) - finally: - socket.setdefaulttimeout(previous) - self.assertEqual(ftp.ftp.sock.gettimeout(), 30) - ftp.ftp.close() - +# Just commented them out. +# Can't really tell why keep failing in windows and sparc. +# Everywhere else they work ok, but on those machines, someteimes +# fail in one of the tests, sometimes in other. I have a linux, and +# the tests go ok. +# If anybody has one of the problematic enviroments, please help! +# . Facundo +# +# def server(evt): +# serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +# serv.settimeout(3) +# serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +# serv.bind(("", 9093)) +# serv.listen(5) +# try: +# conn, addr = serv.accept() +# conn.send("1 Hola mundo\n") +# cantdata = 0 +# while cantdata < 13: +# data = conn.recv(13-cantdata) +# cantdata += len(data) +# time.sleep(.3) +# conn.send("2 No more lines\n") +# conn.close() +# except socket.timeout: +# pass +# finally: +# serv.close() +# evt.set() +# +# class FTPWrapperTests(unittest.TestCase): +# +# def setUp(self): +# ftplib.FTP.port = 9093 +# self.evt = threading.Event() +# threading.Thread(target=server, args=(self.evt,)).start() +# time.sleep(.1) +# +# def tearDown(self): +# self.evt.wait() +# +# def testBasic(self): +# # connects +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# ftp.ftp.sock.close() +# +# def testTimeoutDefault(self): +# # default +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# self.assertTrue(ftp.ftp.sock.gettimeout() is None) +# ftp.ftp.sock.close() +# +# def testTimeoutValue(self): +# # a value +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], timeout=30) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.ftp.sock.close() +# +# def testTimeoutNone(self): +# # None, having other default +# previous = socket.getdefaulttimeout() +# socket.setdefaulttimeout(30) +# try: +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# finally: +# socket.setdefaulttimeout(previous) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.ftp.close() +# From buildbot at python.org Fri May 25 06:44:09 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 04:44:09 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20070525044409.7C6EC1E4005@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2222 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_urllib Traceback (most recent call last): File "./Lib/test/regrtest.py", line 557, in runtest_inner indirect_test() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_urllib.py", line 629, in test_main FTPWrapperTests, NameError: global name 'FTPWrapperTests' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri May 25 06:45:58 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 04:45:58 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070525044558.4676B1E4005@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/564 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib Traceback (most recent call last): File "./Lib/test/regrtest.py", line 557, in runtest_inner indirect_test() File "/home2/buildbot/slave/trunk.loewis-linux/build/Lib/test/test_urllib.py", line 629, in test_main FTPWrapperTests, NameError: global name 'FTPWrapperTests' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri May 25 07:13:49 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 25 May 2007 07:13:49 +0200 (CEST) Subject: [Python-checkins] r55570 - python/trunk/Lib/test/test_urllib.py Message-ID: <20070525051349.5A5A61E4006@bag.python.org> Author: neal.norwitz Date: Fri May 25 07:13:40 2007 New Revision: 55570 Modified: python/trunk/Lib/test/test_urllib.py Log: Get test passing again by commenting out the reference to the test class. Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Fri May 25 07:13:40 2007 @@ -626,7 +626,7 @@ UnquotingTests, urlencode_Tests, Pathname_Tests, - FTPWrapperTests, + #FTPWrapperTests, ) From buildbot at python.org Fri May 25 07:40:03 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 05:40:03 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20070525054003.3FE8B1E4007@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/681 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib Traceback (most recent call last): File "./Lib/test/regrtest.py", line 557, in runtest_inner indirect_test() File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_urllib.py", line 629, in test_main FTPWrapperTests, NameError: global name 'FTPWrapperTests' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri May 25 07:56:16 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 05:56:16 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20070525055616.760DB1E4006@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%2520trunk/builds/967 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib Traceback (most recent call last): File "./Lib/test/regrtest.py", line 557, in runtest_inner indirect_test() File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/test/test_urllib.py", line 629, in test_main FTPWrapperTests, NameError: global name 'FTPWrapperTests' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri May 25 08:17:12 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 25 May 2007 08:17:12 +0200 (CEST) Subject: [Python-checkins] r55571 - peps/trunk/pep-0000.txt peps/trunk/pep-3111.txt Message-ID: <20070525061712.AE51F1E4006@bag.python.org> Author: neal.norwitz Date: Fri May 25 08:17:11 2007 New Revision: 55571 Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3111.txt Log: PEP 3111 (restoring input) has been implemented so mark it Final. Also wrap some long lines in the PEP. Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Fri May 25 08:17:11 2007 @@ -77,7 +77,6 @@ SA 358 The "bytes" Object Schemenauer, GvR SA 3106 Revamping dict.keys(), .values() & .items() GvR SA 3109 Raising Exceptions in Python 3000 Winter - SA 3111 Simple input built-in in Python 3000 Roberge SA 3112 Bytes literals in Python 3000 Orendorff SA 3115 Metaclasses in Python 3000 Talin SA 3119 Introducing Abstract Base Classes GvR, Talin @@ -173,6 +172,7 @@ SF 3105 Make print a function Brandl SF 3107 Function Annotations Winter, Lownds SF 3110 Catching Exceptions in Python 3000 Winter + SF 3111 Simple input built-in in Python 3000 Roberge SF 3113 Removal of Tuple Parameter Unpacking Cannon SF 3114 Renaming iterator.next() to .__next__() Yee SF 3129 Class Decorators Winter @@ -481,7 +481,7 @@ S 3108 Standard Library Reorganization Cannon SA 3109 Raising Exceptions in Python 3000 Winter SF 3110 Catching Exceptions in Python 3000 Winter - SA 3111 Simple input built-in in Python 3000 Roberge + SF 3111 Simple input built-in in Python 3000 Roberge SA 3112 Bytes literals in Python 3000 Orendorff SF 3113 Removal of Tuple Parameter Unpacking Cannon SF 3114 Renaming iterator.next() to .__next__() Yee Modified: peps/trunk/pep-3111.txt ============================================================================== --- peps/trunk/pep-3111.txt (original) +++ peps/trunk/pep-3111.txt Fri May 25 08:17:11 2007 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Andre Roberge -Status: Accepted +Status: Final Type: Standards Track Content-Type: text/x-rst Created: 13-Sep-2006 @@ -108,9 +108,9 @@ Naming Discussion ================= -With ``input()`` effectively removed from the language, the name ``raw_input()`` -makes much less sense and alternatives should be considered. The -various possibilities mentioned in various forums include:: +With ``input()`` effectively removed from the language, +the name ``raw_input()`` makes much less sense and alternatives should be +considered. The various possibilities mentioned in various forums include:: ask() ask_user() @@ -121,8 +121,8 @@ user_input() get_response() -While it was initially rejected by the BDFL, it has been suggested that the most -direct solution would be to rename "raw_input" to "input" in Python 3000. +While it was initially rejected by the BDFL, it has been suggested that the +most direct solution would be to rename "raw_input" to "input" in Python 3000. The main objection is that Python 2.x already has a function named "input", and, even though it is not going to be included in Python 3000, having a built-in function with the same name but different semantics may From python-checkins at python.org Fri May 25 08:32:38 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 25 May 2007 08:32:38 +0200 (CEST) Subject: [Python-checkins] r55572 - peps/trunk/pep-0361.txt Message-ID: <20070525063238.971E01E4006@bag.python.org> Author: neal.norwitz Date: Fri May 25 08:32:35 2007 New Revision: 55572 Modified: peps/trunk/pep-0361.txt Log: Update status of some items (mostly deprecated modules) Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Fri May 25 08:32:35 2007 @@ -61,9 +61,11 @@ Deprecated modules and functions in the standard library: - - sets + - commands.getstatus() - macostools.touched() + - popen2, os.popen[234]() - posixfile + - sets Modules removed from the standard library: @@ -73,7 +75,10 @@ Python 3.0 compatability: - None + - warnings were added for the following builtins + which no longer exist in 3.0: + + apply, callable, coerce, dict.has_key, execfile, reduce, reload Other major features: @@ -112,7 +117,7 @@ PJE's withdrawal from 2.5 for inclusion in 2.6: http://mail.python.org/pipermail/python-dev/2006-April/064145.html - Module to gain a DeprecationWarning (as specified for Python 2.6 + Modules to gain a DeprecationWarning (as specified for Python 2.6 or through negligence): - rfc822 @@ -124,6 +129,7 @@ - sha - buildtools - cfmfile + - compiler package - warnings module implemented in C * Convert Parser/*.c to use warnings module rather than printf @@ -141,9 +147,6 @@ * {}.has_key() * All PendingDeprecationWarnings (e.g. exceptions) * using zip() result as a list - * input() - * apply() - * reduce() * the exec statement (use function syntax) * file.xreadlines * function attributes that start with func_* (should use __*__) @@ -167,7 +170,7 @@ - Replace all old style tests (operate on import) with unittest or docttest - - All tests for all untested modules + - Add tests for all untested modules - Document undocumented modules/features @@ -196,15 +199,16 @@ http://python.org/sf/1515609 http://python.org/sf/1515361 - How should -m (and __main__ in general) work with relative imports? - http://mail.python.org/pipermail/python-dev/2006-June/066161.html - (also see the section on main modules in PEP 338) + How should -m (__main__ in general) work with relative imports? [#pep366]_ References - [1] Adding a __dir__() magic method - http://mail.python.org/pipermail/python-dev/2006-July/067139.html +.. [1] Adding a __dir__() magic method + http://mail.python.org/pipermail/python-dev/2006-July/067139.html + +.. [#pep366] PEP 366 (Main module explicit relative imports) + http://www.python.org/dev/peps/pep-0366 Copyright From python-checkins at python.org Fri May 25 08:36:36 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 25 May 2007 08:36:36 +0200 (CEST) Subject: [Python-checkins] r55573 - peps/trunk/pep-0361.txt Message-ID: <20070525063636.200D81E4007@bag.python.org> Author: neal.norwitz Date: Fri May 25 08:36:35 2007 New Revision: 55573 Modified: peps/trunk/pep-0361.txt Log: Add some PEPs that are possible for 2.6: bytes (& literals) and int literals Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Fri May 25 08:36:35 2007 @@ -95,6 +95,9 @@ The following PEPs are being worked on for possible inclusion in 2.6: - PEP 297: Support for System Upgrades + - PEP 358: The "bytes" Object + - PEP 3112: Bytes literals in Python 3000 + - PEP 3127: Integer Literal Support and Syntax Each non-trivial feature listed here that is not a PEP must be discussed on python-dev. Other enhancements include: From python-checkins at python.org Fri May 25 08:40:55 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 25 May 2007 08:40:55 +0200 (CEST) Subject: [Python-checkins] r55574 - peps/trunk/pep-0361.txt Message-ID: <20070525064055.77AFF1E4006@bag.python.org> Author: neal.norwitz Date: Fri May 25 08:40:53 2007 New Revision: 55574 Modified: peps/trunk/pep-0361.txt Log: Oops, forgot the super PEP and references Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Fri May 25 08:40:53 2007 @@ -94,10 +94,11 @@ The following PEPs are being worked on for possible inclusion in 2.6: - - PEP 297: Support for System Upgrades - - PEP 358: The "bytes" Object - - PEP 3112: Bytes literals in Python 3000 - - PEP 3127: Integer Literal Support and Syntax + - PEP 297: Support for System Upgrades [#pep297] + - PEP 358: The "bytes" Object [#pep358] + - PEP 367: New Super [#pep367] + - PEP 3112: Bytes literals in Python 3000 [#pep3112] + - PEP 3127: Integer Literal Support and Syntax [#pep3127] Each non-trivial feature listed here that is not a PEP must be discussed on python-dev. Other enhancements include: @@ -210,9 +211,21 @@ .. [1] Adding a __dir__() magic method http://mail.python.org/pipermail/python-dev/2006-July/067139.html +.. [#pep358] PEP 358 (The "bytes" Object) + http://www.python.org/dev/peps/pep-0358 + .. [#pep366] PEP 366 (Main module explicit relative imports) http://www.python.org/dev/peps/pep-0366 +.. [#pep367] PEP 367 (New Super) + http://www.python.org/dev/peps/pep-0367 + +.. [#pep3112] PEP 3112 (Bytes literals in Python 3000) + http://www.python.org/dev/peps/pep-03112 + +.. [#pep3127] PEP 3127 (Integer Literal Support and Syntax) + http://www.python.org/dev/peps/pep-03127 + Copyright From buildbot at python.org Fri May 25 08:41:03 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 06:41:03 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian trunk Message-ID: <20070525064103.F31161E4006@bag.python.org> The Buildbot has detected a new failure of MIPS Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%2520trunk/builds/836 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_urllib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri May 25 09:06:04 2007 From: python-checkins at python.org (vinay.sajip) Date: Fri, 25 May 2007 09:06:04 +0200 (CEST) Subject: [Python-checkins] r55575 - python/trunk/Lib/logging/handlers.py Message-ID: <20070525070604.AE0601E4006@bag.python.org> Author: vinay.sajip Date: Fri May 25 09:05:59 2007 New Revision: 55575 Modified: python/trunk/Lib/logging/handlers.py Log: Updated docstring for SysLogHandler (#1720726). Modified: python/trunk/Lib/logging/handlers.py ============================================================================== --- python/trunk/Lib/logging/handlers.py (original) +++ python/trunk/Lib/logging/handlers.py Fri May 25 09:05:59 2007 @@ -625,7 +625,8 @@ """ Initialize a handler. - If address is specified as a string, UNIX socket is used. + If address is specified as a string, a UNIX socket is used. To log to a + local syslogd, "SysLogHandler(address="/dev/log")" can be used. If facility is not specified, LOG_USER is used. """ logging.Handler.__init__(self) From python-checkins at python.org Fri May 25 09:06:56 2007 From: python-checkins at python.org (vinay.sajip) Date: Fri, 25 May 2007 09:06:56 +0200 (CEST) Subject: [Python-checkins] r55576 - python/trunk/Doc/lib/liblogging.tex Message-ID: <20070525070656.E47241E4006@bag.python.org> Author: vinay.sajip Date: Fri May 25 09:06:55 2007 New Revision: 55576 Modified: python/trunk/Doc/lib/liblogging.tex Log: Updated documentation for SysLogHandler (#1720726). Modified: python/trunk/Doc/lib/liblogging.tex ============================================================================== --- python/trunk/Doc/lib/liblogging.tex (original) +++ python/trunk/Doc/lib/liblogging.tex Fri May 25 09:06:55 2007 @@ -1208,8 +1208,11 @@ communicate with a remote \UNIX{} machine whose address is given by \var{address} in the form of a \code{(\var{host}, \var{port})} tuple. If \var{address} is not specified, \code{('localhost', 514)} is -used. The address is used to open a UDP socket. If \var{facility} is -not specified, \constant{LOG_USER} is used. +used. The address is used to open a UDP socket. An alternative to providing +a \code{(\var{host}, \var{port})} tuple is providing an address as a string, +for example "/dev/log". In this case, a Unix domain socket is used to send +the message to the syslog. If \var{facility} is not specified, +\constant{LOG_USER} is used. \end{classdesc} \begin{methoddesc}{close}{} From python-checkins at python.org Fri May 25 09:10:05 2007 From: python-checkins at python.org (neal.norwitz) Date: Fri, 25 May 2007 09:10:05 +0200 (CEST) Subject: [Python-checkins] r55577 - peps/trunk/pep-0367.txt Message-ID: <20070525071005.136E41E400B@bag.python.org> Author: neal.norwitz Date: Fri May 25 09:10:03 2007 New Revision: 55577 Modified: peps/trunk/pep-0367.txt Log: Checkpoint from Tim Modified: peps/trunk/pep-0367.txt ============================================================================== --- peps/trunk/pep-0367.txt (original) +++ peps/trunk/pep-0367.txt Fri May 25 09:10:03 2007 @@ -2,264 +2,457 @@ Title: New Super Version: $Revision$ Last-Modified: $Date$ -Author: Calvin Spealman +Author: Calvin Spealman , + Tim Delaney Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 28-Apr-2007 Python-Version: 2.6 -Post-History: 28-Apr-2007, 29-Apr-2007 (1), 29-Apr-2007 (2) - +Post-History: 28-Apr-2007, 29-Apr-2007 (1), 29-Apr-2007 (2), 14-May-2007 Abstract ======== -The PEP defines the proposal to enhance the ``super`` builtin to work -implicitly upon the class within which it is used and upon the -instance the current function was called on. The premise of the new -super usage suggested is as follows:: +This PEP proposes syntactic sugar for use of the ``super`` type to automatically +construct instances of the super type binding to the class that a method was +defined in, and the instance (or class object for classmethods) that the method +is currently acting upon. + +The premise of the new super usage suggested is as follows:: super.foo(1, 2) -to replace the old :: +to replace the old:: super(Foo, self).foo(1, 2) +and the current ``__builtin__.super`` be aliased to ``__builtin__.__super__`` +(with ``__builtin__.super`` to be removed in Python 3.0). + +It is further proposed that assignment to ``super`` become a ``SyntaxError``, +similar to the behaviour of ``None``. + Rationale ========= -The current usage of ``super`` requires an explicit passing of both -the class and instance it must operate from, requiring a breaking of -the *DRY* (Don't Repeat Yourself) rule. This hinders any change in -class name, and is often considered a wart by many. +The current usage of super requires an explicit passing of both the class and +instance it must operate from, requiring a breaking of the DRY (Don't Repeat +Yourself) rule. This hinders any change in class name, and is often considered +a wart by many. Specification ============= -Within the specification section, some special terminology will be -used to distinguish similar and closely related concepts. "Super -type" will refer to the actual builtin type named ``super``. "Next -Class/Type in the MRO" will refer to the class where attribute lookups -will be performed by ``super``, for example, in the following, ``A`` -is the "Next class in the MRO" for the use of ``super``. :: +Within the specification section, some special terminology will be used to +distinguish similar and closely related concepts. "super type" will refer to +the actual builtin type named "super". A "super instance" is simply an instance +of the super type, which is associated with a class and possibly with an +instance of that class. + +Because the new ``super`` semantics are not backwards compatible with Python +2.5, the new semantics will require a ``__future__`` import:: + + from __future__ import new_super + +The current ``__builtin__.super`` will be aliased to ``__builtin__.__super__``. +This will occur regardless of whether the new ``super`` semantics are active. +It is not possible to simply rename ``__builtin__.super``, as that would affect +modules that do not use the new ``super`` semantics. In Python 3.0 it is +proposed that the name ``__builtin__.super`` will be removed. + +Replacing the old usage of super, calls to the next class in the MRO (method +resolution order) can be made without explicitly creating a ``super`` +instance (although doing so will still be supported via ``__super__``). Every +function will have an implicit local named ``super``. This name behaves +identically to a normal local, including use by inner functions via a cell, +with the following exceptions: + +1. Assigning to the name ``super`` will raise a ``SyntaxError`` at compile time; + +2. Calling a static method or normal function that accesses the name ``super`` + will raise a ``TypeError`` at runtime. + +Every function that uses the name ``super``, or has an inner function that +uses the name ``super``, will include a preamble that performs the equivalent +of:: + + super = __builtin__.__super__(, ) + +where ```` is the class that the method was defined in, and +```` is the first parameter of the method (normally ``self`` for +instance methods, and ``cls`` for class methods). For static methods and normal +functions, ```` will be ``None``, resulting in a ``TypeError`` being +raised during the preamble. - class A(object): - def f(self): - return 'A' +Note: The relationship between ``super`` and ``__super__`` is similar to that +between ``import`` and ``__import__``. - class B(A): - def f(self): - super(B, self).f() # Here, A would be our "Next class - # in the MRO", of course. - -A "super object" is simply an instance of the super type, which is -associated with a class and possibly with an instance of that class. -Finally, "new super" refers to the new super type, which will replace -the original. - -Replacing the old usage of ``super``, calls to the next class in the -MRO (method resolution order) will be made without an explicit super -object creation, by simply accessing an attribute on the super type -directly, which will automatically apply the class and instance to -perform the proper lookup. The following example demonstrates the use -of this. :: +Much of this was discussed in the thread of the python-dev list, "Fixing super +anyone?" [1]_. - class A(object): - def f(self): - return 'A' - - class B(A): - def f(self): - return 'B' + super.f() - - class C(A): - def f(self): - return 'C' + super.f() - - class D(B, C): - def f(self): - return 'D' + super.f() - - assert D().f() == 'DBCA' - -The proposal adds a dynamic attribute lookup to the super type, which -will automatically determine the proper class and instance parameters. -Each super attribute lookup identifies these parameters and performs -the super lookup on the instance, as the current super implementation -does with the explicit invocation of a super object upon a class and -instance. - -The enhancements to the super type will define a new ``__getattr__`` -classmethod of the super type, which must look backwards to the -previous frame and locate the instance object. This can be naively -determined by located the local named by the first argument to the -function. Using super outside of a function where this is a valid -lookup for the instance can be considered undocumented in its -behavior. This special method will actually be invoked on attribute -lookups to the super type itself, as opposed to super objects, as the -current implementation works. This may pose open issues, which are -detailed below. - -"Every class will gain a new special attribute, ``__super__``, which -refers to an instance of the associated super object for that class." -In this capacity, the new super also acts as its own descriptor, -create an instance-specific super upon lookup. - -Much of this was discussed in the thread of the python-dev list, -"Fixing super anyone?" [1]_. Open Issues ----------- -__call__ methods -'''''''''''''''' -Backward compatibility of the super type API raises some issues. -Names, the lookup of the ``__call__`` method of the super type itself, -which means a conflict with doing an actual super lookup of the -``__call__`` attribute. Namely, the following is ambiguous in the -current proposal:: - - super.__call__(arg) - -Which means the backward compatible API, which involves instantiating -the super type, will either not be possible, because it will actually -do a super lookup on the ``__call__`` attribute, or there will be no -way to perform a super lookup on the ``__call__`` attribute. Both -seem unacceptable, so any suggestions are welcome. - -Actually keeping the old super around in 2.x and creating a completely -new super type separately may be the best option. A future import or -even a simple import in 2.x of the new super type from some built-in -module may offer a way to choose which each module uses, even mixing -uses by binding to different names. Such a built-in module might be -called 'newsuper'. This module is also the reference implementation, -which I will present below. - -super type's new getattr -'''''''''''''''''''''''' - -To give the behavior needed, the super type either needs a way to do -dynamic lookup of attributes on the super type object itself or define -a metaclass for the built-in type. This author is unsure which, if -either, is possible with C-defined types. +Determining the class object to use +''''''''''''''''''''''''''''''''''' + +The exact mechanism for associating the method with the defining class is not +specified in this PEP, and should be chosen for maximum performance. For +CPython, it is suggested that the class instance be held in a C-level variable +on the function object which is bound to one of ``NULL`` (not part of a class), +``Py_None`` (static method) or a class object (instance or class method). -When should we create __super__ attributes? + +Should ``super`` actually become a keyword? ''''''''''''''''''''''''''''''''''''''''''' -They either need to be created on class creation or on ``__super__`` -attribute lookup. For the second, they could be cached, of course, -which seems like it may be the best idea, if implicit creation of a -super object for every class is considered too much overhead. - -How does it work in inner functions? -'''''''''''''''''''''''''''''''''''' - -If a method defines a function and super is used inside of it, how -does this work? The frame looking and instance detection breaks here. -However, if there can be some unambiguous way to use both the new -super form and still be able to explicitly name the type and instance, -I think its an acceptable tradeoff to simply be explicit in these -cases, rather than add weird super-specific lookup rules in these -cases. - -An example of such a problematic bit of code is:: - - class B(A): - def f(self): - def g(): - return super.f() - return g() - -Should super actually become a keyword? -''''''''''''''''''''''''''''''''''''''' - -This would solve many of the problems and allow more direct -implementation of super into the language proper. However, some are -against the actual keywordization of super. The simplest solution is -often the correct solution and the simplest solution may well not be -adding additional keywords to the language when they are not needed. -Still, it may solve many of the other open issues. - -Can we also allow super()? -'''''''''''''''''''''''''' - -There is strong sentiment for and against this, but implementation and -style concerns are obvious. Particularly, that it's "magical" and -that ``super()`` would differ from ``super.__call__()``, being very -unpythonic. +With this proposal, ``super`` would become a keyword to the same extent that +``None`` is a keyword. It is possible that further restricting the ``super`` +name may simplify implementation, however some are against the actual keyword- +ization of super. The simplest solution is often the correct solution and the +simplest solution may well not be adding additional keywords to the language +when they are not needed. Still, it may solve other open issues. + + +Closed Issues +------------- + +super used with __call__ attributes +''''''''''''''''''''''''''''''''''' + +It was considered that it might be a problem that instantiating super instances +the classic way, because calling it would lookup the __call__ attribute and +thus try to perform an automatic super lookup to the next class in the MRO. +However, this was found to be false, because calling an object only looks up +the __call__ method directly on the object's type. The following example shows +this in action. + +:: + + class A(object): + def __call__(self): + return '__call__' + def __getattribute__(self, attr): + if attr == '__call__': + return lambda: '__getattribute__' + a = A() + assert a() == '__call__' + assert a.__call__() == '__getattribute__' + +In any case, with the renaming of ``__builtin__.super`` to +``__builtin__.__super__`` this issue goes away entirely. Reference Implementation ======================== -This implementation was a cooperative contribution in the original thread [1]_. :: +It is impossible to implement the above specification entirely in Python. This +reference implementation has the following differences to the specification: + +1. New ``super`` semantics are implemented using bytecode hacking. + +2. Assignment to ``super`` is not a ``SyntaxError``. Also see point #4. + +3. Classes must either use the metaclass ``autosuper_meta`` or inherit from + the base class ``autosuper`` to acquire the new ``super`` semantics. + +4. ``super`` is not an implicit local variable. In particular, for inner + functions to be able to use the super instance, there must be an assignment + of the form ``super = super`` in the method. + +The reference implementation assumes that it is being run on Python 2.5+. + +:: #!/usr/bin/env python # - # newsuper.py - - import sys + # autosuper.py - class SuperMetaclass(type): - def __getattr__(cls, attr): - calling_frame = sys._getframe().f_back - instance_name = calling_frame.f_code.co_varnames[0] - instance = calling_frame.f_locals[instance_name] - return getattr(instance.__super__, attr) - - class Super(object): - __metaclass__ = SuperMetaclass - def __init__(self, type, obj=None): - if isinstance(obj, Super): - obj = obj.__obj__ - self.__type__ = type - self.__obj__ = obj - def __get__(self, obj, cls=None): - if obj is None: - raise Exception('only supports instances') - else: - return Super(self.__type__, obj) - def __getattr__(self, attr): - mro = iter(self.__obj__.__class__.__mro__) - for cls in mro: - if cls is self.__type__: - break - for cls in mro: - if attr in cls.__dict__: - x = cls.__dict__[attr] - if hasattr(x, '__get__'): - x = x.__get__(self, cls) - return x - raise AttributeError, attr + from array import array + import dis + import new + import types + import __builtin__ + __builtin__.__super__ = __builtin__.super + del __builtin__.super + + # We need these for modifying bytecode + from opcode import opmap, HAVE_ARGUMENT, EXTENDED_ARG + + LOAD_GLOBAL = opmap['LOAD_GLOBAL'] + LOAD_NAME = opmap['LOAD_NAME'] + LOAD_CONST = opmap['LOAD_CONST'] + LOAD_FAST = opmap['LOAD_FAST'] + LOAD_ATTR = opmap['LOAD_ATTR'] + STORE_FAST = opmap['STORE_FAST'] + LOAD_DEREF = opmap['LOAD_DEREF'] + STORE_DEREF = opmap['STORE_DEREF'] + CALL_FUNCTION = opmap['CALL_FUNCTION'] + STORE_GLOBAL = opmap['STORE_GLOBAL'] + DUP_TOP = opmap['DUP_TOP'] + POP_TOP = opmap['POP_TOP'] + NOP = opmap['NOP'] + JUMP_FORWARD = opmap['JUMP_FORWARD'] + ABSOLUTE_TARGET = dis.hasjabs + + def _oparg(code, opcode_pos): + return code[opcode_pos+1] + (code[opcode_pos+2] << 8) + + def _bind_autosuper(func, cls): + co = func.func_code + name = func.func_name + newcode = array('B', co.co_code) + codelen = len(newcode) + newconsts = list(co.co_consts) + newvarnames = list(co.co_varnames) + + # Check if the global 'super' keyword is already present + try: + sn_pos = list(co.co_names).index('super') + except ValueError: + sn_pos = None + + # Check if the varname 'super' keyword is already present + try: + sv_pos = newvarnames.index('super') + except ValueError: + sv_pos = None + + # Check if the callvar 'super' keyword is already present + try: + sc_pos = list(co.co_cellvars).index('super') + except ValueError: + sc_pos = None + + # If 'super' isn't used anywhere in the function, we don't have anything to do + if sn_pos is None and sv_pos is None and sc_pos is None: + return func + + c_pos = None + s_pos = None + n_pos = None + + # Check if the 'cls_name' and 'super' objects are already in the constants + for pos, o in enumerate(newconsts): + if o is cls: + c_pos = pos + + if o is __super__: + s_pos = pos + + if o == name: + n_pos = pos + + # Add in any missing objects to constants and varnames + if c_pos is None: + c_pos = len(newconsts) + newconsts.append(cls) + + if n_pos is None: + n_pos = len(newconsts) + newconsts.append(name) + + if s_pos is None: + s_pos = len(newconsts) + newconsts.append(__super__) + + if sv_pos is None: + sv_pos = len(newvarnames) + newvarnames.append('super') + + # This goes at the start of the function. It is: + # + # super = __super__(cls, self) + # + # If 'super' is a cell variable, we store to both the + # local and cell variables (i.e. STORE_FAST and STORE_DEREF). + # + preamble = [ + LOAD_CONST, s_pos & 0xFF, s_pos >> 8, + LOAD_CONST, c_pos & 0xFF, c_pos >> 8, + LOAD_FAST, 0, 0, + CALL_FUNCTION, 2, 0, + ] + + if sc_pos is None: + # 'super' is not a cell variable - we can just use the local variable + preamble += [ + STORE_FAST, sv_pos & 0xFF, sv_pos >> 8, + ] + else: + # If 'super' is a cell variable, we need to handle LOAD_DEREF. + preamble += [ + DUP_TOP, + STORE_FAST, sv_pos & 0xFF, sv_pos >> 8, + STORE_DEREF, sc_pos & 0xFF, sc_pos >> 8, + ] + + preamble = array('B', preamble) + + # Bytecode for loading the local 'super' variable. + load_super = array('B', [ + LOAD_FAST, sv_pos & 0xFF, sv_pos >> 8, + ]) + + preamble_len = len(preamble) + need_preamble = False + i = 0 + + while i < codelen: + opcode = newcode[i] + need_load = False + remove_store = False + + if opcode == EXTENDED_ARG: + raise TypeError("Cannot use 'super' in function with EXTENDED_ARG opcode") + + # If the opcode is an absolute target it needs to be adjusted + # to take into account the preamble. + elif opcode in ABSOLUTE_TARGET: + oparg = _oparg(newcode, i) + preamble_len + newcode[i+1] = oparg & 0xFF + newcode[i+2] = oparg >> 8 + + # If LOAD_GLOBAL(super) or LOAD_NAME(super) then we want to change it into + # LOAD_FAST(super) + elif (opcode == LOAD_GLOBAL or opcode == LOAD_NAME) and _oparg(newcode, i) == sn_pos: + need_preamble = need_load = True + + # If LOAD_FAST(super) then we just need to add the preamble + elif opcode == LOAD_FAST and _oparg(newcode, i) == sv_pos: + need_preamble = need_load = True + + # If LOAD_DEREF(super) then we change it into LOAD_FAST(super) because + # it's slightly faster. + elif opcode == LOAD_DEREF and _oparg(newcode, i) == sc_pos: + need_preamble = need_load = True + + if need_load: + newcode[i:i+3] = load_super + + i += 1 + + if opcode >= HAVE_ARGUMENT: + i += 2 + + # No changes needed - get out. + if not need_preamble: + return func + + # Our preamble will have 3 things on the stack + co_stacksize = max(3, co.co_stacksize) + + # Conceptually, our preamble is on the `def` line. + co_lnotab = array('B', co.co_lnotab) + + if co_lnotab: + co_lnotab[0] += preamble_len + + co_lnotab = co_lnotab.tostring() + + # Our code consists of the preamble and the modified code. + codestr = (preamble + newcode).tostring() + + codeobj = new.code(co.co_argcount, len(newvarnames), co_stacksize, + co.co_flags, codestr, tuple(newconsts), co.co_names, + tuple(newvarnames), co.co_filename, co.co_name, + co.co_firstlineno, co_lnotab, co.co_freevars, + co.co_cellvars) + + func.func_code = codeobj + func.func_class = cls + return func - class autosuper(type): + class autosuper_meta(type): def __init__(cls, name, bases, clsdict): - cls.__super__ = Super(cls) + UnboundMethodType = types.UnboundMethodType + + for v in vars(cls): + o = getattr(cls, v) + if isinstance(o, UnboundMethodType): + _bind_autosuper(o.im_func, cls) + + class autosuper(object): + __metaclass__ = autosuper_meta if __name__ == '__main__': - class A(object): - __metaclass__ = autosuper + class A(autosuper): def f(self): return 'A' class B(A): def f(self): - return 'B' + Super.f() + return 'B' + super.f() class C(A): def f(self): - return 'C' + Super.f() + def inner(): + return 'C' + super.f() + + # Needed to put 'super' into a cell + super = super + return inner() class D(B, C): def f(self, arg=None): var = None - return 'D' + Super.f() + return 'D' + super.f() assert D().f() == 'DBCA' +Disassembly of B.f and C.f reveals the different preambles used when ``super`` +is simply a local variable compared to when it is used by an inner function. + +:: + + >>> dis.dis(B.f) + + 214 0 LOAD_CONST 4 () + 3 LOAD_CONST 2 () + 6 LOAD_FAST 0 (self) + 9 CALL_FUNCTION 2 + 12 STORE_FAST 1 (super) + + 215 15 LOAD_CONST 1 ('B') + 18 LOAD_FAST 1 (super) + 21 LOAD_ATTR 1 (f) + 24 CALL_FUNCTION 0 + 27 BINARY_ADD + 28 RETURN_VALUE + +:: + + >>> dis.dis(C.f) + + 218 0 LOAD_CONST 4 () + 3 LOAD_CONST 2 () + 6 LOAD_FAST 0 (self) + 9 CALL_FUNCTION 2 + 12 DUP_TOP + 13 STORE_FAST 1 (super) + 16 STORE_DEREF 0 (super) + + 219 19 LOAD_CLOSURE 0 (super) + 22 LOAD_CONST 1 () + 25 MAKE_CLOSURE 0 + 28 STORE_FAST 2 (inner) + + 223 31 LOAD_FAST 1 (super) + 34 STORE_DEREF 0 (super) + + 224 37 LOAD_FAST 2 (inner) + 40 CALL_FUNCTION 0 + 43 RETURN_VALUE + +Note that in the final implementation, the preamble would not be part of the +bytecode of the method, but would occur immediately following unpacking of +parameters. + Alternative Proposals ===================== @@ -267,71 +460,103 @@ No Changes ---------- -Although its always attractive to just keep things how they are, -people have sought a change in the usage of super calling for some -time, and for good reason, all mentioned previously. - -* Decoupling from the class name (which might not even be bound to the - right class anymore!). +Although its always attractive to just keep things how they are, people have +sought a change in the usage of super calling for some time, and for good +reason, all mentioned previously. + +- Decoupling from the class name (which might not even be bound to the + right class anymore!) +- Simpler looking, cleaner super calls would be better -* Simpler looking, cleaner super calls would be better. - -``super(__this_class__, self)`` +Dynamic attribute on super type ------------------------------- -This is nearly an anti-proposal, as it basically relies on the -acceptance of the ``__this_class__`` PEP [#pep3130]_, which proposes a -special name that would always be bound to the class within which it -is used. If that is accepted, ``__this_class__`` could simply be used -instead of the class' name explicitly, solving the name binding issues. - -``self.__super__.foo(*args)`` ------------------------------ - -The ``__super__`` attribute is mentioned in this PEP in several -places, and could be a candidate for the complete solution, actually -using it explicitly instead of any super usage directly. However, -double-underscore names are usually an internal detail, and attempted -to be kept out of everyday code. - -``super(self, *args) or __super__(self, *args)`` ------------------------------------------------- - -This solution only solves the problem of the type indication, does not -handle differently named super methods, and is explicit about the name -of the instance. It is less flexible without being able to enacted on -other method names, in cases where that is needed. One use case where -this fails is when a base class has a factory classmethod and a -subclass has two factory classmethods, both of which need to properly -make super calls to the one in the base class. +The proposal adds a dynamic attribute lookup to the super type, which will +automatically determine the proper class and instance parameters. Each super +attribute lookup identifies these parameters and performs the super lookup on +the instance, as the current super implementation does with the explicit +invokation of a super instance upon a class and instance. + +This proposal relies on sys._getframe(), which is not appropriate for anything +except a prototype implementation. + + +super(__this_class__, self) +--------------------------- + +This is nearly an anti-proposal, as it basically relies on the acceptance of +the __this_class__ PEP, which proposes a special name that would always be +bound to the class within which it is used. If that is accepted, __this_class__ +could simply be used instead of the class' name explicitly, solving the name +binding issues [2]_. -``super.foo(self, *args)`` +self.__super__.foo(\*args) -------------------------- -This variation actually eliminates the problems with locating the -proper instance, and if any of the alternatives were pushed into the -spotlight, I would want it to be this one. - -``super`` or ``super()`` ------------------------- - -This proposal leaves no room for different names, signatures, or -application to other classes, or instances. A way to allow some -similar use alongside the normal proposal would be favorable, -encouraging good design of multiple inheritance trees and compatible -methods. +The __super__ attribute is mentioned in this PEP in several places, and could +be a candidate for the complete solution, actually using it explicitly instead +of any super usage directly. However, double-underscore names are usually an +internal detail, and attempted to be kept out of everyday code. + +super(self, \*args) or __super__(self, \*args) +---------------------------------------------- + +This solution only solves the problem of the type indication, does not handle +differently named super methods, and is explicit about the name of the +instance. It is less flexable without being able to enacted on other method +names, in cases where that is needed. One use case this fails is where a base- +class has a factory classmethod and a subclass has two factory classmethods, +both of which needing to properly make super calls to the one in the base- +class. + +super.foo(self, \*args) +----------------------- + +This variation actually eliminates the problems with locating the proper +instance, and if any of the alternatives were pushed into the spotlight, I +would want it to be this one. + +super or super() +---------------- + +This proposal leaves no room for different names, signatures, or application +to other classes, or instances. A way to allow some similar use alongside the +normal proposal would be favorable, encouraging good design of multiple +inheritence trees and compatible methods. + +super(\*p, \*\*kw) +------------------ + +There has been the proposal that directly calling ``super(*p, **kw)`` would +be equivalent to calling the method on the ``super`` object with the same name +as the method currently being executed i.e. the following two methods would be +equivalent: + +:: + + def f(self, *p, **kw): + super.f(*p, **kw) + +:: + + def f(self, *p, **kw): + super(*p, **kw) + +There is strong sentiment for and against this, but implementation and style +concerns are obvious. Guido has suggested that this should be excluded from +this PEP on the principle of KISS (Keep It Simple Stupid). + History ======= +29-Apr-2007 - Changed title from "Super As A Keyword" to "New Super" + - Updated much of the language and added a terminology section + for clarification in confusing places. + - Added reference implementation and history sections. -29-Apr-2007: - -- Changed title from "Super As A Keyword" to "New Super" -- Updated much of the language and added a terminology section - for clarification in confusing places. -- Added reference implementation and history sections. - +06-May-2007 - Updated by Tim Delaney to reflect discussions on the python-3000 + and python-dev mailing lists. References ========== @@ -339,8 +564,8 @@ .. [1] Fixing super anyone? (http://mail.python.org/pipermail/python-3000/2007-April/006667.html) -.. [#pep3130] PEP 3130 (Access to Current Module/Class/Function) - http://www.python.org/dev/peps/pep-3130 +.. [2] PEP 3130: Access to Module/Class/Function Currently Being Defined (this) + (http://mail.python.org/pipermail/python-ideas/2007-April/000542.html) Copyright From python-checkins at python.org Fri May 25 09:17:43 2007 From: python-checkins at python.org (vinay.sajip) Date: Fri, 25 May 2007 09:17:43 +0200 (CEST) Subject: [Python-checkins] r55578 - python/branches/release24-maint/Doc/lib/liblogging.tex Message-ID: <20070525071743.520DC1E4007@bag.python.org> Author: vinay.sajip Date: Fri May 25 09:17:37 2007 New Revision: 55578 Modified: python/branches/release24-maint/Doc/lib/liblogging.tex Log: Updated findCaller documentation. Modified: python/branches/release24-maint/Doc/lib/liblogging.tex ============================================================================== --- python/branches/release24-maint/Doc/lib/liblogging.tex (original) +++ python/branches/release24-maint/Doc/lib/liblogging.tex Fri May 25 09:17:37 2007 @@ -428,9 +428,11 @@ Removes the specified handler \var{hdlr} from this logger. \end{methoddesc} -\begin{methoddesc}{findCaller}{} -Finds the caller's source filename and line number. Returns the filename -and line number as a 2-element tuple. +\begin{methoddesc}[Logger]{findCaller}{} +Finds the caller's source filename and line number. Returns the filename, +line number and function name as a 3-element tuple. +\versionchanged[The function name was added. In earlier versions, the +filename and line number were returned as a 2-element tuple.] \end{methoddesc} \begin{methoddesc}{handle}{record} From python-checkins at python.org Fri May 25 09:21:20 2007 From: python-checkins at python.org (vinay.sajip) Date: Fri, 25 May 2007 09:21:20 +0200 (CEST) Subject: [Python-checkins] r55579 - python/branches/release25-maint/Doc/lib/liblogging.tex Message-ID: <20070525072120.645811E4029@bag.python.org> Author: vinay.sajip Date: Fri May 25 09:21:19 2007 New Revision: 55579 Modified: python/branches/release25-maint/Doc/lib/liblogging.tex Log: Updated documentation for SysLogHandler (#1720726). Modified: python/branches/release25-maint/Doc/lib/liblogging.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/liblogging.tex (original) +++ python/branches/release25-maint/Doc/lib/liblogging.tex Fri May 25 09:21:19 2007 @@ -1175,8 +1175,11 @@ communicate with a remote \UNIX{} machine whose address is given by \var{address} in the form of a \code{(\var{host}, \var{port})} tuple. If \var{address} is not specified, \code{('localhost', 514)} is -used. The address is used to open a UDP socket. If \var{facility} is -not specified, \constant{LOG_USER} is used. +used. The address is used to open a UDP socket. An alternative to providing +a \code{(\var{host}, \var{port})} tuple is providing an address as a string, +for example "/dev/log". In this case, a Unix domain socket is used to send +the message to the syslog. If \var{facility} is not specified, +\constant{LOG_USER} is used. \end{classdesc} \begin{methoddesc}{close}{} From python-checkins at python.org Fri May 25 09:22:58 2007 From: python-checkins at python.org (vinay.sajip) Date: Fri, 25 May 2007 09:22:58 +0200 (CEST) Subject: [Python-checkins] r55580 - python/branches/release24-maint/Doc/lib/liblogging.tex Message-ID: <20070525072258.070401E4006@bag.python.org> Author: vinay.sajip Date: Fri May 25 09:22:57 2007 New Revision: 55580 Modified: python/branches/release24-maint/Doc/lib/liblogging.tex Log: Updated documentation for SysLogHandler (#1720726). Modified: python/branches/release24-maint/Doc/lib/liblogging.tex ============================================================================== --- python/branches/release24-maint/Doc/lib/liblogging.tex (original) +++ python/branches/release24-maint/Doc/lib/liblogging.tex Fri May 25 09:22:57 2007 @@ -1082,8 +1082,11 @@ communicate with a remote \UNIX{} machine whose address is given by \var{address} in the form of a \code{(\var{host}, \var{port})} tuple. If \var{address} is not specified, \code{('localhost', 514)} is -used. The address is used to open a UDP socket. If \var{facility} is -not specified, \constant{LOG_USER} is used. +used. The address is used to open a UDP socket. An alternative to providing +a \code{(\var{host}, \var{port})} tuple is providing an address as a string, +for example "/dev/log". In this case, a Unix domain socket is used to send +the message to the syslog. If \var{facility} is not specified, +\constant{LOG_USER} is used. \end{classdesc} \begin{methoddesc}{close}{} From python-checkins at python.org Fri May 25 09:26:27 2007 From: python-checkins at python.org (vinay.sajip) Date: Fri, 25 May 2007 09:26:27 +0200 (CEST) Subject: [Python-checkins] r55581 - python/branches/release24-maint/Lib/logging/handlers.py Message-ID: <20070525072627.5FA9E1E4006@bag.python.org> Author: vinay.sajip Date: Fri May 25 09:26:26 2007 New Revision: 55581 Modified: python/branches/release24-maint/Lib/logging/handlers.py Log: Updated documentation for SysLogHandler (#1720726). Modified: python/branches/release24-maint/Lib/logging/handlers.py ============================================================================== --- python/branches/release24-maint/Lib/logging/handlers.py (original) +++ python/branches/release24-maint/Lib/logging/handlers.py Fri May 25 09:26:26 2007 @@ -1,4 +1,4 @@ -# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2007 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -22,7 +22,7 @@ Should work under Python versions >= 1.5.2, except that source line information is not available unless 'sys._getframe()' is. -Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ @@ -566,7 +566,8 @@ """ Initialize a handler. - If address is specified as a string, UNIX socket is used. + If address is specified as a string, a UNIX socket is used. To log to a + local syslogd, "SysLogHandler(address="/dev/log")" can be used. If facility is not specified, LOG_USER is used. """ logging.Handler.__init__(self) From python-checkins at python.org Fri May 25 09:27:32 2007 From: python-checkins at python.org (vinay.sajip) Date: Fri, 25 May 2007 09:27:32 +0200 (CEST) Subject: [Python-checkins] r55582 - python/branches/release25-maint/Lib/logging/handlers.py Message-ID: <20070525072732.4AC671E4007@bag.python.org> Author: vinay.sajip Date: Fri May 25 09:27:30 2007 New Revision: 55582 Modified: python/branches/release25-maint/Lib/logging/handlers.py Log: Updated docstring for SysLogHandler (#1720726). Modified: python/branches/release25-maint/Lib/logging/handlers.py ============================================================================== --- python/branches/release25-maint/Lib/logging/handlers.py (original) +++ python/branches/release25-maint/Lib/logging/handlers.py Fri May 25 09:27:30 2007 @@ -578,7 +578,8 @@ """ Initialize a handler. - If address is specified as a string, UNIX socket is used. + If address is specified as a string, a UNIX socket is used. To log to a + local syslogd, "SysLogHandler(address="/dev/log")" can be used. If facility is not specified, LOG_USER is used. """ logging.Handler.__init__(self) From python-checkins at python.org Fri May 25 19:18:15 2007 From: python-checkins at python.org (georg.brandl) Date: Fri, 25 May 2007 19:18:15 +0200 (CEST) Subject: [Python-checkins] r55586 - peps/trunk/pep-0365.txt Message-ID: <20070525171815.0BE411E4007@bag.python.org> Author: georg.brandl Date: Fri May 25 19:18:09 2007 New Revision: 55586 Modified: peps/trunk/pep-0365.txt (props changed) Log: Text file doesn't need to be executable. From python-checkins at python.org Fri May 25 20:04:45 2007 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 25 May 2007 20:04:45 +0200 (CEST) Subject: [Python-checkins] r55589 - peps/trunk/pep-3118.txt Message-ID: <20070525180445.1E1951E4014@bag.python.org> Author: guido.van.rossum Date: Fri May 25 20:04:40 2007 New Revision: 55589 Modified: peps/trunk/pep-3118.txt Log: Fix markup and clarify table entry for ignored whitespace. Modified: peps/trunk/pep-3118.txt ============================================================================== --- peps/trunk/pep-3118.txt (original) +++ peps/trunk/pep-3118.txt Fri May 25 20:04:40 2007 @@ -662,7 +662,7 @@ ':name:' optional name of the preceeding element 'X{}' pointer to a function (optional function signature inside {}) -' \n\t' ignored (allow better readability) +' ', '\\n', \\t' ignored (allow better readability) -- this may already be true ================ =========== From python-checkins at python.org Fri May 25 22:17:18 2007 From: python-checkins at python.org (brett.cannon) Date: Fri, 25 May 2007 22:17:18 +0200 (CEST) Subject: [Python-checkins] r55592 - in python/trunk/Lib: tarfile.py test/test_zipfile.py Message-ID: <20070525201718.7A9CB1E4010@bag.python.org> Author: brett.cannon Date: Fri May 25 22:17:15 2007 New Revision: 55592 Modified: python/trunk/Lib/tarfile.py python/trunk/Lib/test/test_zipfile.py Log: Remove direct call's to file's constructor and replace them with calls to open() as ths is considered best practice. Modified: python/trunk/Lib/tarfile.py ============================================================================== --- python/trunk/Lib/tarfile.py (original) +++ python/trunk/Lib/tarfile.py Fri May 25 22:17:15 2007 @@ -1490,7 +1490,7 @@ # Create nonexistent files in append mode. self.mode = "w" self._mode = "wb" - fileobj = file(name, self._mode) + fileobj = bltn_open(name, self._mode) self._extfileobj = False else: if name is None and hasattr(fileobj, "name"): @@ -1667,7 +1667,7 @@ raise CompressionError("gzip module is not available") if fileobj is None: - fileobj = file(name, mode + "b") + fileobj = bltn_open(name, mode + "b") try: t = cls.taropen(name, mode, @@ -1928,7 +1928,7 @@ # Append the tar header and data to the archive. if tarinfo.isreg(): - f = file(name, "rb") + f = bltn_open(name, "rb") self.addfile(tarinfo, f) f.close() @@ -2139,7 +2139,7 @@ """Make a file called targetpath. """ source = self.extractfile(tarinfo) - target = file(targetpath, "wb") + target = bltn_open(targetpath, "wb") copyfileobj(source, target) source.close() target.close() @@ -2484,4 +2484,5 @@ except TarError: return False +bltn_open = open open = TarFile.open Modified: python/trunk/Lib/test/test_zipfile.py ============================================================================== --- python/trunk/Lib/test/test_zipfile.py (original) +++ python/trunk/Lib/test/test_zipfile.py Fri May 25 22:17:15 2007 @@ -712,7 +712,7 @@ for n, s in enumerate(self.seps): self.arcdata[s] = s.join(self.line_gen) + s self.arcfiles[s] = '%s-%d' % (TESTFN, n) - file(self.arcfiles[s], "wb").write(self.arcdata[s]) + open(self.arcfiles[s], "wb").write(self.arcdata[s]) def makeTestArchive(self, f, compression): # Create the ZIP archive From python-checkins at python.org Fri May 25 22:17:27 2007 From: python-checkins at python.org (brett.cannon) Date: Fri, 25 May 2007 22:17:27 +0200 (CEST) Subject: [Python-checkins] r55591 - in python/branches/bcannon-objcap: BRANCH_NOTES Demo/parser/unparse.py Demo/threads/README Doc/Makefile.deps Doc/api/abstract.tex Doc/api/concrete.tex Doc/api/init.tex Doc/api/memory.tex Doc/api/newtypes.tex Doc/api/utilities.tex Doc/commontex/copyright.tex Doc/commontex/license.tex Doc/dist/dist.tex Doc/ext/newtypes.tex Doc/ext/shoddy.c Doc/inst/inst.tex Doc/lib/compiler.tex Doc/lib/email.tex Doc/lib/emailgenerator.tex Doc/lib/emailutil.tex Doc/lib/lib.tex Doc/lib/libamoeba.tex Doc/lib/libasyncore.tex Doc/lib/libbase64.tex Doc/lib/libbsddb.tex Doc/lib/libcfgparser.tex Doc/lib/libcgitb.tex Doc/lib/libcmath.tex Doc/lib/libcmd.tex Doc/lib/libcode.tex Doc/lib/libcodecs.tex Doc/lib/libcollections.tex Doc/lib/libcommands.tex Doc/lib/libconsts.tex Doc/lib/libcontextlib.tex Doc/lib/libcookielib.tex Doc/lib/libctypes.tex Doc/lib/libcurses.tex Doc/lib/libcursespanel.tex Doc/lib/libdatetime.tex Doc/lib/libdbhash.tex Doc/lib/libdecimal.tex Doc/lib/libdifflib.tex Doc/lib/libdl.tex Doc/lib/libdoctest.tex Doc/lib/libdocxmlrpc.tex Doc/lib/libdumbdbm.tex Doc/lib/libetree.tex Doc/lib/libexcs.tex Doc/lib/libfm.tex Doc/lib/libfnmatch.tex Doc/lib/libftplib.tex Doc/lib/libfuncs.tex Doc/lib/libfunctools.tex Doc/lib/libgettext.tex Doc/lib/libgopherlib.tex Doc/lib/libheapq.tex Doc/lib/libhmac.tex Doc/lib/libhotshot.tex Doc/lib/libhtmllib.tex Doc/lib/libhtmlparser.tex Doc/lib/libhttplib.tex Doc/lib/libimaplib.tex Doc/lib/libitertools.tex Doc/lib/liblocale.tex Doc/lib/liblogging.tex Doc/lib/libmailbox.tex Doc/lib/libmimetools.tex Doc/lib/libmimetypes.tex Doc/lib/libmimewriter.tex Doc/lib/libmmap.tex Doc/lib/libmsilib.tex Doc/lib/libmultifile.tex Doc/lib/libmutex.tex Doc/lib/libnetrc.tex Doc/lib/libnntplib.tex Doc/lib/liboptparse.tex Doc/lib/libos.tex Doc/lib/libpanel.tex Doc/lib/libpdb.tex Doc/lib/libpipes.tex Doc/lib/libplatform.tex Doc/lib/libpopen2.tex Doc/lib/libpoplib.tex Doc/lib/libposixfile.tex Doc/lib/libposixpath.tex Doc/lib/libpprint.tex Doc/lib/libprofile.tex Doc/lib/libqueue.tex Doc/lib/libre.tex Doc/lib/librepr.tex Doc/lib/librexec.tex Doc/lib/librfc822.tex Doc/lib/librgbimg.tex Doc/lib/libsched.tex Doc/lib/libselect.tex Doc/lib/libsets.tex Doc/lib/libshlex.tex Doc/lib/libshutil.tex Doc/lib/libsimplexmlrpc.tex Doc/lib/libsite.tex Doc/lib/libsmtplib.tex Doc/lib/libsocket.tex Doc/lib/libsqlite3.tex Doc/lib/libstdtypes.tex Doc/lib/libstdwin.tex Doc/lib/libstring.tex Doc/lib/libstruct.tex Doc/lib/libsubprocess.tex Doc/lib/libsun.tex Doc/lib/libsys.tex Doc/lib/libtarfile.tex Doc/lib/libtelnetlib.tex Doc/lib/libtempfile.tex Doc/lib/libtest.tex Doc/lib/libtextwrap.tex Doc/lib/libthreading.tex Doc/lib/libtimeit.tex Doc/lib/libturtle.tex Doc/lib/libunittest.tex Doc/lib/liburllib.tex Doc/lib/liburllib2.tex Doc/lib/liburlparse.tex Doc/lib/libwebbrowser.tex Doc/lib/libwinreg.tex Doc/lib/libxmlrpclib.tex Doc/lib/libzipfile.tex Doc/lib/libzlib.tex Doc/mac/libframework.tex Doc/mac/libmacfs.tex Doc/mac/libmacic.tex Doc/mac/libmacostools.tex Doc/mac/mac.tex Doc/mac/undoc.tex Doc/mac/using.tex Doc/ref/ref1.tex Doc/ref/ref3.tex Doc/ref/ref5.tex Doc/ref/ref6.tex Doc/ref/ref7.tex Doc/texinputs/python.sty Doc/tools/listmodules Doc/tut/tut.tex Doc/whatsnew/whatsnew23.tex Doc/whatsnew/whatsnew24.tex Doc/whatsnew/whatsnew25.tex Doc/whatsnew/whatsnew26.tex Grammar/Grammar Include/Python-ast.h Include/dictobject.h Include/fileobject.h Include/intobject.h Include/listobject.h Include/longobject.h Include/object.h Include/pydebug.h Include/pyerrors.h Include/pymem.h Include/pystate.h Include/setobject.h Include/stringobject.h Include/tupleobject.h Include/unicodeobject.h LICENSE Lib/Bastion.py Lib/CGIHTTPServer.py Lib/ConfigParser.py Lib/DocXMLRPCServer.py Lib/HTMLParser.py Lib/SimpleXMLRPCServer.py Lib/SocketServer.py Lib/_strptime.py Lib/binhex.py Lib/bisect.py Lib/bsddb/test/test_recno.py Lib/calendar.py Lib/cgitb.py Lib/collections.py Lib/commands.py Lib/compiler/transformer.py Lib/copy_reg.py Lib/csv.py Lib/ctypes/__init__.py Lib/ctypes/test/test_checkretval.py Lib/ctypes/test/test_functions.py Lib/ctypes/test/test_loading.py Lib/ctypes/test/test_memfunctions.py Lib/ctypes/test/test_numbers.py Lib/ctypes/test/test_python_api.py Lib/ctypes/test/test_random_things.py Lib/ctypes/test/test_repr.py Lib/decimal.py Lib/difflib.py Lib/distutils/__init__.py Lib/distutils/command/build_ext.py Lib/distutils/msvccompiler.py Lib/doctest.py Lib/email/_parseaddr.py Lib/email/header.py Lib/email/message.py Lib/email/test/test_email.py Lib/email/test/test_email_renamed.py Lib/encodings/__init__.py Lib/encodings/utf_8_sig.py Lib/ftplib.py Lib/genericpath.py Lib/glob.py Lib/gopherlib.py Lib/gzip.py Lib/heapq.py Lib/httplib.py Lib/idlelib/AutoCompleteWindow.py Lib/idlelib/CallTips.py Lib/idlelib/CodeContext.py Lib/idlelib/IOBinding.py Lib/idlelib/MultiCall.py Lib/idlelib/NEWS.txt Lib/idlelib/PyShell.py Lib/idlelib/configHandler.py Lib/idlelib/help.txt Lib/imaplib.py Lib/imputil.py Lib/locale.py Lib/logging/__init__.py Lib/logging/handlers.py Lib/macpath.py Lib/mimetypes.py Lib/ntpath.py Lib/os.py Lib/pdb.doc Lib/pdb.py Lib/plat-freebsd2 Lib/plat-freebsd3 Lib/plat-mac/macfs.py Lib/plat-mac/macostools.py Lib/plat-mac/pimp.py Lib/popen2.py Lib/poplib.py Lib/posixfile.py Lib/posixpath.py Lib/pydoc.py Lib/rexec.py Lib/robotparser.py Lib/sched.py Lib/shlex.py Lib/shutil.py Lib/site.py Lib/smtplib.py Lib/socket.py Lib/sre.py Lib/stat.py Lib/string.py Lib/subprocess.py Lib/tarfile.py Lib/telnetlib.py Lib/tempfile.py Lib/test/README Lib/test/crashers/dangerous_subclassing.py Lib/test/crashers/modify_dict_attr.py Lib/test/infinite_reload.py Lib/test/output/test_extcall Lib/test/output/test_operations Lib/test/output/test_popen2 Lib/test/output/test_pty Lib/test/output/test_pyexpat Lib/test/output/test_threadedtempfile Lib/test/output/xmltests Lib/test/outstanding_bugs.py Lib/test/pickletester.py Lib/test/regrtest.py Lib/test/ssl_cert.pem Lib/test/ssl_key.pem Lib/test/string_tests.py Lib/test/test___all__.py Lib/test/test_array.py Lib/test/test_base64.py Lib/test/test_binascii.py Lib/test/test_bsddb.py Lib/test/test_bsddb3.py Lib/test/test_builtin.py Lib/test/test_bz2.py Lib/test/test_cfgparser.py Lib/test/test_cmath.py Lib/test/test_cmd_line.py Lib/test/test_codecencodings_cn.py Lib/test/test_codecencodings_hk.py Lib/test/test_codecencodings_jp.py Lib/test/test_codecencodings_kr.py Lib/test/test_codecencodings_tw.py Lib/test/test_codecmaps_cn.py Lib/test/test_codecmaps_hk.py Lib/test/test_codecmaps_jp.py Lib/test/test_codecmaps_kr.py Lib/test/test_codecmaps_tw.py Lib/test/test_codecs.py Lib/test/test_collections.py Lib/test/test_commands.py Lib/test/test_compile.py Lib/test/test_complex.py Lib/test/test_contextlib.py Lib/test/test_crypt.py Lib/test/test_csv.py Lib/test/test_ctypes.py Lib/test/test_curses.py Lib/test/test_datetime.py Lib/test/test_dbm.py Lib/test/test_defaultdict.py Lib/test/test_descr.py Lib/test/test_dict.py Lib/test/test_dis.py Lib/test/test_email.py Lib/test/test_email_codecs.py Lib/test/test_email_renamed.py Lib/test/test_exceptions.py Lib/test/test_extcall.py Lib/test/test_fileinput.py Lib/test/test_format.py Lib/test/test_ftplib.py Lib/test/test_gc.py Lib/test/test_gdbm.py Lib/test/test_generators.py Lib/test/test_getopt.py Lib/test/test_gettext.py Lib/test/test_glob.py Lib/test/test_grammar.py Lib/test/test_gzip.py Lib/test/test_heapq.py Lib/test/test_htmlparser.py Lib/test/test_httplib.py Lib/test/test_imageop.py Lib/test/test_import.py Lib/test/test_index.py Lib/test/test_itertools.py Lib/test/test_locale.py Lib/test/test_logging.py Lib/test/test_long_future.py Lib/test/test_macfs.py Lib/test/test_macostools.py Lib/test/test_macpath.py Lib/test/test_mailbox.py Lib/test/test_marshal.py Lib/test/test_minidom.py Lib/test/test_module.py Lib/test/test_multibytecodec.py Lib/test/test_normalization.py Lib/test/test_ntpath.py Lib/test/test_operations.py Lib/test/test_operator.py Lib/test/test_optparse.py Lib/test/test_os.py Lib/test/test_ossaudiodev.py Lib/test/test_peepholer.py Lib/test/test_pep352.py Lib/test/test_popen2.py Lib/test/test_poplib.py Lib/test/test_posix.py Lib/test/test_posixpath.py Lib/test/test_pty.py Lib/test/test_pyexpat.py Lib/test/test_re.py Lib/test/test_rgbimg.py Lib/test/test_robotparser.py Lib/test/test_sax.py Lib/test/test_scope.py Lib/test/test_set.py Lib/test/test_slice.py Lib/test/test_smtplib.py Lib/test/test_socket.py Lib/test/test_socket_ssl.py Lib/test/test_socketserver.py Lib/test/test_softspace.py Lib/test/test_stringprep.py Lib/test/test_strptime.py Lib/test/test_struct.py Lib/test/test_structmembers.py Lib/test/test_sundry.py Lib/test/test_support.py Lib/test/test_syntax.py Lib/test/test_tarfile.py Lib/test/test_telnetlib.py Lib/test/test_tempfile.py Lib/test/test_textwrap.py Lib/test/test_threadedtempfile.py Lib/test/test_threading_local.py Lib/test/test_unicode.py Lib/test/test_unicode_file.py Lib/test/test_unittest.py Lib/test/test_unpack.py Lib/test/test_urllib.py Lib/test/test_urllib2.py Lib/test/test_urllib2net.py Lib/test/test_userdict.py Lib/test/test_warnings.py Lib/test/test_wsgiref.py Lib/test/test_xmlrpc.py Lib/test/test_zipfile.py Lib/test/test_zlib.py Lib/test/testtar.tar Lib/test/warning_tests.py Lib/textwrap.py Lib/timeit.py Lib/trace.py Lib/unittest.py Lib/urllib.py Lib/urllib2.py Lib/wave.py Lib/webbrowser.py Lib/xml/sax/saxutils.py Lib/zipfile.py Misc/ACKS Misc/BeOS-NOTES Misc/NEWS Misc/build.sh Misc/cheatsheet Misc/developers.txt Misc/python-config.in Modules/Setup.dist Modules/_bsddb.c Modules/_collectionsmodule.c Modules/_ctypes/_ctypes.c Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_ctypes/ctypes.h Modules/_ctypes/libffi/configure Modules/_ctypes/libffi/configure.ac Modules/_ctypes/libffi/fficonfig.h.in Modules/_ctypes/libffi_msvc/ffitarget.h Modules/_ctypes/stgdict.c Modules/_cursesmodule.c Modules/_localemodule.c Modules/_struct.c Modules/_tkinter.c Modules/arraymodule.c Modules/binascii.c Modules/bz2module.c Modules/cPickle.c Modules/cStringIO.c Modules/collectionsmodule.c Modules/datetimemodule.c Modules/getbuildinfo.c Modules/getpath.c Modules/itertoolsmodule.c Modules/main.c Modules/operator.c Modules/posixmodule.c Modules/readline.c Modules/rgbimgmodule.c Modules/socketmodule.c Modules/socketmodule.h Modules/timemodule.c Objects/abstract.c Objects/classobject.c Objects/complexobject.c Objects/dictnotes.txt Objects/dictobject.c Objects/enumobject.c Objects/exceptions.c Objects/fileobject.c Objects/floatobject.c Objects/frameobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/object.c Objects/setobject.c Objects/sliceobject.c Objects/stringobject.c Objects/tupleobject.c Objects/typeobject.c Objects/unicodeobject.c PC/VC6/pcbuild.dsw PC/_winreg.c PC/config.c PC/getpathp.c PC/make_versioninfo.c PC/pyconfig.h PCbuild/pythoncore.vcproj PCbuild8/PGInstrument.vsprops PCbuild8/PGUpdate.vsprops PCbuild8/Uninstal.wse PCbuild8/_bsddb PCbuild8/_bsddb.vcproj PCbuild8/_ctypes PCbuild8/_ctypes.vcproj PCbuild8/_ctypes_test PCbuild8/_ctypes_test.vcproj PCbuild8/_elementtree PCbuild8/_elementtree.vcproj PCbuild8/_msi PCbuild8/_msi.vcproj PCbuild8/_socket PCbuild8/_socket.vcproj PCbuild8/_sqlite3 PCbuild8/_sqlite3.vcproj PCbuild8/_ssl.mak PCbuild8/_ssl.vcproj PCbuild8/_testcapi PCbuild8/_testcapi.vcproj PCbuild8/_tkinter PCbuild8/_tkinter.vcproj PCbuild8/build.bat PCbuild8/build_pgo.bat PCbuild8/build_ssl.py PCbuild8/bz2 PCbuild8/bz2.vcproj PCbuild8/db.build PCbuild8/field3.py PCbuild8/make_buildinfo PCbuild8/make_buildinfo.c PCbuild8/make_buildinfo.vcproj PCbuild8/make_versioninfo PCbuild8/make_versioninfo.vcproj PCbuild8/pcbuild.sln PCbuild8/pyd.vsprops PCbuild8/pyd_d.vsprops PCbuild8/pyexpat PCbuild8/pyexpat.vcproj PCbuild8/pyproject.vsprops PCbuild8/python PCbuild8/python.build PCbuild8/python.iss PCbuild8/python.vcproj PCbuild8/python20.wse PCbuild8/pythoncore PCbuild8/pythoncore.vcproj PCbuild8/pythonw PCbuild8/pythonw.vcproj PCbuild8/readme.txt PCbuild8/rmpyc.py PCbuild8/rt.bat PCbuild8/select PCbuild8/select.vcproj PCbuild8/unicodedata PCbuild8/unicodedata.vcproj PCbuild8/w9xpopen.vcproj PCbuild8/winsound PCbuild8/winsound.vcproj Parser/Python.asdl Parser/asdl_c.py Python/Python-ast.c Python/ast.c Python/bltinmodule.c Python/ceval.c Python/compile.c Python/dynload_win.c Python/errors.c Python/fmod.c Python/graminit.c Python/import.c Python/marshal.c Python/peephole.c Python/pystate.c Python/pythonrun.c Python/sysmodule.c Python/thread_nt.h README Tools/msi/msilib.py Tools/pybench/pybench.py configure configure.in pyconfig.h.in setup.py Message-ID: <20070525201727.521EB1E400F@bag.python.org> Author: brett.cannon Date: Fri May 25 22:13:08 2007 New Revision: 55591 Added: python/branches/bcannon-objcap/Doc/ext/shoddy.c - copied unchanged from r55563, python/trunk/Doc/ext/shoddy.c python/branches/bcannon-objcap/Lib/collections.py - copied unchanged from r55563, python/trunk/Lib/collections.py python/branches/bcannon-objcap/Lib/test/infinite_reload.py - copied unchanged from r55563, python/trunk/Lib/test/infinite_reload.py python/branches/bcannon-objcap/Lib/test/ssl_cert.pem - copied unchanged from r55563, python/trunk/Lib/test/ssl_cert.pem python/branches/bcannon-objcap/Lib/test/ssl_key.pem - copied unchanged from r55563, python/trunk/Lib/test/ssl_key.pem python/branches/bcannon-objcap/Lib/test/test_collections.py - copied unchanged from r55563, python/trunk/Lib/test/test_collections.py python/branches/bcannon-objcap/Lib/test/test_ftplib.py - copied unchanged from r55563, python/trunk/Lib/test/test_ftplib.py python/branches/bcannon-objcap/Lib/test/test_poplib.py - copied unchanged from r55563, python/trunk/Lib/test/test_poplib.py python/branches/bcannon-objcap/Lib/test/test_smtplib.py - copied unchanged from r55563, python/trunk/Lib/test/test_smtplib.py python/branches/bcannon-objcap/Lib/test/test_telnetlib.py - copied unchanged from r55563, python/trunk/Lib/test/test_telnetlib.py python/branches/bcannon-objcap/Lib/test/warning_tests.py - copied unchanged from r55563, python/trunk/Lib/test/warning_tests.py python/branches/bcannon-objcap/Modules/_collectionsmodule.c - copied unchanged from r55563, python/trunk/Modules/_collectionsmodule.c python/branches/bcannon-objcap/PCbuild8/PGInstrument.vsprops - copied unchanged from r55563, python/trunk/PCbuild8/PGInstrument.vsprops python/branches/bcannon-objcap/PCbuild8/PGUpdate.vsprops - copied unchanged from r55563, python/trunk/PCbuild8/PGUpdate.vsprops python/branches/bcannon-objcap/PCbuild8/_bsddb/ - copied from r55563, python/trunk/PCbuild8/_bsddb/ python/branches/bcannon-objcap/PCbuild8/_ctypes/ - copied from r55563, python/trunk/PCbuild8/_ctypes/ python/branches/bcannon-objcap/PCbuild8/_ctypes_test/ - copied from r55563, python/trunk/PCbuild8/_ctypes_test/ python/branches/bcannon-objcap/PCbuild8/_elementtree/ - copied from r55563, python/trunk/PCbuild8/_elementtree/ python/branches/bcannon-objcap/PCbuild8/_msi/ - copied from r55563, python/trunk/PCbuild8/_msi/ python/branches/bcannon-objcap/PCbuild8/_socket/ - copied from r55563, python/trunk/PCbuild8/_socket/ python/branches/bcannon-objcap/PCbuild8/_sqlite3/ - copied from r55563, python/trunk/PCbuild8/_sqlite3/ python/branches/bcannon-objcap/PCbuild8/_testcapi/ - copied from r55563, python/trunk/PCbuild8/_testcapi/ python/branches/bcannon-objcap/PCbuild8/_tkinter/ - copied from r55563, python/trunk/PCbuild8/_tkinter/ python/branches/bcannon-objcap/PCbuild8/build.bat - copied unchanged from r55563, python/trunk/PCbuild8/build.bat python/branches/bcannon-objcap/PCbuild8/build_pgo.bat - copied unchanged from r55563, python/trunk/PCbuild8/build_pgo.bat python/branches/bcannon-objcap/PCbuild8/bz2/ - copied from r55563, python/trunk/PCbuild8/bz2/ python/branches/bcannon-objcap/PCbuild8/make_buildinfo/ - copied from r55563, python/trunk/PCbuild8/make_buildinfo/ python/branches/bcannon-objcap/PCbuild8/make_versioninfo/ - copied from r55563, python/trunk/PCbuild8/make_versioninfo/ python/branches/bcannon-objcap/PCbuild8/pyd.vsprops - copied unchanged from r55563, python/trunk/PCbuild8/pyd.vsprops python/branches/bcannon-objcap/PCbuild8/pyd_d.vsprops - copied unchanged from r55563, python/trunk/PCbuild8/pyd_d.vsprops python/branches/bcannon-objcap/PCbuild8/pyexpat/ - copied from r55563, python/trunk/PCbuild8/pyexpat/ python/branches/bcannon-objcap/PCbuild8/pyproject.vsprops - copied unchanged from r55563, python/trunk/PCbuild8/pyproject.vsprops python/branches/bcannon-objcap/PCbuild8/python/ - copied from r55563, python/trunk/PCbuild8/python/ python/branches/bcannon-objcap/PCbuild8/pythoncore/ - copied from r55563, python/trunk/PCbuild8/pythoncore/ python/branches/bcannon-objcap/PCbuild8/pythonw/ - copied from r55563, python/trunk/PCbuild8/pythonw/ python/branches/bcannon-objcap/PCbuild8/select/ - copied from r55563, python/trunk/PCbuild8/select/ python/branches/bcannon-objcap/PCbuild8/unicodedata/ - copied from r55563, python/trunk/PCbuild8/unicodedata/ python/branches/bcannon-objcap/PCbuild8/winsound/ - copied from r55563, python/trunk/PCbuild8/winsound/ Removed: python/branches/bcannon-objcap/Doc/lib/libamoeba.tex python/branches/bcannon-objcap/Doc/lib/libgopherlib.tex python/branches/bcannon-objcap/Doc/lib/libpanel.tex python/branches/bcannon-objcap/Doc/lib/librgbimg.tex python/branches/bcannon-objcap/Doc/lib/libstdwin.tex python/branches/bcannon-objcap/Doc/mac/libmacfs.tex python/branches/bcannon-objcap/Lib/gopherlib.py python/branches/bcannon-objcap/Lib/plat-freebsd2/ python/branches/bcannon-objcap/Lib/plat-freebsd3/ python/branches/bcannon-objcap/Lib/plat-mac/macfs.py python/branches/bcannon-objcap/Lib/test/crashers/dangerous_subclassing.py python/branches/bcannon-objcap/Lib/test/crashers/modify_dict_attr.py python/branches/bcannon-objcap/Lib/test/output/test_operations python/branches/bcannon-objcap/Lib/test/output/test_popen2 python/branches/bcannon-objcap/Lib/test/output/test_pty python/branches/bcannon-objcap/Lib/test/output/test_pyexpat python/branches/bcannon-objcap/Lib/test/output/test_threadedtempfile python/branches/bcannon-objcap/Lib/test/output/xmltests python/branches/bcannon-objcap/Lib/test/test_macfs.py python/branches/bcannon-objcap/Lib/test/test_operations.py python/branches/bcannon-objcap/Lib/test/test_rgbimg.py python/branches/bcannon-objcap/Modules/collectionsmodule.c python/branches/bcannon-objcap/Modules/rgbimgmodule.c python/branches/bcannon-objcap/PCbuild8/Uninstal.wse python/branches/bcannon-objcap/PCbuild8/_bsddb.vcproj python/branches/bcannon-objcap/PCbuild8/_ctypes.vcproj python/branches/bcannon-objcap/PCbuild8/_ctypes_test.vcproj python/branches/bcannon-objcap/PCbuild8/_elementtree.vcproj python/branches/bcannon-objcap/PCbuild8/_msi.vcproj python/branches/bcannon-objcap/PCbuild8/_socket.vcproj python/branches/bcannon-objcap/PCbuild8/_sqlite3.vcproj python/branches/bcannon-objcap/PCbuild8/_ssl.mak python/branches/bcannon-objcap/PCbuild8/_ssl.vcproj python/branches/bcannon-objcap/PCbuild8/_testcapi.vcproj python/branches/bcannon-objcap/PCbuild8/_tkinter.vcproj python/branches/bcannon-objcap/PCbuild8/build_ssl.py python/branches/bcannon-objcap/PCbuild8/bz2.vcproj python/branches/bcannon-objcap/PCbuild8/db.build python/branches/bcannon-objcap/PCbuild8/field3.py python/branches/bcannon-objcap/PCbuild8/make_buildinfo.c python/branches/bcannon-objcap/PCbuild8/make_buildinfo.vcproj python/branches/bcannon-objcap/PCbuild8/make_versioninfo.vcproj python/branches/bcannon-objcap/PCbuild8/pyexpat.vcproj python/branches/bcannon-objcap/PCbuild8/python.build python/branches/bcannon-objcap/PCbuild8/python.iss python/branches/bcannon-objcap/PCbuild8/python.vcproj python/branches/bcannon-objcap/PCbuild8/python20.wse python/branches/bcannon-objcap/PCbuild8/pythoncore.vcproj python/branches/bcannon-objcap/PCbuild8/pythonw.vcproj python/branches/bcannon-objcap/PCbuild8/select.vcproj python/branches/bcannon-objcap/PCbuild8/unicodedata.vcproj python/branches/bcannon-objcap/PCbuild8/w9xpopen.vcproj python/branches/bcannon-objcap/PCbuild8/winsound.vcproj python/branches/bcannon-objcap/Python/fmod.c Modified: python/branches/bcannon-objcap/ (props changed) python/branches/bcannon-objcap/BRANCH_NOTES python/branches/bcannon-objcap/Demo/parser/unparse.py python/branches/bcannon-objcap/Demo/threads/README python/branches/bcannon-objcap/Doc/Makefile.deps python/branches/bcannon-objcap/Doc/api/abstract.tex python/branches/bcannon-objcap/Doc/api/concrete.tex python/branches/bcannon-objcap/Doc/api/init.tex python/branches/bcannon-objcap/Doc/api/memory.tex python/branches/bcannon-objcap/Doc/api/newtypes.tex python/branches/bcannon-objcap/Doc/api/utilities.tex python/branches/bcannon-objcap/Doc/commontex/copyright.tex python/branches/bcannon-objcap/Doc/commontex/license.tex python/branches/bcannon-objcap/Doc/dist/dist.tex python/branches/bcannon-objcap/Doc/ext/newtypes.tex python/branches/bcannon-objcap/Doc/inst/inst.tex python/branches/bcannon-objcap/Doc/lib/compiler.tex python/branches/bcannon-objcap/Doc/lib/email.tex python/branches/bcannon-objcap/Doc/lib/emailgenerator.tex python/branches/bcannon-objcap/Doc/lib/emailutil.tex python/branches/bcannon-objcap/Doc/lib/lib.tex python/branches/bcannon-objcap/Doc/lib/libasyncore.tex python/branches/bcannon-objcap/Doc/lib/libbase64.tex python/branches/bcannon-objcap/Doc/lib/libbsddb.tex python/branches/bcannon-objcap/Doc/lib/libcfgparser.tex python/branches/bcannon-objcap/Doc/lib/libcgitb.tex python/branches/bcannon-objcap/Doc/lib/libcmath.tex python/branches/bcannon-objcap/Doc/lib/libcmd.tex python/branches/bcannon-objcap/Doc/lib/libcode.tex python/branches/bcannon-objcap/Doc/lib/libcodecs.tex python/branches/bcannon-objcap/Doc/lib/libcollections.tex python/branches/bcannon-objcap/Doc/lib/libcommands.tex python/branches/bcannon-objcap/Doc/lib/libconsts.tex python/branches/bcannon-objcap/Doc/lib/libcontextlib.tex python/branches/bcannon-objcap/Doc/lib/libcookielib.tex python/branches/bcannon-objcap/Doc/lib/libctypes.tex python/branches/bcannon-objcap/Doc/lib/libcurses.tex python/branches/bcannon-objcap/Doc/lib/libcursespanel.tex python/branches/bcannon-objcap/Doc/lib/libdatetime.tex python/branches/bcannon-objcap/Doc/lib/libdbhash.tex python/branches/bcannon-objcap/Doc/lib/libdecimal.tex python/branches/bcannon-objcap/Doc/lib/libdifflib.tex python/branches/bcannon-objcap/Doc/lib/libdl.tex python/branches/bcannon-objcap/Doc/lib/libdoctest.tex python/branches/bcannon-objcap/Doc/lib/libdocxmlrpc.tex python/branches/bcannon-objcap/Doc/lib/libdumbdbm.tex python/branches/bcannon-objcap/Doc/lib/libetree.tex python/branches/bcannon-objcap/Doc/lib/libexcs.tex python/branches/bcannon-objcap/Doc/lib/libfm.tex python/branches/bcannon-objcap/Doc/lib/libfnmatch.tex python/branches/bcannon-objcap/Doc/lib/libftplib.tex python/branches/bcannon-objcap/Doc/lib/libfuncs.tex python/branches/bcannon-objcap/Doc/lib/libfunctools.tex python/branches/bcannon-objcap/Doc/lib/libgettext.tex python/branches/bcannon-objcap/Doc/lib/libheapq.tex python/branches/bcannon-objcap/Doc/lib/libhmac.tex python/branches/bcannon-objcap/Doc/lib/libhotshot.tex python/branches/bcannon-objcap/Doc/lib/libhtmllib.tex python/branches/bcannon-objcap/Doc/lib/libhtmlparser.tex python/branches/bcannon-objcap/Doc/lib/libhttplib.tex python/branches/bcannon-objcap/Doc/lib/libimaplib.tex python/branches/bcannon-objcap/Doc/lib/libitertools.tex python/branches/bcannon-objcap/Doc/lib/liblocale.tex python/branches/bcannon-objcap/Doc/lib/liblogging.tex python/branches/bcannon-objcap/Doc/lib/libmailbox.tex python/branches/bcannon-objcap/Doc/lib/libmimetools.tex python/branches/bcannon-objcap/Doc/lib/libmimetypes.tex python/branches/bcannon-objcap/Doc/lib/libmimewriter.tex python/branches/bcannon-objcap/Doc/lib/libmmap.tex python/branches/bcannon-objcap/Doc/lib/libmsilib.tex python/branches/bcannon-objcap/Doc/lib/libmultifile.tex python/branches/bcannon-objcap/Doc/lib/libmutex.tex python/branches/bcannon-objcap/Doc/lib/libnetrc.tex python/branches/bcannon-objcap/Doc/lib/libnntplib.tex python/branches/bcannon-objcap/Doc/lib/liboptparse.tex python/branches/bcannon-objcap/Doc/lib/libos.tex python/branches/bcannon-objcap/Doc/lib/libpdb.tex python/branches/bcannon-objcap/Doc/lib/libpipes.tex python/branches/bcannon-objcap/Doc/lib/libplatform.tex python/branches/bcannon-objcap/Doc/lib/libpopen2.tex python/branches/bcannon-objcap/Doc/lib/libpoplib.tex python/branches/bcannon-objcap/Doc/lib/libposixfile.tex python/branches/bcannon-objcap/Doc/lib/libposixpath.tex python/branches/bcannon-objcap/Doc/lib/libpprint.tex python/branches/bcannon-objcap/Doc/lib/libprofile.tex python/branches/bcannon-objcap/Doc/lib/libqueue.tex python/branches/bcannon-objcap/Doc/lib/libre.tex python/branches/bcannon-objcap/Doc/lib/librepr.tex python/branches/bcannon-objcap/Doc/lib/librexec.tex python/branches/bcannon-objcap/Doc/lib/librfc822.tex python/branches/bcannon-objcap/Doc/lib/libsched.tex python/branches/bcannon-objcap/Doc/lib/libselect.tex python/branches/bcannon-objcap/Doc/lib/libsets.tex python/branches/bcannon-objcap/Doc/lib/libshlex.tex python/branches/bcannon-objcap/Doc/lib/libshutil.tex python/branches/bcannon-objcap/Doc/lib/libsimplexmlrpc.tex python/branches/bcannon-objcap/Doc/lib/libsite.tex python/branches/bcannon-objcap/Doc/lib/libsmtplib.tex python/branches/bcannon-objcap/Doc/lib/libsocket.tex python/branches/bcannon-objcap/Doc/lib/libsqlite3.tex python/branches/bcannon-objcap/Doc/lib/libstdtypes.tex python/branches/bcannon-objcap/Doc/lib/libstring.tex python/branches/bcannon-objcap/Doc/lib/libstruct.tex python/branches/bcannon-objcap/Doc/lib/libsubprocess.tex python/branches/bcannon-objcap/Doc/lib/libsun.tex python/branches/bcannon-objcap/Doc/lib/libsys.tex python/branches/bcannon-objcap/Doc/lib/libtarfile.tex python/branches/bcannon-objcap/Doc/lib/libtelnetlib.tex python/branches/bcannon-objcap/Doc/lib/libtempfile.tex python/branches/bcannon-objcap/Doc/lib/libtest.tex python/branches/bcannon-objcap/Doc/lib/libtextwrap.tex python/branches/bcannon-objcap/Doc/lib/libthreading.tex python/branches/bcannon-objcap/Doc/lib/libtimeit.tex python/branches/bcannon-objcap/Doc/lib/libturtle.tex python/branches/bcannon-objcap/Doc/lib/libunittest.tex python/branches/bcannon-objcap/Doc/lib/liburllib.tex python/branches/bcannon-objcap/Doc/lib/liburllib2.tex python/branches/bcannon-objcap/Doc/lib/liburlparse.tex python/branches/bcannon-objcap/Doc/lib/libwebbrowser.tex python/branches/bcannon-objcap/Doc/lib/libwinreg.tex python/branches/bcannon-objcap/Doc/lib/libxmlrpclib.tex python/branches/bcannon-objcap/Doc/lib/libzipfile.tex python/branches/bcannon-objcap/Doc/lib/libzlib.tex python/branches/bcannon-objcap/Doc/mac/libframework.tex python/branches/bcannon-objcap/Doc/mac/libmacic.tex python/branches/bcannon-objcap/Doc/mac/libmacostools.tex python/branches/bcannon-objcap/Doc/mac/mac.tex python/branches/bcannon-objcap/Doc/mac/undoc.tex python/branches/bcannon-objcap/Doc/mac/using.tex python/branches/bcannon-objcap/Doc/ref/ref1.tex python/branches/bcannon-objcap/Doc/ref/ref3.tex python/branches/bcannon-objcap/Doc/ref/ref5.tex python/branches/bcannon-objcap/Doc/ref/ref6.tex python/branches/bcannon-objcap/Doc/ref/ref7.tex python/branches/bcannon-objcap/Doc/texinputs/python.sty python/branches/bcannon-objcap/Doc/tools/listmodules python/branches/bcannon-objcap/Doc/tut/tut.tex python/branches/bcannon-objcap/Doc/whatsnew/whatsnew23.tex python/branches/bcannon-objcap/Doc/whatsnew/whatsnew24.tex python/branches/bcannon-objcap/Doc/whatsnew/whatsnew25.tex python/branches/bcannon-objcap/Doc/whatsnew/whatsnew26.tex python/branches/bcannon-objcap/Grammar/Grammar python/branches/bcannon-objcap/Include/Python-ast.h python/branches/bcannon-objcap/Include/dictobject.h python/branches/bcannon-objcap/Include/fileobject.h python/branches/bcannon-objcap/Include/intobject.h python/branches/bcannon-objcap/Include/listobject.h python/branches/bcannon-objcap/Include/longobject.h python/branches/bcannon-objcap/Include/object.h python/branches/bcannon-objcap/Include/pydebug.h python/branches/bcannon-objcap/Include/pyerrors.h python/branches/bcannon-objcap/Include/pymem.h python/branches/bcannon-objcap/Include/pystate.h python/branches/bcannon-objcap/Include/setobject.h python/branches/bcannon-objcap/Include/stringobject.h python/branches/bcannon-objcap/Include/tupleobject.h python/branches/bcannon-objcap/Include/unicodeobject.h python/branches/bcannon-objcap/LICENSE python/branches/bcannon-objcap/Lib/Bastion.py python/branches/bcannon-objcap/Lib/CGIHTTPServer.py python/branches/bcannon-objcap/Lib/ConfigParser.py python/branches/bcannon-objcap/Lib/DocXMLRPCServer.py python/branches/bcannon-objcap/Lib/HTMLParser.py python/branches/bcannon-objcap/Lib/SimpleXMLRPCServer.py python/branches/bcannon-objcap/Lib/SocketServer.py python/branches/bcannon-objcap/Lib/_strptime.py python/branches/bcannon-objcap/Lib/binhex.py python/branches/bcannon-objcap/Lib/bisect.py python/branches/bcannon-objcap/Lib/bsddb/test/test_recno.py python/branches/bcannon-objcap/Lib/calendar.py python/branches/bcannon-objcap/Lib/cgitb.py python/branches/bcannon-objcap/Lib/commands.py python/branches/bcannon-objcap/Lib/compiler/transformer.py python/branches/bcannon-objcap/Lib/copy_reg.py python/branches/bcannon-objcap/Lib/csv.py python/branches/bcannon-objcap/Lib/ctypes/__init__.py python/branches/bcannon-objcap/Lib/ctypes/test/test_checkretval.py python/branches/bcannon-objcap/Lib/ctypes/test/test_functions.py python/branches/bcannon-objcap/Lib/ctypes/test/test_loading.py python/branches/bcannon-objcap/Lib/ctypes/test/test_memfunctions.py python/branches/bcannon-objcap/Lib/ctypes/test/test_numbers.py python/branches/bcannon-objcap/Lib/ctypes/test/test_python_api.py python/branches/bcannon-objcap/Lib/ctypes/test/test_random_things.py python/branches/bcannon-objcap/Lib/ctypes/test/test_repr.py python/branches/bcannon-objcap/Lib/decimal.py python/branches/bcannon-objcap/Lib/difflib.py python/branches/bcannon-objcap/Lib/distutils/__init__.py python/branches/bcannon-objcap/Lib/distutils/command/build_ext.py python/branches/bcannon-objcap/Lib/distutils/msvccompiler.py python/branches/bcannon-objcap/Lib/doctest.py python/branches/bcannon-objcap/Lib/email/_parseaddr.py python/branches/bcannon-objcap/Lib/email/header.py python/branches/bcannon-objcap/Lib/email/message.py python/branches/bcannon-objcap/Lib/email/test/test_email.py python/branches/bcannon-objcap/Lib/email/test/test_email_renamed.py python/branches/bcannon-objcap/Lib/encodings/__init__.py python/branches/bcannon-objcap/Lib/encodings/utf_8_sig.py python/branches/bcannon-objcap/Lib/ftplib.py python/branches/bcannon-objcap/Lib/genericpath.py python/branches/bcannon-objcap/Lib/glob.py python/branches/bcannon-objcap/Lib/gzip.py python/branches/bcannon-objcap/Lib/heapq.py python/branches/bcannon-objcap/Lib/httplib.py python/branches/bcannon-objcap/Lib/idlelib/AutoCompleteWindow.py python/branches/bcannon-objcap/Lib/idlelib/CallTips.py python/branches/bcannon-objcap/Lib/idlelib/CodeContext.py python/branches/bcannon-objcap/Lib/idlelib/IOBinding.py python/branches/bcannon-objcap/Lib/idlelib/MultiCall.py python/branches/bcannon-objcap/Lib/idlelib/NEWS.txt python/branches/bcannon-objcap/Lib/idlelib/PyShell.py python/branches/bcannon-objcap/Lib/idlelib/configHandler.py python/branches/bcannon-objcap/Lib/idlelib/help.txt python/branches/bcannon-objcap/Lib/imaplib.py python/branches/bcannon-objcap/Lib/imputil.py python/branches/bcannon-objcap/Lib/locale.py python/branches/bcannon-objcap/Lib/logging/__init__.py python/branches/bcannon-objcap/Lib/logging/handlers.py python/branches/bcannon-objcap/Lib/macpath.py python/branches/bcannon-objcap/Lib/mimetypes.py python/branches/bcannon-objcap/Lib/ntpath.py python/branches/bcannon-objcap/Lib/os.py python/branches/bcannon-objcap/Lib/pdb.doc python/branches/bcannon-objcap/Lib/pdb.py python/branches/bcannon-objcap/Lib/plat-mac/macostools.py python/branches/bcannon-objcap/Lib/plat-mac/pimp.py python/branches/bcannon-objcap/Lib/popen2.py python/branches/bcannon-objcap/Lib/poplib.py python/branches/bcannon-objcap/Lib/posixfile.py python/branches/bcannon-objcap/Lib/posixpath.py python/branches/bcannon-objcap/Lib/pydoc.py python/branches/bcannon-objcap/Lib/rexec.py python/branches/bcannon-objcap/Lib/robotparser.py python/branches/bcannon-objcap/Lib/sched.py python/branches/bcannon-objcap/Lib/shlex.py python/branches/bcannon-objcap/Lib/shutil.py python/branches/bcannon-objcap/Lib/site.py python/branches/bcannon-objcap/Lib/smtplib.py python/branches/bcannon-objcap/Lib/socket.py python/branches/bcannon-objcap/Lib/sre.py python/branches/bcannon-objcap/Lib/stat.py python/branches/bcannon-objcap/Lib/string.py python/branches/bcannon-objcap/Lib/subprocess.py python/branches/bcannon-objcap/Lib/tarfile.py python/branches/bcannon-objcap/Lib/telnetlib.py python/branches/bcannon-objcap/Lib/tempfile.py python/branches/bcannon-objcap/Lib/test/README python/branches/bcannon-objcap/Lib/test/output/test_extcall python/branches/bcannon-objcap/Lib/test/outstanding_bugs.py python/branches/bcannon-objcap/Lib/test/pickletester.py python/branches/bcannon-objcap/Lib/test/regrtest.py python/branches/bcannon-objcap/Lib/test/string_tests.py python/branches/bcannon-objcap/Lib/test/test___all__.py python/branches/bcannon-objcap/Lib/test/test_array.py python/branches/bcannon-objcap/Lib/test/test_base64.py python/branches/bcannon-objcap/Lib/test/test_binascii.py python/branches/bcannon-objcap/Lib/test/test_bsddb.py python/branches/bcannon-objcap/Lib/test/test_bsddb3.py python/branches/bcannon-objcap/Lib/test/test_builtin.py python/branches/bcannon-objcap/Lib/test/test_bz2.py python/branches/bcannon-objcap/Lib/test/test_cfgparser.py python/branches/bcannon-objcap/Lib/test/test_cmath.py python/branches/bcannon-objcap/Lib/test/test_cmd_line.py python/branches/bcannon-objcap/Lib/test/test_codecencodings_cn.py python/branches/bcannon-objcap/Lib/test/test_codecencodings_hk.py python/branches/bcannon-objcap/Lib/test/test_codecencodings_jp.py python/branches/bcannon-objcap/Lib/test/test_codecencodings_kr.py python/branches/bcannon-objcap/Lib/test/test_codecencodings_tw.py python/branches/bcannon-objcap/Lib/test/test_codecmaps_cn.py python/branches/bcannon-objcap/Lib/test/test_codecmaps_hk.py python/branches/bcannon-objcap/Lib/test/test_codecmaps_jp.py python/branches/bcannon-objcap/Lib/test/test_codecmaps_kr.py python/branches/bcannon-objcap/Lib/test/test_codecmaps_tw.py python/branches/bcannon-objcap/Lib/test/test_codecs.py python/branches/bcannon-objcap/Lib/test/test_commands.py python/branches/bcannon-objcap/Lib/test/test_compile.py python/branches/bcannon-objcap/Lib/test/test_complex.py python/branches/bcannon-objcap/Lib/test/test_contextlib.py python/branches/bcannon-objcap/Lib/test/test_crypt.py python/branches/bcannon-objcap/Lib/test/test_csv.py python/branches/bcannon-objcap/Lib/test/test_ctypes.py python/branches/bcannon-objcap/Lib/test/test_curses.py python/branches/bcannon-objcap/Lib/test/test_datetime.py python/branches/bcannon-objcap/Lib/test/test_dbm.py python/branches/bcannon-objcap/Lib/test/test_defaultdict.py python/branches/bcannon-objcap/Lib/test/test_descr.py python/branches/bcannon-objcap/Lib/test/test_dict.py python/branches/bcannon-objcap/Lib/test/test_dis.py python/branches/bcannon-objcap/Lib/test/test_email.py python/branches/bcannon-objcap/Lib/test/test_email_codecs.py python/branches/bcannon-objcap/Lib/test/test_email_renamed.py python/branches/bcannon-objcap/Lib/test/test_exceptions.py python/branches/bcannon-objcap/Lib/test/test_extcall.py python/branches/bcannon-objcap/Lib/test/test_fileinput.py python/branches/bcannon-objcap/Lib/test/test_format.py python/branches/bcannon-objcap/Lib/test/test_gc.py python/branches/bcannon-objcap/Lib/test/test_gdbm.py python/branches/bcannon-objcap/Lib/test/test_generators.py python/branches/bcannon-objcap/Lib/test/test_getopt.py python/branches/bcannon-objcap/Lib/test/test_gettext.py python/branches/bcannon-objcap/Lib/test/test_glob.py python/branches/bcannon-objcap/Lib/test/test_grammar.py python/branches/bcannon-objcap/Lib/test/test_gzip.py python/branches/bcannon-objcap/Lib/test/test_heapq.py python/branches/bcannon-objcap/Lib/test/test_htmlparser.py python/branches/bcannon-objcap/Lib/test/test_httplib.py python/branches/bcannon-objcap/Lib/test/test_imageop.py python/branches/bcannon-objcap/Lib/test/test_import.py python/branches/bcannon-objcap/Lib/test/test_index.py python/branches/bcannon-objcap/Lib/test/test_itertools.py python/branches/bcannon-objcap/Lib/test/test_locale.py python/branches/bcannon-objcap/Lib/test/test_logging.py python/branches/bcannon-objcap/Lib/test/test_long_future.py python/branches/bcannon-objcap/Lib/test/test_macostools.py python/branches/bcannon-objcap/Lib/test/test_macpath.py python/branches/bcannon-objcap/Lib/test/test_mailbox.py python/branches/bcannon-objcap/Lib/test/test_marshal.py python/branches/bcannon-objcap/Lib/test/test_minidom.py python/branches/bcannon-objcap/Lib/test/test_module.py python/branches/bcannon-objcap/Lib/test/test_multibytecodec.py python/branches/bcannon-objcap/Lib/test/test_normalization.py python/branches/bcannon-objcap/Lib/test/test_ntpath.py python/branches/bcannon-objcap/Lib/test/test_operator.py python/branches/bcannon-objcap/Lib/test/test_optparse.py python/branches/bcannon-objcap/Lib/test/test_os.py python/branches/bcannon-objcap/Lib/test/test_ossaudiodev.py python/branches/bcannon-objcap/Lib/test/test_peepholer.py python/branches/bcannon-objcap/Lib/test/test_pep352.py python/branches/bcannon-objcap/Lib/test/test_popen2.py python/branches/bcannon-objcap/Lib/test/test_posix.py python/branches/bcannon-objcap/Lib/test/test_posixpath.py python/branches/bcannon-objcap/Lib/test/test_pty.py python/branches/bcannon-objcap/Lib/test/test_pyexpat.py python/branches/bcannon-objcap/Lib/test/test_re.py python/branches/bcannon-objcap/Lib/test/test_robotparser.py python/branches/bcannon-objcap/Lib/test/test_sax.py python/branches/bcannon-objcap/Lib/test/test_scope.py python/branches/bcannon-objcap/Lib/test/test_set.py python/branches/bcannon-objcap/Lib/test/test_slice.py python/branches/bcannon-objcap/Lib/test/test_socket.py python/branches/bcannon-objcap/Lib/test/test_socket_ssl.py python/branches/bcannon-objcap/Lib/test/test_socketserver.py python/branches/bcannon-objcap/Lib/test/test_softspace.py python/branches/bcannon-objcap/Lib/test/test_stringprep.py python/branches/bcannon-objcap/Lib/test/test_strptime.py python/branches/bcannon-objcap/Lib/test/test_struct.py python/branches/bcannon-objcap/Lib/test/test_structmembers.py python/branches/bcannon-objcap/Lib/test/test_sundry.py python/branches/bcannon-objcap/Lib/test/test_support.py python/branches/bcannon-objcap/Lib/test/test_syntax.py python/branches/bcannon-objcap/Lib/test/test_tarfile.py python/branches/bcannon-objcap/Lib/test/test_tempfile.py python/branches/bcannon-objcap/Lib/test/test_textwrap.py python/branches/bcannon-objcap/Lib/test/test_threadedtempfile.py python/branches/bcannon-objcap/Lib/test/test_threading_local.py python/branches/bcannon-objcap/Lib/test/test_unicode.py python/branches/bcannon-objcap/Lib/test/test_unicode_file.py python/branches/bcannon-objcap/Lib/test/test_unittest.py python/branches/bcannon-objcap/Lib/test/test_unpack.py python/branches/bcannon-objcap/Lib/test/test_urllib.py python/branches/bcannon-objcap/Lib/test/test_urllib2.py python/branches/bcannon-objcap/Lib/test/test_urllib2net.py python/branches/bcannon-objcap/Lib/test/test_userdict.py python/branches/bcannon-objcap/Lib/test/test_warnings.py python/branches/bcannon-objcap/Lib/test/test_wsgiref.py python/branches/bcannon-objcap/Lib/test/test_xmlrpc.py python/branches/bcannon-objcap/Lib/test/test_zipfile.py python/branches/bcannon-objcap/Lib/test/test_zlib.py python/branches/bcannon-objcap/Lib/test/testtar.tar python/branches/bcannon-objcap/Lib/textwrap.py python/branches/bcannon-objcap/Lib/timeit.py python/branches/bcannon-objcap/Lib/trace.py python/branches/bcannon-objcap/Lib/unittest.py python/branches/bcannon-objcap/Lib/urllib.py python/branches/bcannon-objcap/Lib/urllib2.py python/branches/bcannon-objcap/Lib/wave.py python/branches/bcannon-objcap/Lib/webbrowser.py python/branches/bcannon-objcap/Lib/xml/sax/saxutils.py python/branches/bcannon-objcap/Lib/zipfile.py python/branches/bcannon-objcap/Misc/ACKS python/branches/bcannon-objcap/Misc/BeOS-NOTES python/branches/bcannon-objcap/Misc/NEWS python/branches/bcannon-objcap/Misc/build.sh python/branches/bcannon-objcap/Misc/cheatsheet python/branches/bcannon-objcap/Misc/developers.txt python/branches/bcannon-objcap/Misc/python-config.in python/branches/bcannon-objcap/Modules/Setup.dist python/branches/bcannon-objcap/Modules/_bsddb.c python/branches/bcannon-objcap/Modules/_ctypes/_ctypes.c python/branches/bcannon-objcap/Modules/_ctypes/callbacks.c python/branches/bcannon-objcap/Modules/_ctypes/callproc.c python/branches/bcannon-objcap/Modules/_ctypes/cfield.c python/branches/bcannon-objcap/Modules/_ctypes/ctypes.h python/branches/bcannon-objcap/Modules/_ctypes/libffi/configure python/branches/bcannon-objcap/Modules/_ctypes/libffi/configure.ac python/branches/bcannon-objcap/Modules/_ctypes/libffi/fficonfig.h.in python/branches/bcannon-objcap/Modules/_ctypes/libffi_msvc/ffitarget.h python/branches/bcannon-objcap/Modules/_ctypes/stgdict.c python/branches/bcannon-objcap/Modules/_cursesmodule.c python/branches/bcannon-objcap/Modules/_localemodule.c python/branches/bcannon-objcap/Modules/_struct.c python/branches/bcannon-objcap/Modules/_tkinter.c python/branches/bcannon-objcap/Modules/arraymodule.c python/branches/bcannon-objcap/Modules/binascii.c python/branches/bcannon-objcap/Modules/bz2module.c python/branches/bcannon-objcap/Modules/cPickle.c python/branches/bcannon-objcap/Modules/cStringIO.c python/branches/bcannon-objcap/Modules/datetimemodule.c python/branches/bcannon-objcap/Modules/getbuildinfo.c python/branches/bcannon-objcap/Modules/getpath.c python/branches/bcannon-objcap/Modules/itertoolsmodule.c python/branches/bcannon-objcap/Modules/main.c python/branches/bcannon-objcap/Modules/operator.c python/branches/bcannon-objcap/Modules/posixmodule.c python/branches/bcannon-objcap/Modules/readline.c python/branches/bcannon-objcap/Modules/socketmodule.c python/branches/bcannon-objcap/Modules/socketmodule.h python/branches/bcannon-objcap/Modules/timemodule.c python/branches/bcannon-objcap/Objects/abstract.c python/branches/bcannon-objcap/Objects/classobject.c python/branches/bcannon-objcap/Objects/complexobject.c python/branches/bcannon-objcap/Objects/dictnotes.txt python/branches/bcannon-objcap/Objects/dictobject.c python/branches/bcannon-objcap/Objects/enumobject.c python/branches/bcannon-objcap/Objects/exceptions.c python/branches/bcannon-objcap/Objects/fileobject.c python/branches/bcannon-objcap/Objects/floatobject.c python/branches/bcannon-objcap/Objects/frameobject.c python/branches/bcannon-objcap/Objects/intobject.c python/branches/bcannon-objcap/Objects/listobject.c python/branches/bcannon-objcap/Objects/longobject.c python/branches/bcannon-objcap/Objects/object.c python/branches/bcannon-objcap/Objects/setobject.c python/branches/bcannon-objcap/Objects/sliceobject.c python/branches/bcannon-objcap/Objects/stringobject.c python/branches/bcannon-objcap/Objects/tupleobject.c python/branches/bcannon-objcap/Objects/typeobject.c python/branches/bcannon-objcap/Objects/unicodeobject.c python/branches/bcannon-objcap/PC/VC6/pcbuild.dsw python/branches/bcannon-objcap/PC/_winreg.c python/branches/bcannon-objcap/PC/config.c python/branches/bcannon-objcap/PC/getpathp.c python/branches/bcannon-objcap/PC/make_versioninfo.c python/branches/bcannon-objcap/PC/pyconfig.h python/branches/bcannon-objcap/PCbuild/pythoncore.vcproj python/branches/bcannon-objcap/PCbuild8/pcbuild.sln python/branches/bcannon-objcap/PCbuild8/readme.txt python/branches/bcannon-objcap/PCbuild8/rmpyc.py python/branches/bcannon-objcap/PCbuild8/rt.bat python/branches/bcannon-objcap/Parser/Python.asdl python/branches/bcannon-objcap/Parser/asdl_c.py python/branches/bcannon-objcap/Python/Python-ast.c python/branches/bcannon-objcap/Python/ast.c python/branches/bcannon-objcap/Python/bltinmodule.c python/branches/bcannon-objcap/Python/ceval.c python/branches/bcannon-objcap/Python/compile.c python/branches/bcannon-objcap/Python/dynload_win.c python/branches/bcannon-objcap/Python/errors.c python/branches/bcannon-objcap/Python/graminit.c python/branches/bcannon-objcap/Python/import.c python/branches/bcannon-objcap/Python/marshal.c python/branches/bcannon-objcap/Python/peephole.c python/branches/bcannon-objcap/Python/pystate.c python/branches/bcannon-objcap/Python/pythonrun.c python/branches/bcannon-objcap/Python/sysmodule.c python/branches/bcannon-objcap/Python/thread_nt.h python/branches/bcannon-objcap/README python/branches/bcannon-objcap/Tools/msi/msilib.py python/branches/bcannon-objcap/Tools/pybench/pybench.py python/branches/bcannon-objcap/configure python/branches/bcannon-objcap/configure.in python/branches/bcannon-objcap/pyconfig.h.in python/branches/bcannon-objcap/setup.py Log: Merged revisions 53607-55563 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk . Also removed calls to file's constructor from tarfile and test_zipfile. A test in test_xmlrpc was disabled as it required setdefaultencoding to appear upon reloading sys; doesn't work at the moment. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Fri May 25 22:13:08 2007 @@ -12,6 +12,8 @@ ====== Status ====== +* Fix failing tests. + - test_xmlrpc * Turn on whitelisting. - Verify injecting 'open' into importlib works. * Write tests. @@ -26,6 +28,9 @@ - Types crippled. + file + code +* Fix 'sys' module. + - test_xmlrpc relies on reloading sys to get setdefaultencoding, but hack + to allow re-import of sys doesn't let this work. ========== References Modified: python/branches/bcannon-objcap/Demo/parser/unparse.py ============================================================================== --- python/branches/bcannon-objcap/Demo/parser/unparse.py (original) +++ python/branches/bcannon-objcap/Demo/parser/unparse.py Fri May 25 22:13:08 2007 @@ -4,6 +4,19 @@ import cStringIO import os +def interleave(inter, f, seq): + """Call f on each item in seq, calling inter() in between. + """ + seq = iter(seq) + try: + f(seq.next()) + except StopIteration: + pass + else: + for x in seq: + inter() + f(x) + class Unparser: """Methods in this class recursively traverse an AST and output source code for the abstract syntax; original formatting @@ -63,26 +76,13 @@ def _Import(self, t): self.fill("import ") - first = True - for a in t.names: - if first: - first = False - else: - self.write(", ") - self.write(a.name) - if a.asname: - self.write(" as "+a.asname) + interleave(lambda: self.write(", "), self.dispatch, t.names) def _ImportFrom(self, t): self.fill("from ") self.write(t.module) self.write(" import ") - for i, a in enumerate(t.names): - if i == 0: - self.write(", ") - self.write(a.name) - if a.asname: - self.write(" as "+a.asname) + interleave(lambda: self.write(", "), self.dispatch, t.names) # XXX(jpe) what is level for? def _Assign(self, t): @@ -99,8 +99,9 @@ self.dispatch(t.value) def _Return(self, t): - self.fill("return ") + self.fill("return") if t.value: + self.write(" ") self.dispatch(t.value) def _Pass(self, t): @@ -148,18 +149,16 @@ self.write(",") def _Global(self, t): - self.fill("global") - for i, n in enumerate(t.names): - if i != 0: - self.write(",") - self.write(" " + n) + self.fill("global ") + interleave(lambda: self.write(", "), self.write, t.names) def _Yield(self, t): - self.fill("yield") + self.write("(") + self.write("yield") if t.value: - self.write(" (") + self.write(" ") self.dispatch(t.value) - self.write(")") + self.write(")") def _Raise(self, t): self.fill('raise ') @@ -198,8 +197,9 @@ self.leave() def _excepthandler(self, t): - self.fill("except ") + self.fill("except") if t.type: + self.write(" ") self.dispatch(t.type) if t.name: self.write(", ") @@ -299,9 +299,7 @@ def _List(self, t): self.write("[") - for e in t.elts: - self.dispatch(e) - self.write(", ") + interleave(lambda: self.write(", "), self.dispatch, t.elts) self.write("]") def _ListComp(self, t): @@ -328,30 +326,31 @@ self.dispatch(if_clause) def _IfExp(self, t): + self.write("(") self.dispatch(t.body) self.write(" if ") self.dispatch(t.test) - if t.orelse: - self.write(" else ") - self.dispatch(t.orelse) + self.write(" else ") + self.dispatch(t.orelse) + self.write(")") def _Dict(self, t): self.write("{") - for k,v in zip(t.keys, t.values): + def writem((k, v)): self.dispatch(k) - self.write(" : ") + self.write(": ") self.dispatch(v) - self.write(", ") + interleave(lambda: self.write(", "), writem, zip(t.keys, t.values)) self.write("}") def _Tuple(self, t): - if not t.elts: - self.write("()") - return self.write("(") - for e in t.elts: - self.dispatch(e) - self.write(", ") + if len(t.elts) == 1: + (elt,) = t.elts + self.dispatch(elt) + self.write(",") + else: + interleave(lambda: self.write(", "), self.dispatch, t.elts) self.write(")") unop = {"Invert":"~", "Not": "not", "UAdd":"+", "USub":"-"} @@ -367,7 +366,7 @@ def _BinOp(self, t): self.write("(") self.dispatch(t.left) - self.write(")" + self.binop[t.op.__class__.__name__] + "(") + self.write(" " + self.binop[t.op.__class__.__name__] + " ") self.dispatch(t.right) self.write(")") @@ -377,17 +376,15 @@ self.write("(") self.dispatch(t.left) for o, e in zip(t.ops, t.comparators): - self.write(") " +self.cmpops[o.__class__.__name__] + " (") + self.write(" " + self.cmpops[o.__class__.__name__] + " ") self.dispatch(e) self.write(")") boolops = {_ast.And: 'and', _ast.Or: 'or'} def _BoolOp(self, t): self.write("(") - self.dispatch(t.values[0]) - for v in t.values[1:]: - self.write(" %s " % self.boolops[t.op.__class__]) - self.dispatch(v) + s = " %s " % self.boolops[t.op.__class__] + interleave(lambda: self.write(s), self.dispatch, t.values) self.write(")") def _Attribute(self,t): @@ -443,10 +440,7 @@ self.dispatch(t.step) def _ExtSlice(self, t): - for i, d in enumerate(t.dims): - if i != 0: - self.write(': ') - self.dispatch(d) + interleave(lambda: self.write(', '), self.dispatch, t.dims) # others def _arguments(self, t): @@ -482,9 +476,14 @@ self.write(": ") self.dispatch(t.body) + def _alias(self, t): + self.write(t.name) + if t.asname: + self.write(" as "+t.asname) + def roundtrip(filename, output=sys.stdout): source = open(filename).read() - tree = compile(source, filename, "exec", 0x400) + tree = compile(source, filename, "exec", _ast.PyCF_ONLY_AST) Unparser(tree, output) Modified: python/branches/bcannon-objcap/Demo/threads/README ============================================================================== --- python/branches/bcannon-objcap/Demo/threads/README (original) +++ python/branches/bcannon-objcap/Demo/threads/README Fri May 25 22:13:08 2007 @@ -3,10 +3,8 @@ These are mostly "proof of concept" type applications: Generator.py Generator class implemented with threads. -find.py Parallelized "find(1)" (looks for directories). sync.py Condition variables primitives by Tim Peters. telnet.py Version of ../sockets/telnet.py using threads. -wpi.py Version of ../scripts/pi.py using threads (needs stdwin). Coroutine.py Coroutines using threads, by Tim Peters (22 May 94) fcmp.py Example of above, by Tim Modified: python/branches/bcannon-objcap/Doc/Makefile.deps ============================================================================== --- python/branches/bcannon-objcap/Doc/Makefile.deps (original) +++ python/branches/bcannon-objcap/Doc/Makefile.deps Fri May 25 22:13:08 2007 @@ -187,7 +187,6 @@ lib/liburllib2.tex \ lib/libhttplib.tex \ lib/libftplib.tex \ - lib/libgopherlib.tex \ lib/libnntplib.tex \ lib/liburlparse.tex \ lib/libhtmlparser.tex \ @@ -202,14 +201,12 @@ lib/libimageop.tex \ lib/libaifc.tex \ lib/libjpeg.tex \ - lib/librgbimg.tex \ lib/libossaudiodev.tex \ lib/libcrypto.tex \ lib/libhashlib.tex \ lib/libmd5.tex \ lib/libsha.tex \ lib/libhmac.tex \ - lib/libstdwin.tex \ lib/libsgi.tex \ lib/libal.tex \ lib/libcd.tex \ @@ -369,7 +366,6 @@ mac/libaetools.tex \ mac/libaepack.tex \ mac/libaetypes.tex \ - mac/libmacfs.tex \ mac/libmacos.tex \ mac/libmacostools.tex \ mac/libmacui.tex \ Modified: python/branches/bcannon-objcap/Doc/api/abstract.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/api/abstract.tex (original) +++ python/branches/bcannon-objcap/Doc/api/abstract.tex Fri May 25 22:13:08 2007 @@ -810,7 +810,7 @@ the Python statement \samp{del \var{o}[\var{i1}:\var{i2}]}. \end{cfuncdesc} -\begin{cfuncdesc}{int}{PySequence_Count}{PyObject *o, PyObject *value} +\begin{cfuncdesc}{Py_ssize_t}{PySequence_Count}{PyObject *o, PyObject *value} Return the number of occurrences of \var{value} in \var{o}, that is, return the number of keys for which \code{\var{o}[\var{key}] == \var{value}}. On failure, return \code{-1}. This is equivalent to @@ -824,7 +824,7 @@ expression \samp{\var{value} in \var{o}}. \end{cfuncdesc} -\begin{cfuncdesc}{int}{PySequence_Index}{PyObject *o, PyObject *value} +\begin{cfuncdesc}{Py_ssize_t}{PySequence_Index}{PyObject *o, PyObject *value} Return the first index \var{i} for which \code{\var{o}[\var{i}] == \var{value}}. On error, return \code{-1}. This is equivalent to the Python expression \samp{\var{o}.index(\var{value})}. @@ -874,7 +874,7 @@ \versionadded{2.3} \end{cfuncdesc} -\begin{cfuncdesc}{int}{PySequence_Fast_GET_SIZE}{PyObject *o} +\begin{cfuncdesc}{Py_ssize_t}{PySequence_Fast_GET_SIZE}{PyObject *o} Returns the length of \var{o}, assuming that \var{o} was returned by \cfunction{PySequence_Fast()} and that \var{o} is not \NULL. The size can also be gotten by calling Modified: python/branches/bcannon-objcap/Doc/api/concrete.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/api/concrete.tex (original) +++ python/branches/bcannon-objcap/Doc/api/concrete.tex Fri May 25 22:13:08 2007 @@ -443,7 +443,9 @@ \begin{cfuncdesc}{double}{PyFloat_AsDouble}{PyObject *pyfloat} Return a C \ctype{double} representation of the contents of - \var{pyfloat}. + \var{pyfloat}. If \var{pyfloat} is not a Python floating point + object but has a \method{__float__} method, this method will first + be called to convert \var{pyfloat} into a float. \end{cfuncdesc} \begin{cfuncdesc}{double}{PyFloat_AS_DOUBLE}{PyObject *pyfloat} @@ -558,8 +560,11 @@ \end{cfuncdesc} \begin{cfuncdesc}{Py_complex}{PyComplex_AsCComplex}{PyObject *op} - Return the \ctype{Py_complex} value of the complex number - \var{op}. + Return the \ctype{Py_complex} value of the complex number \var{op}. + \versionchanged[If \var{op} is not a Python complex number object + but has a \method{__complex__} method, this method + will first be called to convert \var{op} to a Python + complex number object]{2.6} \end{cfuncdesc} @@ -1173,10 +1178,10 @@ *byteorder == 1: big endian \end{verbatim} - and then switches according to all byte order marks (BOM) it finds - in the input data. BOMs are not copied into the resulting Unicode - string. After completion, \var{*byteorder} is set to the current - byte order at the end of input data. + and then switches if the first two bytes of the input data are a byte order + mark (BOM) and the specified byte order is native order. This BOM is not + copied into the resulting Unicode string. After completion, \var{*byteorder} + is set to the current byte order at the. If \var{byteorder} is \NULL{}, the codec starts in native order mode. @@ -2157,6 +2162,35 @@ \section{Other Objects \label{otherObjects}} +\subsection{Class Objects \label{classObjects}} + +\obindex{class} +Note that the class objects described here represent old-style classes, +which will go away in Python 3. When creating new types for extension +modules, you will want to work with type objects (section +\ref{typeObjects}). + +\begin{ctypedesc}{PyClassObject} + The C structure of the objects used to describe built-in classes. +\end{ctypedesc} + +\begin{cvardesc}{PyObject*}{PyClass_Type} + This is the type object for class objects; it is the same object as + \code{types.ClassType} in the Python layer. + \withsubitem{(in module types)}{\ttindex{ClassType}} +\end{cvardesc} + +\begin{cfuncdesc}{int}{PyClass_Check}{PyObject *o} + Return true if the object \var{o} is a class object, including + instances of types derived from the standard class object. Return + false in all other cases. +\end{cfuncdesc} + +\begin{cfuncdesc}{int}{PyClass_IsSubclass}{PyObject *klass, PyObject *base} + Return true if \var{klass} is a subclass of \var{base}. Return false in + all other cases. +\end{cfuncdesc} + \subsection{File Objects \label{fileObjects}} \obindex{file} Modified: python/branches/bcannon-objcap/Doc/api/init.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/api/init.tex (original) +++ python/branches/bcannon-objcap/Doc/api/init.tex Fri May 25 22:13:08 2007 @@ -245,7 +245,7 @@ program name (set by \cfunction{Py_SetProgramName()} above) and some environment variables. The returned string consists of a series of directory names separated by a platform dependent delimiter - character. The delimiter character is \character{:} on \UNIX and Mac OS X, + character. The delimiter character is \character{:} on \UNIX{} and Mac OS X, \character{;} on Windows. The returned string points into static storage; the caller should not modify its value. The value is available to Python code as the list Modified: python/branches/bcannon-objcap/Doc/api/memory.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/api/memory.tex (original) +++ python/branches/bcannon-objcap/Doc/api/memory.tex Fri May 25 22:13:08 2007 @@ -100,7 +100,9 @@ memory block is resized but is not freed, and the returned pointer is non-\NULL. Unless \var{p} is \NULL, it must have been returned by a previous call to \cfunction{PyMem_Malloc()} or - \cfunction{PyMem_Realloc()}. + \cfunction{PyMem_Realloc()}. If the request fails, + \cfunction{PyMem_Realloc()} returns \NULL{} and \var{p} remains a + valid pointer to the previous memory area. \end{cfuncdesc} \begin{cfuncdesc}{void}{PyMem_Free}{void *p} @@ -124,7 +126,8 @@ \begin{cfuncdesc}{\var{TYPE}*}{PyMem_Resize}{void *p, TYPE, size_t n} Same as \cfunction{PyMem_Realloc()}, but the memory block is resized to \code{(\var{n} * sizeof(\var{TYPE}))} bytes. Returns a pointer - cast to \ctype{\var{TYPE}*}. + cast to \ctype{\var{TYPE}*}. On return, \var{p} will be a pointer to + the new memory area, or \NULL{} in the event of failure. \end{cfuncdesc} \begin{cfuncdesc}{void}{PyMem_Del}{void *p} Modified: python/branches/bcannon-objcap/Doc/api/newtypes.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/api/newtypes.tex (original) +++ python/branches/bcannon-objcap/Doc/api/newtypes.tex Fri May 25 22:13:08 2007 @@ -1316,7 +1316,7 @@ This field is inherited by static subtypes, but not by dynamic subtypes (subtypes created by a class statement); in the latter, - this field is always set to \cfunction{PyType_GenericAlloc()}, to + this field is always set to \cfunction{PyType_GenericAlloc}, to force a standard heap allocation strategy. That is also the recommended value for statically defined types. \end{cmemberdesc} Modified: python/branches/bcannon-objcap/Doc/api/utilities.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/api/utilities.tex (original) +++ python/branches/bcannon-objcap/Doc/api/utilities.tex Fri May 25 22:13:08 2007 @@ -930,3 +930,94 @@ If there is an error in the format string, the \exception{SystemError} exception is set and \NULL{} returned. \end{cfuncdesc} + +\section{String conversion and formatting \label{string-formatting}} + +Functions for number conversion and formatted string output. + +\begin{cfuncdesc}{int}{PyOS_snprintf}{char *str, size_t size, + const char *format, \moreargs} +Output not more than \var{size} bytes to \var{str} according to the format +string \var{format} and the extra arguments. See the \UNIX{} man +page \manpage{snprintf}{2}. +\end{cfuncdesc} + +\begin{cfuncdesc}{int}{PyOS_vsnprintf}{char *str, size_t size, + const char *format, va_list va} +Output not more than \var{size} bytes to \var{str} according to the format +string \var{format} and the variable argument list \var{va}. \UNIX{} +man page \manpage{vsnprintf}{2}. +\end{cfuncdesc} + +\cfunction{PyOS_snprintf} and \cfunction{PyOS_vsnprintf} wrap the +Standard C library functions \cfunction{snprintf()} and +\cfunction{vsnprintf()}. Their purpose is to guarantee consistent +behavior in corner cases, which the Standard C functions do not. + +The wrappers ensure that \var{str}[\var{size}-1] is always +\character{\textbackslash0} upon return. They never write more than +\var{size} bytes (including the trailing \character{\textbackslash0} +into str. Both functions require that \code{\var{str} != NULL}, +\code{\var{size} > 0} and \code{\var{format} != NULL}. + +If the platform doesn't have \cfunction{vsnprintf()} and the buffer +size needed to avoid truncation exceeds \var{size} by more than 512 +bytes, Python aborts with a \var{Py_FatalError}. + +The return value (\var{rv}) for these functions should be interpreted +as follows: + +\begin{itemize} + +\item When \code{0 <= \var{rv} < \var{size}}, the output conversion + was successful and \var{rv} characters were written to \var{str} + (excluding the trailing \character{\textbackslash0} byte at + \var{str}[\var{rv}]). + +\item When \code{\var{rv} >= \var{size}}, the output conversion was + truncated and a buffer with \code{\var{rv} + 1} bytes would have + been needed to succeed. \var{str}[\var{size}-1] is + \character{\textbackslash0} in this case. + +\item When \code{\var{rv} < 0}, ``something bad happened.'' + \var{str}[\var{size}-1] is \character{\textbackslash0} in this case + too, but the rest of \var{str} is undefined. The exact cause of the + error depends on the underlying platform. + +\end{itemize} + +The following functions provide locale-independent string to number +conversions. + +\begin{cfuncdesc}{double}{PyOS_ascii_strtod}{const char *nptr, char **endptr} +Convert a string to a \ctype{double}. This function behaves like the +Standard C function \cfunction{strtod()} does in the C locale. It does +this without changing the current locale, since that would not be +thread-safe. + +\cfunction{PyOS_ascii_strtod} should typically be used for reading +configuration files or other non-user input that should be locale +independent. \versionadded{2.4} + +See the \UNIX{} man page \manpage{strtod}{2} for details. + +\end{cfuncdesc} + +\begin{cfuncdesc}{char *}{PyOS_ascii_formatd}{char *buffer, size_t buf_len, + const char *format, double d} +Convert a \ctype{double} to a string using the \character{.} as the +decimal separator. \var{format} is a \cfunction{printf()}-style format +string specifying the number format. Allowed conversion characters are +\character{e}, \character{E}, \character{f}, \character{F}, +\character{g} and \character{G}. + +The return value is a pointer to \var{buffer} with the converted +string or NULL if the conversion failed. \versionadded{2.4} +\end{cfuncdesc} + +\begin{cfuncdesc}{double}{PyOS_ascii_atof}{const char *nptr} +Convert a string to a \ctype{double} in a locale-independent +way. \versionadded{2.4} + +See the \UNIX{} man page \manpage{atof}{2} for details. +\end{cfuncdesc} Modified: python/branches/bcannon-objcap/Doc/commontex/copyright.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/commontex/copyright.tex (original) +++ python/branches/bcannon-objcap/Doc/commontex/copyright.tex Fri May 25 22:13:08 2007 @@ -1,4 +1,4 @@ -Copyright \copyright{} 2001-2006 Python Software Foundation. +Copyright \copyright{} 2001-2007 Python Software Foundation. All rights reserved. Copyright \copyright{} 2000 BeOpen.com. Modified: python/branches/bcannon-objcap/Doc/commontex/license.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/commontex/license.tex (original) +++ python/branches/bcannon-objcap/Doc/commontex/license.tex Fri May 25 22:13:08 2007 @@ -52,6 +52,7 @@ \linev{2.4.3}{2.4.2}{2006}{PSF}{yes} \linev{2.4.4}{2.4.3}{2006}{PSF}{yes} \linev{2.5}{2.4}{2006}{PSF}{yes} + \linev{2.5.1}{2.5}{2007}{PSF}{yes} \end{tablev} \note{GPL-compatible doesn't mean that we're distributing @@ -82,7 +83,7 @@ prepare derivative works, distribute, and otherwise use Python \version{} alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., -``Copyright \copyright{} 2001-2006 Python Software Foundation; All +``Copyright \copyright{} 2001-2007 Python Software Foundation; All Rights Reserved'' are retained in Python \version{} alone or in any derivative version prepared by Licensee. Modified: python/branches/bcannon-objcap/Doc/dist/dist.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/dist/dist.tex (original) +++ python/branches/bcannon-objcap/Doc/dist/dist.tex Fri May 25 22:13:08 2007 @@ -486,9 +486,24 @@ extensions: it will run SWIG on the interface file and compile the resulting C/\Cpp{} file into your extension. -\XXX{SWIG support is rough around the edges and largely untested; - especially SWIG support for \Cpp{} extensions! Explain in more detail - here when the interface firms up.} +\XXX{SWIG support is rough around the edges and largely untested!} + +This warning notwithstanding, options to SWIG can be currently passed +like this: + +\begin{verbatim} +setup(... + ext_modules=[Extension('_foo', ['foo.i'], + swig_opts=['-modern', '-I../include'])], + py_modules=['foo'], + ) +\end{verbatim} + +Or on the commandline like this: + +\begin{verbatim} +> python setup.py build_ext --swig-opts="-modern -I../include" +\end{verbatim} On some platforms, you can include non-source files that are processed by the compiler and included in your extension. Currently, this just @@ -1017,6 +1032,7 @@ --include-dirs (-I) list of directories to search for header files --define (-D) C preprocessor macros to define --undef (-U) C preprocessor macros to undefine + --swig-opts list of SWIG command line options [...] \end{verbatim} @@ -1802,9 +1818,9 @@ setup.py foo.py \end{verbatim} -(In all diagrams in this section, \verb|| will refer to the -distribution root directory.) A minimal setup script to describe this -situation would be: +(In all diagrams in this section, \var{\textless root\textgreater} +will refer to the distribution root directory.) A minimal setup script +to describe this situation would be: \begin{verbatim} from distutils.core import setup setup(name='foo', @@ -3179,7 +3195,7 @@ Note that this is not a fully-fledged string interpolation function. A valid \code{\$variable} can consist only of upper and lower case letters, -numbers and an underscore. No \{ \} or \( \) style quoting is available. +numbers and an underscore. No \{ \} or ( ) style quoting is available. \end{funcdesc} \begin{funcdesc}{grok_environment_error}{exc\optional{, prefix=\samp{'error: '}}} @@ -3733,7 +3749,7 @@ Subclasses of \class{Command} must define the following methods. -\begin{methoddesc}{initialize_options()} +\begin{methoddesc}[Command]{initialize_options()} Set default values for all the options that this command supports. Note that these defaults may be overridden by other commands, by the setup script, by config files, or by the @@ -3742,7 +3758,7 @@ are just a bunch of \samp{self.foo = None} assignments. \end{methoddesc} -\begin{methoddesc}{finalize_options}{} +\begin{methoddesc}[Command]{finalize_options}{} Set final values for all the options that this command supports. This is always called as late as possible, ie. after any option assignments from the command-line or from other commands have been @@ -3751,7 +3767,7 @@ \var{bar} as long as \var{foo} still has the same value it was assigned in \method{initialize_options()}. \end{methoddesc} -\begin{methoddesc}{run}{} +\begin{methoddesc}[Command]{run}{} A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in \method{initialize_options()}, customized by other commands, the setup Modified: python/branches/bcannon-objcap/Doc/ext/newtypes.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/ext/newtypes.tex (original) +++ python/branches/bcannon-objcap/Doc/ext/newtypes.tex Fri May 25 22:13:08 2007 @@ -489,7 +489,6 @@ garbage collection, there are calls that can be made to ``untrack'' the object from garbage collection, however, these calls are advanced and not covered here.} -\item \end{itemize} @@ -930,6 +929,102 @@ collection. Most extensions will use the versions automatically provided. +\subsection{Subclassing other types} + +It is possible to create new extension types that are derived from existing +types. It is easiest to inherit from the built in types, since an extension +can easily use the \class{PyTypeObject} it needs. It can be difficult to +share these \class{PyTypeObject} structures between extension modules. + +In this example we will create a \class{Shoddy} type that inherits from +the builtin \class{list} type. The new type will be completely compatible +with regular lists, but will have an additional \method{increment()} method +that increases an internal counter. + +\begin{verbatim} +>>> import shoddy +>>> s = shoddy.Shoddy(range(3)) +>>> s.extend(s) +>>> print len(s) +6 +>>> print s.increment() +1 +>>> print s.increment() +2 +\end{verbatim} + +\verbatiminput{shoddy.c} + +As you can see, the source code closely resembles the \class{Noddy} examples in previous +sections. We will break down the main differences between them. + +\begin{verbatim} +typedef struct { + PyListObject list; + int state; +} Shoddy; +\end{verbatim} + +The primary difference for derived type objects is that the base type's +object structure must be the first value. The base type will already +include the \cfunction{PyObject_HEAD} at the beginning of its structure. + +When a Python object is a \class{Shoddy} instance, its \var{PyObject*} pointer +can be safely cast to both \var{PyListObject*} and \var{Shoddy*}. + +\begin{verbatim} +static int +Shoddy_init(Shoddy *self, PyObject *args, PyObject *kwds) +{ + if (PyList_Type.tp_init((PyObject *)self, args, kwds) < 0) + return -1; + self->state = 0; + return 0; +} +\end{verbatim} + +In the \member{__init__} method for our type, we can see how to call through +to the \member{__init__} method of the base type. + +This pattern is important when writing a type with custom \member{new} and +\member{dealloc} methods. The \member{new} method should not actually create the +memory for the object with \member{tp_alloc}, that will be handled by +the base class when calling its \member{tp_new}. + +When filling out the \cfunction{PyTypeObject} for the \class{Shoddy} type, +you see a slot for \cfunction{tp_base}. Due to cross platform compiler +issues, you can't fill that field directly with the \cfunction{PyList_Type}; +it can be done later in the module's \cfunction{init} function. + +\begin{verbatim} +PyMODINIT_FUNC +initshoddy(void) +{ + PyObject *m; + + ShoddyType.tp_base = &PyList_Type; + if (PyType_Ready(&ShoddyType) < 0) + return; + + m = Py_InitModule3("shoddy", NULL, "Shoddy module"); + if (m == NULL) + return; + + Py_INCREF(&ShoddyType); + PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType); +} +\end{verbatim} + +Before calling \cfunction{PyType_Ready}, the type structure must have the +\member{tp_base} slot filled in. When we are deriving a new type, it is +not necessary to fill out the \member{tp_alloc} slot with +\cfunction{PyType_GenericNew} -- the allocate function from the base type +will be inherited. + +After that, calling \cfunction{PyType_Ready} and adding the type object +to the module is the same as with the basic \class{Noddy} examples. + + \section{Type Methods \label{dnt-type-methods}} Modified: python/branches/bcannon-objcap/Doc/inst/inst.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/inst/inst.tex (original) +++ python/branches/bcannon-objcap/Doc/inst/inst.tex Fri May 25 22:13:08 2007 @@ -296,7 +296,7 @@ \filevar{prefix} and \filevar{exec-prefix} stand for the directories that Python is installed to, and where it finds its libraries at run-time. They are always the same under Windows, and very -often the same under \UNIX and Mac OS X. You can find out what your Python +often the same under \UNIX{} and Mac OS X. You can find out what your Python installation uses for \filevar{prefix} and \filevar{exec-prefix} by running Python in interactive mode and typing a few simple commands. Under \UNIX, just type \code{python} at the shell prompt. Under Modified: python/branches/bcannon-objcap/Doc/lib/compiler.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/compiler.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/compiler.tex Fri May 25 22:13:08 2007 @@ -103,8 +103,7 @@ construct. The root of the tree is \class{Module} object. The abstract syntax offers a higher level interface to parsed Python -source code. The \ulink{\module{parser}} -{http://www.python.org/doc/current/lib/module-parser.html} +source code. The \refmodule{parser} module and the compiler written in C for the Python interpreter use a concrete syntax tree. The concrete syntax is tied closely to the grammar description used for the Python parser. Instead of a single Modified: python/branches/bcannon-objcap/Doc/lib/email.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/email.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/email.tex Fri May 25 22:13:08 2007 @@ -1,4 +1,4 @@ -% Copyright (C) 2001-2006 Python Software Foundation +% Copyright (C) 2001-2007 Python Software Foundation % Author: barry at python.org (Barry Warsaw) \section{\module{email} --- @@ -239,7 +239,7 @@ The \module{email} package was originally prototyped as a separate library called -\ulink{\module{mimelib}}{http://mimelib.sf.net/}. +\ulink{\texttt{mimelib}}{http://mimelib.sf.net/}. Changes have been made so that method names are more consistent, and some methods or modules have either been added or removed. The semantics of some of the methods Modified: python/branches/bcannon-objcap/Doc/lib/emailgenerator.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/emailgenerator.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/emailgenerator.tex Fri May 25 22:13:08 2007 @@ -33,7 +33,7 @@ line. This is the only guaranteed portable way to avoid having such lines be mistaken for a \UNIX{} mailbox format envelope header separator (see \ulink{WHY THE CONTENT-LENGTH FORMAT IS BAD} -{http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/content-length.html} +{http://www.jwz.org/doc/content-length.html} for details). \var{mangle_from_} defaults to \code{True}, but you might want to set this to \code{False} if you are not writing \UNIX{} mailbox format files. Modified: python/branches/bcannon-objcap/Doc/lib/emailutil.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/emailutil.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/emailutil.tex Fri May 25 22:13:08 2007 @@ -56,7 +56,7 @@ \code{"Mon, 20 Nov 1995 19:12:08 -0500"}. If it succeeds in parsing the date, \function{parsedate()} returns a 9-tuple that can be passed directly to \function{time.mktime()}; otherwise \code{None} will be -returned. Note that fields 6, 7, and 8 of the result tuple are not +returned. Note that indexes 6, 7, and 8 of the result tuple are not usable. \end{funcdesc} @@ -70,7 +70,7 @@ variable for the same timezone; the latter variable follows the \POSIX{} standard while this module follows \rfc{2822}.}. If the input string has no timezone, the last element of the tuple returned is -\code{None}. Note that fields 6, 7, and 8 of the result tuple are not +\code{None}. Note that indexes 6, 7, and 8 of the result tuple are not usable. \end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/lib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/lib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/lib.tex Fri May 25 22:13:08 2007 @@ -297,7 +297,6 @@ \input{liburllib2} \input{libhttplib} \input{libftplib} -\input{libgopherlib} \input{libpoplib} \input{libimaplib} \input{libnntplib} @@ -328,7 +327,6 @@ \input{libwave} \input{libchunk} \input{libcolorsys} -\input{librgbimg} \input{libimghdr} \input{libsndhdr} \input{libossaudiodev} @@ -431,10 +429,6 @@ % OTHER PLATFORM-SPECIFIC STUFF % ============= -%\input{libamoeba} % AMOEBA ONLY - -%\input{libstdwin} % STDWIN ONLY - \input{libsgi} % SGI IRIX ONLY \input{libal} \input{libcd} @@ -443,7 +437,6 @@ \input{libgl} \input{libimgfile} \input{libjpeg} -%\input{libpanel} \input{libsun} % SUNOS ONLY \input{libsunaudio} Deleted: /python/branches/bcannon-objcap/Doc/lib/libamoeba.tex ============================================================================== --- /python/branches/bcannon-objcap/Doc/lib/libamoeba.tex Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,132 +0,0 @@ -\chapter{Amoeba Specific Services} - -\section{\module{amoeba} --- - Amoeba system support} - -\declaremodule{builtin}{amoeba} - \platform{Amoeba} -\modulesynopsis{Functions for the Amoeba operating system.} - - -This module provides some object types and operations useful for -Amoeba applications. It is only available on systems that support -Amoeba operations. RPC errors and other Amoeba errors are reported as -the exception \code{amoeba.error = 'amoeba.error'}. - -The module \module{amoeba} defines the following items: - -\begin{funcdesc}{name_append}{path, cap} -Stores a capability in the Amoeba directory tree. -Arguments are the pathname (a string) and the capability (a capability -object as returned by -\function{name_lookup()}). -\end{funcdesc} - -\begin{funcdesc}{name_delete}{path} -Deletes a capability from the Amoeba directory tree. -Argument is the pathname. -\end{funcdesc} - -\begin{funcdesc}{name_lookup}{path} -Looks up a capability. -Argument is the pathname. -Returns a -\dfn{capability} -object, to which various interesting operations apply, described below. -\end{funcdesc} - -\begin{funcdesc}{name_replace}{path, cap} -Replaces a capability in the Amoeba directory tree. -Arguments are the pathname and the new capability. -(This differs from -\function{name_append()} -in the behavior when the pathname already exists: -\function{name_append()} -finds this an error while -\function{name_replace()} -allows it, as its name suggests.) -\end{funcdesc} - -\begin{datadesc}{capv} -A table representing the capability environment at the time the -interpreter was started. -(Alas, modifying this table does not affect the capability environment -of the interpreter.) -For example, -\code{amoeba.capv['ROOT']} -is the capability of your root directory, similar to -\code{getcap("ROOT")} -in C. -\end{datadesc} - -\begin{excdesc}{error} -The exception raised when an Amoeba function returns an error. -The value accompanying this exception is a pair containing the numeric -error code and the corresponding string, as returned by the C function -\cfunction{err_why()}. -\end{excdesc} - -\begin{funcdesc}{timeout}{msecs} -Sets the transaction timeout, in milliseconds. -Returns the previous timeout. -Initially, the timeout is set to 2 seconds by the Python interpreter. -\end{funcdesc} - -\subsection{Capability Operations} - -Capabilities are written in a convenient \ASCII{} format, also used by the -Amoeba utilities -\emph{c2a}(U) -and -\emph{a2c}(U). -For example: - -\begin{verbatim} ->>> amoeba.name_lookup('/profile/cap') -aa:1c:95:52:6a:fa/14(ff)/8e:ba:5b:8:11:1a ->>> -\end{verbatim} -% -The following methods are defined for capability objects. - -\setindexsubitem{(capability method)} -\begin{funcdesc}{dir_list}{} -Returns a list of the names of the entries in an Amoeba directory. -\end{funcdesc} - -\begin{funcdesc}{b_read}{offset, maxsize} -Reads (at most) -\var{maxsize} -bytes from a bullet file at offset -\var{offset.} -The data is returned as a string. -EOF is reported as an empty string. -\end{funcdesc} - -\begin{funcdesc}{b_size}{} -Returns the size of a bullet file. -\end{funcdesc} - -\begin{funcdesc}{dir_append}{} -\funcline{dir_delete}{} -\funcline{dir_lookup}{} -\funcline{dir_replace}{} -Like the corresponding -\samp{name_}* -functions, but with a path relative to the capability. -(For paths beginning with a slash the capability is ignored, since this -is the defined semantics for Amoeba.) -\end{funcdesc} - -\begin{funcdesc}{std_info}{} -Returns the standard info string of the object. -\end{funcdesc} - -\begin{funcdesc}{tod_gettime}{} -Returns the time (in seconds since the Epoch, in UCT, as for \POSIX) from -a time server. -\end{funcdesc} - -\begin{funcdesc}{tod_settime}{t} -Sets the time kept by a time server. -\end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libasyncore.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libasyncore.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libasyncore.tex Fri May 25 22:13:08 2007 @@ -46,7 +46,7 @@ \begin{funcdesc}{loop}{\optional{timeout\optional{, use_poll\optional{, map\optional{,count}}}}} Enter a polling loop that terminates after count passes or all open - channels have been closed. All arguments are optional. The \var(count) + channels have been closed. All arguments are optional. The \var{count} parameter defaults to None, resulting in the loop terminating only when all channels have been closed. The \var{timeout} argument sets the timeout parameter for the appropriate \function{select()} or Modified: python/branches/bcannon-objcap/Doc/lib/libbase64.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libbase64.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libbase64.tex Fri May 25 22:13:08 2007 @@ -85,7 +85,7 @@ letter O (oh), and for optional mapping of the digit 1 (one) to either the letter I (eye) or letter L (el). The optional argument \var{map01} when not \code{None}, specifies which letter the digit 1 should -be mapped to (when map01 is not \var{None}, the digit 0 is always +be mapped to (when \var{map01} is not \code{None}, the digit 0 is always mapped to the letter O). For security purposes the default is \code{None}, so that 0 and 1 are not allowed in the input. Modified: python/branches/bcannon-objcap/Doc/lib/libbsddb.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libbsddb.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libbsddb.tex Fri May 25 22:13:08 2007 @@ -2,7 +2,6 @@ Interface to Berkeley DB library} \declaremodule{extension}{bsddb} - \platform{Unix, Windows} \modulesynopsis{Interface to Berkeley DB database library} \sectionauthor{Skip Montanaro}{skip at mojam.com} @@ -46,10 +45,10 @@ instances. \begin{funcdesc}{hashopen}{filename\optional{, flag\optional{, - mode\optional{, bsize\optional{, + mode\optional{, pgsize\optional{, ffactor\optional{, nelem\optional{, - cachesize\optional{, hash\optional{, - lorder}}}}}}}}} + cachesize\optional{, lorder\optional{, + hflags}}}}}}}}} Open the hash format file named \var{filename}. Files never intended to be preserved on disk may be created by passing \code{None} as the \var{filename}. The optional @@ -80,7 +79,7 @@ \begin{funcdesc}{rnopen}{filename\optional{, flag\optional{, mode\optional{, rnflags\optional{, cachesize\optional{, pgsize\optional{, lorder\optional{, -reclen\optional{, bval\optional{, bfname}}}}}}}}}} +rlen\optional{, delim\optional{, source\optional{, pad}}}}}}}}}}} Open a DB record format file named \var{filename}. Files never intended to be preserved on disk may be created by passing \code{None} as the @@ -114,23 +113,23 @@ the methods listed below. \versionchanged[Added dictionary methods]{2.3.1} -\begin{methoddesc}{close}{} +\begin{methoddesc}[bsddbobject]{close}{} Close the underlying file. The object can no longer be accessed. Since there is no open \method{open} method for these objects, to open the file again a new \module{bsddb} module open function must be called. \end{methoddesc} -\begin{methoddesc}{keys}{} +\begin{methoddesc}[bsddbobject]{keys}{} Return the list of keys contained in the DB file. The order of the list is unspecified and should not be relied on. In particular, the order of the list returned is different for different file formats. \end{methoddesc} -\begin{methoddesc}{has_key}{key} +\begin{methoddesc}[bsddbobject]{has_key}{key} Return \code{1} if the DB file contains the argument as a key. \end{methoddesc} -\begin{methoddesc}{set_location}{key} +\begin{methoddesc}[bsddbobject]{set_location}{key} Set the cursor to the item indicated by \var{key} and return a tuple containing the key and its value. For binary tree databases (opened using \function{btopen()}), if \var{key} does not actually exist in @@ -140,32 +139,32 @@ database. \end{methoddesc} -\begin{methoddesc}{first}{} +\begin{methoddesc}[bsddbobject]{first}{} Set the cursor to the first item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. This method raises \exception{bsddb.error} if the database is empty. \end{methoddesc} -\begin{methoddesc}{next}{} +\begin{methoddesc}[bsddbobject]{next}{} Set the cursor to the next item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. \end{methoddesc} -\begin{methoddesc}{previous}{} +\begin{methoddesc}[bsddbobject]{previous}{} Set the cursor to the previous item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. This is not supported on hashtable databases (those opened with \function{hashopen()}). \end{methoddesc} -\begin{methoddesc}{last}{} +\begin{methoddesc}[bsddbobject]{last}{} Set the cursor to the last item in the DB file and return it. The order of keys in the file is unspecified. This is not supported on hashtable databases (those opened with \function{hashopen()}). This method raises \exception{bsddb.error} if the database is empty. \end{methoddesc} -\begin{methoddesc}{sync}{} +\begin{methoddesc}[bsddbobject]{sync}{} Synchronize the database on disk. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libcfgparser.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcfgparser.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcfgparser.tex Fri May 25 22:13:08 2007 @@ -155,37 +155,37 @@ \class{RawConfigParser} instances have the following methods: -\begin{methoddesc}{defaults}{} +\begin{methoddesc}[RawConfigParser]{defaults}{} Return a dictionary containing the instance-wide defaults. \end{methoddesc} -\begin{methoddesc}{sections}{} +\begin{methoddesc}[RawConfigParser]{sections}{} Return a list of the sections available; \code{DEFAULT} is not included in the list. \end{methoddesc} -\begin{methoddesc}{add_section}{section} +\begin{methoddesc}[RawConfigParser]{add_section}{section} Add a section named \var{section} to the instance. If a section by the given name already exists, \exception{DuplicateSectionError} is raised. \end{methoddesc} -\begin{methoddesc}{has_section}{section} +\begin{methoddesc}[RawConfigParser]{has_section}{section} Indicates whether the named section is present in the configuration. The \code{DEFAULT} section is not acknowledged. \end{methoddesc} -\begin{methoddesc}{options}{section} +\begin{methoddesc}[RawConfigParser]{options}{section} Returns a list of options available in the specified \var{section}. \end{methoddesc} -\begin{methoddesc}{has_option}{section, option} +\begin{methoddesc}[RawConfigParser]{has_option}{section, option} If the given section exists, and contains the given option, return \constant{True}; otherwise return \constant{False}. \versionadded{1.6} \end{methoddesc} -\begin{methoddesc}{read}{filenames} +\begin{methoddesc}[RawConfigParser]{read}{filenames} Attempt to read and parse a list of filenames, returning a list of filenames which were successfully parsed. If \var{filenames} is a string or Unicode string, it is treated as a single filename. @@ -210,28 +210,28 @@ \versionchanged[Returns list of successfully parsed filenames]{2.4} \end{methoddesc} -\begin{methoddesc}{readfp}{fp\optional{, filename}} +\begin{methoddesc}[RawConfigParser]{readfp}{fp\optional{, filename}} Read and parse configuration data from the file or file-like object in \var{fp} (only the \method{readline()} method is used). If \var{filename} is omitted and \var{fp} has a \member{name} attribute, that is used for \var{filename}; the default is \samp{}. \end{methoddesc} -\begin{methoddesc}{get}{section, option} +\begin{methoddesc}[RawConfigParser]{get}{section, option} Get an \var{option} value for the named \var{section}. \end{methoddesc} -\begin{methoddesc}{getint}{section, option} +\begin{methoddesc}[RawConfigParser]{getint}{section, option} A convenience method which coerces the \var{option} in the specified \var{section} to an integer. \end{methoddesc} -\begin{methoddesc}{getfloat}{section, option} +\begin{methoddesc}[RawConfigParser]{getfloat}{section, option} A convenience method which coerces the \var{option} in the specified \var{section} to a floating point number. \end{methoddesc} -\begin{methoddesc}{getboolean}{section, option} +\begin{methoddesc}[RawConfigParser]{getboolean}{section, option} A convenience method which coerces the \var{option} in the specified \var{section} to a Boolean value. Note that the accepted values for the option are \code{"1"}, \code{"yes"}, \code{"true"}, and \code{"on"}, @@ -241,12 +241,12 @@ cause it to raise \exception{ValueError}. \end{methoddesc} -\begin{methoddesc}{items}{section} +\begin{methoddesc}[RawConfigParser]{items}{section} Return a list of \code{(\var{name}, \var{value})} pairs for each option in the given \var{section}. \end{methoddesc} -\begin{methoddesc}{set}{section, option, value} +\begin{methoddesc}[RawConfigParser]{set}{section, option, value} If the given section exists, set the given option to the specified value; otherwise raise \exception{NoSectionError}. While it is possible to use \class{RawConfigParser} (or \class{ConfigParser} with @@ -256,14 +256,14 @@ \versionadded{1.6} \end{methoddesc} -\begin{methoddesc}{write}{fileobject} +\begin{methoddesc}[RawConfigParser]{write}{fileobject} Write a representation of the configuration to the specified file object. This representation can be parsed by a future \method{read()} call. \versionadded{1.6} \end{methoddesc} -\begin{methoddesc}{remove_option}{section, option} +\begin{methoddesc}[RawConfigParser]{remove_option}{section, option} Remove the specified \var{option} from the specified \var{section}. If the section does not exist, raise \exception{NoSectionError}. If the option existed to be removed, return \constant{True}; @@ -271,13 +271,13 @@ \versionadded{1.6} \end{methoddesc} -\begin{methoddesc}{remove_section}{section} +\begin{methoddesc}[RawConfigParser]{remove_section}{section} Remove the specified \var{section} from the configuration. If the section in fact existed, return \code{True}. Otherwise return \code{False}. \end{methoddesc} -\begin{methoddesc}{optionxform}{option} +\begin{methoddesc}[RawConfigParser]{optionxform}{option} Transforms the option name \var{option} as found in an input file or as passed in by client code to the form that should be used in the internal structures. The default implementation returns a lower-case @@ -293,14 +293,14 @@ The \class{ConfigParser} class extends some methods of the \class{RawConfigParser} interface, adding some optional arguments. -\begin{methoddesc}{get}{section, option\optional{, raw\optional{, vars}}} +\begin{methoddesc}[ConfigParser]{get}{section, option\optional{, raw\optional{, vars}}} Get an \var{option} value for the named \var{section}. All the \character{\%} interpolations are expanded in the return values, based on the defaults passed into the constructor, as well as the options \var{vars} provided, unless the \var{raw} argument is true. \end{methoddesc} -\begin{methoddesc}{items}{section\optional{, raw\optional{, vars}}} +\begin{methoddesc}[ConfigParser]{items}{section\optional{, raw\optional{, vars}}} Return a list of \code{(\var{name}, \var{value})} pairs for each option in the given \var{section}. Optional arguments have the same meaning as for the \method{get()} method. @@ -313,7 +313,7 @@ The \class{SafeConfigParser} class implements the same extended interface as \class{ConfigParser}, with the following addition: -\begin{methoddesc}{set}{section, option, value} +\begin{methoddesc}[SafeConfigParser]{set}{section, option, value} If the given section exists, set the given option to the specified value; otherwise raise \exception{NoSectionError}. \var{value} must be a string (\class{str} or \class{unicode}); if not, Modified: python/branches/bcannon-objcap/Doc/lib/libcgitb.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcgitb.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcgitb.tex Fri May 25 22:13:08 2007 @@ -38,7 +38,7 @@ context\optional{, format}}}}} This function causes the \module{cgitb} module to take over the interpreter's default handling for exceptions by setting the - value of \code{\refmodule{sys}.excepthook}. + value of \member{\refmodule{sys}.excepthook}. \withsubitem{(in module sys)}{\ttindex{excepthook()}} The optional argument \var{display} defaults to \code{1} and can be set @@ -61,7 +61,7 @@ report it using \module{cgitb}. The optional \var{info} argument should be a 3-tuple containing an exception type, exception value, and traceback object, exactly like the tuple returned by - \code{\refmodule{sys}.exc_info()}. If the \var{info} argument + \function{\refmodule{sys}.exc_info()}. If the \var{info} argument is not supplied, the current exception is obtained from - \code{\refmodule{sys}.exc_info()}. + \function{\refmodule{sys}.exc_info()}. \end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libcmath.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcmath.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcmath.tex Fri May 25 22:13:08 2007 @@ -5,7 +5,14 @@ \modulesynopsis{Mathematical functions for complex numbers.} This module is always available. It provides access to mathematical -functions for complex numbers. The functions are: +functions for complex numbers. The functions in this module accept +integers, floating-point numbers or complex numbers as arguments. +They will also accept any Python object that has either a +\method{__complex__} or a \method{__float__} method: these methods are +used to convert the object to a complex or floating-point number, respectively, and +the function is then applied to the result of the conversion. + +The functions are: \begin{funcdesc}{acos}{x} Return the arc cosine of \var{x}. Modified: python/branches/bcannon-objcap/Doc/lib/libcmd.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcmd.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcmd.tex Fri May 25 22:13:08 2007 @@ -37,7 +37,7 @@ A \class{Cmd} instance has the following methods: -\begin{methoddesc}{cmdloop}{\optional{intro}} +\begin{methoddesc}[Cmd]{cmdloop}{\optional{intro}} Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument. @@ -82,7 +82,7 @@ any undocumented commands. \end{methoddesc} -\begin{methoddesc}{onecmd}{str} +\begin{methoddesc}[Cmd]{onecmd}{str} Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the \method{precmd()} and \method{postcmd()} methods for useful @@ -93,25 +93,25 @@ \method{default()} method is returned. \end{methoddesc} -\begin{methoddesc}{emptyline}{} +\begin{methoddesc}[Cmd]{emptyline}{} Method called when an empty line is entered in response to the prompt. If this method is not overridden, it repeats the last nonempty command entered. \end{methoddesc} -\begin{methoddesc}{default}{line} +\begin{methoddesc}[Cmd]{default}{line} Method called on an input line when the command prefix is not recognized. If this method is not overridden, it prints an error message and returns. \end{methoddesc} -\begin{methoddesc}{completedefault}{text, line, begidx, endidx} +\begin{methoddesc}[Cmd]{completedefault}{text, line, begidx, endidx} Method called to complete an input line when no command-specific \method{complete_*()} method is available. By default, it returns an empty list. \end{methoddesc} -\begin{methoddesc}{precmd}{line} +\begin{methoddesc}[Cmd]{precmd}{line} Hook method executed just before the command line \var{line} is interpreted, but after the input prompt is generated and issued. This method is a stub in \class{Cmd}; it exists to be overridden by @@ -121,7 +121,7 @@ unchanged. \end{methoddesc} -\begin{methoddesc}{postcmd}{stop, line} +\begin{methoddesc}[Cmd]{postcmd}{stop, line} Hook method executed just after a command dispatch is finished. This method is a stub in \class{Cmd}; it exists to be overridden by subclasses. \var{line} is the command line which was executed, and @@ -133,13 +133,13 @@ to continue. \end{methoddesc} -\begin{methoddesc}{preloop}{} +\begin{methoddesc}[Cmd]{preloop}{} Hook method executed once when \method{cmdloop()} is called. This method is a stub in \class{Cmd}; it exists to be overridden by subclasses. \end{methoddesc} -\begin{methoddesc}{postloop}{} +\begin{methoddesc}[Cmd]{postloop}{} Hook method executed once when \method{cmdloop()} is about to return. This method is a stub in \class{Cmd}; it exists to be overridden by subclasses. @@ -147,47 +147,47 @@ Instances of \class{Cmd} subclasses have some public instance variables: -\begin{memberdesc}{prompt} +\begin{memberdesc}[Cmd]{prompt} The prompt issued to solicit input. \end{memberdesc} -\begin{memberdesc}{identchars} +\begin{memberdesc}[Cmd]{identchars} The string of characters accepted for the command prefix. \end{memberdesc} -\begin{memberdesc}{lastcmd} +\begin{memberdesc}[Cmd]{lastcmd} The last nonempty command prefix seen. \end{memberdesc} -\begin{memberdesc}{intro} +\begin{memberdesc}[Cmd]{intro} A string to issue as an intro or banner. May be overridden by giving the \method{cmdloop()} method an argument. \end{memberdesc} -\begin{memberdesc}{doc_header} +\begin{memberdesc}[Cmd]{doc_header} The header to issue if the help output has a section for documented commands. \end{memberdesc} -\begin{memberdesc}{misc_header} +\begin{memberdesc}[Cmd]{misc_header} The header to issue if the help output has a section for miscellaneous help topics (that is, there are \method{help_*()} methods without corresponding \method{do_*()} methods). \end{memberdesc} -\begin{memberdesc}{undoc_header} +\begin{memberdesc}[Cmd]{undoc_header} The header to issue if the help output has a section for undocumented commands (that is, there are \method{do_*()} methods without corresponding \method{help_*()} methods). \end{memberdesc} -\begin{memberdesc}{ruler} +\begin{memberdesc}[Cmd]{ruler} The character used to draw separator lines under the help-message headers. If empty, no ruler line is drawn. It defaults to \character{=}. \end{memberdesc} -\begin{memberdesc}{use_rawinput} +\begin{memberdesc}[Cmd]{use_rawinput} A flag, defaulting to true. If true, \method{cmdloop()} uses \function{raw_input()} to display a prompt and read the next command; if false, \method{sys.stdout.write()} and Modified: python/branches/bcannon-objcap/Doc/lib/libcode.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcode.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcode.tex Fri May 25 22:13:08 2007 @@ -68,7 +68,7 @@ \subsection{Interactive Interpreter Objects \label{interpreter-objects}} -\begin{methoddesc}{runsource}{source\optional{, filename\optional{, symbol}}} +\begin{methoddesc}[InteractiveInterpreter]{runsource}{source\optional{, filename\optional{, symbol}}} Compile and run some source in the interpreter. Arguments are the same as for \function{compile_command()}; the default for \var{filename} is \code{''}, and for @@ -98,7 +98,7 @@ \code{sys.ps1} or \code{sys.ps2} to prompt the next line. \end{methoddesc} -\begin{methoddesc}{runcode}{code} +\begin{methoddesc}[InteractiveInterpreter]{runcode}{code} Execute a code object. When an exception occurs, \method{showtraceback()} is called to display a traceback. All exceptions are caught except @@ -109,7 +109,7 @@ should be prepared to deal with it. \end{methoddesc} -\begin{methoddesc}{showsyntaxerror}{\optional{filename}} +\begin{methoddesc}[InteractiveInterpreter]{showsyntaxerror}{\optional{filename}} Display the syntax error that just occurred. This does not display a stack trace because there isn't one for syntax errors. If \var{filename} is given, it is stuffed into the exception instead @@ -118,13 +118,13 @@ The output is written by the \method{write()} method. \end{methoddesc} -\begin{methoddesc}{showtraceback}{} +\begin{methoddesc}[InteractiveInterpreter]{showtraceback}{} Display the exception that just occurred. We remove the first stack item because it is within the interpreter object implementation. The output is written by the \method{write()} method. \end{methoddesc} -\begin{methoddesc}{write}{data} +\begin{methoddesc}[InteractiveInterpreter]{write}{data} Write a string to the standard error stream (\code{sys.stderr}). Derived classes should override this to provide the appropriate output handling as needed. @@ -138,7 +138,7 @@ \class{InteractiveInterpreter}, and so offers all the methods of the interpreter objects as well as the following additions. -\begin{methoddesc}{interact}{\optional{banner}} +\begin{methoddesc}[InteractiveConsole]{interact}{\optional{banner}} Closely emulate the interactive Python console. The optional banner argument specify the banner to print before the first interaction; by default it prints a banner similar to the one @@ -147,7 +147,7 @@ with the real interpreter -- since it's so close!). \end{methoddesc} -\begin{methoddesc}{push}{line} +\begin{methoddesc}[InteractiveConsole]{push}{line} Push a line of source text to the interpreter. The line should not have a trailing newline; it may have internal newlines. The line is appended to a buffer and the interpreter's @@ -160,11 +160,11 @@ \method{runsource()}). \end{methoddesc} -\begin{methoddesc}{resetbuffer}{} +\begin{methoddesc}[InteractiveConsole]{resetbuffer}{} Remove any unhandled source text from the input buffer. \end{methoddesc} -\begin{methoddesc}{raw_input}{\optional{prompt}} +\begin{methoddesc}[InteractiveConsole]{raw_input}{\optional{prompt}} Write a prompt and read a line. The returned line does not include the trailing newline. When the user enters the \EOF{} key sequence, \exception{EOFError} is raised. The base implementation uses the Modified: python/branches/bcannon-objcap/Doc/lib/libcodecs.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcodecs.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcodecs.tex Fri May 25 22:13:08 2007 @@ -307,7 +307,7 @@ The \class{Codec} class defines these methods which also define the function interfaces of the stateless encoder and decoder: -\begin{methoddesc}{encode}{input\optional{, errors}} +\begin{methoddesc}[Codec]{encode}{input\optional{, errors}} Encodes the object \var{input} and returns a tuple (output object, length consumed). While codecs are not restricted to use with Unicode, in a Unicode context, encoding converts a Unicode object to a plain string @@ -325,7 +325,7 @@ empty object of the output object type in this situation. \end{methoddesc} -\begin{methoddesc}{decode}{input\optional{, errors}} +\begin{methoddesc}[Codec]{decode}{input\optional{, errors}} Decodes the object \var{input} and returns a tuple (output object, length consumed). In a Unicode context, decoding converts a plain string encoded using a particular character set encoding to a Unicode object. @@ -1197,9 +1197,8 @@ \lineiv{idna} {} {Unicode string} - {Implements \rfc{3490}. - \versionadded{2.3} - See also \refmodule{encodings.idna}} + {Implements \rfc{3490}, + see also \refmodule{encodings.idna}} \lineiv{mbcs} {dbcs} @@ -1214,8 +1213,7 @@ \lineiv{punycode} {} {Unicode string} - {Implements \rfc{3492}. - \versionadded{2.3}} + {Implements \rfc{3492}} \lineiv{quopri_codec} {quopri, quoted-printable, quotedprintable} @@ -1269,6 +1267,8 @@ \end{tableiv} +\versionadded[The \code{idna} and \code{punycode} encodings]{2.3} + \subsection{\module{encodings.idna} --- Internationalized Domain Names in Applications} Modified: python/branches/bcannon-objcap/Doc/lib/libcollections.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcollections.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcollections.tex Fri May 25 22:13:08 2007 @@ -9,14 +9,16 @@ This module implements high-performance container datatypes. Currently, -there are two datatypes, deque and defaultdict. +there are two datatypes, deque and defaultdict, and one datatype factory +function, \function{NamedTuple}. Future additions may include balanced trees and ordered dictionaries. \versionchanged[Added defaultdict]{2.5} +\versionchanged[Added NamedTuple]{2.6} \subsection{\class{deque} objects \label{deque-objects}} -\begin{funcdesc}{deque}{\optional{iterable}} - Returns a new deque objected initialized left-to-right (using +\begin{classdesc}{deque}{\optional{iterable}} + Returns a new deque object initialized left-to-right (using \method{append()}) with data from \var{iterable}. If \var{iterable} is not specified, the new deque is empty. @@ -30,7 +32,7 @@ for \samp{pop(0)} and \samp{insert(0, v)} operations which change both the size and position of the underlying data representation. \versionadded{2.4} -\end{funcdesc} +\end{classdesc} Deque objects support the following methods: @@ -219,7 +221,7 @@ \subsection{\class{defaultdict} objects \label{defaultdict-objects}} -\begin{funcdesc}{defaultdict}{\optional{default_factory\optional{, ...}}} +\begin{classdesc}{defaultdict}{\optional{default_factory\optional{, ...}}} Returns a new dictionary-like object. \class{defaultdict} is a subclass of the builtin \class{dict} class. It overrides one method and adds one writable instance variable. The remaining functionality is the same as @@ -231,7 +233,7 @@ passed to the \class{dict} constructor, including keyword arguments. \versionadded{2.5} -\end{funcdesc} +\end{classdesc} \class{defaultdict} objects support the following method in addition to the standard \class{dict} operations: @@ -254,11 +256,11 @@ \class{defaultdict} objects support the following instance variable: -\begin{datadesc}{default_factory} +\begin{memberdesc}{default_factory} This attribute is used by the \method{__missing__} method; it is initialized from the first argument to the constructor, if present, or to \code{None}, if absent. -\end{datadesc} +\end{memberdesc} \subsubsection{\class{defaultdict} Examples \label{defaultdict-examples}} @@ -311,16 +313,20 @@ When a letter is first encountered, it is missing from the mapping, so the \member{default_factory} function calls \function{int()} to supply a default count of zero. The increment operation then builds up the count for each -letter. This technique makes counting simpler and faster than an equivalent -technique using \method{dict.get()}: +letter. -\begin{verbatim} ->>> d = {} ->>> for k in s: - d[k] = d.get(k, 0) + 1 +The function \function{int()} which always returns zero is just a special +case of constant functions. A faster and more flexible way to create +constant functions is to use \function{itertools.repeat()} which can supply +any constant value (not just zero): ->>> d.items() -[('i', 4), ('p', 2), ('s', 4), ('m', 1)] +\begin{verbatim} +>>> def constant_factory(value): +... return itertools.repeat(value).next +>>> d = defaultdict(constant_factory('')) +>>> d.update(name='John', action='ran') +>>> '%(name)s %(action)s to %(object)s' % d +'John ran to ' \end{verbatim} Setting the \member{default_factory} to \class{set} makes the @@ -335,3 +341,62 @@ >>> d.items() [('blue', set([2, 4])), ('red', set([1, 3]))] \end{verbatim} + + + +\subsection{\function{NamedTuple} datatype factory function \label{named-tuple-factory}} + +\begin{funcdesc}{NamedTuple}{typename, fieldnames} + Returns a new tuple subclass named \var{typename}. The new subclass is used + to create tuple-like objects that have fields accessable by attribute + lookup as well as being indexable and iterable. Instances of the subclass + also have a helpful docstring (with typename and fieldnames) and a helpful + \method{__repr__()} method which lists the tuple contents in a \code{name=value} + format. + \versionadded{2.6} + + The \var{fieldnames} are specified in a single string and are separated by spaces. + Any valid Python identifier may be used for a field name. + + Example: + \begin{verbatim} +>>> Point = NamedTuple('Point', 'x y') +>>> Point.__doc__ # docstring for the new datatype +'Point(x, y)' +>>> p = Point(11, y=22) # instantiate with positional or keyword arguments +>>> p[0] + p[1] # works just like the tuple (11, 22) +33 +>>> x, y = p # unpacks just like a tuple +>>> x, y +(11, 22) +>>> p.x + p.y # fields also accessable by name +33 +>>> p # readable __repr__ with name=value style +Point(x=11, y=22) +\end{verbatim} + + The use cases are the same as those for tuples. The named factories + assign meaning to each tuple position and allow for more readable, + self-documenting code. Named tuples can also be used to assign field names + to tuples returned by the \module{csv} or \module{sqlite3} modules. + For example: + + \begin{verbatim} +from itertools import starmap +import csv +EmployeeRecord = NamedTuple('EmployeeRecord', 'name age title department paygrade') +for record in starmap(EmployeeRecord, csv.reader(open("employees.csv", "rb"))): + print record +\end{verbatim} + + To cast an individual record stored as \class{list}, \class{tuple}, or some other + iterable type, use the star-operator to unpack the values: + + \begin{verbatim} +>>> Color = NamedTuple('Color', 'name code') +>>> m = dict(red=1, green=2, blue=3) +>>> print Color(*m.popitem()) +Color(name='blue', code=3) +\end{verbatim} + +\end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libcommands.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcommands.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcommands.tex Fri May 25 22:13:08 2007 @@ -39,6 +39,10 @@ Return the output of \samp{ls -ld \var{file}} as a string. This function uses the \function{getoutput()} function, and properly escapes backslashes and dollar signs in the argument. + +\deprecated{2.6}{This function is nonobvious and useless, + also the name is misleading in the presence of + \function{getstatusoutput()}.} \end{funcdesc} Example: Modified: python/branches/bcannon-objcap/Doc/lib/libconsts.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libconsts.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libconsts.tex Fri May 25 22:13:08 2007 @@ -13,7 +13,7 @@ \end{datadesc} \begin{datadesc}{None} - The sole value of \code{\refmodule{types}.NoneType}. \code{None} is + The sole value of \member{\refmodule{types}.NoneType}. \code{None} is frequently used to represent the absence of a value, as when default arguments are not passed to a function. \end{datadesc} Modified: python/branches/bcannon-objcap/Doc/lib/libcontextlib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcontextlib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcontextlib.tex Fri May 25 22:13:08 2007 @@ -111,7 +111,7 @@ \begin{verbatim} from __future__ import with_statement from contextlib import closing -import codecs +import urllib with closing(urllib.urlopen('http://www.python.org')) as page: for line in page: Modified: python/branches/bcannon-objcap/Doc/lib/libcookielib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcookielib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcookielib.tex Fri May 25 22:13:08 2007 @@ -292,12 +292,12 @@ \class{FileCookieJar} instances have the following public attributes: -\begin{memberdesc}{filename} +\begin{memberdesc}[FileCookieJar]{filename} Filename of default file in which to keep cookies. This attribute may be assigned to. \end{memberdesc} -\begin{memberdesc}{delayload} +\begin{memberdesc}[FileCookieJar]{delayload} If true, load cookies lazily from disk. This attribute should not be assigned to. This is only a hint, since this only affects performance, not behaviour (unless the cookies on disk are changing). @@ -400,13 +400,13 @@ attributes, indicating which protocols should be used, and how. All of these attributes may be assigned to. -\begin{memberdesc}{netscape} +\begin{memberdesc}[CookiePolicy]{netscape} Implement Netscape protocol. \end{memberdesc} -\begin{memberdesc}{rfc2965} +\begin{memberdesc}[CookiePolicy]{rfc2965} Implement RFC 2965 protocol. \end{memberdesc} -\begin{memberdesc}{hide_cookie2} +\begin{memberdesc}[CookiePolicy]{hide_cookie2} Don't add \mailheader{Cookie2} header to requests (the presence of this header indicates to the server that we understand RFC 2965 cookies). @@ -504,7 +504,7 @@ which are all initialised from the constructor arguments of the same name, and which may all be assigned to. -\begin{memberdesc}{rfc2109_as_netscape} +\begin{memberdesc}[DefaultCookiePolicy]{rfc2109_as_netscape} If true, request that the \class{CookieJar} instance downgrade RFC 2109 cookies (ie. cookies received in a \mailheader{Set-Cookie} header with a version cookie-attribute of 1) to Netscape cookies by setting @@ -517,7 +517,7 @@ General strictness switches: -\begin{memberdesc}{strict_domain} +\begin{memberdesc}[DefaultCookiePolicy]{strict_domain} Don't allow sites to set two-component domains with country-code top-level domains like \code{.co.uk}, \code{.gov.uk}, \code{.co.nz}.etc. This is far from perfect and isn't guaranteed to @@ -526,7 +526,7 @@ RFC 2965 protocol strictness switches: -\begin{memberdesc}{strict_rfc2965_unverifiable} +\begin{memberdesc}[DefaultCookiePolicy]{strict_rfc2965_unverifiable} Follow RFC 2965 rules on unverifiable transactions (usually, an unverifiable transaction is one resulting from a redirect or a request for an image hosted on another site). If this is false, cookies are @@ -535,19 +535,19 @@ Netscape protocol strictness switches: -\begin{memberdesc}{strict_ns_unverifiable} +\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_unverifiable} apply RFC 2965 rules on unverifiable transactions even to Netscape cookies \end{memberdesc} -\begin{memberdesc}{strict_ns_domain} +\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_domain} Flags indicating how strict to be with domain-matching rules for Netscape cookies. See below for acceptable values. \end{memberdesc} -\begin{memberdesc}{strict_ns_set_initial_dollar} +\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_set_initial_dollar} Ignore cookies in Set-Cookie: headers that have names starting with \code{'\$'}. \end{memberdesc} -\begin{memberdesc}{strict_ns_set_path} +\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_set_path} Don't allow setting cookies whose path doesn't path-match request URI. \end{memberdesc} @@ -556,30 +556,30 @@ \code{DomainStrictNoDots|DomainStrictNonDomain} means both flags are set). -\begin{memberdesc}{DomainStrictNoDots} +\begin{memberdesc}[DefaultCookiePolicy]{DomainStrictNoDots} When setting cookies, the 'host prefix' must not contain a dot (eg. \code{www.foo.bar.com} can't set a cookie for \code{.bar.com}, because \code{www.foo} contains a dot). \end{memberdesc} -\begin{memberdesc}{DomainStrictNonDomain} +\begin{memberdesc}[DefaultCookiePolicy]{DomainStrictNonDomain} Cookies that did not explicitly specify a \code{domain} cookie-attribute can only be returned to a domain equal to the domain that set the cookie (eg. \code{spam.example.com} won't be returned cookies from \code{example.com} that had no \code{domain} cookie-attribute). \end{memberdesc} -\begin{memberdesc}{DomainRFC2965Match} +\begin{memberdesc}[DefaultCookiePolicy]{DomainRFC2965Match} When setting cookies, require a full RFC 2965 domain-match. \end{memberdesc} The following attributes are provided for convenience, and are the most useful combinations of the above flags: -\begin{memberdesc}{DomainLiberal} +\begin{memberdesc}[DefaultCookiePolicy]{DomainLiberal} Equivalent to 0 (ie. all of the above Netscape domain strictness flags switched off). \end{memberdesc} -\begin{memberdesc}{DomainStrict} +\begin{memberdesc}[DefaultCookiePolicy]{DomainStrict} Equivalent to \code{DomainStrictNoDots|DomainStrictNonDomain}. \end{memberdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libctypes.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libctypes.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libctypes.tex Fri May 25 22:13:08 2007 @@ -7,21 +7,21 @@ \versionadded{2.5} \code{ctypes} is a foreign function library for Python. It provides C -compatible data types, and allows to call functions in dlls/shared +compatible data types, and allows calling functions in dlls/shared libraries. It can be used to wrap these libraries in pure Python. \subsection{ctypes tutorial\label{ctypes-ctypes-tutorial}} -Note: The code samples in this tutorial uses \code{doctest} to make sure +Note: The code samples in this tutorial use \code{doctest} to make sure that they actually work. Since some code samples behave differently under Linux, Windows, or Mac OS X, they contain doctest directives in comments. -Note: Quite some code samples references the ctypes \class{c{\_}int} type. +Note: Some code sample references the ctypes \class{c{\_}int} type. This type is an alias to the \class{c{\_}long} type on 32-bit systems. So, you should not be confused if \class{c{\_}long} is printed if you would -expect \class{c{\_}int} - they are actually the same type. +expect \class{c{\_}int} --- they are actually the same type. \subsubsection{Loading dynamic link libraries\label{ctypes-loading-dynamic-link-libraries}} @@ -38,7 +38,7 @@ automatically raise \class{WindowsError} Python exceptions when the function call fails. -Here are some examples for Windows, note that \code{msvcrt} is the MS +Here are some examples for Windows. Note that \code{msvcrt} is the MS standard C library containing most standard C functions, and uses the cdecl calling convention: \begin{verbatim} @@ -1219,7 +1219,7 @@ It is quite interesting to see that the Windows \function{qsort} function needs more comparisons than the linux version! -As we can easily check, our array sorted now: +As we can easily check, our array is sorted now: \begin{verbatim} >>> for i in ia: print i, ... @@ -1242,7 +1242,7 @@ \programopt{-O} or \programopt{-OO} flag given on startup. \code{ctypes} can access values like this with the \method{in{\_}dll} class -methods of the type. \var{pythonapi} ?s a predefined symbol giving +methods of the type. \var{pythonapi} is a predefined symbol giving access to the Python C api: \begin{verbatim} >>> opt_flag = c_int.in_dll(pythonapi, "Py_OptimizeFlag") @@ -2113,7 +2113,7 @@ \end{memberdesc} -\subsubsection{Fundamental data types\label{ctypes-fundamental-data-types}} +\subsubsection{Fundamental data types\label{ctypes-fundamental-data-types-2}} \begin{classdesc*}{_SimpleCData} This non-public class is the base class of all fundamental ctypes @@ -2294,6 +2294,13 @@ an integer address, or a string. \end{classdesc*} +\begin{classdesc*}{c_bool} +Represent the C \code{bool} datatype (more accurately, _Bool from C99). +Its value can be True or False, and the constructor accepts any object that +has a truth value. +\versionadded{2.6} +\end{classdesc*} + \begin{classdesc*}{HRESULT} Windows only: Represents a \class{HRESULT} value, which contains success or error information for a function or method call. Modified: python/branches/bcannon-objcap/Doc/lib/libcurses.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcurses.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcurses.tex Fri May 25 22:13:08 2007 @@ -646,6 +646,16 @@ corner characters are always used by this function. \end{methoddesc} +\begin{methoddesc}[window]{chgat}{\optional{y, x, } \optional{num,} attr} +Sets the attributes of \var{num} characters at the current cursor +position, or at position \code{(\var{y}, \var{x})} if supplied. If no +value of \var{num} is given or \var{num} = -1, the attribute will +be set on all the characters to the end of the line. +This function does not move the cursor. The changed line +will be touched using the \method{touchline} method so that the +contents will be redisplayed by the next window refresh. +\end{methoddesc} + \begin{methoddesc}[window]{clear}{} Like \method{erase()}, but also causes the whole window to be repainted upon next call to \method{refresh()}. @@ -1014,9 +1024,11 @@ input at the end of that time. \end{methoddesc} -\begin{methoddesc}[window]{touchline}{start, count} +\begin{methoddesc}[window]{touchline}{start, count\optional{, changed}} Pretend \var{count} lines have been changed, starting with line -\var{start}. +\var{start}. If \var{changed} is supplied, it specifies +whether the affected lines are marked as +having been changed (\var{changed}=1) or unchanged (\var{changed}=0). \end{methoddesc} \begin{methoddesc}[window]{touchwin}{} Modified: python/branches/bcannon-objcap/Doc/lib/libcursespanel.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcursespanel.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcursespanel.tex Fri May 25 22:13:08 2007 @@ -45,52 +45,52 @@ Panel objects have the following methods: -\begin{methoddesc}{above}{} +\begin{methoddesc}[Panel]{above}{} Returns the panel above the current panel. \end{methoddesc} -\begin{methoddesc}{below}{} +\begin{methoddesc}[Panel]{below}{} Returns the panel below the current panel. \end{methoddesc} -\begin{methoddesc}{bottom}{} +\begin{methoddesc}[Panel]{bottom}{} Push the panel to the bottom of the stack. \end{methoddesc} -\begin{methoddesc}{hidden}{} +\begin{methoddesc}[Panel]{hidden}{} Returns true if the panel is hidden (not visible), false otherwise. \end{methoddesc} -\begin{methoddesc}{hide}{} +\begin{methoddesc}[Panel]{hide}{} Hide the panel. This does not delete the object, it just makes the window on screen invisible. \end{methoddesc} -\begin{methoddesc}{move}{y, x} +\begin{methoddesc}[Panel]{move}{y, x} Move the panel to the screen coordinates \code{(\var{y}, \var{x})}. \end{methoddesc} -\begin{methoddesc}{replace}{win} +\begin{methoddesc}[Panel]{replace}{win} Change the window associated with the panel to the window \var{win}. \end{methoddesc} -\begin{methoddesc}{set_userptr}{obj} +\begin{methoddesc}[Panel]{set_userptr}{obj} Set the panel's user pointer to \var{obj}. This is used to associate an arbitrary piece of data with the panel, and can be any Python object. \end{methoddesc} -\begin{methoddesc}{show}{} +\begin{methoddesc}[Panel]{show}{} Display the panel (which might have been hidden). \end{methoddesc} -\begin{methoddesc}{top}{} +\begin{methoddesc}[Panel]{top}{} Push panel to the top of the stack. \end{methoddesc} -\begin{methoddesc}{userptr}{} +\begin{methoddesc}[Panel]{userptr}{} Returns the user pointer for the panel. This might be any Python object. \end{methoddesc} -\begin{methoddesc}{window}{} +\begin{methoddesc}[Panel]{window}{} Returns the window object associated with the panel. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libdatetime.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libdatetime.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libdatetime.tex Fri May 25 22:13:08 2007 @@ -1154,7 +1154,7 @@ uses made of aware \module{datetime} objects. If in doubt, simply implement all of them. -\begin{methoddesc}{utcoffset}{self, dt} +\begin{methoddesc}[tzinfo]{utcoffset}{self, dt} Return offset of local time from UTC, in minutes east of UTC. If local time is west of UTC, this should be negative. Note that this is intended to be the total offset from UTC; for example, if a @@ -1178,7 +1178,7 @@ \exception{NotImplementedError}. \end{methoddesc} -\begin{methoddesc}{dst}{self, dt} +\begin{methoddesc}[tzinfo]{dst}{self, dt} Return the daylight saving time (DST) adjustment, in minutes east of UTC, or \code{None} if DST information isn't known. Return \code{timedelta(0)} if DST is not in effect. @@ -1237,7 +1237,7 @@ \exception{NotImplementedError}. \end{methoddesc} -\begin{methoddesc}{tzname}{self, dt} +\begin{methoddesc}[tzinfo]{tzname}{self, dt} Return the time zone name corresponding to the \class{datetime} object \var{dt}, as a string. Nothing about string names is defined by the @@ -1278,7 +1278,7 @@ There is one more \class{tzinfo} method that a subclass may wish to override: -\begin{methoddesc}{fromutc}{self, dt} +\begin{methoddesc}[tzinfo]{fromutc}{self, dt} This is called from the default \class{datetime.astimezone()} implementation. When called from that, \code{\var{dt}.tzinfo} is \var{self}, and \var{dt}'s date and time members are to be viewed as Modified: python/branches/bcannon-objcap/Doc/lib/libdbhash.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libdbhash.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libdbhash.tex Fri May 25 22:13:08 2007 @@ -2,7 +2,6 @@ DBM-style interface to the BSD database library} \declaremodule{standard}{dbhash} - \platform{Unix, Windows} \modulesynopsis{DBM-style interface to the BSD database library.} \sectionauthor{Fred L. Drake, Jr.}{fdrake at acm.org} Modified: python/branches/bcannon-objcap/Doc/lib/libdecimal.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libdecimal.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libdecimal.tex Fri May 25 22:13:08 2007 @@ -425,7 +425,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\subsection{Context objects \label{decimal-decimal}} +\subsection{Context objects \label{decimal-context}} Contexts are environments for arithmetic operations. They govern precision, set rules for rounding, determine which signals are treated as exceptions, and Modified: python/branches/bcannon-objcap/Doc/lib/libdifflib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libdifflib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libdifflib.tex Fri May 25 22:13:08 2007 @@ -302,7 +302,7 @@ \begin{seealso} - \seetitle[http://www.ddj.com/documents/s=1103/ddj8807c/] + \seetitle[http://www.ddj.com/184407970?pgno=5] {Pattern Matching: The Gestalt Approach}{Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. This was published in Modified: python/branches/bcannon-objcap/Doc/lib/libdl.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libdl.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libdl.tex Fri May 25 22:13:08 2007 @@ -67,11 +67,11 @@ Dl objects, as returned by \function{open()} above, have the following methods: -\begin{methoddesc}{close}{} +\begin{methoddesc}[dl]{close}{} Free all resources, except the memory. \end{methoddesc} -\begin{methoddesc}{sym}{name} +\begin{methoddesc}[dl]{sym}{name} Return the pointer for the function named \var{name}, as a number, if it exists in the referenced shared object, otherwise \code{None}. This is useful in code like: @@ -87,7 +87,7 @@ \NULL{} pointer) \end{methoddesc} -\begin{methoddesc}{call}{name\optional{, arg1\optional{, arg2\ldots}}} +\begin{methoddesc}[dl]{call}{name\optional{, arg1\optional{, arg2\ldots}}} Call the function named \var{name} in the referenced shared object. The arguments must be either Python integers, which will be passed as is, Python strings, to which a pointer will be passed, Modified: python/branches/bcannon-objcap/Doc/lib/libdoctest.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libdoctest.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libdoctest.tex Fri May 25 22:13:08 2007 @@ -201,6 +201,19 @@ \code{sys.argv} is not examined by \function{testmod()} (so passing \programopt{-v} or not has no effect). +Since Python 2.6, there is also a command line shortcut for running +\function{testmod()}. You can instruct the Python interpreter to run +the doctest module directly from the standard library and pass the module +name(s) on the command line: + +\begin{verbatim} +python -m doctest -v example.py +\end{verbatim} + +This will import \file{example.py} as a standalone module and run +\function{testmod()} on it. Note that this may not work correctly if the +file is part of a package and imports other submodules from that package. + For more information on \function{testmod()}, see section~\ref{doctest-basic-api}. @@ -267,6 +280,18 @@ set with the \programopt{-v} command-line switch or with the optional keyword argument \var{verbose}. +Since Python 2.6, there is also a command line shortcut for running +\function{testfile()}. You can instruct the Python interpreter to run +the doctest module directly from the standard library and pass the file +name(s) on the command line: + +\begin{verbatim} +python -m doctest -v example.txt +\end{verbatim} + +Because the file name does not end with \file{.py}, \module{doctest} infers +that it must be run with \function{testfile()}, not \function{testmod()}. + For more information on \function{testfile()}, see section~\ref{doctest-basic-api}. @@ -1716,7 +1741,7 @@ >>> \end{verbatim} - \versionchanged[The ability to use \code{\refmodule{pdb}.set_trace()} + \versionchanged[The ability to use \function{\refmodule{pdb}.set_trace()} usefully inside doctests was added]{2.4} \end{itemize} @@ -1800,10 +1825,10 @@ used. If \var{pm} has a true value, the script file is run directly, and the debugger gets involved only if the script terminates via raising an unhandled exception. If it does, then post-mortem debugging is invoked, - via \code{\refmodule{pdb}.post_mortem()}, passing the traceback object + via \function{\refmodule{pdb}.post_mortem()}, passing the traceback object from the unhandled exception. If \var{pm} is not specified, or is false, the script is run under the debugger from the start, via passing an - appropriate \function{execfile()} call to \code{\refmodule{pdb}.run()}. + appropriate \function{execfile()} call to \function{\refmodule{pdb}.run()}. \versionadded{2.3} Modified: python/branches/bcannon-objcap/Doc/lib/libdocxmlrpc.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libdocxmlrpc.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libdocxmlrpc.tex Fri May 25 22:13:08 2007 @@ -14,8 +14,12 @@ \class{DocXMLRPCServer}, or embedded in a CGI environment, using \class{DocCGIXMLRPCRequestHandler}. -\begin{classdesc}{DocXMLRPCServer}{addr\optional{, - requestHandler\optional{, logRequests}}} +\begin{classdesc}{DocXMLRPCServer}{addr\optional{, + requestHandler\optional{, + logRequests\optional{, + allow_none\optional{, + encoding\optional{, + bind_and_activate}}}}}} Create a new server instance. All parameters have the same meaning as for \class{SimpleXMLRPCServer.SimpleXMLRPCServer}; @@ -47,14 +51,14 @@ handled by generating pydoc-style HTML documentation. This allows a server to provide its own web-based documentation. -\begin{methoddesc}{set_server_title}{server_title} +\begin{methoddesc}[DocXMLRPCServer]{set_server_title}{server_title} Set the title used in the generated HTML documentation. This title will be used inside the HTML "title" element. \end{methoddesc} -\begin{methoddesc}{set_server_name}{server_name} +\begin{methoddesc}[DocXMLRPCServer]{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will appear at the top of the generated documentation inside a "h1" @@ -63,7 +67,7 @@ \end{methoddesc} -\begin{methoddesc}{set_server_documentation}{server_documentation} +\begin{methoddesc}[DocXMLRPCServer]{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This description will appear as a paragraph, below the server name, in the @@ -80,14 +84,14 @@ generating pydoc-style HTML documentation. This allows a server to provide its own web-based documentation. -\begin{methoddesc}{set_server_title}{server_title} +\begin{methoddesc}[DocCGIXMLRPCRequestHandler]{set_server_title}{server_title} Set the title used in the generated HTML documentation. This title will be used inside the HTML "title" element. \end{methoddesc} -\begin{methoddesc}{set_server_name}{server_name} +\begin{methoddesc}[DocCGIXMLRPCRequestHandler]{set_server_name}{server_name} Set the name used in the generated HTML documentation. This name will appear at the top of the generated documentation inside a "h1" @@ -96,7 +100,7 @@ \end{methoddesc} -\begin{methoddesc}{set_server_documentation}{server_documentation} +\begin{methoddesc}[DocCGIXMLRPCRequestHandler]{set_server_documentation}{server_documentation} Set the description used in the generated HTML documentation. This description will appear as a paragraph, below the server name, in the Modified: python/branches/bcannon-objcap/Doc/lib/libdumbdbm.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libdumbdbm.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libdumbdbm.tex Fri May 25 22:13:08 2007 @@ -57,7 +57,7 @@ In addition to the methods provided by the \class{UserDict.DictMixin} class, \class{dumbdbm} objects provide the following methods. -\begin{methoddesc}{sync}{} +\begin{methoddesc}[dumbdbm]{sync}{} Synchronize the on-disk directory and data files. This method is called by the \method{sync} method of \class{Shelve} objects. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libetree.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libetree.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libetree.tex Fri May 25 22:13:08 2007 @@ -38,10 +38,7 @@ The comment string can be either an 8-bit ASCII string or a Unicode string. \var{text} is a string containing the comment string. - -\begin{datadescni}{Returns:} -An element instance, representing a comment. -\end{datadescni} +Returns an element instance representing a comment. \end{funcdesc} \begin{funcdesc}{dump}{elem} @@ -65,28 +62,19 @@ \var{tag} is the element name. \var{attrib} is an optional dictionary, containing element attributes. \var{extra} contains additional attributes, given as keyword arguments. - -\begin{datadescni}{Returns:} -An element instance. -\end{datadescni} +Returns an element instance. \end{funcdesc} \begin{funcdesc}{fromstring}{text} Parses an XML section from a string constant. Same as XML. \var{text} is a string containing XML data. - -\begin{datadescni}{Returns:} -An Element instance. -\end{datadescni} +Returns an Element instance. \end{funcdesc} \begin{funcdesc}{iselement}{element} Checks if an object appears to be a valid element object. \var{element} is an element instance. - -\begin{datadescni}{Returns:} -A true value if this is an element object. -\end{datadescni} +Returns a true value if this is an element object. \end{funcdesc} \begin{funcdesc}{iterparse}{source\optional{, events}} @@ -95,10 +83,7 @@ \var{source} is a filename or file object containing XML data. \var{events} is a list of events to report back. If omitted, only ``end'' events are reported. - -\begin{datadescni}{Returns:} -A (event, elem) iterator. -\end{datadescni} +Returns an iterator providing \code{(\var{event}, \var{elem})} pairs. \end{funcdesc} \begin{funcdesc}{parse}{source\optional{, parser}} @@ -106,10 +91,7 @@ \var{source} is a filename or file object containing XML data. \var{parser} is an optional parser instance. If not given, the standard XMLTreeBuilder parser is used. - -\begin{datadescni}{Returns:} -An ElementTree instance -\end{datadescni} +Returns an ElementTree instance. \end{funcdesc} \begin{funcdesc}{ProcessingInstruction}{target\optional{, text}} @@ -117,13 +99,11 @@ that will be serialized as an XML processing instruction. \var{target} is a string containing the PI target. \var{text} is a string containing the PI contents, if given. - -\begin{datadescni}{Returns:} -An element instance, representing a PI. -\end{datadescni} +Returns an element instance, representing a processing instruction. \end{funcdesc} -\begin{funcdesc}{SubElement}{parent, tag\optional{, attrib} \optional{, **extra}} +\begin{funcdesc}{SubElement}{parent, tag\optional{, + attrib\optional{, **extra}}} Subelement factory. This function creates an element instance, and appends it to an existing element. @@ -133,10 +113,7 @@ \var{tag} is the subelement name. \var{attrib} is an optional dictionary, containing element attributes. \var{extra} contains additional attributes, given as keyword arguments. - -\begin{datadescni}{Returns:} -An element instance. -\end{datadescni} +Returns an element instance. \end{funcdesc} \begin{funcdesc}{tostring}{element\optional{, encoding}} @@ -144,33 +121,162 @@ subelements. \var{element} is an Element instance. \var{encoding} is the output encoding (default is US-ASCII). - -\begin{datadescni}{Returns:} -An encoded string containing the XML data. -\end{datadescni} +Returns an encoded string containing the XML data. \end{funcdesc} \begin{funcdesc}{XML}{text} Parses an XML section from a string constant. This function can be used to embed ``XML literals'' in Python code. \var{text} is a string containing XML data. - -\begin{datadescni}{Returns:} -An Element instance. -\end{datadescni} +Returns an Element instance. \end{funcdesc} \begin{funcdesc}{XMLID}{text} Parses an XML section from a string constant, and also returns a dictionary which maps from element id:s to elements. \var{text} is a string containing XML data. - -\begin{datadescni}{Returns:} -A tuple containing an Element instance and a dictionary. -\end{datadescni} +Returns a tuple containing an Element instance and a dictionary. \end{funcdesc} +\subsection{The Element Interface\label{elementtree-element-interface}} + +Element objects returned by Element or SubElement have the +following methods and attributes. + +\begin{memberdesc}[Element]{tag} +A string identifying what kind of data this element represents +(the element type, in other words). +\end{memberdesc} + +\begin{memberdesc}[Element]{text} +The \var{text} attribute can be used to hold additional data +associated with the element. +As the name implies this attribute is usually a string but may be any +application-specific object. +If the element is created from an XML file the attribute will contain +any text found between the element tags. +\end{memberdesc} + +\begin{memberdesc}[Element]{tail} +The \var{tail} attribute can be used to hold additional data +associated with the element. +This attribute is usually a string but may be any application-specific object. +If the element is created from an XML file the attribute will contain +any text found after the element's end tag and before the next tag. +\end{memberdesc} + +\begin{memberdesc}[Element]{attrib} +A dictionary containing the element's attributes. +Note that while the \var{attrib} value is always a real mutable Python +dictionary, an ElementTree implementation may choose to use another +internal representation, and create the dictionary only if someone +asks for it. To take advantage of such implementations, use the +dictionary methods below whenever possible. +\end{memberdesc} + +The following dictionary-like methods work on the element attributes. + +\begin{methoddesc}[Element]{clear}{} +Resets an element. This function removes all subelements, clears +all attributes, and sets the text and tail attributes to None. +\end{methoddesc} + +\begin{methoddesc}[Element]{get}{key\optional{, default=None}} +Gets the element attribute named \var{key}. + +Returns the attribute value, or \var{default} if the +attribute was not found. +\end{methoddesc} + +\begin{methoddesc}[Element]{items}{} +Returns the element attributes as a sequence of (name, value) pairs. +The attributes are returned in an arbitrary order. +\end{methoddesc} + +\begin{methoddesc}[Element]{keys}{} +Returns the elements attribute names as a list. +The names are returned in an arbitrary order. +\end{methoddesc} + +\begin{methoddesc}[Element]{set}{key, value} +Set the attribute \var{key} on the element to \var{value}. +\end{methoddesc} + +The following methods work on the element's children (subelements). + +\begin{methoddesc}[Element]{append}{subelement} +Adds the element \var{subelement} to the end of this elements internal list +of subelements. +\end{methoddesc} + +\begin{methoddesc}[Element]{find}{match} +Finds the first subelement matching \var{match}. +\var{match} may be a tag name or path. +Returns an element instance or \code{None}. +\end{methoddesc} + +\begin{methoddesc}[Element]{findall}{match} +Finds all subelements matching \var{match}. +\var{match} may be a tag name or path. +Returns an iterable yielding all matching elements in document order. +\end{methoddesc} + +\begin{methoddesc}[Element]{findtext}{condition\optional{, default=None}} +Finds text for the first subelement matching \var{condition}. +\var{condition} may be a tag name or path. +Returns the text content of the first matching element, or +\var{default} if no element was found. Note that if the +matching element has no text content an empty string is returned. +\end{methoddesc} + +\begin{methoddesc}[Element]{getchildren}{} +Returns all subelements. The elements are returned in document order. +\end{methoddesc} + +\begin{methoddesc}[Element]{getiterator}{\optional{tag=None}} +Creates a tree iterator with the current element as the root. +The iterator iterates over this element and all elements below it +that match the given tag. If tag +is \code{None} or \code{'*'} then all elements are iterated over. +Returns an iterable that provides element objects in document (depth first) +order. +\end{methoddesc} + +\begin{methoddesc}[Element]{insert}{index, element} +Inserts a subelement at the given position in this element. +\end{methoddesc} + +\begin{methoddesc}[Element]{makeelement}{tag, attrib} +Creates a new element object of the same type as this element. +Do not call this method, use the SubElement factory function instead. +\end{methoddesc} + +\begin{methoddesc}[Element]{remove}{subelement} +Removes \var{subelement} from the element. +Unlike the findXXX methods this method compares elements based on +the instance identity, not on tag value or contents. +\end{methoddesc} + +Element objects also support the following sequence type methods for +working with subelements: \method{__delitem__()}, +\method{__getitem__()}, \method{__setitem__()}, \method{__len__()}. + +Caution: Because Element objects do not define a +\method{__nonzero__()} method, elements with no subelements will test +as \code{False}. + +\begin{verbatim} +element = root.find('foo') + +if not element: # careful! + print "element not found, or element has no subelements" + +if element is None: + print "element not found" +\end{verbatim} + + \subsection{ElementTree Objects\label{elementtree-elementtree-objects}} \begin{classdesc}{ElementTree}{\optional{element,} \optional{file}} @@ -193,21 +299,15 @@ Finds the first toplevel element with given tag. Same as getroot().find(path). \var{path} is the element to look for. - -\begin{datadescni}{Returns:} -The first matching element, or None if no element was found. -\end{datadescni} +Returns the first matching element, or \code{None} if no element was found. \end{methoddesc} \begin{methoddesc}{findall}{path} Finds all toplevel elements with the given tag. Same as getroot().findall(path). \var{path} is the element to look for. - -\begin{datadescni}{Returns:} -A list or iterator containing all matching elements, -in section order. -\end{datadescni} +Returns a list or iterator containing all matching elements, +in document order. \end{methoddesc} \begin{methoddesc}{findtext}{path\optional{, default}} @@ -215,31 +315,20 @@ tag. Same as getroot().findtext(path). \var{path} is the toplevel element to look for. \var{default} is the value to return if the element was not found. - -\begin{datadescni}{Returns:} -The text content of the first matching element, or the +Returns the text content of the first matching element, or the default value no element was found. Note that if the element has is found, but has no text content, this method returns an empty string. -\end{datadescni} \end{methoddesc} \begin{methoddesc}{getiterator}{\optional{tag}} -Creates a tree iterator for the root element. The iterator loops +Creates and returns a tree iterator for the root element. The iterator loops over all elements in this tree, in section order. \var{tag} is the tag to look for (default is to return all elements) - -\begin{datadescni}{Returns:} -An iterator. -\end{datadescni} \end{methoddesc} \begin{methoddesc}{getroot}{} -Gets the root element for this tree. - -\begin{datadescni}{Returns:} -An element instance. -\end{datadescni} +Returns the root element for this tree. \end{methoddesc} \begin{methoddesc}{parse}{source\optional{, parser}} @@ -247,10 +336,7 @@ \var{source} is a file name or file object. \var{parser} is an optional parser instance. If not given, the standard XMLTreeBuilder parser is used. - -\begin{datadescni}{Returns:} -The section root element. -\end{datadescni} +Returns the section root element. \end{methoddesc} \begin{methoddesc}{write}{file\optional{, encoding}} @@ -270,10 +356,7 @@ the URI part of a QName. If \var{tag} is given, the first argument is interpreted as an URI, and this argument is interpreted as a local name. - -\begin{datadescni}{Returns:} -An opaque object, representing the QName. -\end{datadescni} +\class{QName} instances are opaque. \end{classdesc} @@ -291,10 +374,7 @@ \begin{methoddesc}{close}{} Flushes the parser buffers, and returns the toplevel documen element. - -\begin{datadescni}{Returns:} -An Element instance. -\end{datadescni} +Returns an Element instance. \end{methoddesc} \begin{methoddesc}{data}{data} @@ -306,20 +386,14 @@ \begin{methoddesc}{end}{tag} Closes the current element. \var{tag} is the element name. - -\begin{datadescni}{Returns:} -The closed element. -\end{datadescni} +Returns the closed element. \end{methoddesc} \begin{methoddesc}{start}{tag, attrs} Opens a new element. \var{tag} is the element name. \var{attrs} is a dictionary containing element attributes. - -\begin{datadescni}{Returns:} -The opened element. -\end{datadescni} +Returns the opened element. \end{methoddesc} @@ -336,10 +410,7 @@ \begin{methoddesc}{close}{} Finishes feeding data to the parser. - -\begin{datadescni}{Returns:} -An element structure. -\end{datadescni} +Returns an element structure. \end{methoddesc} \begin{methoddesc}{doctype}{name, pubid, system} @@ -351,6 +422,5 @@ \begin{methoddesc}{feed}{data} Feeds data to the parser. - \var{data} is encoded data. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libexcs.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libexcs.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libexcs.tex Fri May 25 22:13:08 2007 @@ -23,14 +23,10 @@ This may be a string or a tuple containing several items of information (e.g., an error code and a string explaining the code). The associated value is the second argument to the -\keyword{raise}\stindex{raise} statement. For string exceptions, the -associated value itself will be stored in the variable named as the -second argument of the \keyword{except} clause (if any). For class -exceptions, that variable receives the exception instance. If the -exception class is derived from the standard root class -\exception{BaseException}, the associated value is present as the -exception instance's \member{args} attribute. If there is a single argument -(as is preferred), it is bound to the \member{message} attribute. +\keyword{raise}\stindex{raise} statement. If the exception class is +derived from the standard root class \exception{BaseException}, the +associated value is present as the exception instance's \member{args} +attribute. User code can raise built-in exceptions. This can be used to test an exception handler or to report an error condition ``just like'' the @@ -56,14 +52,8 @@ inherited by user-defined classes (for that use \exception{Exception}). If \function{str()} or \function{unicode()} is called on an instance of this class, the representation of the argument(s) to the instance are returned or -the emptry string when there were no arguments. If only a single argument is -passed in, it is stored in the \member{message} attribute. If more than one -argument is passed in, \member{message} is set to the empty string. These -semantics are meant to reflect the fact that \member{message} is to store a -text message explaining why the exception had been raised. If more data needs -to be attached to the exception, attach it through arbitrary attributes on the -instance. All arguments are also stored in \member{args} as a tuple, but it will -eventually be deprecated and thus its use is discouraged. +the emptry string when there were no arguments. All arguments are +stored in \member{args} as a tuple. \versionadded{2.5} \end{excdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libfm.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libfm.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libfm.tex Fri May 25 22:13:08 2007 @@ -55,40 +55,39 @@ Font handle objects support the following operations: -\setindexsubitem{(font handle method)} -\begin{funcdesc}{scalefont}{factor} +\begin{methoddesc}[font handle]{scalefont}{factor} Returns a handle for a scaled version of this font. Calls \code{fmscalefont(\var{fh}, \var{factor})}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{setfont}{} +\begin{methoddesc}[font handle]{setfont}{} Makes this font the current font. Note: the effect is undone silently when the font handle object is deleted. Calls \code{fmsetfont(\var{fh})}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{getfontname}{} +\begin{methoddesc}[font handle]{getfontname}{} Returns this font's name. Calls \code{fmgetfontname(\var{fh})}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{getcomment}{} +\begin{methoddesc}[font handle]{getcomment}{} Returns the comment string associated with this font. Raises an exception if there is none. Calls \code{fmgetcomment(\var{fh})}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{getfontinfo}{} +\begin{methoddesc}[font handle]{getfontinfo}{} Returns a tuple giving some pertinent data about this font. This is an interface to \code{fmgetfontinfo()}. The returned tuple contains the following numbers: \code{(}\var{printermatched}, \var{fixed_width}, \var{xorig}, \var{yorig}, \var{xsize}, \var{ysize}, \var{height}, \var{nglyphs}\code{)}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{getstrwidth}{string} +\begin{methoddesc}[font handle]{getstrwidth}{string} Returns the width, in pixels, of \var{string} when drawn in this font. Calls \code{fmgetstrwidth(\var{fh}, \var{string})}. -\end{funcdesc} +\end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libfnmatch.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libfnmatch.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libfnmatch.tex Fri May 25 22:13:08 2007 @@ -36,6 +36,19 @@ require a case-sensitive comparison regardless of whether that's standard for your operating system, use \function{fnmatchcase()} instead. + +This example will print all file names in the current directory with the +extension \code{.txt}: + +\begin{verbatim} +import fnmatch +import os + +for file in os.listdir('.'): + if fnmatch.fnmatch(file, '*.txt'): + print file +\end{verbatim} + \end{funcdesc} \begin{funcdesc}{fnmatchcase}{filename, pattern} @@ -50,6 +63,24 @@ \versionadded{2.2} \end{funcdesc} +\begin{funcdesc}{translate}{pattern} +Return the shell-style \var{pattern} converted to a regular +expression. + +Example: + +\begin{verbatim} +>>> import fnmatch, re +>>> +>>> regex = fnmatch.translate('*.txt') +>>> regex +'.*\\.txt$' +>>> reobj = re.compile(regex) +>>> print reobj.match('foobar.txt') +<_sre.SRE_Match object at 0x...> +\end{verbatim} +\end{funcdesc} + \begin{seealso} \seemodule{glob}{\UNIX{} shell-style path expansion.} \end{seealso} Modified: python/branches/bcannon-objcap/Doc/lib/libftplib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libftplib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libftplib.tex Fri May 25 22:13:08 2007 @@ -37,12 +37,15 @@ The module defines the following items: \begin{classdesc}{FTP}{\optional{host\optional{, user\optional{, - passwd\optional{, acct}}}}} + passwd\optional{, acct\optional{, timeout}}}}}} Return a new instance of the \class{FTP} class. When \var{host} is given, the method call \code{connect(\var{host})} is made. When \var{user} is given, additionally the method call \code{login(\var{user}, \var{passwd}, \var{acct})} is made (where \var{passwd} and \var{acct} default to the empty string when not given). +The optional \var{timeout} parameter specifies a timeout in seconds for the +connection attempt (if is not specified, or passed as None, the global +default timeout setting will be used). \end{classdesc} \begin{datadesc}{all_errors} @@ -92,7 +95,7 @@ \class{FTP} instances have the following methods: -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[FTP]{set_debuglevel}{level} Set the instance's debugging level. This controls the amount of debugging output printed. The default, \code{0}, produces no debugging output. A value of \code{1} produces a moderate amount of @@ -101,22 +104,28 @@ logging each line sent and received on the control connection. \end{methoddesc} -\begin{methoddesc}{connect}{host\optional{, port}} +\begin{methoddesc}[FTP]{connect}{host\optional{, port\optional{, timeout}}} Connect to the given host and port. The default port number is \code{21}, as specified by the FTP protocol specification. It is rarely needed to specify a different port number. This function should be called only once for each instance; it should not be called at all if a host was given when the instance was created. All other methods can only be used after a connection has been made. + +The optional \var{timeout} parameter specifies a timeout in seconds for +the connection attempt. If is not specified, or passed as None, the +object timeout is used (the timeout that you passed when instantiating the +class); if the object timeout is also None, the global default timeout +setting will be used. \end{methoddesc} -\begin{methoddesc}{getwelcome}{} +\begin{methoddesc}[FTP]{getwelcome}{} Return the welcome message sent by the server in reply to the initial connection. (This message sometimes contains disclaimers or help information that may be relevant to the user.) \end{methoddesc} -\begin{methoddesc}{login}{\optional{user\optional{, passwd\optional{, acct}}}} +\begin{methoddesc}[FTP]{login}{\optional{user\optional{, passwd\optional{, acct}}}} Log in as the given \var{user}. The \var{passwd} and \var{acct} parameters are optional and default to the empty string. If no \var{user} is specified, it defaults to \code{'anonymous'}. If @@ -128,23 +137,23 @@ client has logged in. \end{methoddesc} -\begin{methoddesc}{abort}{} +\begin{methoddesc}[FTP]{abort}{} Abort a file transfer that is in progress. Using this does not always work, but it's worth a try. \end{methoddesc} -\begin{methoddesc}{sendcmd}{command} +\begin{methoddesc}[FTP]{sendcmd}{command} Send a simple command string to the server and return the response string. \end{methoddesc} -\begin{methoddesc}{voidcmd}{command} +\begin{methoddesc}[FTP]{voidcmd}{command} Send a simple command string to the server and handle the response. Return nothing if a response code in the range 200--299 is received. Raise an exception otherwise. \end{methoddesc} -\begin{methoddesc}{retrbinary}{command, +\begin{methoddesc}[FTP]{retrbinary}{command, callback\optional{, maxblocksize\optional{, rest}}} Retrieve a file in binary transfer mode. \var{command} should be an appropriate \samp{RETR} command: \code{'RETR \var{filename}'}. @@ -157,7 +166,7 @@ same thing as in the \method{transfercmd()} method. \end{methoddesc} -\begin{methoddesc}{retrlines}{command\optional{, callback}} +\begin{methoddesc}[FTP]{retrlines}{command\optional{, callback}} Retrieve a file or directory listing in \ASCII{} transfer mode. \var{command} should be an appropriate \samp{RETR} command (see \method{retrbinary()}) or a \samp{LIST} command (usually just the string @@ -166,13 +175,13 @@ the line to \code{sys.stdout}. \end{methoddesc} -\begin{methoddesc}{set_pasv}{boolean} +\begin{methoddesc}[FTP]{set_pasv}{boolean} Enable ``passive'' mode if \var{boolean} is true, other disable passive mode. (In Python 2.0 and before, passive mode was off by default; in Python 2.1 and later, it is on by default.) \end{methoddesc} -\begin{methoddesc}{storbinary}{command, file\optional{, blocksize}} +\begin{methoddesc}[FTP]{storbinary}{command, file\optional{, blocksize}} Store a file in binary transfer mode. \var{command} should be an appropriate \samp{STOR} command: \code{"STOR \var{filename}"}. \var{file} is an open file object which is read until \EOF{} using its @@ -181,14 +190,14 @@ \versionchanged[default for \var{blocksize} added]{2.1} \end{methoddesc} -\begin{methoddesc}{storlines}{command, file} +\begin{methoddesc}[FTP]{storlines}{command, file} Store a file in \ASCII{} transfer mode. \var{command} should be an appropriate \samp{STOR} command (see \method{storbinary()}). Lines are read until \EOF{} from the open file object \var{file} using its \method{readline()} method to provide the data to be stored. \end{methoddesc} -\begin{methoddesc}{transfercmd}{cmd\optional{, rest}} +\begin{methoddesc}[FTP]{transfercmd}{cmd\optional{, rest}} Initiate a transfer over the data connection. If the transfer is active, send a \samp{EPRT} or \samp{PORT} command and the transfer command specified by \var{cmd}, and accept the connection. If the server is passive, @@ -210,7 +219,7 @@ simply call \method{transfercmd()} without a \var{rest} argument. \end{methoddesc} -\begin{methoddesc}{ntransfercmd}{cmd\optional{, rest}} +\begin{methoddesc}[FTP]{ntransfercmd}{cmd\optional{, rest}} Like \method{transfercmd()}, but returns a tuple of the data connection and the expected size of the data. If the expected size could not be computed, \code{None} will be returned as the expected @@ -218,14 +227,14 @@ \method{transfercmd()}. \end{methoddesc} -\begin{methoddesc}{nlst}{argument\optional{, \ldots}} +\begin{methoddesc}[FTP]{nlst}{argument\optional{, \ldots}} Return a list of files as returned by the \samp{NLST} command. The optional \var{argument} is a directory to list (default is the current server directory). Multiple arguments can be used to pass non-standard options to the \samp{NLST} command. \end{methoddesc} -\begin{methoddesc}{dir}{argument\optional{, \ldots}} +\begin{methoddesc}[FTP]{dir}{argument\optional{, \ldots}} Produce a directory listing as returned by the \samp{LIST} command, printing it to standard output. The optional \var{argument} is a directory to list (default is the current server directory). Multiple @@ -235,41 +244,41 @@ prints to \code{sys.stdout}. This method returns \code{None}. \end{methoddesc} -\begin{methoddesc}{rename}{fromname, toname} +\begin{methoddesc}[FTP]{rename}{fromname, toname} Rename file \var{fromname} on the server to \var{toname}. \end{methoddesc} -\begin{methoddesc}{delete}{filename} +\begin{methoddesc}[FTP]{delete}{filename} Remove the file named \var{filename} from the server. If successful, returns the text of the response, otherwise raises \exception{error_perm} on permission errors or \exception{error_reply} on other errors. \end{methoddesc} -\begin{methoddesc}{cwd}{pathname} +\begin{methoddesc}[FTP]{cwd}{pathname} Set the current directory on the server. \end{methoddesc} -\begin{methoddesc}{mkd}{pathname} +\begin{methoddesc}[FTP]{mkd}{pathname} Create a new directory on the server. \end{methoddesc} -\begin{methoddesc}{pwd}{} +\begin{methoddesc}[FTP]{pwd}{} Return the pathname of the current directory on the server. \end{methoddesc} -\begin{methoddesc}{rmd}{dirname} +\begin{methoddesc}[FTP]{rmd}{dirname} Remove the directory named \var{dirname} on the server. \end{methoddesc} -\begin{methoddesc}{size}{filename} +\begin{methoddesc}[FTP]{size}{filename} Request the size of the file named \var{filename} on the server. On success, the size of the file is returned as an integer, otherwise \code{None} is returned. Note that the \samp{SIZE} command is not standardized, but is supported by many common server implementations. \end{methoddesc} -\begin{methoddesc}{quit}{} +\begin{methoddesc}[FTP]{quit}{} Send a \samp{QUIT} command to the server and close the connection. This is the ``polite'' way to close a connection, but it may raise an exception of the server reponds with an error to the @@ -278,7 +287,7 @@ calls (see below). \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[FTP]{close}{} Close the connection unilaterally. This should not be applied to an already closed connection such as after a successful call to \method{quit()}. After this call the \class{FTP} instance should not Modified: python/branches/bcannon-objcap/Doc/lib/libfuncs.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libfuncs.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libfuncs.tex Fri May 25 22:13:08 2007 @@ -175,15 +175,15 @@ \code{\var{x} > \var{y}}. \end{funcdesc} -\begin{funcdesc}{compile}{string, filename, kind\optional{, +\begin{funcdesc}{compile}{source, filename, mode\optional{, flags\optional{, dont_inherit}}} - Compile the \var{string} into a code object. Code objects can be + Compile the \var{source} into a code object. Code objects can be executed by an \keyword{exec} statement or evaluated by a call to \function{eval()}. The \var{filename} argument should give the file from which the code was read; pass some recognizable value if it wasn't read from a file (\code{''} is commonly used). - The \var{kind} argument specifies what kind of code must be - compiled; it can be \code{'exec'} if \var{string} consists of a + The \var{mode} argument specifies what kind of code must be + compiled; it can be \code{'exec'} if \var{source} consists of a sequence of statements, \code{'eval'} if it consists of a single expression, or \code{'single'} if it consists of a single interactive statement (in the latter case, expression statements @@ -198,7 +198,7 @@ The optional arguments \var{flags} and \var{dont_inherit} (which are new in Python 2.2) control which future statements (see - \pep{236}) affect the compilation of \var{string}. If neither is + \pep{236}) affect the compilation of \var{source}. If neither is present (or both are zero) the code is compiled with those future statements that are in effect in the code that is calling compile. If the \var{flags} argument is given and \var{dont_inherit} is not @@ -274,21 +274,34 @@ \end{funcdesc} \begin{funcdesc}{dir}{\optional{object}} - Without arguments, return the list of names in the current local - symbol table. With an argument, attempts to return a list of valid - attributes for that object. This information is gleaned from the - object's \member{__dict__} attribute, if defined, and from the class - or type object. The list is not necessarily complete. - If the object is a module object, the list contains the names of the - module's attributes. - If the object is a type or class object, - the list contains the names of its attributes, - and recursively of the attributes of its bases. - Otherwise, the list contains the object's attributes' names, - the names of its class's attributes, - and recursively of the attributes of its class's base classes. - The resulting list is sorted alphabetically. - For example: + Without arguments, return the list of names in the current local scope. With + an argument, attempt to return a list of valid attributes for that object. + + If the object has a method named \method{__dir__()}, this method will be + called and must return the list of attributes. This allows objects that + implement a custom \function{__getattr__()} or \function{__getattribute__()} + function to customize the way \function{dir()} reports their attributes. + + If the object does not provide \method{__dir__()}, the function tries its best + to gather information from the object's \member{__dict__} attribute, if + defined, and from its type object. The resulting list is not necessarily + complete, and may be inaccurate when the object has a custom + \function{__getattr__()}. + + The default \function{dir()} mechanism behaves differently with different + types of objects, as it attempts to produce the most relevant, rather than + complete, information: + \begin{itemize} + \item If the object is a module object, the list contains the names of the + module's attributes. + \item If the object is a type or class object, the list contains the names of + its attributes, and recursively of the attributes of its bases. + \item Otherwise, the list contains the object's attributes' names, the names + of its class's attributes, and recursively of the attributes of its class's + base classes. + \end{itemize} + + The resulting list is sorted alphabetically. For example: \begin{verbatim} >>> import struct @@ -296,13 +309,19 @@ ['__builtins__', '__doc__', '__name__', 'struct'] >>> dir(struct) ['__doc__', '__name__', 'calcsize', 'error', 'pack', 'unpack'] +>>> class Foo(object): +... def __dir__(self): +... return ["kan", "ga", "roo"] +... +>>> f = Foo() +>>> dir(f) +['ga', 'kan', 'roo'] \end{verbatim} - \note{Because \function{dir()} is supplied primarily as a convenience - for use at an interactive prompt, - it tries to supply an interesting set of names more than it tries to - supply a rigorously or consistently defined set of names, - and its detailed behavior may change across releases.} + \note{Because \function{dir()} is supplied primarily as a convenience for use + at an interactive prompt, it tries to supply an interesting set of names + more than it tries to supply a rigorously or consistently defined set of + names, and its detailed behavior may change across releases.} \end{funcdesc} \begin{funcdesc}{divmod}{a, b} @@ -548,8 +567,9 @@ \begin{funcdesc}{isinstance}{object, classinfo} Return true if the \var{object} argument is an instance of the \var{classinfo} argument, or of a (direct or indirect) subclass - thereof. Also return true if \var{classinfo} is a type object and - \var{object} is an object of that type. If \var{object} is not a + thereof. Also return true if \var{classinfo} is a type object + (new-style class) and \var{object} is an object of that type or of a + (direct or indirect) subclass thereof. If \var{object} is not a class instance or an object of the given type, the function always returns false. If \var{classinfo} is neither a class object nor a type object, it may be a tuple of class or type objects, or may @@ -607,6 +627,11 @@ \warning{The contents of this dictionary should not be modified; changes may not affect the values of local variables used by the interpreter.} + + Free variables are returned by \var{locals} when it is called in + a function block. Modifications of free variables may not affect + the values used by the interpreter. Free variables are not + returned in class blocks. \end{funcdesc} \begin{funcdesc}{long}{\optional{x\optional{, radix}}} @@ -971,7 +996,7 @@ \begin{funcdesc}{reversed}{seq} Return a reverse iterator. \var{seq} must be an object which - supports the sequence protocol (the __len__() method and the + supports the sequence protocol (the \method{__len__()} method and the \method{__getitem__()} method with integer arguments starting at \code{0}). \versionadded{2.4} @@ -1141,7 +1166,7 @@ as detailed below. \end{funcdesc} -\begin{funcdesc}{type}{name, bases, dict} +\begin{funcdescni}{type}{name, bases, dict} Return a new type object. This is essentially a dynamic form of the \keyword{class} statement. The \var{name} string is the class name and becomes the \member{__name__} attribute; the \var{bases} tuple @@ -1158,7 +1183,7 @@ >>> X = type('X', (object,), dict(a=1)) \end{verbatim} \versionadded{2.2} -\end{funcdesc} +\end{funcdescni} \begin{funcdesc}{unichr}{i} Return the Unicode string of one character whose Unicode code is the Modified: python/branches/bcannon-objcap/Doc/lib/libfunctools.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libfunctools.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libfunctools.tex Fri May 25 22:13:08 2007 @@ -53,15 +53,16 @@ \begin{funcdesc}{update_wrapper} {wrapper, wrapped\optional{, assigned}\optional{, updated}} -Update a wrapper function to look like the wrapped function. The optional -arguments are tuples to specify which attributes of the original +Update a \var{wrapper} function to look like the \var{wrapped} function. +The optional arguments are tuples to specify which attributes of the original function are assigned directly to the matching attributes on the wrapper function and which attributes of the wrapper function are updated with the corresponding attributes from the original function. The default values for these arguments are the module level constants -\var{WRAPPER_ASSIGNMENTS} (which assigns to the wrapper function's name, -module and documentation string) and \var{WRAPPER_UPDATES} (which -updates the wrapper function's instance dictionary). +\var{WRAPPER_ASSIGNMENTS} (which assigns to the wrapper function's +\var{__name__}, \var{__module__} and \var{__doc__}, the documentation string) +and \var{WRAPPER_UPDATES} (which updates the wrapper function's \var{__dict__}, +i.e. the instance dictionary). The main intended use for this function is in decorator functions which wrap the decorated function and return the wrapper. If the @@ -85,6 +86,7 @@ ... >>> @my_decorator ... def example(): + ... """Docstring""" ... print 'Called example function' ... >>> example() @@ -92,9 +94,12 @@ Called example function >>> example.__name__ 'example' + >>> example.__doc__ + 'Docstring' \end{verbatim} Without the use of this decorator factory, the name of the example -function would have been \code{'wrapper'}. +function would have been \code{'wrapper'}, and the docstring of the +original \function{example()} would have been lost. \end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libgettext.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libgettext.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libgettext.tex Fri May 25 22:13:08 2007 @@ -102,9 +102,9 @@ return \var{plural} otherwise. The Plural formula is taken from the catalog header. It is a C or -Python expression that has a free variable n; the expression evaluates +Python expression that has a free variable \var{n}; the expression evaluates to the index of the plural in the catalog. See the GNU gettext -documentation for the precise syntax to be used in .po files, and the +documentation for the precise syntax to be used in \file{.po} files and the formulas for a variety of languages. \versionadded{2.3} Deleted: /python/branches/bcannon-objcap/Doc/lib/libgopherlib.tex ============================================================================== --- /python/branches/bcannon-objcap/Doc/lib/libgopherlib.tex Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,36 +0,0 @@ -\section{\module{gopherlib} --- - Gopher protocol client} - -\declaremodule{standard}{gopherlib} -\modulesynopsis{Gopher protocol client (requires sockets).} - -\deprecated{2.5}{The \code{gopher} protocol is not in active use - anymore.} - -\indexii{Gopher}{protocol} - -This module provides a minimal implementation of client side of the -Gopher protocol. It is used by the module \refmodule{urllib} to -handle URLs that use the Gopher protocol. - -The module defines the following functions: - -\begin{funcdesc}{send_selector}{selector, host\optional{, port}} -Send a \var{selector} string to the gopher server at \var{host} and -\var{port} (default \code{70}). Returns an open file object from -which the returned document can be read. -\end{funcdesc} - -\begin{funcdesc}{send_query}{selector, query, host\optional{, port}} -Send a \var{selector} string and a \var{query} string to a gopher -server at \var{host} and \var{port} (default \code{70}). Returns an -open file object from which the returned document can be read. -\end{funcdesc} - -Note that the data returned by the Gopher server can be of any type, -depending on the first character of the selector string. If the data -is text (first character of the selector is \samp{0}), lines are -terminated by CRLF, and the data is terminated by a line consisting of -a single \samp{.}, and a leading \samp{.} should be stripped from -lines that begin with \samp{..}. Directory listings (first character -of the selector is \samp{1}) are transferred using the same protocol. Modified: python/branches/bcannon-objcap/Doc/lib/libheapq.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libheapq.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libheapq.tex Fri May 25 22:13:08 2007 @@ -88,7 +88,18 @@ >>> \end{verbatim} -The module also offers two general purpose functions based on heaps. +The module also offers three general purpose functions based on heaps. + +\begin{funcdesc}{merge}{*iterables} +Merge multiple sorted inputs into a single sorted output (for example, merge +timestamped entries from multiple log files). Returns an iterator over +over the sorted values. + +Similar to \code{sorted(itertools.chain(*iterables))} but returns an iterable, +does not pull the data into memory all at once, and assumes that each of the +input streams is already sorted (smallest to largest). +\versionadded{2.6} +\end{funcdesc} \begin{funcdesc}{nlargest}{n, iterable\optional{, key}} Return a list with the \var{n} largest elements from the dataset defined @@ -110,7 +121,7 @@ \versionchanged[Added the optional \var{key} argument]{2.5} \end{funcdesc} -Both functions perform best for smaller values of \var{n}. For larger +The latter two functions perform best for smaller values of \var{n}. For larger values, it is more efficient to use the \function{sorted()} function. Also, when \code{n==1}, it is more efficient to use the builtin \function{min()} and \function{max()} functions. Modified: python/branches/bcannon-objcap/Doc/lib/libhmac.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libhmac.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libhmac.tex Fri May 25 22:13:08 2007 @@ -15,7 +15,7 @@ Return a new hmac object. If \var{msg} is present, the method call \code{update(\var{msg})} is made. \var{digestmod} is the digest constructor or module for the HMAC object to use. It defaults to - the \code{\refmodule{hashlib}.md5} constructor. \note{The md5 hash + the \function{\refmodule{hashlib}.md5} constructor. \note{The md5 hash has known weaknesses but remains the default for backwards compatibility. Choose a better one for your application.} \end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libhotshot.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libhotshot.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libhotshot.tex Fri May 25 22:13:08 2007 @@ -48,25 +48,25 @@ Profile objects have the following methods: -\begin{methoddesc}{addinfo}{key, value} +\begin{methoddesc}[Profile]{addinfo}{key, value} Add an arbitrary labelled value to the profile output. \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[Profile]{close}{} Close the logfile and terminate the profiler. \end{methoddesc} -\begin{methoddesc}{fileno}{} +\begin{methoddesc}[Profile]{fileno}{} Return the file descriptor of the profiler's log file. \end{methoddesc} -\begin{methoddesc}{run}{cmd} +\begin{methoddesc}[Profile]{run}{cmd} Profile an \keyword{exec}-compatible string in the script environment. The globals from the \refmodule[main]{__main__} module are used as both the globals and locals for the script. \end{methoddesc} -\begin{methoddesc}{runcall}{func, *args, **keywords} +\begin{methoddesc}[Profile]{runcall}{func, *args, **keywords} Profile a single call of a callable. Additional positional and keyword arguments may be passed along; the result of the call is returned, and exceptions are @@ -75,16 +75,16 @@ \end{methoddesc} -\begin{methoddesc}{runctx}{cmd, globals, locals} +\begin{methoddesc}[Profile]{runctx}{cmd, globals, locals} Evaluate an \keyword{exec}-compatible string in a specific environment. The string is compiled before profiling begins. \end{methoddesc} -\begin{methoddesc}{start}{} +\begin{methoddesc}[Profile]{start}{} Start the profiler. \end{methoddesc} -\begin{methoddesc}{stop}{} +\begin{methoddesc}[Profile]{stop}{} Stop the profiler. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libhtmllib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libhtmllib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libhtmllib.tex Fri May 25 22:13:08 2007 @@ -96,11 +96,11 @@ In addition to tag methods, the \class{HTMLParser} class provides some additional methods and instance variables for use within tag methods. -\begin{memberdesc}{formatter} +\begin{memberdesc}[HTMLParser]{formatter} This is the formatter instance associated with the parser. \end{memberdesc} -\begin{memberdesc}{nofill} +\begin{memberdesc}[HTMLParser]{nofill} Boolean flag which should be true when whitespace should not be collapsed, or false when it should be. In general, this should only be true when character data is to be treated as ``preformatted'' text, @@ -109,7 +109,7 @@ \end{memberdesc} -\begin{methoddesc}{anchor_bgn}{href, name, type} +\begin{methoddesc}[HTMLParser]{anchor_bgn}{href, name, type} This method is called at the start of an anchor region. The arguments correspond to the attributes of the \code{} tag with the same names. The default implementation maintains a list of hyperlinks @@ -118,27 +118,27 @@ \member{anchorlist}. \end{methoddesc} -\begin{methoddesc}{anchor_end}{} +\begin{methoddesc}[HTMLParser]{anchor_end}{} This method is called at the end of an anchor region. The default implementation adds a textual footnote marker using an index into the list of hyperlinks created by \method{anchor_bgn()}. \end{methoddesc} -\begin{methoddesc}{handle_image}{source, alt\optional{, ismap\optional{, +\begin{methoddesc}[HTMLParser]{handle_image}{source, alt\optional{, ismap\optional{, align\optional{, width\optional{, height}}}}} This method is called to handle images. The default implementation simply passes the \var{alt} value to the \method{handle_data()} method. \end{methoddesc} -\begin{methoddesc}{save_bgn}{} +\begin{methoddesc}[HTMLParser]{save_bgn}{} Begins saving character data in a buffer instead of sending it to the formatter object. Retrieve the stored data via \method{save_end()}. Use of the \method{save_bgn()} / \method{save_end()} pair may not be nested. \end{methoddesc} -\begin{methoddesc}{save_end}{} +\begin{methoddesc}[HTMLParser]{save_end}{} Ends buffering character data and returns all data saved since the preceding call to \method{save_bgn()}. If the \member{nofill} flag is false, whitespace is collapsed to single spaces. A call to this Modified: python/branches/bcannon-objcap/Doc/lib/libhtmlparser.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libhtmlparser.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libhtmlparser.tex Fri May 25 22:13:08 2007 @@ -75,14 +75,18 @@ be overridden by a derived class; the base class implementation does nothing. -The \var{tag} argument is the name of the tag converted to -lower case. The \var{attrs} argument is a list of \code{(\var{name}, -\var{value})} pairs containing the attributes found inside the tag's -\code{<>} brackets. The \var{name} will be translated to lower case -and double quotes and backslashes in the \var{value} have been -interpreted. For instance, for the tag \code{}, this method would be called as +The \var{tag} argument is the name of the tag converted to lower case. +The \var{attrs} argument is a list of \code{(\var{name}, \var{value})} +pairs containing the attributes found inside the tag's \code{<>} +brackets. The \var{name} will be translated to lower case, and quotes +in the \var{value} have been removed, and character and entity +references have been replaced. For instance, for the tag \code{}, this method would be called as \samp{handle_starttag('a', [('href', 'http://www.cwi.nl/')])}. + +\versionchanged[All entity references from htmlentitydefs are now +replaced in the attribute values]{2.6} + \end{methoddesc} \begin{methoddesc}{handle_startendtag}{tag, attrs} Modified: python/branches/bcannon-objcap/Doc/lib/libhttplib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libhttplib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libhttplib.tex Fri May 25 22:13:08 2007 @@ -26,23 +26,34 @@ The module provides the following classes: -\begin{classdesc}{HTTPConnection}{host\optional{, port}} +\begin{classdesc}{HTTPConnection}{host\optional{, port\optional{, + strict\optional{, timeout}}}} An \class{HTTPConnection} instance represents one transaction with an HTTP server. It should be instantiated passing it a host and optional port number. If no port number is passed, the port is extracted from the host string if it has the form \code{\var{host}:\var{port}}, else the default HTTP port (80) is -used. For example, the following calls all create instances that connect to +used. When True, the optional parameter \var{strict} +causes \code{BadStatusLine} to be raised if the status line can't be parsed +as a valid HTTP/1.0 or 1.1 status line. If the optional \var{timeout} +parameter is given, connection attempts will timeout after that many +seconds (if it is not given or \code{None}, the global default +timeout setting is used). + +For example, the following calls all create instances that connect to the server at the same host and port: \begin{verbatim} >>> h1 = httplib.HTTPConnection('www.cwi.nl') >>> h2 = httplib.HTTPConnection('www.cwi.nl:80') >>> h3 = httplib.HTTPConnection('www.cwi.nl', 80) +>>> h3 = httplib.HTTPConnection('www.cwi.nl', 80, timeout=10) \end{verbatim} \versionadded{2.0} \end{classdesc} -\begin{classdesc}{HTTPSConnection}{host\optional{, port, key_file, cert_file}} +\begin{classdesc}{HTTPSConnection}{host\optional{, port\optional{, + key_file\optional{, cert_file\optional{, + strict\optional{, timeout}}}}}} A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. \var{key_file} is @@ -300,7 +311,7 @@ \class{HTTPConnection} instances have the following methods: -\begin{methoddesc}{request}{method, url\optional{, body\optional{, headers}}} +\begin{methoddesc}[HTTPConnection]{request}{method, url\optional{, body\optional{, headers}}} This will send a request to the server using the HTTP request method \var{method} and the selector \var{url}. If the \var{body} argument is present, it should be a string of data to send after the headers are finished. @@ -314,24 +325,24 @@ \versionchanged[\var{body} can be a file object]{2.6} \end{methoddesc} -\begin{methoddesc}{getresponse}{} +\begin{methoddesc}[HTTPConnection]{getresponse}{} Should be called after a request is sent to get the response from the server. Returns an \class{HTTPResponse} instance. \note{Note that you must have read the whole response before you can send a new request to the server.} \end{methoddesc} -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[HTTPConnection]{set_debuglevel}{level} Set the debugging level (the amount of debugging output printed). The default debug level is \code{0}, meaning no debugging output is printed. \end{methoddesc} -\begin{methoddesc}{connect}{} +\begin{methoddesc}[HTTPConnection]{connect}{} Connect to the server specified when the object was created. \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[HTTPConnection]{close}{} Close the connection to the server. \end{methoddesc} @@ -339,7 +350,7 @@ you can also send your request step by step, by using the four functions below. -\begin{methoddesc}{putrequest}{request, selector\optional{, +\begin{methoddesc}[HTTPConnection]{putrequest}{request, selector\optional{, skip\_host\optional{, skip_accept_encoding}}} This should be the first call after the connection to the server has been made. It sends a line to the server consisting of the @@ -351,18 +362,18 @@ \versionchanged[\var{skip_accept_encoding} argument added]{2.4} \end{methoddesc} -\begin{methoddesc}{putheader}{header, argument\optional{, ...}} +\begin{methoddesc}[HTTPConnection]{putheader}{header, argument\optional{, ...}} Send an \rfc{822}-style header to the server. It sends a line to the server consisting of the header, a colon and a space, and the first argument. If more arguments are given, continuation lines are sent, each consisting of a tab and an argument. \end{methoddesc} -\begin{methoddesc}{endheaders}{} +\begin{methoddesc}[HTTPConnection]{endheaders}{} Send a blank line to the server, signalling the end of the headers. \end{methoddesc} -\begin{methoddesc}{send}{data} +\begin{methoddesc}[HTTPConnection]{send}{data} Send data to the server. This should be used directly only after the \method{endheaders()} method has been called and before \method{getresponse()} is called. @@ -372,34 +383,34 @@ \class{HTTPResponse} instances have the following methods and attributes: -\begin{methoddesc}{read}{\optional{amt}} +\begin{methoddesc}[HTTPResponse]{read}{\optional{amt}} Reads and returns the response body, or up to the next \var{amt} bytes. \end{methoddesc} -\begin{methoddesc}{getheader}{name\optional{, default}} +\begin{methoddesc}[HTTPResponse]{getheader}{name\optional{, default}} Get the contents of the header \var{name}, or \var{default} if there is no matching header. \end{methoddesc} -\begin{methoddesc}{getheaders}{} +\begin{methoddesc}[HTTPResponse]{getheaders}{} Return a list of (header, value) tuples. \versionadded{2.4} \end{methoddesc} -\begin{datadesc}{msg} +\begin{memberdesc}[HTTPResponse]{msg} A \class{mimetools.Message} instance containing the response headers. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{version} +\begin{memberdesc}[HTTPResponse]{version} HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{status} +\begin{memberdesc}[HTTPResponse]{status} Status code returned by server. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{reason} +\begin{memberdesc}[HTTPResponse]{reason} Reason phrase returned by server. -\end{datadesc} +\end{memberdesc} \subsection{Examples \label{httplib-examples}} Modified: python/branches/bcannon-objcap/Doc/lib/libimaplib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libimaplib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libimaplib.tex Fri May 25 22:13:08 2007 @@ -153,11 +153,11 @@ An \class{IMAP4} instance has the following methods: -\begin{methoddesc}{append}{mailbox, flags, date_time, message} +\begin{methoddesc}[IMAP4]{append}{mailbox, flags, date_time, message} Append \var{message} to named mailbox. \end{methoddesc} -\begin{methoddesc}{authenticate}{mechanism, authobject} +\begin{methoddesc}[IMAP4]{authenticate}{mechanism, authobject} Authenticate command --- requires response processing. \var{mechanism} specifies which authentication mechanism is to be @@ -176,115 +176,115 @@ be sent instead. \end{methoddesc} -\begin{methoddesc}{check}{} +\begin{methoddesc}[IMAP4]{check}{} Checkpoint mailbox on server. \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[IMAP4]{close}{} Close currently selected mailbox. Deleted messages are removed from writable mailbox. This is the recommended command before \samp{LOGOUT}. \end{methoddesc} -\begin{methoddesc}{copy}{message_set, new_mailbox} +\begin{methoddesc}[IMAP4]{copy}{message_set, new_mailbox} Copy \var{message_set} messages onto end of \var{new_mailbox}. \end{methoddesc} -\begin{methoddesc}{create}{mailbox} +\begin{methoddesc}[IMAP4]{create}{mailbox} Create new mailbox named \var{mailbox}. \end{methoddesc} -\begin{methoddesc}{delete}{mailbox} +\begin{methoddesc}[IMAP4]{delete}{mailbox} Delete old mailbox named \var{mailbox}. \end{methoddesc} -\begin{methoddesc}{deleteacl}{mailbox, who} +\begin{methoddesc}[IMAP4]{deleteacl}{mailbox, who} Delete the ACLs (remove any rights) set for who on mailbox. \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{expunge}{} +\begin{methoddesc}[IMAP4]{expunge}{} Permanently remove deleted items from selected mailbox. Generates an \samp{EXPUNGE} response for each deleted message. Returned data contains a list of \samp{EXPUNGE} message numbers in order received. \end{methoddesc} -\begin{methoddesc}{fetch}{message_set, message_parts} +\begin{methoddesc}[IMAP4]{fetch}{message_set, message_parts} Fetch (parts of) messages. \var{message_parts} should be a string of message part names enclosed within parentheses, eg: \samp{"(UID BODY[TEXT])"}. Returned data are tuples of message part envelope and data. \end{methoddesc} -\begin{methoddesc}{getacl}{mailbox} +\begin{methoddesc}[IMAP4]{getacl}{mailbox} Get the \samp{ACL}s for \var{mailbox}. The method is non-standard, but is supported by the \samp{Cyrus} server. \end{methoddesc} -\begin{methoddesc}{getannotation}{mailbox, entry, attribute} +\begin{methoddesc}[IMAP4]{getannotation}{mailbox, entry, attribute} Retrieve the specified \samp{ANNOTATION}s for \var{mailbox}. The method is non-standard, but is supported by the \samp{Cyrus} server. \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}{getquota}{root} +\begin{methoddesc}[IMAP4]{getquota}{root} Get the \samp{quota} \var{root}'s resource usage and limits. This method is part of the IMAP4 QUOTA extension defined in rfc2087. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{getquotaroot}{mailbox} +\begin{methoddesc}[IMAP4]{getquotaroot}{mailbox} Get the list of \samp{quota} \samp{roots} for the named \var{mailbox}. This method is part of the IMAP4 QUOTA extension defined in rfc2087. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{list}{\optional{directory\optional{, pattern}}} +\begin{methoddesc}[IMAP4]{list}{\optional{directory\optional{, pattern}}} List mailbox names in \var{directory} matching \var{pattern}. \var{directory} defaults to the top-level mail folder, and \var{pattern} defaults to match anything. Returned data contains a list of \samp{LIST} responses. \end{methoddesc} -\begin{methoddesc}{login}{user, password} +\begin{methoddesc}[IMAP4]{login}{user, password} Identify the client using a plaintext password. The \var{password} will be quoted. \end{methoddesc} -\begin{methoddesc}{login_cram_md5}{user, password} +\begin{methoddesc}[IMAP4]{login_cram_md5}{user, password} Force use of \samp{CRAM-MD5} authentication when identifying the client to protect the password. Will only work if the server \samp{CAPABILITY} response includes the phrase \samp{AUTH=CRAM-MD5}. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{logout}{} +\begin{methoddesc}[IMAP4]{logout}{} Shutdown connection to server. Returns server \samp{BYE} response. \end{methoddesc} -\begin{methoddesc}{lsub}{\optional{directory\optional{, pattern}}} +\begin{methoddesc}[IMAP4]{lsub}{\optional{directory\optional{, pattern}}} List subscribed mailbox names in directory matching pattern. \var{directory} defaults to the top level directory and \var{pattern} defaults to match any mailbox. Returned data are tuples of message part envelope and data. \end{methoddesc} -\begin{methoddesc}{myrights}{mailbox} +\begin{methoddesc}[IMAP4]{myrights}{mailbox} Show my ACLs for a mailbox (i.e. the rights that I have on mailbox). \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{namespace}{} +\begin{methoddesc}[IMAP4]{namespace}{} Returns IMAP namespaces as defined in RFC2342. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{noop}{} +\begin{methoddesc}[IMAP4]{noop}{} Send \samp{NOOP} to server. \end{methoddesc} -\begin{methoddesc}{open}{host, port} +\begin{methoddesc}[IMAP4]{open}{host, port} Opens socket to \var{port} at \var{host}. The connection objects established by this method will be used in the \code{read}, \code{readline}, \code{send}, and @@ -292,42 +292,42 @@ You may override this method. \end{methoddesc} -\begin{methoddesc}{partial}{message_num, message_part, start, length} +\begin{methoddesc}[IMAP4]{partial}{message_num, message_part, start, length} Fetch truncated part of a message. Returned data is a tuple of message part envelope and data. \end{methoddesc} -\begin{methoddesc}{proxyauth}{user} +\begin{methoddesc}[IMAP4]{proxyauth}{user} Assume authentication as \var{user}. Allows an authorised administrator to proxy into any user's mailbox. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{read}{size} +\begin{methoddesc}[IMAP4]{read}{size} Reads \var{size} bytes from the remote server. You may override this method. \end{methoddesc} -\begin{methoddesc}{readline}{} +\begin{methoddesc}[IMAP4]{readline}{} Reads one line from the remote server. You may override this method. \end{methoddesc} -\begin{methoddesc}{recent}{} +\begin{methoddesc}[IMAP4]{recent}{} Prompt server for an update. Returned data is \code{None} if no new messages, else value of \samp{RECENT} response. \end{methoddesc} -\begin{methoddesc}{rename}{oldmailbox, newmailbox} +\begin{methoddesc}[IMAP4]{rename}{oldmailbox, newmailbox} Rename mailbox named \var{oldmailbox} to \var{newmailbox}. \end{methoddesc} -\begin{methoddesc}{response}{code} +\begin{methoddesc}[IMAP4]{response}{code} Return data for response \var{code} if received, or \code{None}. Returns the given code, instead of the usual type. \end{methoddesc} -\begin{methoddesc}{search}{charset, criterion\optional{, ...}} +\begin{methoddesc}[IMAP4]{search}{charset, criterion\optional{, ...}} Search mailbox for matching messages. \var{charset} may be \code{None}, in which case no \samp{CHARSET} will be specified in the request to the server. The IMAP protocol requires that at least one @@ -345,45 +345,45 @@ \end{verbatim} \end{methoddesc} -\begin{methoddesc}{select}{\optional{mailbox\optional{, readonly}}} +\begin{methoddesc}[IMAP4]{select}{\optional{mailbox\optional{, readonly}}} Select a mailbox. Returned data is the count of messages in \var{mailbox} (\samp{EXISTS} response). The default \var{mailbox} is \code{'INBOX'}. If the \var{readonly} flag is set, modifications to the mailbox are not allowed. \end{methoddesc} -\begin{methoddesc}{send}{data} +\begin{methoddesc}[IMAP4]{send}{data} Sends \code{data} to the remote server. You may override this method. \end{methoddesc} -\begin{methoddesc}{setacl}{mailbox, who, what} +\begin{methoddesc}[IMAP4]{setacl}{mailbox, who, what} Set an \samp{ACL} for \var{mailbox}. The method is non-standard, but is supported by the \samp{Cyrus} server. \end{methoddesc} -\begin{methoddesc}{setannotation}{mailbox, entry, attribute\optional{, ...}} +\begin{methoddesc}[IMAP4]{setannotation}{mailbox, entry, attribute\optional{, ...}} Set \samp{ANNOTATION}s for \var{mailbox}. The method is non-standard, but is supported by the \samp{Cyrus} server. \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}{setquota}{root, limits} +\begin{methoddesc}[IMAP4]{setquota}{root, limits} Set the \samp{quota} \var{root}'s resource \var{limits}. This method is part of the IMAP4 QUOTA extension defined in rfc2087. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{shutdown}{} +\begin{methoddesc}[IMAP4]{shutdown}{} Close connection established in \code{open}. You may override this method. \end{methoddesc} -\begin{methoddesc}{socket}{} +\begin{methoddesc}[IMAP4]{socket}{} Returns socket instance used to connect to server. \end{methoddesc} -\begin{methoddesc}{sort}{sort_criteria, charset, search_criterion\optional{, ...}} +\begin{methoddesc}[IMAP4]{sort}{sort_criteria, charset, search_criterion\optional{, ...}} The \code{sort} command is a variant of \code{search} with sorting semantics for the results. Returned data contains a space separated list of matching message numbers. @@ -402,11 +402,11 @@ This is an \samp{IMAP4rev1} extension command. \end{methoddesc} -\begin{methoddesc}{status}{mailbox, names} +\begin{methoddesc}[IMAP4]{status}{mailbox, names} Request named status conditions for \var{mailbox}. \end{methoddesc} -\begin{methoddesc}{store}{message_set, command, flag_list} +\begin{methoddesc}[IMAP4]{store}{message_set, command, flag_list} Alters flag dispositions for messages in mailbox. \var{command} is specified by section 6.4.6 of \rfc{2060} as being one of "FLAGS", "+FLAGS", or "-FLAGS", optionally with a suffix of ".SILENT". @@ -421,11 +421,11 @@ \end{verbatim} \end{methoddesc} -\begin{methoddesc}{subscribe}{mailbox} +\begin{methoddesc}[IMAP4]{subscribe}{mailbox} Subscribe to new mailbox. \end{methoddesc} -\begin{methoddesc}{thread}{threading_algorithm, charset, +\begin{methoddesc}[IMAP4]{thread}{threading_algorithm, charset, search_criterion\optional{, ...}} The \code{thread} command is a variant of \code{search} with threading semantics for the results. Returned data contains a space @@ -448,18 +448,18 @@ This is an \samp{IMAP4rev1} extension command. \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{uid}{command, arg\optional{, ...}} +\begin{methoddesc}[IMAP4]{uid}{command, arg\optional{, ...}} Execute command args with messages identified by UID, rather than message number. Returns response appropriate to command. At least one argument must be supplied; if none are provided, the server will return an error and an exception will be raised. \end{methoddesc} -\begin{methoddesc}{unsubscribe}{mailbox} +\begin{methoddesc}[IMAP4]{unsubscribe}{mailbox} Unsubscribe from old mailbox. \end{methoddesc} -\begin{methoddesc}{xatom}{name\optional{, arg\optional{, ...}}} +\begin{methoddesc}[IMAP4]{xatom}{name\optional{, arg\optional{, ...}}} Allow simple extension commands notified by server in \samp{CAPABILITY} response. \end{methoddesc} @@ -467,7 +467,7 @@ Instances of \class{IMAP4_SSL} have just one additional method: -\begin{methoddesc}{ssl}{} +\begin{methoddesc}[IMAP4_SSL]{ssl}{} Returns SSLObject instance used for the secure connection with the server. \end{methoddesc} @@ -475,12 +475,12 @@ The following attributes are defined on instances of \class{IMAP4}: -\begin{memberdesc}{PROTOCOL_VERSION} +\begin{memberdesc}[IMAP4]{PROTOCOL_VERSION} The most recent supported protocol in the \samp{CAPABILITY} response from the server. \end{memberdesc} -\begin{memberdesc}{debug} +\begin{memberdesc}[IMAP4]{debug} Integer value to control debugging output. The initialize value is taken from the module variable \code{Debug}. Values greater than three trace each command. Modified: python/branches/bcannon-objcap/Doc/lib/libitertools.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libitertools.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libitertools.tex Fri May 25 22:13:08 2007 @@ -302,6 +302,33 @@ don't care about trailing, unmatched values from the longer iterables. \end{funcdesc} +\begin{funcdesc}{izip_longest}{*iterables\optional{, fillvalue}} + Make an iterator that aggregates elements from each of the iterables. + If the iterables are of uneven length, missing values are filled-in + with \var{fillvalue}. Iteration continues until the longest iterable + is exhausted. Equivalent to: + + \begin{verbatim} + def izip_longest(*args, **kwds): + fillvalue = kwds.get('fillvalue') + def sentinel(counter = ([fillvalue]*(len(args)-1)).pop): + yield counter() # yields the fillvalue, or raises IndexError + fillers = repeat(fillvalue) + iters = [chain(it, sentinel(), fillers) for it in args] + try: + for tup in izip(*iters): + yield tup + except IndexError: + pass + \end{verbatim} + + If one of the iterables is potentially infinite, then the + \function{izip_longest()} function should be wrapped with something + that limits the number of calls (for example \function{islice()} or + \function{take()}). + \versionadded{2.6} +\end{funcdesc} + \begin{funcdesc}{repeat}{object\optional{, times}} Make an iterator that returns \var{object} over and over again. Runs indefinitely unless the \var{times} argument is specified. Modified: python/branches/bcannon-objcap/Doc/lib/liblocale.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/liblocale.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/liblocale.tex Fri May 25 22:13:08 2007 @@ -481,7 +481,7 @@ locale settings. When a call to the \function{setlocale()} function changes the \constant{LC_CTYPE} settings, the variables \code{string.lowercase}, \code{string.uppercase} and -\code{string.letters} are recalculated. Note that this code that uses +\code{string.letters} are recalculated. Note that code that uses these variable through `\keyword{from} ... \keyword{import} ...', e.g.\ \code{from string import letters}, is not affected by subsequent \function{setlocale()} calls. Modified: python/branches/bcannon-objcap/Doc/lib/liblogging.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/liblogging.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/liblogging.tex Fri May 25 22:13:08 2007 @@ -203,7 +203,7 @@ \begin{verbatim} FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s" logging.basicConfig(format=FORMAT) - dict = { 'clientip' : '192.168.0.1', 'user' : 'fbloggs' } + d = {'clientip': '192.168.0.1', 'user': 'fbloggs'} logging.warning("Protocol problem: %s", "connection reset", extra=d) \end{verbatim} @@ -364,13 +364,13 @@ never instantiated directly, but always through the module-level function \function{logging.getLogger(name)}. -\begin{datadesc}{propagate} +\begin{memberdesc}[Logger]{propagate} If this evaluates to false, logging messages are not passed by this logger or by child loggers to higher level (ancestor) loggers. The constructor sets this attribute to 1. -\end{datadesc} +\end{memberdesc} -\begin{methoddesc}{setLevel}{lvl} +\begin{methoddesc}[Logger]{setLevel}{lvl} Sets the threshold for this logger to \var{lvl}. Logging messages which are less severe than \var{lvl} will be ignored. When a logger is created, the level is set to \constant{NOTSET} (which causes all messages @@ -393,21 +393,21 @@ as the effective level. \end{methoddesc} -\begin{methoddesc}{isEnabledFor}{lvl} +\begin{methoddesc}[Logger]{isEnabledFor}{lvl} Indicates if a message of severity \var{lvl} would be processed by this logger. This method checks first the module-level level set by \function{logging.disable(lvl)} and then the logger's effective level as determined by \method{getEffectiveLevel()}. \end{methoddesc} -\begin{methoddesc}{getEffectiveLevel}{} +\begin{methoddesc}[Logger]{getEffectiveLevel}{} Indicates the effective level for this logger. If a value other than \constant{NOTSET} has been set using \method{setLevel()}, it is returned. Otherwise, the hierarchy is traversed towards the root until a value other than \constant{NOTSET} is found, and that value is returned. \end{methoddesc} -\begin{methoddesc}{debug}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{debug}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{DEBUG} on this logger. The \var{msg} is the message format string, and the \var{args} are the arguments which are merged into \var{msg} using the string formatting @@ -462,67 +462,67 @@ \end{methoddesc} -\begin{methoddesc}{info}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{info}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{INFO} on this logger. The arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{warning}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{warning}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{WARNING} on this logger. The arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{error}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{error}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{ERROR} on this logger. The arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{critical}{msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{critical}{msg\optional{, *args\optional{, **kwargs}}} Logs a message with level \constant{CRITICAL} on this logger. The arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{log}{lvl, msg\optional{, *args\optional{, **kwargs}}} +\begin{methoddesc}[Logger]{log}{lvl, msg\optional{, *args\optional{, **kwargs}}} Logs a message with integer level \var{lvl} on this logger. The other arguments are interpreted as for \method{debug()}. \end{methoddesc} -\begin{methoddesc}{exception}{msg\optional{, *args}} +\begin{methoddesc}[Logger]{exception}{msg\optional{, *args}} Logs a message with level \constant{ERROR} on this logger. The arguments are interpreted as for \method{debug()}. Exception info is added to the logging message. This method should only be called from an exception handler. \end{methoddesc} -\begin{methoddesc}{addFilter}{filt} +\begin{methoddesc}[Logger]{addFilter}{filt} Adds the specified filter \var{filt} to this logger. \end{methoddesc} -\begin{methoddesc}{removeFilter}{filt} +\begin{methoddesc}[Logger]{removeFilter}{filt} Removes the specified filter \var{filt} from this logger. \end{methoddesc} -\begin{methoddesc}{filter}{record} +\begin{methoddesc}[Logger]{filter}{record} Applies this logger's filters to the record and returns a true value if the record is to be processed. \end{methoddesc} -\begin{methoddesc}{addHandler}{hdlr} +\begin{methoddesc}[Logger]{addHandler}{hdlr} Adds the specified handler \var{hdlr} to this logger. \end{methoddesc} -\begin{methoddesc}{removeHandler}{hdlr} +\begin{methoddesc}[Logger]{removeHandler}{hdlr} Removes the specified handler \var{hdlr} from this logger. \end{methoddesc} -\begin{methoddesc}{findCaller}{} +\begin{methoddesc}[Logger]{findCaller}{} Finds the caller's source filename and line number. Returns the filename, line number and function name as a 3-element tuple. \versionchanged[The function name was added. In earlier versions, the filename and line number were returned as a 2-element tuple.]{2.5} \end{methoddesc} -\begin{methoddesc}{handle}{record} +\begin{methoddesc}[Logger]{handle}{record} Handles a record by passing it to all handlers associated with this logger and its ancestors (until a false value of \var{propagate} is found). This method is used for unpickled records received from a socket, as well @@ -530,8 +530,8 @@ \method{filter()}. \end{methoddesc} -\begin{methoddesc}{makeRecord}{name, lvl, fn, lno, msg, args, exc_info - \optional{, func, extra}} +\begin{methoddesc}[Logger]{makeRecord}{name, lvl, fn, lno, msg, args, exc_info + \optional{, func, extra}} This is a factory method which can be overridden in subclasses to create specialized \class{LogRecord} instances. \versionchanged[\var{func} and \var{extra} were added]{2.5} @@ -875,66 +875,66 @@ base for more useful subclasses. However, the \method{__init__()} method in subclasses needs to call \method{Handler.__init__()}. -\begin{methoddesc}{__init__}{level=\constant{NOTSET}} +\begin{methoddesc}[Handler]{__init__}{level=\constant{NOTSET}} Initializes the \class{Handler} instance by setting its level, setting the list of filters to the empty list and creating a lock (using \method{createLock()}) for serializing access to an I/O mechanism. \end{methoddesc} -\begin{methoddesc}{createLock}{} +\begin{methoddesc}[Handler]{createLock}{} Initializes a thread lock which can be used to serialize access to underlying I/O functionality which may not be threadsafe. \end{methoddesc} -\begin{methoddesc}{acquire}{} +\begin{methoddesc}[Handler]{acquire}{} Acquires the thread lock created with \method{createLock()}. \end{methoddesc} -\begin{methoddesc}{release}{} +\begin{methoddesc}[Handler]{release}{} Releases the thread lock acquired with \method{acquire()}. \end{methoddesc} -\begin{methoddesc}{setLevel}{lvl} +\begin{methoddesc}[Handler]{setLevel}{lvl} Sets the threshold for this handler to \var{lvl}. Logging messages which are less severe than \var{lvl} will be ignored. When a handler is created, the level is set to \constant{NOTSET} (which causes all messages to be processed). \end{methoddesc} -\begin{methoddesc}{setFormatter}{form} +\begin{methoddesc}[Handler]{setFormatter}{form} Sets the \class{Formatter} for this handler to \var{form}. \end{methoddesc} -\begin{methoddesc}{addFilter}{filt} +\begin{methoddesc}[Handler]{addFilter}{filt} Adds the specified filter \var{filt} to this handler. \end{methoddesc} -\begin{methoddesc}{removeFilter}{filt} +\begin{methoddesc}[Handler]{removeFilter}{filt} Removes the specified filter \var{filt} from this handler. \end{methoddesc} -\begin{methoddesc}{filter}{record} +\begin{methoddesc}[Handler]{filter}{record} Applies this handler's filters to the record and returns a true value if the record is to be processed. \end{methoddesc} -\begin{methoddesc}{flush}{} +\begin{methoddesc}[Handler]{flush}{} Ensure all logging output has been flushed. This version does nothing and is intended to be implemented by subclasses. \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[Handler]{close}{} Tidy up any resources used by the handler. This version does nothing and is intended to be implemented by subclasses. \end{methoddesc} -\begin{methoddesc}{handle}{record} +\begin{methoddesc}[Handler]{handle}{record} Conditionally emits the specified logging record, depending on filters which may have been added to the handler. Wraps the actual emission of the record with acquisition/release of the I/O thread lock. \end{methoddesc} -\begin{methoddesc}{handleError}{record} +\begin{methoddesc}[Handler]{handleError}{record} This method should be called from handlers when an exception is encountered during an \method{emit()} call. By default it does nothing, which means that exceptions get silently ignored. This is what is @@ -945,12 +945,12 @@ processed when the exception occurred. \end{methoddesc} -\begin{methoddesc}{format}{record} +\begin{methoddesc}[Handler]{format}{record} Do formatting for a record - if a formatter is set, use it. Otherwise, use the default formatter for the module. \end{methoddesc} -\begin{methoddesc}{emit}{record} +\begin{methoddesc}[Handler]{emit}{record} Do whatever it takes to actually log the specified logging record. This version is intended to be implemented by subclasses and so raises a \exception{NotImplementedError}. @@ -1138,9 +1138,6 @@ Closes the socket. \end{methoddesc} -\begin{methoddesc}{handleError}{} -\end{methoddesc} - \begin{methoddesc}{emit}{} Pickles the record's attribute dictionary and writes it to the socket in binary format. If there is an error with the socket, silently drops the @@ -1299,13 +1296,16 @@ \module{logging.handlers} module, supports sending logging messages to an email address via SMTP. -\begin{classdesc}{SMTPHandler}{mailhost, fromaddr, toaddrs, subject} +\begin{classdesc}{SMTPHandler}{mailhost, fromaddr, toaddrs, subject\optional{, + credentials}} Returns a new instance of the \class{SMTPHandler} class. The instance is initialized with the from and to addresses and subject line of the email. The \var{toaddrs} should be a list of strings. To specify a non-standard SMTP port, use the (host, port) tuple format for the \var{mailhost} argument. If you use a string, the standard SMTP port -is used. +is used. If your SMTP server requires authentication, you can specify a +(username, password) tuple for the \var{credentials} argument. +\versionchanged[\var{credentials} was added]{2.6} \end{classdesc} \begin{methoddesc}{emit}{record} @@ -1531,7 +1531,7 @@ \var{exc_info} is the exception tuple obtained by calling \function{sys.exc_info() }(or \constant{None}, if no exception information is available). The \var{func} is the name of the function from which the -logging call was made. If not specified, it defaults to \var{None}. +logging call was made. If not specified, it defaults to \code{None}. \versionchanged[\var{func} was added]{2.5} \end{classdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libmailbox.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libmailbox.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libmailbox.tex Fri May 25 22:13:08 2007 @@ -1203,7 +1203,6 @@ \end{tableii} \subsection{Exceptions} -\label{mailbox-deprecated} The following exception classes are defined in the \module{mailbox} module: @@ -1247,7 +1246,7 @@ Older mailbox objects support only iteration and provide a single public method: -\begin{methoddesc}{next}{} +\begin{methoddesc}[oldmailbox]{next}{} Return the next message in the mailbox, created with the optional \var{factory} argument passed into the mailbox object's constructor. By default this is an \class{rfc822.Message} object (see the \refmodule{rfc822} module). Depending @@ -1286,13 +1285,13 @@ separated by any line that begins exactly with the string \code{'From '} (note the trailing space) if preceded by exactly two newlines. Because of the wide-range of variations in practice, nothing else on -the From_ line should be considered. However, the current +the \samp{From_} line should be considered. However, the current implementation doesn't check for the leading two newlines. This is usually fine for most applications. The \class{UnixMailbox} class implements a more strict version of -From_ line checking, using a regular expression that usually correctly -matched From_ delimiters. It considers delimiter line to be separated +\samp{From_} line checking, using a regular expression that usually correctly +matched \samp{From_} delimiters. It considers delimiter line to be separated by \samp{From \var{name} \var{time}} lines. For maximum portability, use the \class{PortableUnixMailbox} class instead. This class is identical to \class{UnixMailbox} except that individual messages are Modified: python/branches/bcannon-objcap/Doc/lib/libmimetools.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libmimetools.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libmimetools.tex Fri May 25 22:13:08 2007 @@ -76,7 +76,7 @@ The \class{Message} class defines the following methods in addition to the \class{rfc822.Message} methods: -\begin{methoddesc}{getplist}{} +\begin{methoddesc}[Message]{getplist}{} Return the parameter list of the \mailheader{Content-Type} header. This is a list of strings. For parameters of the form \samp{\var{key}=\var{value}}, \var{key} is converted to lower case but @@ -86,34 +86,34 @@ 'spam=2', 'Spam']}. \end{methoddesc} -\begin{methoddesc}{getparam}{name} +\begin{methoddesc}[Message]{getparam}{name} Return the \var{value} of the first parameter (as returned by \method{getplist()}) of the form \samp{\var{name}=\var{value}} for the given \var{name}. If \var{value} is surrounded by quotes of the form `\code{<}...\code{>}' or `\code{"}...\code{"}', these are removed. \end{methoddesc} -\begin{methoddesc}{getencoding}{} +\begin{methoddesc}[Message]{getencoding}{} Return the encoding specified in the \mailheader{Content-Transfer-Encoding} message header. If no such header exists, return \code{'7bit'}. The encoding is converted to lower case. \end{methoddesc} -\begin{methoddesc}{gettype}{} +\begin{methoddesc}[Message]{gettype}{} Return the message type (of the form \samp{\var{type}/\var{subtype}}) as specified in the \mailheader{Content-Type} header. If no such header exists, return \code{'text/plain'}. The type is converted to lower case. \end{methoddesc} -\begin{methoddesc}{getmaintype}{} +\begin{methoddesc}[Message]{getmaintype}{} Return the main type as specified in the \mailheader{Content-Type} header. If no such header exists, return \code{'text'}. The main type is converted to lower case. \end{methoddesc} -\begin{methoddesc}{getsubtype}{} +\begin{methoddesc}[Message]{getsubtype}{} Return the subtype as specified in the \mailheader{Content-Type} header. If no such header exists, return \code{'plain'}. The subtype is converted to lower case. Modified: python/branches/bcannon-objcap/Doc/lib/libmimetypes.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libmimetypes.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libmimetypes.tex Fri May 25 22:13:08 2007 @@ -178,49 +178,49 @@ \class{MimeTypes} instances provide an interface which is very like that of the \refmodule{mimetypes} module. -\begin{datadesc}{suffix_map} +\begin{memberdesc}[MimeTypes]{suffix_map} Dictionary mapping suffixes to suffixes. This is used to allow recognition of encoded files for which the encoding and the type are indicated by the same extension. For example, the \file{.tgz} extension is mapped to \file{.tar.gz} to allow the encoding and type to be recognized separately. This is initially a copy of the global \code{suffix_map} defined in the module. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{encodings_map} +\begin{memberdesc}[MimeTypes]{encodings_map} Dictionary mapping filename extensions to encoding types. This is initially a copy of the global \code{encodings_map} defined in the module. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{types_map} +\begin{memberdesc}[MimeTypes]{types_map} Dictionary mapping filename extensions to MIME types. This is initially a copy of the global \code{types_map} defined in the module. -\end{datadesc} +\end{memberdesc} -\begin{datadesc}{common_types} +\begin{memberdesc}[MimeTypes]{common_types} Dictionary mapping filename extensions to non-standard, but commonly found MIME types. This is initially a copy of the global \code{common_types} defined in the module. -\end{datadesc} +\end{memberdesc} -\begin{methoddesc}{guess_extension}{type\optional{, strict}} +\begin{methoddesc}[MimeTypes]{guess_extension}{type\optional{, strict}} Similar to the \function{guess_extension()} function, using the tables stored as part of the object. \end{methoddesc} -\begin{methoddesc}{guess_type}{url\optional{, strict}} +\begin{methoddesc}[MimeTypes]{guess_type}{url\optional{, strict}} Similar to the \function{guess_type()} function, using the tables stored as part of the object. \end{methoddesc} -\begin{methoddesc}{read}{path} +\begin{methoddesc}[MimeTypes]{read}{path} Load MIME information from a file named \var{path}. This uses \method{readfp()} to parse the file. \end{methoddesc} -\begin{methoddesc}{readfp}{file} +\begin{methoddesc}[MimeTypes]{readfp}{file} Load MIME type information from an open file. The file must have the format of the standard \file{mime.types} files. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libmimewriter.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libmimewriter.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libmimewriter.tex Fri May 25 22:13:08 2007 @@ -31,7 +31,7 @@ \class{MimeWriter} instances have the following methods: -\begin{methoddesc}{addheader}{key, value\optional{, prefix}} +\begin{methoddesc}[MimeWriter]{addheader}{key, value\optional{, prefix}} Add a header line to the MIME message. The \var{key} is the name of the header, where the \var{value} obviously provides the value of the header. The optional argument \var{prefix} determines where the header @@ -39,14 +39,14 @@ the start. The default is to append. \end{methoddesc} -\begin{methoddesc}{flushheaders}{} +\begin{methoddesc}[MimeWriter]{flushheaders}{} Causes all headers accumulated so far to be written out (and forgotten). This is useful if you don't need a body part at all, e.g.\ for a subpart of type \mimetype{message/rfc822} that's (mis)used to store some header-like information. \end{methoddesc} -\begin{methoddesc}{startbody}{ctype\optional{, plist\optional{, prefix}}} +\begin{methoddesc}[MimeWriter]{startbody}{ctype\optional{, plist\optional{, prefix}}} Returns a file-like object which can be used to write to the body of the message. The content-type is set to the provided \var{ctype}, and the optional parameter \var{plist} provides @@ -55,8 +55,8 @@ insert at the start. \end{methoddesc} -\begin{methoddesc}{startmultipartbody}{subtype\optional{, - boundary\optional{, plist\optional{, prefix}}}} +\begin{methoddesc}[MimeWriter]{startmultipartbody}{subtype\optional{, + boundary\optional{, plist\optional{, prefix}}}} Returns a file-like object which can be used to write to the body of the message. Additionally, this method initializes the multi-part code, where \var{subtype} provides the multipart subtype, @@ -66,7 +66,7 @@ created using \method{nextpart()}. \end{methoddesc} -\begin{methoddesc}{nextpart}{} +\begin{methoddesc}[MimeWriter]{nextpart}{} Returns a new instance of \class{MimeWriter} which represents an individual part in a multipart message. This may be used to write the part as well as used for creating recursively complex multipart @@ -74,7 +74,7 @@ \method{startmultipartbody()} before using \method{nextpart()}. \end{methoddesc} -\begin{methoddesc}{lastpart}{} +\begin{methoddesc}[MimeWriter]{lastpart}{} This is used to designate the last part of a multipart message, and should \emph{always} be used when writing multipart messages. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libmmap.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libmmap.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libmmap.tex Fri May 25 22:13:08 2007 @@ -89,18 +89,18 @@ Memory-mapped file objects support the following methods: -\begin{methoddesc}{close}{} +\begin{methoddesc}[mmap]{close}{} Close the file. Subsequent calls to other methods of the object will result in an exception being raised. \end{methoddesc} -\begin{methoddesc}{find}{string\optional{, start}} +\begin{methoddesc}[mmap]{find}{string\optional{, start}} Returns the lowest index in the object where the substring \var{string} is found. Returns \code{-1} on failure. \var{start} is the index at which the search begins, and defaults to zero. \end{methoddesc} -\begin{methoddesc}{flush}{\optional{offset, size}} +\begin{methoddesc}[mmap]{flush}{\optional{offset, size}} Flushes changes made to the in-memory copy of a file back to disk. Without use of this call there is no guarantee that changes are written back before the object is destroyed. If \var{offset} and @@ -109,36 +109,36 @@ is flushed. \end{methoddesc} -\begin{methoddesc}{move}{\var{dest}, \var{src}, \var{count}} +\begin{methoddesc}[mmap]{move}{\var{dest}, \var{src}, \var{count}} Copy the \var{count} bytes starting at offset \var{src} to the destination index \var{dest}. If the mmap was created with \constant{ACCESS_READ}, then calls to move will throw a \exception{TypeError} exception. \end{methoddesc} -\begin{methoddesc}{read}{\var{num}} +\begin{methoddesc}[mmap]{read}{\var{num}} Return a string containing up to \var{num} bytes starting from the current file position; the file position is updated to point after the bytes that were returned. \end{methoddesc} -\begin{methoddesc}{read_byte}{} +\begin{methoddesc}[mmap]{read_byte}{} Returns a string of length 1 containing the character at the current file position, and advances the file position by 1. \end{methoddesc} -\begin{methoddesc}{readline}{} +\begin{methoddesc}[mmap]{readline}{} Returns a single line, starting at the current file position and up to the next newline. \end{methoddesc} -\begin{methoddesc}{resize}{\var{newsize}} +\begin{methoddesc}[mmap]{resize}{\var{newsize}} Resizes the map and the underlying file, if any. If the mmap was created with \constant{ACCESS_READ} or \constant{ACCESS_COPY}, resizing the map will throw a \exception{TypeError} exception. \end{methoddesc} -\begin{methoddesc}{seek}{pos\optional{, whence}} +\begin{methoddesc}[mmap]{seek}{pos\optional{, whence}} Set the file's current position. \var{whence} argument is optional and defaults to \code{os.SEEK_SET} or \code{0} (absolute file positioning); other values are \code{os.SEEK_CUR} or \code{1} (seek @@ -146,16 +146,16 @@ (seek relative to the file's end). \end{methoddesc} -\begin{methoddesc}{size}{} +\begin{methoddesc}[mmap]{size}{} Return the length of the file, which can be larger than the size of the memory-mapped area. \end{methoddesc} -\begin{methoddesc}{tell}{} +\begin{methoddesc}[mmap]{tell}{} Returns the current position of the file pointer. \end{methoddesc} -\begin{methoddesc}{write}{\var{string}} +\begin{methoddesc}[mmap]{write}{\var{string}} Write the bytes in \var{string} into memory at the current position of the file pointer; the file position is updated to point after the bytes that were written. If the mmap was created with @@ -163,7 +163,7 @@ \exception{TypeError} exception. \end{methoddesc} -\begin{methoddesc}{write_byte}{\var{byte}} +\begin{methoddesc}[mmap]{write_byte}{\var{byte}} Write the single-character string \var{byte} into memory at the current position of the file pointer; the file position is advanced by \code{1}. If the mmap was created with \constant{ACCESS_READ}, Modified: python/branches/bcannon-objcap/Doc/lib/libmsilib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libmsilib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libmsilib.tex Fri May 25 22:13:08 2007 @@ -121,17 +121,17 @@ \subsection{Database Objects\label{database-objects}} -\begin{methoddesc}{OpenView}{sql} +\begin{methoddesc}[Database]{OpenView}{sql} Return a view object, by calling \cfunction{MSIDatabaseOpenView}. \var{sql} is the SQL statement to execute. \end{methoddesc} -\begin{methoddesc}{Commit}{} +\begin{methoddesc}[Database]{Commit}{} Commit the changes pending in the current transaction, by calling \cfunction{MSIDatabaseCommit}. \end{methoddesc} -\begin{methoddesc}{GetSummaryInformation}{count} +\begin{methoddesc}[Database]{GetSummaryInformation}{count} Return a new summary information object, by calling \cfunction{MsiGetSummaryInformation}. \var{count} is the maximum number of updated values. @@ -145,24 +145,24 @@ \subsection{View Objects\label{view-objects}} -\begin{methoddesc}{Execute}{\optional{params=None}} +\begin{methoddesc}[View]{Execute}{\optional{params=None}} Execute the SQL query of the view, through \cfunction{MSIViewExecute}. \var{params} is an optional record describing actual values of the parameter tokens in the query. \end{methoddesc} -\begin{methoddesc}{GetColumnInfo}{kind} +\begin{methoddesc}[View]{GetColumnInfo}{kind} Return a record describing the columns of the view, through calling \cfunction{MsiViewGetColumnInfo}. \var{kind} can be either \code{MSICOLINFO_NAMES} or \code{MSICOLINFO_TYPES}. \end{methoddesc} -\begin{methoddesc}{Fetch}{} +\begin{methoddesc}[View]{Fetch}{} Return a result record of the query, through calling \cfunction{MsiViewFetch}. \end{methoddesc} -\begin{methoddesc}{Modify}{kind, data} +\begin{methoddesc}[View]{Modify}{kind, data} Modify the view, by calling \cfunction{MsiViewModify}. \var{kind} can be one of \code{MSIMODIFY_SEEK}, \code{MSIMODIFY_REFRESH}, \code{MSIMODIFY_INSERT}, \code{MSIMODIFY_UPDATE}, \code{MSIMODIFY_ASSIGN}, @@ -174,7 +174,7 @@ \var{data} must be a record describing the new data. \end{methoddesc} -\begin{methoddesc}{Close}{} +\begin{methoddesc}[View]{Close}{} Close the view, through \cfunction{MsiViewClose}. \end{methoddesc} @@ -188,7 +188,7 @@ \subsection{Summary Information Objects\label{summary-objects}} -\begin{methoddesc}{GetProperty}{field} +\begin{methoddesc}[SummaryInformation]{GetProperty}{field} Return a property of the summary, through \cfunction{MsiSummaryInfoGetProperty}. \var{field} is the name of the property, and can be one of the constants @@ -200,19 +200,19 @@ \code{PID_APPNAME}, or \code{PID_SECURITY}. \end{methoddesc} -\begin{methoddesc}{GetPropertyCount}{} +\begin{methoddesc}[SummaryInformation]{GetPropertyCount}{} Return the number of summary properties, through \cfunction{MsiSummaryInfoGetPropertyCount}. \end{methoddesc} -\begin{methoddesc}{SetProperty}{field, value} +\begin{methoddesc}[SummaryInformation]{SetProperty}{field, value} Set a property through \cfunction{MsiSummaryInfoSetProperty}. \var{field} can have the same values as in \method{GetProperty}, \var{value} is the new value of the property. Possible value types are integer and string. \end{methoddesc} -\begin{methoddesc}{Persist}{} +\begin{methoddesc}[SummaryInformation]{Persist}{} Write the modified properties to the summary information stream, using \cfunction{MsiSummaryInfoPersist}. \end{methoddesc} @@ -226,27 +226,27 @@ \subsection{Record Objects\label{record-objects}} -\begin{methoddesc}{GetFieldCount}{} +\begin{methoddesc}[Record]{GetFieldCount}{} Return the number of fields of the record, through \cfunction{MsiRecordGetFieldCount}. \end{methoddesc} -\begin{methoddesc}{SetString}{field, value} +\begin{methoddesc}[Record]{SetString}{field, value} Set \var{field} to \var{value} through \cfunction{MsiRecordSetString}. \var{field} must be an integer; \var{value} a string. \end{methoddesc} -\begin{methoddesc}{SetStream}{field, value} +\begin{methoddesc}[Record]{SetStream}{field, value} Set \var{field} to the contents of the file named \var{value}, through \cfunction{MsiRecordSetStream}. \var{field} must be an integer; \var{value} a string. \end{methoddesc} -\begin{methoddesc}{SetInteger}{field, value} +\begin{methoddesc}[Record]{SetInteger}{field, value} Set \var{field} to \var{value} through \cfunction{MsiRecordSetInteger}. Both \var{field} and \var{value} must be an integer. \end{methoddesc} -\begin{methoddesc}{ClearData}{} +\begin{methoddesc}[Record]{ClearData}{} Set all fields of the record to 0, through \cfunction{MsiRecordClearData}. \end{methoddesc} @@ -274,7 +274,7 @@ \var{name} is the name of the CAB file in the MSI file. \end{classdesc} -\begin{methoddesc}[CAB]{append}{full, logical} +\begin{methoddesc}[CAB]{append}{full, file, logical} Add the file with the pathname \var{full} to the CAB file, under the name \var{logical}. If there is already a file named \var{logical}, a new file name is created. @@ -283,7 +283,7 @@ new name of the file inside the CAB file. \end{methoddesc} -\begin{methoddesc}[CAB]{append}{database} +\begin{methoddesc}[CAB]{commit}{database} Generate a CAB file, add it as a stream to the MSI file, put it into the \code{Media} table, and remove the generated file from the disk. Modified: python/branches/bcannon-objcap/Doc/lib/libmultifile.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libmultifile.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libmultifile.tex Fri May 25 22:13:08 2007 @@ -48,7 +48,7 @@ A \class{MultiFile} instance has the following methods: -\begin{methoddesc}{readline}{str} +\begin{methoddesc}[MultiFile]{readline}{str} Read a line. If the line is data (not a section-divider or end-marker or real EOF) return it. If the line matches the most-recently-stacked boundary, return \code{''} and set \code{self.last} to 1 or 0 according as @@ -58,33 +58,33 @@ all boundaries have been popped. \end{methoddesc} -\begin{methoddesc}{readlines}{str} +\begin{methoddesc}[MultiFile]{readlines}{str} Return all lines remaining in this part as a list of strings. \end{methoddesc} -\begin{methoddesc}{read}{} +\begin{methoddesc}[MultiFile]{read}{} Read all lines, up to the next section. Return them as a single (multiline) string. Note that this doesn't take a size argument! \end{methoddesc} -\begin{methoddesc}{seek}{pos\optional{, whence}} +\begin{methoddesc}[MultiFile]{seek}{pos\optional{, whence}} Seek. Seek indices are relative to the start of the current section. The \var{pos} and \var{whence} arguments are interpreted as for a file seek. \end{methoddesc} -\begin{methoddesc}{tell}{} +\begin{methoddesc}[MultiFile]{tell}{} Return the file position relative to the start of the current section. \end{methoddesc} -\begin{methoddesc}{next}{} +\begin{methoddesc}[MultiFile]{next}{} Skip lines to the next section (that is, read lines until a section-divider or end-marker has been consumed). Return true if there is such a section, false if an end-marker is seen. Re-enable the most-recently-pushed boundary. \end{methoddesc} -\begin{methoddesc}{is_data}{str} +\begin{methoddesc}[MultiFile]{is_data}{str} Return true if \var{str} is data and false if it might be a section boundary. As written, it tests for a prefix other than \code{'-}\code{-'} at start of line (which all MIME boundaries have) but it is declared so @@ -95,7 +95,7 @@ processing, not cause it to fail. \end{methoddesc} -\begin{methoddesc}{push}{str} +\begin{methoddesc}[MultiFile]{push}{str} Push a boundary string. When a decorated version of this boundary is found as an input line, it will be interpreted as a section-divider or end-marker (depending on the decoration, see \rfc{2045}). All subsequent @@ -108,12 +108,12 @@ boundary will raise an error. \end{methoddesc} -\begin{methoddesc}{pop}{} +\begin{methoddesc}[MultiFile]{pop}{} Pop a section boundary. This boundary will no longer be interpreted as EOF. \end{methoddesc} -\begin{methoddesc}{section_divider}{str} +\begin{methoddesc}[MultiFile]{section_divider}{str} Turn a boundary into a section-divider line. By default, this method prepends \code{'-}\code{-'} (which MIME section boundaries have) but it is declared so it can be overridden in derived classes. This @@ -121,7 +121,7 @@ ignores trailing whitespace. \end{methoddesc} -\begin{methoddesc}{end_marker}{str} +\begin{methoddesc}[MultiFile]{end_marker}{str} Turn a boundary string into an end-marker line. By default, this method prepends \code{'-}\code{-'} and appends \code{'-}\code{-'} (like a MIME-multipart end-of-message marker) but it is declared so it can be @@ -131,11 +131,11 @@ Finally, \class{MultiFile} instances have two public instance variables: -\begin{memberdesc}{level} +\begin{memberdesc}[MultiFile]{level} Nesting depth of the current part. \end{memberdesc} -\begin{memberdesc}{last} +\begin{memberdesc}[MultiFile]{last} True if the last end-of-file was for an end-of-message marker. \end{memberdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libmutex.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libmutex.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libmutex.tex Fri May 25 22:13:08 2007 @@ -35,23 +35,23 @@ \class{mutex} objects have following methods: -\begin{methoddesc}{test}{} +\begin{methoddesc}[mutex]{test}{} Check whether the mutex is locked. \end{methoddesc} -\begin{methoddesc}{testandset}{} +\begin{methoddesc}[mutex]{testandset}{} ``Atomic'' test-and-set, grab the lock if it is not set, and return \code{True}, otherwise, return \code{False}. \end{methoddesc} -\begin{methoddesc}{lock}{function, argument} +\begin{methoddesc}[mutex]{lock}{function, argument} Execute \code{\var{function}(\var{argument})}, unless the mutex is locked. In the case it is locked, place the function and argument on the queue. See \method{unlock} for explanation of when \code{\var{function}(\var{argument})} is executed in that case. \end{methoddesc} -\begin{methoddesc}{unlock}{} +\begin{methoddesc}[mutex]{unlock}{} Unlock the mutex if queue is empty, otherwise execute the first element in the queue. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libnetrc.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libnetrc.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libnetrc.tex Fri May 25 22:13:08 2007 @@ -35,7 +35,7 @@ A \class{netrc} instance has the following methods: -\begin{methoddesc}{authenticators}{host} +\begin{methoddesc}[netrc]{authenticators}{host} Return a 3-tuple \code{(\var{login}, \var{account}, \var{password})} of authenticators for \var{host}. If the netrc file did not contain an entry for the given host, return the tuple associated with @@ -43,20 +43,20 @@ available, return \code{None}. \end{methoddesc} -\begin{methoddesc}{__repr__}{} +\begin{methoddesc}[netrc]{__repr__}{} Dump the class data as a string in the format of a netrc file. (This discards comments and may reorder the entries.) \end{methoddesc} Instances of \class{netrc} have public instance variables: -\begin{memberdesc}{hosts} +\begin{memberdesc}[netrc]{hosts} Dictionary mapping host names to \code{(\var{login}, \var{account}, \var{password})} tuples. The `default' entry, if any, is represented as a pseudo-host by that name. \end{memberdesc} -\begin{memberdesc}{macros} +\begin{memberdesc}[netrc]{macros} Dictionary mapping macro names to string lists. \end{memberdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libnntplib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libnntplib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libnntplib.tex Fri May 25 22:13:08 2007 @@ -121,13 +121,13 @@ the above exceptions. -\begin{methoddesc}{getwelcome}{} +\begin{methoddesc}[NNTP]{getwelcome}{} Return the welcome message sent by the server in reply to the initial connection. (This message sometimes contains disclaimers or help information that may be relevant to the user.) \end{methoddesc} -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[NNTP]{set_debuglevel}{level} Set the instance's debugging level. This controls the amount of debugging output printed. The default, \code{0}, produces no debugging output. A value of \code{1} produces a moderate amount of debugging @@ -137,7 +137,7 @@ message text). \end{methoddesc} -\begin{methoddesc}{newgroups}{date, time, \optional{file}} +\begin{methoddesc}[NNTP]{newgroups}{date, time, \optional{file}} Send a \samp{NEWGROUPS} command. The \var{date} argument should be a string of the form \code{'\var{yy}\var{mm}\var{dd}'} indicating the date, and \var{time} should be a string of the form @@ -152,7 +152,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{newnews}{group, date, time, \optional{file}} +\begin{methoddesc}[NNTP]{newnews}{group, date, time, \optional{file}} Send a \samp{NEWNEWS} command. Here, \var{group} is a group name or \code{'*'}, and \var{date} and \var{time} have the same meaning as for \method{newgroups()}. Return a pair \code{(\var{response}, @@ -165,7 +165,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{list}{\optional{file}} +\begin{methoddesc}[NNTP]{list}{\optional{file}} Send a \samp{LIST} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of tuples. Each tuple has the form \code{(\var{group}, \var{last}, \var{first}, \var{flag})}, where @@ -182,7 +182,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{descriptions}{grouppattern} +\begin{methoddesc}[NNTP]{descriptions}{grouppattern} Send a \samp{LIST NEWSGROUPS} command, where \var{grouppattern} is a wildmat string as specified in RFC2980 (it's essentially the same as DOS or UNIX shell wildcard strings). Return a pair \code{(\var{response}, @@ -192,7 +192,7 @@ \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{description}{group} +\begin{methoddesc}[NNTP]{description}{group} Get a description for a single group \var{group}. If more than one group matches (if 'group' is a real wildmat string), return the first match. If no group matches, return an empty string. @@ -203,7 +203,7 @@ \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}{group}{name} +\begin{methoddesc}[NNTP]{group}{name} Send a \samp{GROUP} command, where \var{name} is the group name. Return a tuple \code{(\var{response}, \var{count}, \var{first}, \var{last}, \var{name})} where \var{count} is the (estimated) number @@ -212,7 +212,7 @@ \var{name} is the group name. The numbers are returned as strings. \end{methoddesc} -\begin{methoddesc}{help}{\optional{file}} +\begin{methoddesc}[NNTP]{help}{\optional{file}} Send a \samp{HELP} command. Return a pair \code{(\var{response}, \var{list})} where \var{list} is a list of help strings. If the \var{file} parameter is supplied, then the output of the @@ -223,7 +223,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{stat}{id} +\begin{methoddesc}[NNTP]{stat}{id} Send a \samp{STAT} command, where \var{id} is the message id (enclosed in \character{<} and \character{>}) or an article number (as a string). Return a triple \code{(\var{response}, \var{number}, \var{id})} where @@ -231,15 +231,15 @@ message id (enclosed in \character{<} and \character{>}). \end{methoddesc} -\begin{methoddesc}{next}{} +\begin{methoddesc}[NNTP]{next}{} Send a \samp{NEXT} command. Return as for \method{stat()}. \end{methoddesc} -\begin{methoddesc}{last}{} +\begin{methoddesc}[NNTP]{last}{} Send a \samp{LAST} command. Return as for \method{stat()}. \end{methoddesc} -\begin{methoddesc}{head}{id} +\begin{methoddesc}[NNTP]{head}{id} Send a \samp{HEAD} command, where \var{id} has the same meaning as for \method{stat()}. Return a tuple \code{(\var{response}, \var{number}, \var{id}, \var{list})} @@ -248,7 +248,7 @@ list of lines, without trailing newlines). \end{methoddesc} -\begin{methoddesc}{body}{id,\optional{file}} +\begin{methoddesc}[NNTP]{body}{id,\optional{file}} Send a \samp{BODY} command, where \var{id} has the same meaning as for \method{stat()}. If the \var{file} parameter is supplied, then the body is stored in a file. If \var{file} is a string, then @@ -259,16 +259,16 @@ the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{article}{id} +\begin{methoddesc}[NNTP]{article}{id} Send an \samp{ARTICLE} command, where \var{id} has the same meaning as for \method{stat()}. Return as for \method{head()}. \end{methoddesc} -\begin{methoddesc}{slave}{} +\begin{methoddesc}[NNTP]{slave}{} Send a \samp{SLAVE} command. Return the server's \var{response}. \end{methoddesc} -\begin{methoddesc}{xhdr}{header, string, \optional{file}} +\begin{methoddesc}[NNTP]{xhdr}{header, string, \optional{file}} Send an \samp{XHDR} command. This command is not defined in the RFC but is a common extension. The \var{header} argument is a header keyword, e.g. \code{'subject'}. The \var{string} argument should have @@ -286,7 +286,7 @@ If \var{file} is supplied, then the returned \var{list} is an empty list. \end{methoddesc} -\begin{methoddesc}{post}{file} +\begin{methoddesc}[NNTP]{post}{file} Post an article using the \samp{POST} command. The \var{file} argument is an open file object which is read until EOF using its \method{readline()} method. It should be a well-formed news article, @@ -294,14 +294,14 @@ automatically escapes lines beginning with \samp{.}. \end{methoddesc} -\begin{methoddesc}{ihave}{id, file} +\begin{methoddesc}[NNTP]{ihave}{id, file} Send an \samp{IHAVE} command. \var{id} is a message id (enclosed in \character{<} and \character{>}). If the response is not an error, treat \var{file} exactly as for the \method{post()} method. \end{methoddesc} -\begin{methoddesc}{date}{} +\begin{methoddesc}[NNTP]{date}{} Return a triple \code{(\var{response}, \var{date}, \var{time})}, containing the current date and time in a form suitable for the \method{newnews()} and \method{newgroups()} methods. @@ -309,7 +309,7 @@ servers. \end{methoddesc} -\begin{methoddesc}{xgtitle}{name, \optional{file}} +\begin{methoddesc}[NNTP]{xgtitle}{name, \optional{file}} Process an \samp{XGTITLE} command, returning a pair \code{(\var{response}, \var{list})}, where \var{list} is a list of tuples containing \code{(\var{name}, \var{title})}. @@ -327,7 +327,7 @@ \method{descriptions()} or \method{description()} instead. \end{methoddesc} -\begin{methoddesc}{xover}{start, end, \optional{file}} +\begin{methoddesc}[NNTP]{xover}{start, end, \optional{file}} Return a pair \code{(\var{resp}, \var{list})}. \var{list} is a list of tuples, one for each article in the range delimited by the \var{start} and \var{end} article numbers. Each tuple is of the form @@ -343,13 +343,13 @@ servers. \end{methoddesc} -\begin{methoddesc}{xpath}{id} +\begin{methoddesc}[NNTP]{xpath}{id} Return a pair \code{(\var{resp}, \var{path})}, where \var{path} is the directory path to the article with message ID \var{id}. This is an optional NNTP extension, and may not be supported by all servers. \end{methoddesc} -\begin{methoddesc}{quit}{} +\begin{methoddesc}[NNTP]{quit}{} Send a \samp{QUIT} command and close the connection. Once this method has been called, no other methods of the NNTP object should be called. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/liboptparse.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/liboptparse.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/liboptparse.tex Fri May 25 22:13:08 2007 @@ -518,7 +518,7 @@ is then printed before the detailed option help. If you don't supply a usage string, \module{optparse} uses a bland but sensible -default: ``\code{usage: {\%}prog {[}options]"}, which is fine if your script +default: \code{"usage: {\%}prog {[}options]"}, which is fine if your script doesn't take any positional arguments. \item {} @@ -1191,14 +1191,14 @@ The whole point of creating and populating an OptionParser is to call its \method{parse{\_}args()} method: \begin{verbatim} -(options, args) = parser.parse_args(args=None, options=None) +(options, args) = parser.parse_args(args=None, values=None) \end{verbatim} where the input parameters are \begin{description} \item[\code{args}] the list of arguments to process (default: \code{sys.argv{[}1:]}) -\item[\code{options}] +\item[\code{values}] object to store option arguments in (default: a new instance of optparse.Values) \end{description} Modified: python/branches/bcannon-objcap/Doc/lib/libos.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libos.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libos.tex Fri May 25 22:13:08 2007 @@ -361,9 +361,8 @@ errors), \code{None} is returned. Availability: Macintosh, \UNIX, Windows. -The \module{subprocess} module provides more powerful facilities for -spawning new processes and retrieving their results; using that module -is preferable to using this function. +\deprecated{2.6}{This function is obsolete. Use the + \module{subprocess} module.} \versionchanged[This function worked unreliably under Windows in earlier versions of Python. This was due to the use of the @@ -380,10 +379,9 @@ \end{funcdesc} There are a number of different \function{popen*()} functions that -provide slightly different ways to create subprocesses. Note that the -\module{subprocess} module is easier to use and more powerful; -consider using that module before writing code using the -lower-level \function{popen*()} functions. +provide slightly different ways to create subprocesses. +\deprecated{2.6}{All of the \function{popen*()} functions are obsolete. + Use the \module{subprocess} module.} For each of the \function{popen*()} variants, if \var{bufsize} is specified, it specifies the buffer size for the I/O pipes. @@ -400,8 +398,7 @@ These methods do not make it possible to retrieve the exit status from the child processes. The only way to control the input and output streams and also retrieve the return codes is to use the -\class{Popen3} and \class{Popen4} classes from the \refmodule{popen2} -module; these are only available on \UNIX. +\refmodule{subprocess} module; these are only available on \UNIX. For a discussion of possible deadlock conditions related to the use of these functions, see ``\ulink{Flow Control @@ -411,6 +408,8 @@ \begin{funcdesc}{popen2}{cmd\optional{, mode\optional{, bufsize}}} Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout})}. +\deprecated{2.6}{All of the \function{popen*()} functions are obsolete. + Use the \module{subprocess} module.} Availability: Macintosh, \UNIX, Windows. \versionadded{2.0} \end{funcdesc} @@ -418,6 +417,8 @@ \begin{funcdesc}{popen3}{cmd\optional{, mode\optional{, bufsize}}} Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout}, \var{child_stderr})}. +\deprecated{2.6}{All of the \function{popen*()} functions are obsolete. + Use the \module{subprocess} module.} Availability: Macintosh, \UNIX, Windows. \versionadded{2.0} \end{funcdesc} @@ -425,6 +426,8 @@ \begin{funcdesc}{popen4}{cmd\optional{, mode\optional{, bufsize}}} Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout_and_stderr})}. +\deprecated{2.6}{All of the \function{popen*()} functions are obsolete. + Use the \module{subprocess} module.} Availability: Macintosh, \UNIX, Windows. \versionadded{2.0} \end{funcdesc} @@ -758,6 +761,26 @@ \versionadded{2.3} \end{funcdesc} +\begin{funcdesc}{chflags}{path, flags} +Set the flags of \var{path} to the numeric \var{flags}. +\var{flags} may take a combination (bitwise OR) of the following values +(as defined in the \module{stat} module): +\begin{itemize} + \item \code{UF_NODUMP} + \item \code{UF_IMMUTABLE} + \item \code{UF_APPEND} + \item \code{UF_OPAQUE} + \item \code{UF_NOUNLINK} + \item \code{SF_ARCHIVED} + \item \code{SF_IMMUTABLE} + \item \code{SF_APPEND} + \item \code{SF_NOUNLINK} + \item \code{SF_SNAPSHOT} +\end{itemize} +Availability: Macintosh, \UNIX. +\versionadded{2.6} +\end{funcdesc} + \begin{funcdesc}{chroot}{path} Change the root directory of the current process to \var{path}. Availability: Macintosh, \UNIX. @@ -804,6 +827,13 @@ Availability: Macintosh, \UNIX. \end{funcdesc} +\begin{funcdesc}{lchflags}{path, flags} +Set the flags of \var{path} to the numeric \var{flags}, like +\function{chflags()}, but do not follow symbolic links. +Availability: \UNIX. +\versionadded{2.6} +\end{funcdesc} + \begin{funcdesc}{lchown}{path, uid, gid} Change the owner and group id of \var{path} to the numeric \var{uid} and gid. This function will not follow symbolic links. @@ -1206,7 +1236,8 @@ \end{funcdesc} \begin{funcdesc}{walk}{top\optional{, topdown\code{=True} - \optional{, onerror\code{=None}}}} + \optional{, onerror\code{=None}\optional{, + followlinks\code{=False}}}}} \index{directory!walking} \index{directory!traversal} \function{walk()} generates the file names in a directory tree, by @@ -1246,6 +1277,18 @@ to abort the walk. Note that the filename is available as the \code{filename} attribute of the exception object. +By default, \function{walk()} will not walk down into symbolic links that +resolve to directories. Set \var{followlinks} to True to visit directories +pointed to by symlinks, on systems that support them. + +\versionadded[The \var{followlinks} parameter]{2.6} + +\begin{notice} +Be aware that setting \var{followlinks} to true can lead to infinite recursion +if a link points to a parent directory of itself. \function{walk()} does not +keep track of the directories it visited already. +\end{notice} + \begin{notice} If you pass a relative pathname, don't change the current working directory between resumptions of \function{walk()}. \function{walk()} @@ -1253,15 +1296,6 @@ doesn't either. \end{notice} -\begin{notice} -On systems that support symbolic links, links to subdirectories appear -in \var{dirnames} lists, but \function{walk()} will not visit them -(infinite loops are hard to avoid when following symbolic links). -To visit linked directories, you can identify them with -\code{os.path.islink(\var{path})}, and invoke \code{walk(\var{path})} -on each directly. -\end{notice} - This example displays the number of bytes taken by non-directory files in each directory under the starting directory, except that it doesn't look under any CVS subdirectory: @@ -1975,9 +2009,12 @@ \begin{datadesc}{linesep} The string used to separate (or, rather, terminate) lines on the -current platform. This may be a single character, such as \code{'\e -n'} for \POSIX{} or \code{'\e r'} for Mac OS, or multiple characters, -for example, \code{'\e r\e n'} for Windows. +current platform. This may be a single character, such as +\code{'\e n'} for \POSIX{} or \code{'\e r'} for Mac OS, or multiple +characters, for example, \code{'\e r\e n'} for Windows. +Do not use \var{os.linesep} as a line terminator when writing files +opened in text mode (the default); use a single \code{'\e n'} instead, +on all platforms. \end{datadesc} \begin{datadesc}{devnull} Deleted: /python/branches/bcannon-objcap/Doc/lib/libpanel.tex ============================================================================== --- /python/branches/bcannon-objcap/Doc/lib/libpanel.tex Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,74 +0,0 @@ -\section{\module{panel} --- - None} -\declaremodule{standard}{panel} - -\modulesynopsis{None} - - -\strong{Please note:} The FORMS library, to which the -\code{fl}\refbimodindex{fl} module described above interfaces, is a -simpler and more accessible user interface library for use with GL -than the \code{panel} module (besides also being by a Dutch author). - -This module should be used instead of the built-in module -\code{pnl}\refbimodindex{pnl} -to interface with the -\emph{Panel Library}. - -The module is too large to document here in its entirety. -One interesting function: - -\begin{funcdesc}{defpanellist}{filename} -Parses a panel description file containing S-expressions written by the -\emph{Panel Editor} -that accompanies the Panel Library and creates the described panels. -It returns a list of panel objects. -\end{funcdesc} - -\warning{The Python interpreter will dump core if you don't create a -GL window before calling -\code{panel.mkpanel()} -or -\code{panel.defpanellist()}.} - -\section{\module{panelparser} --- - None} -\declaremodule{standard}{panelparser} - -\modulesynopsis{None} - - -This module defines a self-contained parser for S-expressions as output -by the Panel Editor (which is written in Scheme so it can't help writing -S-expressions). -The relevant function is -\code{panelparser.parse_file(\var{file})} -which has a file object (not a filename!) as argument and returns a list -of parsed S-expressions. -Each S-expression is converted into a Python list, with atoms converted -to Python strings and sub-expressions (recursively) to Python lists. -For more details, read the module file. -% XXXXJH should be funcdesc, I think - -\section{\module{pnl} --- - None} -\declaremodule{builtin}{pnl} - -\modulesynopsis{None} - - -This module provides access to the -\emph{Panel Library} -built by NASA Ames\index{NASA} (to get it, send email to -\code{panel-request at nas.nasa.gov}). -All access to it should be done through the standard module -\code{panel}\refstmodindex{panel}, -which transparently exports most functions from -\code{pnl} -but redefines -\code{pnl.dopanel()}. - -\warning{The Python interpreter will dump core if you don't create a -GL window before calling \code{pnl.mkpanel()}.} - -The module is too large to document here in its entirety. Modified: python/branches/bcannon-objcap/Doc/lib/libpdb.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libpdb.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libpdb.tex Fri May 25 22:13:08 2007 @@ -378,6 +378,14 @@ (Pdb) \end{verbatim} +\item[run \optional{\var{args} ...}] +Restart the debugged python program. If an argument is supplied, it is +splitted with "shlex" and the result is used as the new sys.argv. +History, breakpoints, actions and debugger options are preserved. +"restart" is an alias for "run". + +\versionadded{2.6} + \item[q(uit)] Quit from the debugger. Modified: python/branches/bcannon-objcap/Doc/lib/libpipes.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libpipes.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libpipes.tex Fri May 25 22:13:08 2007 @@ -39,21 +39,21 @@ Template objects following methods: -\begin{methoddesc}{reset}{} +\begin{methoddesc}[Template]{reset}{} Restore a pipeline template to its initial state. \end{methoddesc} -\begin{methoddesc}{clone}{} +\begin{methoddesc}[Template]{clone}{} Return a new, equivalent, pipeline template. \end{methoddesc} -\begin{methoddesc}{debug}{flag} +\begin{methoddesc}[Template]{debug}{flag} If \var{flag} is true, turn debugging on. Otherwise, turn debugging off. When debugging is on, commands to be executed are printed, and the shell is given \code{set -x} command to be more verbose. \end{methoddesc} -\begin{methoddesc}{append}{cmd, kind} +\begin{methoddesc}[Template]{append}{cmd, kind} Append a new action at the end. The \var{cmd} variable must be a valid bourne shell command. The \var{kind} variable consists of two letters. @@ -68,17 +68,17 @@ the command does not write anything, and hence must be last.) \end{methoddesc} -\begin{methoddesc}{prepend}{cmd, kind} +\begin{methoddesc}[Template]{prepend}{cmd, kind} Add a new action at the beginning. See \method{append()} for explanations of the arguments. \end{methoddesc} -\begin{methoddesc}{open}{file, mode} +\begin{methoddesc}[Template]{open}{file, mode} Return a file-like object, open to \var{file}, but read from or written to by the pipeline. Note that only one of \code{'r'}, \code{'w'} may be given. \end{methoddesc} -\begin{methoddesc}{copy}{infile, outfile} +\begin{methoddesc}[Template]{copy}{infile, outfile} Copy \var{infile} to \var{outfile} through the pipe. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libplatform.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libplatform.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libplatform.tex Fri May 25 22:13:08 2007 @@ -80,6 +80,22 @@ Returns a string identifying the compiler used for compiling Python. \end{funcdesc} +\begin{funcdesc}{python_branch}{} + Returns a string identifying the Python implementation SCM branch. + \versionadded{2.6} +\end{funcdesc} + +\begin{funcdesc}{python_implementation}{} + Returns a string identifying the Python implementation. + Possible return values are: 'CPython', 'IronPython', 'Jython' + \versionadded{2.6} +\end{funcdesc} + +\begin{funcdesc}{python_revision}{} + Returns a string identifying the Python implementation SCM revision. + \versionadded{2.6} +\end{funcdesc} + \begin{funcdesc}{python_version}{} Returns the Python version as string \code{'major.minor.patchlevel'} @@ -205,6 +221,7 @@ which defaults to the args given as parameters. \end{funcdesc} +% Document linux_distribution()? \begin{funcdesc}{libc_ver}{executable=sys.executable, lib='', version='', chunksize=2048} Modified: python/branches/bcannon-objcap/Doc/lib/libpopen2.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libpopen2.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libpopen2.tex Fri May 25 22:13:08 2007 @@ -2,10 +2,10 @@ Subprocesses with accessible I/O streams} \declaremodule{standard}{popen2} - \platform{Unix, Windows} \modulesynopsis{Subprocesses with accessible standard I/O streams.} \sectionauthor{Drew Csillag}{drew_csillag at geocities.com} +\deprecated{2.6}{This module is obsolete. Use the \module{subprocess} module.} This module allows you to spawn processes and connect to their input/output/error pipes and obtain their return codes under @@ -85,12 +85,12 @@ Instances of the \class{Popen3} and \class{Popen4} classes have the following methods: -\begin{methoddesc}{poll}{} +\begin{methoddesc}[Popen3]{poll}{} Returns \code{-1} if child process hasn't completed yet, or its return code otherwise. \end{methoddesc} -\begin{methoddesc}{wait}{} +\begin{methoddesc}[Popen3]{wait}{} Waits for and returns the status code of the child process. The status code encodes both the return code of the process and information about whether it exited using the \cfunction{exit()} @@ -102,24 +102,24 @@ The following attributes are also available: -\begin{memberdesc}{fromchild} +\begin{memberdesc}[Popen3]{fromchild} A file object that provides output from the child process. For \class{Popen4} instances, this will provide both the standard output and standard error streams. \end{memberdesc} -\begin{memberdesc}{tochild} +\begin{memberdesc}[Popen3]{tochild} A file object that provides input to the child process. \end{memberdesc} -\begin{memberdesc}{childerr} +\begin{memberdesc}[Popen3]{childerr} A file object that provides error output from the child process, if \var{capturestderr} was true for the constructor, otherwise \code{None}. This will always be \code{None} for \class{Popen4} instances. \end{memberdesc} -\begin{memberdesc}{pid} +\begin{memberdesc}[Popen3]{pid} The process ID of the child process. \end{memberdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libpoplib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libpoplib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libpoplib.tex Fri May 25 22:13:08 2007 @@ -23,15 +23,18 @@ Note that POP3, though widely supported, is obsolescent. The implementation quality of POP3 servers varies widely, and too many are quite poor. If your mailserver supports IMAP, you would be better off -using the \code{\refmodule{imaplib}.\class{IMAP4}} class, as IMAP +using the \class{\refmodule{imaplib}.IMAP4} class, as IMAP servers tend to be better implemented. A single class is provided by the \module{poplib} module: -\begin{classdesc}{POP3}{host\optional{, port}} +\begin{classdesc}{POP3}{host\optional{, port\optional{, timeout}}} This class implements the actual POP3 protocol. The connection is created when the instance is initialized. If \var{port} is omitted, the standard POP3 port (110) is used. +The optional \var{timeout} parameter specifies a timeout in seconds for the +connection attempt (if not specified, or passed as None, the global default +timeout setting will be used). \end{classdesc} \begin{classdesc}{POP3_SSL}{host\optional{, port\optional{, keyfile\optional{, certfile}}}} @@ -47,8 +50,9 @@ One exception is defined as an attribute of the \module{poplib} module: \begin{excdesc}{error_proto} -Exception raised on any errors. The reason for the exception is -passed to the constructor as a string. +Exception raised on any errors from this module (errors from +\module{socket} module are not caught). The reason for the exception +is passed to the constructor as a string. \end{excdesc} \begin{seealso} @@ -70,7 +74,7 @@ An \class{POP3} instance has the following methods: -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[POP3]{set_debuglevel}{level} Set the instance's debugging level. This controls the amount of debugging output printed. The default, \code{0}, produces no debugging output. A value of \code{1} produces a moderate amount of @@ -79,64 +83,64 @@ logging each line sent and received on the control connection. \end{methoddesc} -\begin{methoddesc}{getwelcome}{} +\begin{methoddesc}[POP3]{getwelcome}{} Returns the greeting string sent by the POP3 server. \end{methoddesc} -\begin{methoddesc}{user}{username} +\begin{methoddesc}[POP3]{user}{username} Send user command, response should indicate that a password is required. \end{methoddesc} -\begin{methoddesc}{pass_}{password} +\begin{methoddesc}[POP3]{pass_}{password} Send password, response includes message count and mailbox size. Note: the mailbox on the server is locked until \method{quit()} is called. \end{methoddesc} -\begin{methoddesc}{apop}{user, secret} +\begin{methoddesc}[POP3]{apop}{user, secret} Use the more secure APOP authentication to log into the POP3 server. \end{methoddesc} -\begin{methoddesc}{rpop}{user} +\begin{methoddesc}[POP3]{rpop}{user} Use RPOP authentication (similar to UNIX r-commands) to log into POP3 server. \end{methoddesc} -\begin{methoddesc}{stat}{} +\begin{methoddesc}[POP3]{stat}{} Get mailbox status. The result is a tuple of 2 integers: \code{(\var{message count}, \var{mailbox size})}. \end{methoddesc} -\begin{methoddesc}{list}{\optional{which}} +\begin{methoddesc}[POP3]{list}{\optional{which}} Request message list, result is in the form \code{(\var{response}, ['mesg_num octets', ...], \var{octets})}. If \var{which} is set, it is the message to list. \end{methoddesc} -\begin{methoddesc}{retr}{which} +\begin{methoddesc}[POP3]{retr}{which} Retrieve whole message number \var{which}, and set its seen flag. Result is in form \code{(\var{response}, ['line', ...], \var{octets})}. \end{methoddesc} -\begin{methoddesc}{dele}{which} +\begin{methoddesc}[POP3]{dele}{which} Flag message number \var{which} for deletion. On most servers deletions are not actually performed until QUIT (the major exception is Eudora QPOP, which deliberately violates the RFCs by doing pending deletes on any disconnect). \end{methoddesc} -\begin{methoddesc}{rset}{} +\begin{methoddesc}[POP3]{rset}{} Remove any deletion marks for the mailbox. \end{methoddesc} -\begin{methoddesc}{noop}{} +\begin{methoddesc}[POP3]{noop}{} Do nothing. Might be used as a keep-alive. \end{methoddesc} -\begin{methoddesc}{quit}{} +\begin{methoddesc}[POP3]{quit}{} Signoff: commit changes, unlock mailbox, drop connection. \end{methoddesc} -\begin{methoddesc}{top}{which, howmuch} +\begin{methoddesc}[POP3]{top}{which, howmuch} Retrieves the message header plus \var{howmuch} lines of the message after the header of message number \var{which}. Result is in form \code{(\var{response}, ['line', ...], \var{octets})}. @@ -148,7 +152,7 @@ trusting it. \end{methoddesc} -\begin{methoddesc}{uidl}{\optional{which}} +\begin{methoddesc}[POP3]{uidl}{\optional{which}} Return message digest (unique id) list. If \var{which} is specified, result contains the unique id for that message in the form \code{'\var{response}\ \var{mesgnum}\ \var{uid}}, Modified: python/branches/bcannon-objcap/Doc/lib/libposixfile.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libposixfile.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libposixfile.tex Fri May 25 22:13:08 2007 @@ -62,8 +62,7 @@ The posixfile object defines the following additional methods: -\setindexsubitem{(posixfile method)} -\begin{funcdesc}{lock}{fmt, \optional{len\optional{, start\optional{, whence}}}} +\begin{methoddesc}[posixfile]{lock}{fmt, \optional{len\optional{, start\optional{, whence}}}} Lock the specified section of the file that the file object is referring to. The format is explained below in a table. The \var{len} argument specifies the length of the @@ -74,9 +73,9 @@ \constant{SEEK_CUR} or \constant{SEEK_END}. The default is \constant{SEEK_SET}. For more information about the arguments refer to the \manpage{fcntl}{2} manual page on your system. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{flags}{\optional{flags}} +\begin{methoddesc}[posixfile]{flags}{\optional{flags}} Set the specified flags for the file that the file object is referring to. The new flags are ORed with the old flags, unless specified otherwise. The format is explained below in a table. Without @@ -84,25 +83,25 @@ a string indicating the current flags is returned (this is the same as the \samp{?} modifier). For more information about the flags refer to the \manpage{fcntl}{2} manual page on your system. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{dup}{} +\begin{methoddesc}[posixfile]{dup}{} Duplicate the file object and the underlying file pointer and file descriptor. The resulting object behaves as if it were newly opened. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{dup2}{fd} +\begin{methoddesc}[posixfile]{dup2}{fd} Duplicate the file object and the underlying file pointer and file descriptor. The new object will have the given file descriptor. Otherwise the resulting object behaves as if it were newly opened. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{file}{} +\begin{methoddesc}[posixfile]{file}{} Return the standard file object that the posixfile object is based on. This is sometimes necessary for functions that insist on a standard file object. -\end{funcdesc} +\end{methoddesc} All methods raise \exception{IOError} when the request fails. Modified: python/branches/bcannon-objcap/Doc/lib/libposixpath.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libposixpath.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libposixpath.tex Fri May 25 22:13:08 2007 @@ -58,18 +58,20 @@ \end{funcdesc} \begin{funcdesc}{expanduser}{path} -On \UNIX, return the argument with an initial component of \samp{\~} or -\samp{\~\var{user}} replaced by that \var{user}'s home directory. -An initial \samp{\~} is replaced by the environment variable +On \UNIX{} and Windows, return the argument with an initial component of +\samp{\~} or \samp{\~\var{user}} replaced by that \var{user}'s home directory. + +On \UNIX, an initial \samp{\~} is replaced by the environment variable \envvar{HOME} if it is set; otherwise the current user's home directory is looked up in the password directory through the built-in module \refmodule{pwd}\refbimodindex{pwd}. An initial \samp{\~\var{user}} is looked up directly in the password directory. -On Windows, only \samp{\~} is supported; it is replaced by the -environment variable \envvar{HOME} or by a combination of -\envvar{HOMEDRIVE} and \envvar{HOMEPATH}. +On Windows, \envvar{HOME} and \envvar{USERPROFILE} will be used if set, +otherwise a combination of \envvar{HOMEPATH} and \envvar{HOMEDRIVE} will be +used. An initial \samp{\~\var{user}} is handled by stripping the last +directory component from the created user path derived above. If the expansion fails or if the path does not begin with a tilde, the path is returned unchanged. @@ -81,6 +83,9 @@ replaced by the value of environment variable \var{name}. Malformed variable names and references to non-existing variables are left unchanged. + +On Windows, \samp{\%\var{name}\%} expansions are supported in addition to +\samp{\$\var{name}} and \samp{\$\{\var{name}\}}. \end{funcdesc} \begin{funcdesc}{getatime}{path} @@ -184,6 +189,15 @@ \versionadded{2.2} \end{funcdesc} +\begin{funcdesc}{relpath}{path\optional{, start}} +Return a relative filepath to \var{path} either from the current +directory or from an optional \var{start} point. + +\var{start} defaults to \member{os.curdir}. +Availability: Windows, \UNIX. +\versionadded{2.6} +\end{funcdesc} + \begin{funcdesc}{samefile}{path1, path2} Return \code{True} if both pathname arguments refer to the same file or directory (as indicated by device number and i-node number). @@ -234,7 +248,12 @@ Split the pathname \var{path} into a pair \code{(\var{root}, \var{ext})} such that \code{\var{root} + \var{ext} == \var{path}}, and \var{ext} is empty or begins with a period and contains -at most one period. +at most one period. Leading periods on the basename are +ignored; \code{\var{splitext}.('.cshrc')} returns +\code{('.cshrc', '')}. + +\versionchanged[Earlier versions could produce an empty root when +the only period was the first character]{2.6} \end{funcdesc} \begin{funcdesc}{splitunc}{path} Modified: python/branches/bcannon-objcap/Doc/lib/libpprint.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libpprint.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libpprint.tex Fri May 25 22:13:08 2007 @@ -118,7 +118,7 @@ \begin{funcdesc}{isreadable}{object} Determine if the formatted representation of \var{object} is ``readable,'' or can be used to reconstruct the value using -\function{eval()}\bifuncindex{eval}. This always returns false for +\function{eval()}\bifuncindex{eval}. This always returns \code{False} for recursive objects. \begin{verbatim} @@ -158,12 +158,12 @@ \class{PrettyPrinter} instances have the following methods: -\begin{methoddesc}{pformat}{object} +\begin{methoddesc}[PrettyPrinter]{pformat}{object} Return the formatted representation of \var{object}. This takes into account the options passed to the \class{PrettyPrinter} constructor. \end{methoddesc} -\begin{methoddesc}{pprint}{object} +\begin{methoddesc}[PrettyPrinter]{pprint}{object} Print the formatted representation of \var{object} on the configured stream, followed by a newline. \end{methoddesc} @@ -173,16 +173,16 @@ instance is slightly more efficient since new \class{PrettyPrinter} objects don't need to be created. -\begin{methoddesc}{isreadable}{object} +\begin{methoddesc}[PrettyPrinter]{isreadable}{object} Determine if the formatted representation of the object is ``readable,'' or can be used to reconstruct the value using -\function{eval()}\bifuncindex{eval}. Note that this returns false for +\function{eval()}\bifuncindex{eval}. Note that this returns \code{False} for recursive objects. If the \var{depth} parameter of the \class{PrettyPrinter} is set and the object is deeper than allowed, -this returns false. +this returns \code{False}. \end{methoddesc} -\begin{methoddesc}{isrecursive}{object} +\begin{methoddesc}[PrettyPrinter]{isrecursive}{object} Determine if the object requires a recursive representation. \end{methoddesc} @@ -190,7 +190,7 @@ way objects are converted to strings. The default implementation uses the internals of the \function{saferepr()} implementation. -\begin{methoddesc}{format}{object, context, maxlevels, level} +\begin{methoddesc}[PrettyPrinter]{format}{object, context, maxlevels, level} Returns three values: the formatted version of \var{object} as a string, a flag indicating whether the result is readable, and a flag indicating whether recursion was detected. The first argument is the @@ -199,7 +199,7 @@ context (direct and indirect containers for \var{object} that are affecting the presentation) as the keys; if an object needs to be presented which is already represented in \var{context}, the third -return value should be true. Recursive calls to the \method{format()} +return value should be \code{True}. Recursive calls to the \method{format()} method should add additional entries for containers to this dictionary. The third argument, \var{maxlevels}, gives the requested limit to recursion; this will be \code{0} if there is no requested Modified: python/branches/bcannon-objcap/Doc/lib/libprofile.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libprofile.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libprofile.tex Fri May 25 22:13:08 2007 @@ -319,7 +319,7 @@ \begin{funcdesc}{run}{command\optional{, filename}} -This function takes a single argument that has can be passed to the +This function takes a single argument that can be passed to the \keyword{exec} statement, and an optional file name. In all cases this routine attempts to \keyword{exec} its first argument, and gather profiling statistics from the execution. If no file name is present, then this Modified: python/branches/bcannon-objcap/Doc/lib/libqueue.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libqueue.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libqueue.tex Fri May 25 22:13:08 2007 @@ -45,22 +45,22 @@ is not described here. See the source code for details. The public methods are: -\begin{methoddesc}{qsize}{} +\begin{methoddesc}[Queue]{qsize}{} Return the approximate size of the queue. Because of multithreading semantics, this number is not reliable. \end{methoddesc} -\begin{methoddesc}{empty}{} +\begin{methoddesc}[Queue]{empty}{} Return \code{True} if the queue is empty, \code{False} otherwise. Because of multithreading semantics, this is not reliable. \end{methoddesc} -\begin{methoddesc}{full}{} +\begin{methoddesc}[Queue]{full}{} Return \code{True} if the queue is full, \code{False} otherwise. Because of multithreading semantics, this is not reliable. \end{methoddesc} -\begin{methoddesc}{put}{item\optional{, block\optional{, timeout}}} +\begin{methoddesc}[Queue]{put}{item\optional{, block\optional{, timeout}}} Put \var{item} into the queue. If optional args \var{block} is true and \var{timeout} is None (the default), block if necessary until a free slot is available. If \var{timeout} is a positive number, it @@ -74,11 +74,11 @@ \end{methoddesc} -\begin{methoddesc}{put_nowait}{item} +\begin{methoddesc}[Queue]{put_nowait}{item} Equivalent to \code{put(\var{item}, False)}. \end{methoddesc} -\begin{methoddesc}{get}{\optional{block\optional{, timeout}}} +\begin{methoddesc}[Queue]{get}{\optional{block\optional{, timeout}}} Remove and return an item from the queue. If optional args \var{block} is true and \var{timeout} is None (the default), block if necessary until an item is available. If \var{timeout} is @@ -92,14 +92,14 @@ \end{methoddesc} -\begin{methoddesc}{get_nowait}{} +\begin{methoddesc}[Queue]{get_nowait}{} Equivalent to \code{get(False)}. \end{methoddesc} Two methods are offered to support tracking whether enqueued tasks have been fully processed by daemon consumer threads. -\begin{methoddesc}{task_done}{} +\begin{methoddesc}[Queue]{task_done}{} Indicate that a formerly enqueued task is complete. Used by queue consumer threads. For each \method{get()} used to fetch a task, a subsequent call to \method{task_done()} tells the queue that the processing on the task is complete. @@ -113,7 +113,7 @@ \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}{join}{} +\begin{methoddesc}[Queue]{join}{} Blocks until all items in the queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the Modified: python/branches/bcannon-objcap/Doc/lib/libre.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libre.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libre.tex Fri May 25 22:13:08 2007 @@ -812,7 +812,7 @@ \end{methoddesc} \begin{methoddesc}[MatchObject]{start}{\optional{group}} -\methodline{end}{\optional{group}} +\methodline[MatchObject]{end}{\optional{group}} Return the indices of the start and end of the substring matched by \var{group}; \var{group} defaults to zero (meaning the whole matched substring). Modified: python/branches/bcannon-objcap/Doc/lib/librepr.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/librepr.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/librepr.tex Fri May 25 22:13:08 2007 @@ -44,18 +44,18 @@ and methods which format specific object types. -\begin{memberdesc}{maxlevel} +\begin{memberdesc}[Repr]{maxlevel} Depth limit on the creation of recursive representations. The default is \code{6}. \end{memberdesc} -\begin{memberdesc}{maxdict} -\memberline{maxlist} -\memberline{maxtuple} -\memberline{maxset} -\memberline{maxfrozenset} -\memberline{maxdeque} -\memberline{maxarray} +\begin{memberdesc}[Repr]{maxdict} +\memberline[Repr]{maxlist} +\memberline[Repr]{maxtuple} +\memberline[Repr]{maxset} +\memberline[Repr]{maxfrozenset} +\memberline[Repr]{maxdeque} +\memberline[Repr]{maxarray} Limits on the number of entries represented for the named object type. The default is \code{4} for \member{maxdict}, \code{5} for \member{maxarray}, and \code{6} for the others. @@ -63,13 +63,13 @@ and \member{set}]{2.4}. \end{memberdesc} -\begin{memberdesc}{maxlong} +\begin{memberdesc}[Repr]{maxlong} Maximum number of characters in the representation for a long integer. Digits are dropped from the middle. The default is \code{40}. \end{memberdesc} -\begin{memberdesc}{maxstring} +\begin{memberdesc}[Repr]{maxstring} Limit on the number of characters in the representation of the string. Note that the ``normal'' representation of the string is used as the character source: if escape sequences are needed in the @@ -77,19 +77,19 @@ shortened. The default is \code{30}. \end{memberdesc} -\begin{memberdesc}{maxother} +\begin{memberdesc}[Repr]{maxother} This limit is used to control the size of object types for which no specific formatting method is available on the \class{Repr} object. It is applied in a similar manner as \member{maxstring}. The default is \code{20}. \end{memberdesc} -\begin{methoddesc}{repr}{obj} +\begin{methoddesc}[Repr]{repr}{obj} The equivalent to the built-in \function{repr()} that uses the formatting imposed by the instance. \end{methoddesc} -\begin{methoddesc}{repr1}{obj, level} +\begin{methoddesc}[Repr]{repr1}{obj, level} Recursive implementation used by \method{repr()}. This uses the type of \var{obj} to determine which formatting method to call, passing it \var{obj} and \var{level}. The type-specific methods @@ -98,7 +98,7 @@ call. \end{methoddesc} -\begin{methoddescni}{repr_\var{type}}{obj, level} +\begin{methoddescni}[Repr]{repr_\var{type}}{obj, level} Formatting methods for specific types are implemented as methods with a name based on the type name. In the method name, \var{type} is replaced by Modified: python/branches/bcannon-objcap/Doc/lib/librexec.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/librexec.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/librexec.tex Fri May 25 22:13:08 2007 @@ -89,20 +89,20 @@ \class{RExec} instances support the following methods: -\begin{methoddesc}{r_eval}{code} +\begin{methoddesc}[RExec]{r_eval}{code} \var{code} must either be a string containing a Python expression, or a compiled code object, which will be evaluated in the restricted environment's \module{__main__} module. The value of the expression or code object will be returned. \end{methoddesc} -\begin{methoddesc}{r_exec}{code} +\begin{methoddesc}[RExec]{r_exec}{code} \var{code} must either be a string containing one or more lines of Python code, or a compiled code object, which will be executed in the restricted environment's \module{__main__} module. \end{methoddesc} -\begin{methoddesc}{r_execfile}{filename} +\begin{methoddesc}[RExec]{r_execfile}{filename} Execute the Python code contained in the file \var{filename} in the restricted environment's \module{__main__} module. \end{methoddesc} @@ -112,17 +112,17 @@ restricted versions of the standard I/O streams \code{sys.stdin}, \code{sys.stderr}, and \code{sys.stdout}. -\begin{methoddesc}{s_eval}{code} +\begin{methoddesc}[RExec]{s_eval}{code} \var{code} must be a string containing a Python expression, which will be evaluated in the restricted environment. \end{methoddesc} -\begin{methoddesc}{s_exec}{code} +\begin{methoddesc}[RExec]{s_exec}{code} \var{code} must be a string containing one or more lines of Python code, which will be executed in the restricted environment. \end{methoddesc} -\begin{methoddesc}{s_execfile}{code} +\begin{methoddesc}[RExec]{s_execfile}{code} Execute the Python code contained in the file \var{filename} in the restricted environment. \end{methoddesc} @@ -132,13 +132,13 @@ Overriding these methods in a subclass is used to change the policies enforced by a restricted environment. -\begin{methoddesc}{r_import}{modulename\optional{, globals\optional{, - locals\optional{, fromlist}}}} +\begin{methoddesc}[RExec]{r_import}{modulename\optional{, globals\optional{, + locals\optional{, fromlist}}}} Import the module \var{modulename}, raising an \exception{ImportError} exception if the module is considered unsafe. \end{methoddesc} -\begin{methoddesc}{r_open}{filename\optional{, mode\optional{, bufsize}}} +\begin{methoddesc}[RExec]{r_open}{filename\optional{, mode\optional{, bufsize}}} Method called when \function{open()} is called in the restricted environment. The arguments are identical to those of \function{open()}, and a file object (or a class instance compatible with file objects) @@ -148,28 +148,28 @@ \method{r_open()}. \end{methoddesc} -\begin{methoddesc}{r_reload}{module} +\begin{methoddesc}[RExec]{r_reload}{module} Reload the module object \var{module}, re-parsing and re-initializing it. \end{methoddesc} -\begin{methoddesc}{r_unload}{module} +\begin{methoddesc}[RExec]{r_unload}{module} Unload the module object \var{module} (remove it from the restricted environment's \code{sys.modules} dictionary). \end{methoddesc} And their equivalents with access to restricted standard I/O streams: -\begin{methoddesc}{s_import}{modulename\optional{, globals\optional{, - locals\optional{, fromlist}}}} +\begin{methoddesc}[RExec]{s_import}{modulename\optional{, globals\optional{, + locals\optional{, fromlist}}}} Import the module \var{modulename}, raising an \exception{ImportError} exception if the module is considered unsafe. \end{methoddesc} -\begin{methoddesc}{s_reload}{module} +\begin{methoddesc}[RExec]{s_reload}{module} Reload the module object \var{module}, re-parsing and re-initializing it. \end{methoddesc} -\begin{methoddesc}{s_unload}{module} +\begin{methoddesc}[RExec]{s_unload}{module} Unload the module object \var{module}. % XXX what are the semantics of this? \end{methoddesc} @@ -184,7 +184,7 @@ Instances of the new class will then use those new values. All these attributes are tuples of strings. -\begin{memberdesc}{nok_builtin_names} +\begin{memberdesc}[RExec]{nok_builtin_names} Contains the names of built-in functions which will \emph{not} be available to programs running in the restricted environment. The value for \class{RExec} is \code{('open', 'reload', '__import__')}. @@ -196,7 +196,7 @@ this module.) \end{memberdesc} -\begin{memberdesc}{ok_builtin_modules} +\begin{memberdesc}[RExec]{ok_builtin_modules} Contains the names of built-in modules which can be safely imported. The value for \class{RExec} is \code{('audioop', 'array', 'binascii', 'cmath', 'errno', 'imageop', 'marshal', 'math', 'md5', 'operator', @@ -205,14 +205,14 @@ applies --- use the value from the base class as a starting point. \end{memberdesc} -\begin{memberdesc}{ok_path} +\begin{memberdesc}[RExec]{ok_path} Contains the directories which will be searched when an \keyword{import} is performed in the restricted environment. The value for \class{RExec} is the same as \code{sys.path} (at the time the module is loaded) for unrestricted code. \end{memberdesc} -\begin{memberdesc}{ok_posix_names} +\begin{memberdesc}[RExec]{ok_posix_names} % Should this be called ok_os_names? Contains the names of the functions in the \refmodule{os} module which will be available to programs running in the restricted environment. The @@ -221,14 +221,14 @@ 'getcwd', 'getuid', 'getgid', 'geteuid', 'getegid')}. \end{memberdesc} -\begin{memberdesc}{ok_sys_names} +\begin{memberdesc}[RExec]{ok_sys_names} Contains the names of the functions and variables in the \refmodule{sys} module which will be available to programs running in the restricted environment. The value for \class{RExec} is \code{('ps1', 'ps2', 'copyright', 'version', 'platform', 'exit', 'maxint')}. \end{memberdesc} -\begin{memberdesc}{ok_file_types} +\begin{memberdesc}[RExec]{ok_file_types} Contains the file types from which modules are allowed to be loaded. Each file type is an integer constant defined in the \refmodule{imp} module. The meaningful values are \constant{PY_SOURCE}, \constant{PY_COMPILED}, and Modified: python/branches/bcannon-objcap/Doc/lib/librfc822.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/librfc822.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/librfc822.tex Fri May 25 22:13:08 2007 @@ -100,7 +100,7 @@ \code{'Mon, 20 Nov 1995 19:12:08 -0500'}. If it succeeds in parsing the date, \function{parsedate()} returns a 9-tuple that can be passed directly to \function{time.mktime()}; otherwise \code{None} will be -returned. Note that fields 6, 7, and 8 of the result tuple are not +returned. Note that indexes 6, 7, and 8 of the result tuple are not usable. \end{funcdesc} @@ -114,7 +114,7 @@ variable for the same timezone; the latter variable follows the \POSIX{} standard while this module follows \rfc{2822}.) If the input string has no timezone, the last element of the tuple returned is -\code{None}. Note that fields 6, 7, and 8 of the result tuple are not +\code{None}. Note that indexes 6, 7, and 8 of the result tuple are not usable. \end{funcdesc} @@ -142,12 +142,12 @@ A \class{Message} instance has the following methods: -\begin{methoddesc}{rewindbody}{} +\begin{methoddesc}[Message]{rewindbody}{} Seek to the start of the message body. This only works if the file object is seekable. \end{methoddesc} -\begin{methoddesc}{isheader}{line} +\begin{methoddesc}[Message]{isheader}{line} Returns a line's canonicalized fieldname (the dictionary key that will be used to index it) if the line is a legal \rfc{2822} header; otherwise returns \code{None} (implying that parsing should stop here and the @@ -155,33 +155,33 @@ override this method in a subclass. \end{methoddesc} -\begin{methoddesc}{islast}{line} +\begin{methoddesc}[Message]{islast}{line} Return true if the given line is a delimiter on which Message should stop. The delimiter line is consumed, and the file object's read location positioned immediately after it. By default this method just checks that the line is blank, but you can override it in a subclass. \end{methoddesc} -\begin{methoddesc}{iscomment}{line} +\begin{methoddesc}[Message]{iscomment}{line} Return \code{True} if the given line should be ignored entirely, just skipped. By default this is a stub that always returns \code{False}, but you can override it in a subclass. \end{methoddesc} -\begin{methoddesc}{getallmatchingheaders}{name} +\begin{methoddesc}[Message]{getallmatchingheaders}{name} Return a list of lines consisting of all headers matching \var{name}, if any. Each physical line, whether it is a continuation line or not, is a separate list item. Return the empty list if no header matches \var{name}. \end{methoddesc} -\begin{methoddesc}{getfirstmatchingheader}{name} +\begin{methoddesc}[Message]{getfirstmatchingheader}{name} Return a list of lines comprising the first header matching \var{name}, and its continuation line(s), if any. Return \code{None} if there is no header matching \var{name}. \end{methoddesc} -\begin{methoddesc}{getrawheader}{name} +\begin{methoddesc}[Message]{getrawheader}{name} Return a single string consisting of the text after the colon in the first header matching \var{name}. This includes leading whitespace, the trailing linefeed, and internal linefeeds and whitespace if there @@ -189,19 +189,19 @@ no header matching \var{name}. \end{methoddesc} -\begin{methoddesc}{getheader}{name\optional{, default}} +\begin{methoddesc}[Message]{getheader}{name\optional{, default}} Like \code{getrawheader(\var{name})}, but strip leading and trailing whitespace. Internal whitespace is not stripped. The optional \var{default} argument can be used to specify a different default to be returned when there is no header matching \var{name}. \end{methoddesc} -\begin{methoddesc}{get}{name\optional{, default}} +\begin{methoddesc}[Message]{get}{name\optional{, default}} An alias for \method{getheader()}, to make the interface more compatible with regular dictionaries. \end{methoddesc} -\begin{methoddesc}{getaddr}{name} +\begin{methoddesc}[Message]{getaddr}{name} Return a pair \code{(\var{full name}, \var{email address})} parsed from the string returned by \code{getheader(\var{name})}. If no header matching \var{name} exists, return \code{(None, None)}; @@ -217,7 +217,7 @@ exact same result. \end{methoddesc} -\begin{methoddesc}{getaddrlist}{name} +\begin{methoddesc}[Message]{getaddrlist}{name} This is similar to \code{getaddr(\var{list})}, but parses a header containing a list of email addresses (e.g.\ a \mailheader{To} header) and returns a list of \code{(\var{full name}, \var{email address})} pairs @@ -229,7 +229,7 @@ Any continuation lines the named headers contain are also parsed. \end{methoddesc} -\begin{methoddesc}{getdate}{name} +\begin{methoddesc}[Message]{getdate}{name} Retrieve a header using \method{getheader()} and parse it into a 9-tuple compatible with \function{time.mktime()}; note that fields 6, 7, and 8 are not usable. If there is no header matching @@ -241,7 +241,7 @@ function may occasionally yield an incorrect result. \end{methoddesc} -\begin{methoddesc}{getdate_tz}{name} +\begin{methoddesc}[Message]{getdate_tz}{name} Retrieve a header using \method{getheader()} and parse it into a 10-tuple; the first 9 elements will make a tuple compatible with \function{time.mktime()}, and the 10th is a number giving the offset @@ -270,19 +270,19 @@ Finally, \class{Message} instances have some public instance variables: -\begin{memberdesc}{headers} +\begin{memberdesc}[Message]{headers} A list containing the entire set of header lines, in the order in which they were read (except that setitem calls may disturb this order). Each line contains a trailing newline. The blank line terminating the headers is not contained in the list. \end{memberdesc} -\begin{memberdesc}{fp} +\begin{memberdesc}[Message]{fp} The file or file-like object passed at instantiation time. This can be used to read the message content. \end{memberdesc} -\begin{memberdesc}{unixfrom} +\begin{memberdesc}[Message]{unixfrom} The \UNIX{} \samp{From~} line, if the message had one, or an empty string. This is needed to regenerate the message in some contexts, such as an \code{mbox}-style mailbox file. @@ -293,34 +293,34 @@ An \class{AddressList} instance has the following methods: -\begin{methoddesc}{__len__}{} +\begin{methoddesc}[AddressList]{__len__}{} Return the number of addresses in the address list. \end{methoddesc} -\begin{methoddesc}{__str__}{} +\begin{methoddesc}[AddressList]{__str__}{} Return a canonicalized string representation of the address list. Addresses are rendered in "name" form, comma-separated. \end{methoddesc} -\begin{methoddesc}{__add__}{alist} +\begin{methoddesc}[AddressList]{__add__}{alist} Return a new \class{AddressList} instance that contains all addresses in both \class{AddressList} operands, with duplicates removed (set union). \end{methoddesc} -\begin{methoddesc}{__iadd__}{alist} +\begin{methoddesc}[AddressList]{__iadd__}{alist} In-place version of \method{__add__()}; turns this \class{AddressList} instance into the union of itself and the right-hand instance, \var{alist}. \end{methoddesc} -\begin{methoddesc}{__sub__}{alist} +\begin{methoddesc}[AddressList]{__sub__}{alist} Return a new \class{AddressList} instance that contains every address in the left-hand \class{AddressList} operand that is not present in the right-hand address operand (set difference). \end{methoddesc} -\begin{methoddesc}{__isub__}{alist} +\begin{methoddesc}[AddressList]{__isub__}{alist} In-place version of \method{__sub__()}, removing addresses in this list which are also in \var{alist}. \end{methoddesc} @@ -328,7 +328,7 @@ Finally, \class{AddressList} instances have one public instance variable: -\begin{memberdesc}{addresslist} +\begin{memberdesc}[AddressList]{addresslist} A list of tuple string pairs, one per address. In each member, the first is the canonicalized name part, the second is the actual route-address (\character{@}-separated username-host.domain Deleted: /python/branches/bcannon-objcap/Doc/lib/librgbimg.tex ============================================================================== --- /python/branches/bcannon-objcap/Doc/lib/librgbimg.tex Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,54 +0,0 @@ -\section{\module{rgbimg} --- - Read and write ``SGI RGB'' files} - -\declaremodule{builtin}{rgbimg} -\modulesynopsis{Read and write image files in ``SGI RGB'' format (the module - is \emph{not} SGI specific though!).} - -\deprecated{2.5}{This module is not maintained anymore and seems to be - unused.} - -The \module{rgbimg} module allows Python programs to access SGI imglib image -files (also known as \file{.rgb} files). The module is far from -complete, but is provided anyway since the functionality that there is -enough in some cases. Currently, colormap files are not supported. - -\note{This module is only built by default for 32-bit platforms; it is -not expected to work properly on other systems.} - -The module defines the following variables and functions: - -\begin{excdesc}{error} -This exception is raised on all errors, such as unsupported file type, etc. -\end{excdesc} - -\begin{funcdesc}{sizeofimage}{file} -This function returns a tuple \code{(\var{x}, \var{y})} where -\var{x} and \var{y} are the size of the image in pixels. -Only 4 byte RGBA pixels, 3 byte RGB pixels, and 1 byte greyscale pixels -are currently supported. -\end{funcdesc} - -\begin{funcdesc}{longimagedata}{file} -This function reads and decodes the image on the specified file, and -returns it as a Python string. The string has 4 byte RGBA pixels. -The bottom left pixel is the first in -the string. This format is suitable to pass to \function{gl.lrectwrite()}, -for instance. -\end{funcdesc} - -\begin{funcdesc}{longstoimage}{data, x, y, z, file} -This function writes the RGBA data in \var{data} to image -file \var{file}. \var{x} and \var{y} give the size of the image. -\var{z} is 1 if the saved image should be 1 byte greyscale, 3 if the -saved image should be 3 byte RGB data, or 4 if the saved images should -be 4 byte RGBA data. The input data always contains 4 bytes per pixel. -These are the formats returned by \function{gl.lrectread()}. -\end{funcdesc} - -\begin{funcdesc}{ttob}{flag} -This function sets a global flag which defines whether the scan lines -of the image are read or written from bottom to top (flag is zero, -compatible with SGI GL) or from top to bottom (flag is one, -compatible with X). The default is zero. -\end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libsched.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsched.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsched.tex Fri May 25 22:13:08 2007 @@ -48,7 +48,7 @@ \class{scheduler} instances have the following methods: -\begin{methoddesc}{enterabs}{time, priority, action, argument} +\begin{methoddesc}[scheduler]{enterabs}{time, priority, action, argument} Schedule a new event. The \var{time} argument should be a numeric type compatible with the return value of the \var{timefunc} function passed to the constructor. Events scheduled for @@ -63,23 +63,23 @@ the event (see \method{cancel()}). \end{methoddesc} -\begin{methoddesc}{enter}{delay, priority, action, argument} +\begin{methoddesc}[scheduler]{enter}{delay, priority, action, argument} Schedule an event for \var{delay} more time units. Other then the relative time, the other arguments, the effect and the return value are the same as those for \method{enterabs()}. \end{methoddesc} -\begin{methoddesc}{cancel}{event} +\begin{methoddesc}[scheduler]{cancel}{event} Remove the event from the queue. If \var{event} is not an event currently in the queue, this method will raise a \exception{RuntimeError}. \end{methoddesc} -\begin{methoddesc}{empty}{} +\begin{methoddesc}[scheduler]{empty}{} Return true if the event queue is empty. \end{methoddesc} -\begin{methoddesc}{run}{} +\begin{methoddesc}[scheduler]{run}{} Run all scheduled events. This function will wait (using the \function{delayfunc} function passed to the constructor) for the next event, then execute it and so on until there are no more Modified: python/branches/bcannon-objcap/Doc/lib/libselect.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libselect.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libselect.tex Fri May 25 22:13:08 2007 @@ -77,7 +77,7 @@ \cfunction{select()} is O(highest file descriptor), while \cfunction{poll()} is O(number of file descriptors). -\begin{methoddesc}{register}{fd\optional{, eventmask}} +\begin{methoddesc}[poll]{register}{fd\optional{, eventmask}} Register a file descriptor with the polling object. Future calls to the \method{poll()} method will then check whether the file descriptor has any pending I/O events. \var{fd} can be either an integer, or an @@ -105,7 +105,7 @@ once. \end{methoddesc} -\begin{methoddesc}{unregister}{fd} +\begin{methoddesc}[poll]{unregister}{fd} Remove a file descriptor being tracked by a polling object. Just like the \method{register()} method, \var{fd} can be an integer or an object with a \method{fileno()} method that returns an integer. @@ -114,7 +114,7 @@ causes a \exception{KeyError} exception to be raised. \end{methoddesc} -\begin{methoddesc}{poll}{\optional{timeout}} +\begin{methoddesc}[poll]{poll}{\optional{timeout}} Polls the set of registered file descriptors, and returns a possibly-empty list containing \code{(\var{fd}, \var{event})} 2-tuples for the descriptors that have events or errors to report. Modified: python/branches/bcannon-objcap/Doc/lib/libsets.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsets.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsets.tex Fri May 25 22:13:08 2007 @@ -189,13 +189,13 @@ >>> engineers.add('Marvin') # add element >>> print engineers Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) ->>> employees.issuperset(engineers) # superset test +>>> employees.issuperset(engineers) # superset test False ->>> employees.union_update(engineers) # update from another set +>>> employees.update(engineers) # update from another set >>> employees.issuperset(engineers) True >>> for group in [engineers, programmers, managers, employees]: -... group.discard('Susan') # unconditionally remove element +... group.discard('Susan') # unconditionally remove element ... print group ... Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) Modified: python/branches/bcannon-objcap/Doc/lib/libshlex.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libshlex.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libshlex.tex Fri May 25 22:13:08 2007 @@ -19,13 +19,15 @@ The \module{shlex} module defines the following functions: -\begin{funcdesc}{split}{s\optional{, comments}} +\begin{funcdesc}{split}{s\optional{, comments\optional{, posix}}} Split the string \var{s} using shell-like syntax. If \var{comments} is \constant{False} (the default), the parsing of comments in the given string will be disabled (setting the \member{commenters} member of the \class{shlex} instance to the empty string). This function operates -in \POSIX{} mode. +in \POSIX{} mode by default, but uses non-\POSIX{} mode if the +\var{posix} argument is false. \versionadded{2.3} +\versionchanged[Added the \var{posix} parameter]{2.6} \end{funcdesc} The \module{shlex} module defines the following class: @@ -58,7 +60,7 @@ A \class{shlex} instance has the following methods: -\begin{methoddesc}{get_token}{} +\begin{methoddesc}[shlex]{get_token}{} Return a token. If tokens have been stacked using \method{push_token()}, pop a token off the stack. Otherwise, read one from the input stream. If reading encounters an immediate @@ -66,17 +68,17 @@ in non-\POSIX{} mode, and \code{None} in \POSIX{} mode). \end{methoddesc} -\begin{methoddesc}{push_token}{str} +\begin{methoddesc}[shlex]{push_token}{str} Push the argument onto the token stack. \end{methoddesc} -\begin{methoddesc}{read_token}{} +\begin{methoddesc}[shlex]{read_token}{} Read a raw token. Ignore the pushback stack, and do not interpret source requests. (This is not ordinarily a useful entry point, and is documented here only for the sake of completeness.) \end{methoddesc} -\begin{methoddesc}{sourcehook}{filename} +\begin{methoddesc}[shlex]{sourcehook}{filename} When \class{shlex} detects a source request (see \member{source} below) this method is given the following token as argument, and expected to return a tuple consisting of a filename and @@ -106,7 +108,7 @@ \method{push_source()} and \method{pop_source()} methods. \end{methoddesc} -\begin{methoddesc}{push_source}{stream\optional{, filename}} +\begin{methoddesc}[shlex]{push_source}{stream\optional{, filename}} Push an input source stream onto the input stack. If the filename argument is specified it will later be available for use in error messages. This is the same method used internally by the @@ -114,14 +116,14 @@ \versionadded{2.1} \end{methoddesc} -\begin{methoddesc}{pop_source}{} +\begin{methoddesc}[shlex]{pop_source}{} Pop the last-pushed input source from the input stack. This is the same method used internally when the lexer reaches \EOF{} on a stacked input stream. \versionadded{2.1} \end{methoddesc} -\begin{methoddesc}{error_leader}{\optional{file\optional{, line}}} +\begin{methoddesc}[shlex]{error_leader}{\optional{file\optional{, line}}} This method generates an error message leader in the format of a \UNIX{} C compiler error label; the format is \code{'"\%s", line \%d: '}, where the \samp{\%s} is replaced with the name of the current source @@ -137,63 +139,63 @@ variables which either control lexical analysis or can be used for debugging: -\begin{memberdesc}{commenters} +\begin{memberdesc}[shlex]{commenters} The string of characters that are recognized as comment beginners. All characters from the comment beginner to end of line are ignored. Includes just \character{\#} by default. \end{memberdesc} -\begin{memberdesc}{wordchars} +\begin{memberdesc}[shlex]{wordchars} The string of characters that will accumulate into multi-character tokens. By default, includes all \ASCII{} alphanumerics and underscore. \end{memberdesc} -\begin{memberdesc}{whitespace} +\begin{memberdesc}[shlex]{whitespace} Characters that will be considered whitespace and skipped. Whitespace bounds tokens. By default, includes space, tab, linefeed and carriage-return. \end{memberdesc} -\begin{memberdesc}{escape} +\begin{memberdesc}[shlex]{escape} Characters that will be considered as escape. This will be only used in \POSIX{} mode, and includes just \character{\textbackslash} by default. \versionadded{2.3} \end{memberdesc} -\begin{memberdesc}{quotes} +\begin{memberdesc}[shlex]{quotes} Characters that will be considered string quotes. The token accumulates until the same quote is encountered again (thus, different quote types protect each other as in the shell.) By default, includes \ASCII{} single and double quotes. \end{memberdesc} -\begin{memberdesc}{escapedquotes} +\begin{memberdesc}[shlex]{escapedquotes} Characters in \member{quotes} that will interpret escape characters defined in \member{escape}. This is only used in \POSIX{} mode, and includes just \character{"} by default. \versionadded{2.3} \end{memberdesc} -\begin{memberdesc}{whitespace_split} +\begin{memberdesc}[shlex]{whitespace_split} If \code{True}, tokens will only be split in whitespaces. This is useful, for example, for parsing command lines with \class{shlex}, getting tokens in a similar way to shell arguments. \versionadded{2.3} \end{memberdesc} -\begin{memberdesc}{infile} +\begin{memberdesc}[shlex]{infile} The name of the current input file, as initially set at class instantiation time or stacked by later source requests. It may be useful to examine this when constructing error messages. \end{memberdesc} -\begin{memberdesc}{instream} +\begin{memberdesc}[shlex]{instream} The input stream from which this \class{shlex} instance is reading characters. \end{memberdesc} -\begin{memberdesc}{source} +\begin{memberdesc}[shlex]{source} This member is \code{None} by default. If you assign a string to it, that string will be recognized as a lexical-level inclusion request similar to the \samp{source} keyword in various shells. That is, the @@ -204,23 +206,23 @@ number of levels deep. \end{memberdesc} -\begin{memberdesc}{debug} +\begin{memberdesc}[shlex]{debug} If this member is numeric and \code{1} or more, a \class{shlex} instance will print verbose progress output on its behavior. If you need to use this, you can read the module source code to learn the details. \end{memberdesc} -\begin{memberdesc}{lineno} +\begin{memberdesc}[shlex]{lineno} Source line number (count of newlines seen so far plus one). \end{memberdesc} -\begin{memberdesc}{token} +\begin{memberdesc}[shlex]{token} The token buffer. It may be useful to examine this when catching exceptions. \end{memberdesc} -\begin{memberdesc}{eof} +\begin{memberdesc}[shlex]{eof} Token used to determine end of file. This will be set to the empty string (\code{''}), in non-\POSIX{} mode, and to \code{None} in \POSIX{} mode. Modified: python/branches/bcannon-objcap/Doc/lib/libshutil.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libshutil.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libshutil.tex Fri May 25 22:13:08 2007 @@ -34,7 +34,9 @@ is the buffer size. In particular, a negative \var{length} value means to copy the data without looping over the source data in chunks; by default the data is read in chunks to avoid uncontrolled - memory consumption. + memory consumption. Note that if the current file position of the + \var{fsrc} object is not 0, only the contents from the current file + position to the end of the file will be copied. \end{funcdesc} \begin{funcdesc}{copymode}{src, dst} @@ -44,8 +46,8 @@ \end{funcdesc} \begin{funcdesc}{copystat}{src, dst} - Copy the permission bits, last access time, and last modification - time from \var{src} to \var{dst}. The file contents, owner, and + Copy the permission bits, last access time, last modification time, + and flags from \var{src} to \var{dst}. The file contents, owner, and group are unaffected. \var{src} and \var{dst} are path names given as strings. \end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libsimplexmlrpc.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsimplexmlrpc.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsimplexmlrpc.tex Fri May 25 22:13:08 2007 @@ -15,7 +15,9 @@ \begin{classdesc}{SimpleXMLRPCServer}{addr\optional{, requestHandler\optional{, - logRequests\optional{, allow_none\optional{, encoding}}}}} + logRequests\optional{, + allow_none\optional{, + encoding}}}}} Create a new server instance. This class provides methods for registration of functions that can be called by @@ -28,8 +30,13 @@ setting this parameter to false will turn off logging. The \var{allow_none} and \var{encoding} parameters are passed on to \module{xmlrpclib} and control the XML-RPC responses that will be returned - from the server. + from the server. The \var{bind_and_activate} parameter controls whether + \method{server_bind()} and \method{server_activate()} are called immediately + by the constructor; it defaults to true. Setting it to false allows code to + manipulate the \var{allow_reuse_address} class variable before the address + is bound. \versionchanged[The \var{allow_none} and \var{encoding} parameters were added]{2.5} + \versionchanged[The \var{bind_and_activate} parameter was added]{2.6} \end{classdesc} \begin{classdesc}{CGIXMLRPCRequestHandler}{\optional{allow_none\optional{, encoding}}} @@ -101,13 +108,13 @@ \end{methoddesc} -\begin{methoddesc}{register_introspection_functions}{} +\begin{methoddesc}[SimpleXMLRPCServer]{register_introspection_functions}{} Registers the XML-RPC introspection functions \code{system.listMethods}, \code{system.methodHelp} and \code{system.methodSignature}. \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{register_multicall_functions}{} +\begin{methoddesc}[SimpleXMLRPCServer]{register_multicall_functions}{} Registers the XML-RPC multicall function system.multicall. \end{methoddesc} @@ -171,7 +178,7 @@ The \class{CGIXMLRPCRequestHandler} class can be used to handle XML-RPC requests sent to Python CGI scripts. -\begin{methoddesc}{register_function}{function\optional{, name}} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_function}{function\optional{, name}} Register a function that can respond to XML-RPC requests. If \var{name} is given, it will be the method name associated with function, otherwise \var{function.__name__} will be used. \var{name} @@ -180,7 +187,7 @@ character. \end{methoddesc} -\begin{methoddesc}{register_instance}{instance} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_instance}{instance} Register an object which is used to expose method names which have not been registered using \method{register_function()}. If instance contains a \method{_dispatch()} method, it is called with the @@ -196,17 +203,17 @@ back to the client. \end{methoddesc} -\begin{methoddesc}{register_introspection_functions}{} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_introspection_functions}{} Register the XML-RPC introspection functions \code{system.listMethods}, \code{system.methodHelp} and \code{system.methodSignature}. \end{methoddesc} -\begin{methoddesc}{register_multicall_functions}{} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_multicall_functions}{} Register the XML-RPC multicall function \code{system.multicall}. \end{methoddesc} -\begin{methoddesc}{handle_request}{\optional{request_text = None}} +\begin{methoddesc}[CGIXMLRPCRequestHandler]{handle_request}{\optional{request_text = None}} Handle a XML-RPC request. If \var{request_text} is given, it should be the POST data provided by the HTTP server, otherwise the contents of stdin will be used. Modified: python/branches/bcannon-objcap/Doc/lib/libsite.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsite.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsite.tex Fri May 25 22:13:08 2007 @@ -28,12 +28,17 @@ A path configuration file is a file whose name has the form \file{\var{package}.pth} and exists in one of the four directories -mentioned above; its contents are additional items (one -per line) to be added to \code{sys.path}. Non-existing items are -never added to \code{sys.path}, but no check is made that the item -refers to a directory (rather than a file). No item is added to -\code{sys.path} more than once. Blank lines and lines beginning with -\code{\#} are skipped. Lines starting with \code{import} are executed. +mentioned above; its contents are additional items (one per line) to +be added to \code{sys.path}. Non-existing items are never added to +\code{sys.path}, but no check is made that the item refers to a +directory (rather than a file). No item is added to \code{sys.path} +more than once. Blank lines and lines beginning with \code{\#} are +skipped. Lines starting with \code{import} (followed by space or tab) +are executed. + +\versionchanged[A space or tab is now required after the import +keyword]{2.6} + \index{package} \indexiii{path}{configuration}{file} Modified: python/branches/bcannon-objcap/Doc/lib/libsmtplib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsmtplib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsmtplib.tex Fri May 25 22:13:08 2007 @@ -15,13 +15,16 @@ (\citetitle{SMTP Service Extensions}). \begin{classdesc}{SMTP}{\optional{host\optional{, port\optional{, - local_hostname}}}} + local_hostname\optional{, timeout}}}}} A \class{SMTP} instance encapsulates an SMTP connection. It has methods that support a full repertoire of SMTP and ESMTP operations. If the optional host and port parameters are given, the SMTP \method{connect()} method is called with those parameters during initialization. An \exception{SMTPConnectError} is raised if the specified host doesn't respond correctly. +The optional \var{timeout} parameter specifies a timeout in seconds for the +connection attempt (if not specified, or passed as None, the global +default timeout setting will be used). For normal use, you should only require the initialization/connect, \method{sendmail()}, and \method{quit()} methods. An example is @@ -31,7 +34,7 @@ \begin{classdesc}{SMTP_SSL}{\optional{host\optional{, port\optional{, local_hostname\optional{, keyfile\optional{, - certfile}}}}}} + certfile\optional{, timeout}}}}}}} A \class{SMTP_SSL} instance behaves exactly the same as instances of \class{SMTP}. \class{SMTP_SSL} should be used for situations where SSL is required from the beginning of the connection and using \method{starttls()} is not appropriate. @@ -39,6 +42,26 @@ omitted, the standard SMTP-over-SSL port (465) is used. \var{keyfile} and \var{certfile} are also optional, and can contain a PEM formatted private key and certificate chain file for the SSL connection. +The optional \var{timeout} parameter specifies a timeout in seconds for the +connection attempt (if not specified, or passed as None, the global +default timeout setting will be used). +\end{classdesc} + +\begin{classdesc}{LMTP}{\optional{host\optional{, port\optional{, + local_hostname}}}} + +The LMTP protocol, which is very similar to ESMTP, is heavily based +on the standard SMTP client. It's common to use Unix sockets for LMTP, +so our connect() method must support that as well as a regular +host:port server. To specify a Unix socket, you must use an absolute +path for \var{host}, starting with a '/'. + +Authentication is supported, using the regular SMTP mechanism. When +using a Unix socket, LMTP generally don't support or require any +authentication, but your mileage might vary. + +\versionadded{2.6} + \end{classdesc} A nice selection of exceptions is defined as well: @@ -103,13 +126,13 @@ An \class{SMTP} instance has the following methods: -\begin{methoddesc}{set_debuglevel}{level} +\begin{methoddesc}[SMTP]{set_debuglevel}{level} Set the debug output level. A true value for \var{level} results in debug messages for connection and for all messages sent to and received from the server. \end{methoddesc} -\begin{methoddesc}{connect}{\optional{host\optional{, port}}} +\begin{methoddesc}[SMTP]{connect}{\optional{host\optional{, port}}} Connect to a host on a given port. The defaults are to connect to the local host at the standard SMTP port (25). If the hostname ends with a colon (\character{:}) followed by a @@ -119,7 +142,7 @@ host is specified during instantiation. \end{methoddesc} -\begin{methoddesc}{docmd}{cmd, \optional{, argstring}} +\begin{methoddesc}[SMTP]{docmd}{cmd, \optional{, argstring}} Send a command \var{cmd} to the server. The optional argument \var{argstring} is simply concatenated to the command, separated by a space. @@ -136,7 +159,7 @@ \exception{SMTPServerDisconnected} will be raised. \end{methoddesc} -\begin{methoddesc}{helo}{\optional{hostname}} +\begin{methoddesc}[SMTP]{helo}{\optional{hostname}} Identify yourself to the SMTP server using \samp{HELO}. The hostname argument defaults to the fully qualified domain name of the local host. @@ -146,7 +169,7 @@ when necessary. \end{methoddesc} -\begin{methoddesc}{ehlo}{\optional{hostname}} +\begin{methoddesc}[SMTP]{ehlo}{\optional{hostname}} Identify yourself to an ESMTP server using \samp{EHLO}. The hostname argument defaults to the fully qualified domain name of the local host. Examine the response for ESMTP option and store them for use by @@ -157,13 +180,13 @@ will be implicitly called by \method{sendmail()} when necessary. \end{methoddesc} -\begin{methoddesc}{has_extn}{name} +\begin{methoddesc}[SMTP]{has_extn}{name} Return \constant{True} if \var{name} is in the set of SMTP service extensions returned by the server, \constant{False} otherwise. Case is ignored. \end{methoddesc} -\begin{methoddesc}{verify}{address} +\begin{methoddesc}[SMTP]{verify}{address} Check the validity of an address on this server using SMTP \samp{VRFY}. Returns a tuple consisting of code 250 and a full \rfc{822} address (including human name) if the user address is valid. Otherwise returns @@ -172,7 +195,7 @@ \note{Many sites disable SMTP \samp{VRFY} in order to foil spammers.} \end{methoddesc} -\begin{methoddesc}{login}{user, password} +\begin{methoddesc}[SMTP]{login}{user, password} Log in on an SMTP server that requires authentication. The arguments are the username and the password to authenticate with. If there has been no previous \samp{EHLO} or \samp{HELO} command this @@ -190,7 +213,7 @@ \end{description} \end{methoddesc} -\begin{methoddesc}{starttls}{\optional{keyfile\optional{, certfile}}} +\begin{methoddesc}[SMTP]{starttls}{\optional{keyfile\optional{, certfile}}} Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP commands that follow will be encrypted. You should then call \method{ehlo()} again. @@ -199,8 +222,8 @@ the \refmodule{socket} module's \function{ssl()} function. \end{methoddesc} -\begin{methoddesc}{sendmail}{from_addr, to_addrs, msg\optional{, - mail_options, rcpt_options}} +\begin{methoddesc}[SMTP]{sendmail}{from_addr, to_addrs, msg\optional{, + mail_options, rcpt_options}} Send mail. The required arguments are an \rfc{822} from-address string, a list of \rfc{822} to-address strings (a bare string will be treated as a list with 1 address), and a message string. The caller @@ -256,7 +279,7 @@ \end{methoddesc} -\begin{methoddesc}{quit}{} +\begin{methoddesc}[SMTP]{quit}{} Terminate the SMTP session and close the connection. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libsocket.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsocket.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsocket.tex Fri May 25 22:13:08 2007 @@ -14,7 +14,7 @@ papers: \citetitle{An Introductory 4.3BSD Interprocess Communication Tutorial}, by Stuart Sechrest and \citetitle{An Advanced 4.3BSD Interprocess Communication Tutorial}, by Samuel J. Leffler et al, -both in the \citetitle{\UNIX{} Programmer's Manual, Supplementary Documents 1} +both in the \citetitle{UNIX Programmer's Manual, Supplementary Documents 1} (sections PS1:7 and PS1:8). The platform-specific reference material for the various socket-related system calls are also a valuable source of information on the details of socket semantics. For \UNIX, refer @@ -170,6 +170,15 @@ \versionadded{2.3} \end{datadesc} +\begin{funcdesc}{create_connection}{address\optional{, timeout}} +Connects to the \var{address} received (as usual, a \code{(host, port)} +pair), with an optional timeout for the connection. Specially useful for +higher-level protocols, it is not normally used directly from +application-level code. Passing the optional \var{timeout} parameter +will set the timeout on the socket instance (if it is not given or +\code{None}, the global default timeout setting is used). +\end{funcdesc} + \begin{funcdesc}{getaddrinfo}{host, port\optional{, family\optional{, socktype\optional{, proto\optional{, flags}}}}} @@ -548,7 +557,7 @@ The file object references a \cfunction{dup()}ped version of the socket file descriptor, so the file object and socket object may be closed or garbage-collected independently. -The socket must be in blocking mode. +The socket must be in blocking mode (it can not have a timeout). \index{I/O control!buffering}The optional \var{mode} and \var{bufsize} arguments are interpreted the same way as by the built-in \function{file()} function; see ``Built-in Functions'' @@ -584,6 +593,7 @@ \manpage{recv}{2} for the meaning of the optional argument \var{flags}; it defaults to zero. (The format of \var{address} depends on the address family --- see above.) +\versionadded{2.5} \end{methoddesc} \begin{methoddesc}[socket]{recv_into}{buffer\optional{, nbytes\optional{, flags}}} @@ -593,6 +603,7 @@ receive up to the size available in the given buffer. See the \UNIX{} manual page \manpage{recv}{2} for the meaning of the optional argument \var{flags}; it defaults to zero. +\versionadded{2.5} \end{methoddesc} \begin{methoddesc}[socket]{send}{string\optional{, flags}} @@ -722,23 +733,23 @@ SSL objects have the following methods. -\begin{methoddesc}{write}{s} +\begin{methoddesc}[SSL]{write}{s} Writes the string \var{s} to the on the object's SSL connection. The return value is the number of bytes written. \end{methoddesc} -\begin{methoddesc}{read}{\optional{n}} +\begin{methoddesc}[SSL]{read}{\optional{n}} If \var{n} is provided, read \var{n} bytes from the SSL connection, otherwise read until EOF. The return value is a string of the bytes read. \end{methoddesc} -\begin{methoddesc}{server}{} +\begin{methoddesc}[SSL]{server}{} Returns a string describing the server's certificate. Useful for debugging purposes; do not parse the content of this string because its format can't be parsed unambiguously. \end{methoddesc} -\begin{methoddesc}{issuer}{} +\begin{methoddesc}[SSL]{issuer}{} Returns a string describing the issuer of the server's certificate. Useful for debugging purposes; do not parse the content of this string because its format can't be parsed unambiguously. Modified: python/branches/bcannon-objcap/Doc/lib/libsqlite3.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsqlite3.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsqlite3.tex Fri May 25 22:13:08 2007 @@ -210,37 +210,37 @@ A \class{Connection} instance has the following attributes and methods: \label{sqlite3-Connection-IsolationLevel} -\begin{memberdesc}{isolation_level} +\begin{memberdesc}[Connection]{isolation_level} Get or set the current isolation level. None for autocommit mode or one of "DEFERRED", "IMMEDIATE" or "EXLUSIVE". See ``Controlling Transactions'', section~\ref{sqlite3-Controlling-Transactions}, for a more detailed explanation. \end{memberdesc} -\begin{methoddesc}{cursor}{\optional{cursorClass}} +\begin{methoddesc}[Connection]{cursor}{\optional{cursorClass}} The cursor method accepts a single optional parameter \var{cursorClass}. If supplied, this must be a custom cursor class that extends \class{sqlite3.Cursor}. \end{methoddesc} -\begin{methoddesc}{execute}{sql, \optional{parameters}} +\begin{methoddesc}[Connection]{execute}{sql, \optional{parameters}} This is a nonstandard shortcut that creates an intermediate cursor object by calling the cursor method, then calls the cursor's \method{execute} method with the parameters given. \end{methoddesc} -\begin{methoddesc}{executemany}{sql, \optional{parameters}} +\begin{methoddesc}[Connection]{executemany}{sql, \optional{parameters}} This is a nonstandard shortcut that creates an intermediate cursor object by calling the cursor method, then calls the cursor's \method{executemany} method with the parameters given. \end{methoddesc} -\begin{methoddesc}{executescript}{sql_script} +\begin{methoddesc}[Connection]{executescript}{sql_script} This is a nonstandard shortcut that creates an intermediate cursor object by calling the cursor method, then calls the cursor's \method{executescript} method with the parameters given. \end{methoddesc} -\begin{methoddesc}{create_function}{name, num_params, func} +\begin{methoddesc}[Connection]{create_function}{name, num_params, func} Creates a user-defined function that you can later use from within SQL statements under the function name \var{name}. \var{num_params} is the number @@ -255,7 +255,7 @@ \verbatiminput{sqlite3/md5func.py} \end{methoddesc} -\begin{methoddesc}{create_aggregate}{name, num_params, aggregate_class} +\begin{methoddesc}[Connection]{create_aggregate}{name, num_params, aggregate_class} Creates a user-defined aggregate function. @@ -271,7 +271,7 @@ \verbatiminput{sqlite3/mysumaggr.py} \end{methoddesc} -\begin{methoddesc}{create_collation}{name, callable} +\begin{methoddesc}[Connection]{create_collation}{name, callable} Creates a collation with the specified \var{name} and \var{callable}. The callable will be passed two string arguments. It should return -1 if the first @@ -293,14 +293,14 @@ \end{verbatim} \end{methoddesc} -\begin{methoddesc}{interrupt}{} +\begin{methoddesc}[Connection]{interrupt}{} You can call this method from a different thread to abort any queries that might be executing on the connection. The query will then abort and the caller will get an exception. \end{methoddesc} -\begin{methoddesc}{set_authorizer}{authorizer_callback} +\begin{methoddesc}[Connection]{set_authorizer}{authorizer_callback} This routine registers a callback. The callback is invoked for each attempt to access a column of a table in the database. The callback should return @@ -322,7 +322,7 @@ module. \end{methoddesc} -\begin{memberdesc}{row_factory} +\begin{memberdesc}[Connection]{row_factory} You can change this attribute to a callable that accepts the cursor and the original row as a tuple and will return the real result row. This way, you can implement more advanced ways of returning results, such @@ -341,7 +341,7 @@ % XXX what's a db_row-based solution? \end{memberdesc} -\begin{memberdesc}{text_factory} +\begin{memberdesc}[Connection]{text_factory} Using this attribute you can control what objects are returned for the TEXT data type. By default, this attribute is set to \class{unicode} and the \module{sqlite3} module will return Unicode objects for TEXT. If you want to return @@ -359,7 +359,7 @@ \verbatiminput{sqlite3/text_factory.py} \end{memberdesc} -\begin{memberdesc}{total_changes} +\begin{memberdesc}[Connection]{total_changes} Returns the total number of database rows that have been modified, inserted, or deleted since the database connection was opened. \end{memberdesc} @@ -372,7 +372,7 @@ A \class{Cursor} instance has the following attributes and methods: -\begin{methoddesc}{execute}{sql, \optional{parameters}} +\begin{methoddesc}[Cursor]{execute}{sql, \optional{parameters}} Executes a SQL statement. The SQL statement may be parametrized (i. e. placeholders instead of SQL literals). The \module{sqlite3} module supports two kinds of @@ -394,7 +394,7 @@ \end{methoddesc} -\begin{methoddesc}{executemany}{sql, seq_of_parameters} +\begin{methoddesc}[Cursor]{executemany}{sql, seq_of_parameters} Executes a SQL command against all parameter sequences or mappings found in the sequence \var{sql}. The \module{sqlite3} module also allows using an iterator yielding parameters instead of a sequence. @@ -406,7 +406,7 @@ \verbatiminput{sqlite3/executemany_2.py} \end{methoddesc} -\begin{methoddesc}{executescript}{sql_script} +\begin{methoddesc}[Cursor]{executescript}{sql_script} This is a nonstandard convenience method for executing multiple SQL statements at once. It issues a COMMIT statement first, then executes the SQL script it @@ -419,7 +419,7 @@ \verbatiminput{sqlite3/executescript.py} \end{methoddesc} -\begin{memberdesc}{rowcount} +\begin{memberdesc}[Cursor]{rowcount} Although the \class{Cursor} class of the \module{sqlite3} module implements this attribute, the database engine's own support for the determination of "rows affected"/"rows selected" is quirky. Modified: python/branches/bcannon-objcap/Doc/lib/libstdtypes.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libstdtypes.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libstdtypes.tex Fri May 25 22:13:08 2007 @@ -572,25 +572,25 @@ These are the string methods which both 8-bit strings and Unicode objects support: -\begin{methoddesc}[string]{capitalize}{} +\begin{methoddesc}[str]{capitalize}{} Return a copy of the string with only its first character capitalized. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{center}{width\optional{, fillchar}} +\begin{methoddesc}[str]{center}{width\optional{, fillchar}} Return centered in a string of length \var{width}. Padding is done using the specified \var{fillchar} (default is a space). \versionchanged[Support for the \var{fillchar} argument]{2.4} \end{methoddesc} -\begin{methoddesc}[string]{count}{sub\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{count}{sub\optional{, start\optional{, end}}} Return the number of occurrences of substring \var{sub} in string S\code{[\var{start}:\var{end}]}. Optional arguments \var{start} and \var{end} are interpreted as in slice notation. \end{methoddesc} -\begin{methoddesc}[string]{decode}{\optional{encoding\optional{, errors}}} +\begin{methoddesc}[str]{decode}{\optional{encoding\optional{, errors}}} Decodes the string using the codec registered for \var{encoding}. \var{encoding} defaults to the default string encoding. \var{errors} may be given to set a different error handling scheme. The default is @@ -602,7 +602,7 @@ \versionchanged[Support for other error handling schemes added]{2.3} \end{methoddesc} -\begin{methoddesc}[string]{encode}{\optional{encoding\optional{,errors}}} +\begin{methoddesc}[str]{encode}{\optional{encoding\optional{,errors}}} Return an encoded version of the string. Default encoding is the current default string encoding. \var{errors} may be given to set a different error handling scheme. The default for \var{errors} is @@ -617,7 +617,7 @@ \code{'backslashreplace'} and other error handling schemes added]{2.3} \end{methoddesc} -\begin{methoddesc}[string]{endswith}{suffix\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{endswith}{suffix\optional{, start\optional{, end}}} Return \code{True} if the string ends with the specified \var{suffix}, otherwise return \code{False}. \var{suffix} can also be a tuple of suffixes to look for. With optional \var{start}, test beginning at @@ -626,13 +626,13 @@ \versionchanged[Accept tuples as \var{suffix}]{2.5} \end{methoddesc} -\begin{methoddesc}[string]{expandtabs}{\optional{tabsize}} +\begin{methoddesc}[str]{expandtabs}{\optional{tabsize}} Return a copy of the string where all tab characters are expanded using spaces. If \var{tabsize} is not given, a tab size of \code{8} characters is assumed. \end{methoddesc} -\begin{methoddesc}[string]{find}{sub\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{find}{sub\optional{, start\optional{, end}}} Return the lowest index in the string where substring \var{sub} is found, such that \var{sub} is contained in the range [\var{start}, \var{end}]. Optional arguments \var{start} and \var{end} are @@ -640,47 +640,47 @@ not found. \end{methoddesc} -\begin{methoddesc}[string]{index}{sub\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{index}{sub\optional{, start\optional{, end}}} Like \method{find()}, but raise \exception{ValueError} when the substring is not found. \end{methoddesc} -\begin{methoddesc}[string]{isalnum}{} +\begin{methoddesc}[str]{isalnum}{} Return true if all characters in the string are alphanumeric and there is at least one character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{isalpha}{} +\begin{methoddesc}[str]{isalpha}{} Return true if all characters in the string are alphabetic and there is at least one character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{isdigit}{} +\begin{methoddesc}[str]{isdigit}{} Return true if all characters in the string are digits and there is at least one character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{islower}{} +\begin{methoddesc}[str]{islower}{} Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{isspace}{} +\begin{methoddesc}[str]{isspace}{} Return true if there are only whitespace characters in the string and there is at least one character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{istitle}{} +\begin{methoddesc}[str]{istitle}{} Return true if the string is a titlecased string and there is at least one character, for example uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return false @@ -689,20 +689,20 @@ For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{isupper}{} +\begin{methoddesc}[str]{isupper}{} Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{join}{seq} +\begin{methoddesc}[str]{join}{seq} Return a string which is the concatenation of the strings in the sequence \var{seq}. The separator between elements is the string providing this method. \end{methoddesc} -\begin{methoddesc}[string]{ljust}{width\optional{, fillchar}} +\begin{methoddesc}[str]{ljust}{width\optional{, fillchar}} Return the string left justified in a string of length \var{width}. Padding is done using the specified \var{fillchar} (default is a space). The original string is returned if @@ -710,13 +710,13 @@ \versionchanged[Support for the \var{fillchar} argument]{2.4} \end{methoddesc} -\begin{methoddesc}[string]{lower}{} +\begin{methoddesc}[str]{lower}{} Return a copy of the string converted to lowercase. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{lstrip}{\optional{chars}} +\begin{methoddesc}[str]{lstrip}{\optional{chars}} Return a copy of the string with leading characters removed. The \var{chars} argument is a string specifying the set of characters to be removed. If omitted or \code{None}, the \var{chars} argument @@ -731,7 +731,7 @@ \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} -\begin{methoddesc}[string]{partition}{sep} +\begin{methoddesc}[str]{partition}{sep} Split the string at the first occurrence of \var{sep}, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not @@ -740,26 +740,26 @@ \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}[string]{replace}{old, new\optional{, count}} +\begin{methoddesc}[str]{replace}{old, new\optional{, count}} Return a copy of the string with all occurrences of substring \var{old} replaced by \var{new}. If the optional argument \var{count} is given, only the first \var{count} occurrences are replaced. \end{methoddesc} -\begin{methoddesc}[string]{rfind}{sub \optional{,start \optional{,end}}} +\begin{methoddesc}[str]{rfind}{sub \optional{,start \optional{,end}}} Return the highest index in the string where substring \var{sub} is found, such that \var{sub} is contained within s[start,end]. Optional arguments \var{start} and \var{end} are interpreted as in slice notation. Return \code{-1} on failure. \end{methoddesc} -\begin{methoddesc}[string]{rindex}{sub\optional{, start\optional{, end}}} +\begin{methoddesc}[str]{rindex}{sub\optional{, start\optional{, end}}} Like \method{rfind()} but raises \exception{ValueError} when the substring \var{sub} is not found. \end{methoddesc} -\begin{methoddesc}[string]{rjust}{width\optional{, fillchar}} +\begin{methoddesc}[str]{rjust}{width\optional{, fillchar}} Return the string right justified in a string of length \var{width}. Padding is done using the specified \var{fillchar} (default is a space). The original string is returned if @@ -767,7 +767,7 @@ \versionchanged[Support for the \var{fillchar} argument]{2.4} \end{methoddesc} -\begin{methoddesc}[string]{rpartition}{sep} +\begin{methoddesc}[str]{rpartition}{sep} Split the string at the last occurrence of \var{sep}, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not @@ -776,7 +776,7 @@ \versionadded{2.5} \end{methoddesc} -\begin{methoddesc}[string]{rsplit}{\optional{sep \optional{,maxsplit}}} +\begin{methoddesc}[str]{rsplit}{\optional{sep \optional{,maxsplit}}} Return a list of the words in the string, using \var{sep} as the delimiter string. If \var{maxsplit} is given, at most \var{maxsplit} splits are done, the \emph{rightmost} ones. If \var{sep} is not specified @@ -786,7 +786,7 @@ \versionadded{2.4} \end{methoddesc} -\begin{methoddesc}[string]{rstrip}{\optional{chars}} +\begin{methoddesc}[str]{rstrip}{\optional{chars}} Return a copy of the string with trailing characters removed. The \var{chars} argument is a string specifying the set of characters to be removed. If omitted or \code{None}, the \var{chars} argument @@ -801,7 +801,7 @@ \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} -\begin{methoddesc}[string]{split}{\optional{sep \optional{,maxsplit}}} +\begin{methoddesc}[str]{split}{\optional{sep \optional{,maxsplit}}} Return a list of the words in the string, using \var{sep} as the delimiter string. If \var{maxsplit} is given, at most \var{maxsplit} splits are done. (thus, the list will have at most \code{\var{maxsplit}+1} @@ -824,13 +824,13 @@ returns an empty list. \end{methoddesc} -\begin{methoddesc}[string]{splitlines}{\optional{keepends}} +\begin{methoddesc}[str]{splitlines}{\optional{keepends}} Return a list of the lines in the string, breaking at line boundaries. Line breaks are not included in the resulting list unless \var{keepends} is given and true. \end{methoddesc} -\begin{methoddesc}[string]{startswith}{prefix\optional{, +\begin{methoddesc}[str]{startswith}{prefix\optional{, start\optional{, end}}} Return \code{True} if string starts with the \var{prefix}, otherwise return \code{False}. \var{prefix} can also be a tuple of @@ -841,7 +841,7 @@ \versionchanged[Accept tuples as \var{prefix}]{2.5} \end{methoddesc} -\begin{methoddesc}[string]{strip}{\optional{chars}} +\begin{methoddesc}[str]{strip}{\optional{chars}} Return a copy of the string with the leading and trailing characters removed. The \var{chars} argument is a string specifying the set of characters to be removed. If omitted or \code{None}, the \var{chars} @@ -856,21 +856,21 @@ \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} -\begin{methoddesc}[string]{swapcase}{} +\begin{methoddesc}[str]{swapcase}{} Return a copy of the string with uppercase characters converted to lowercase and vice versa. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{title}{} +\begin{methoddesc}[str]{title}{} Return a titlecased version of the string: words start with uppercase characters, all remaining cased characters are lowercase. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{translate}{table\optional{, deletechars}} +\begin{methoddesc}[str]{translate}{table\optional{, deletechars}} Return a copy of the string where all characters occurring in the optional argument \var{deletechars} are removed, and the remaining characters have been mapped through the given translation table, which @@ -878,6 +878,13 @@ You can use the \function{maketrans()} helper function in the \refmodule{string} module to create a translation table. +For string objects, set the \var{table} argument to \code{None} +for translations that only delete characters: +\begin{verbatim} + >>> 'read this short text'.translate(None, 'aeiou') + 'rd ths shrt txt' +\end{verbatim} +\versionadded[Support for a \code{None} \var{table} argument]{2.6} For Unicode objects, the \method{translate()} method does not accept the optional \var{deletechars} argument. Instead, it @@ -890,13 +897,13 @@ \module{encodings.cp1251} for an example). \end{methoddesc} -\begin{methoddesc}[string]{upper}{} +\begin{methoddesc}[str]{upper}{} Return a copy of the string converted to uppercase. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{zfill}{width} +\begin{methoddesc}[str]{zfill}{width} Return the numeric string left filled with zeros in a string of length \var{width}. The original string is returned if \var{width} is less than \code{len(\var{s})}. @@ -1224,7 +1231,7 @@ \label{types-set}} \obindex{set} -A \dfn{set} object is an unordered collection of immutable values. +A \dfn{set} object is an unordered collection of distinct hashable objects. Common uses include membership testing, removing duplicates from a sequence, and computing mathematical operations such as intersection, union, difference, and symmetric difference. @@ -1489,7 +1496,7 @@ \item[(5)] \function{setdefault()} is like \function{get()}, except that if \var{k} is missing, \var{x} is both returned and inserted into -the dictionary as the value of \var{k}. \var{x} defaults to \var{None}. +the dictionary as the value of \var{k}. \var{x} defaults to \code{None}. \item[(6)] \function{popitem()} is useful to destructively iterate over a dictionary, as often used in set algorithms. If the dictionary @@ -1615,14 +1622,15 @@ iterator, typically in a \keyword{for} loop (for example, \code{for line in f: print line}), the \method{next()} method is called repeatedly. This method returns the next input line, or raises -\exception{StopIteration} when \EOF{} is hit. In order to make a -\keyword{for} loop the most efficient way of looping over the lines of -a file (a very common operation), the \method{next()} method uses a -hidden read-ahead buffer. As a consequence of using a read-ahead -buffer, combining \method{next()} with other file methods (like -\method{readline()}) does not work right. However, using -\method{seek()} to reposition the file to an absolute position will -flush the read-ahead buffer. +\exception{StopIteration} when \EOF{} is hit when the file is open for +reading (behavior is undefined when the file is open for writing). In +order to make a \keyword{for} loop the most efficient way of looping +over the lines of a file (a very common operation), the +\method{next()} method uses a hidden read-ahead buffer. As a +consequence of using a read-ahead buffer, combining \method{next()} +with other file methods (like \method{readline()}) does not work +right. However, using \method{seek()} to reposition the file to an +absolute position will flush the read-ahead buffer. \versionadded{2.3} \end{methoddesc} @@ -1847,7 +1855,7 @@ expection that occurred should be suppressed. If an exception occurred while executing the body of the \keyword{with} statement, the arguments contain the exception type, value and traceback information. - Otherwise, all three arguments are \var{None}. + Otherwise, all three arguments are \code{None}. Returning a true value from this method will cause the \keyword{with} statement to suppress the exception and continue execution with the Deleted: /python/branches/bcannon-objcap/Doc/lib/libstdwin.tex ============================================================================== --- /python/branches/bcannon-objcap/Doc/lib/libstdwin.tex Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,832 +0,0 @@ -\chapter{Standard Windowing Interface} - -The modules in this chapter are available only on those systems where -the STDWIN library is available. STDWIN runs on \UNIX{} under X11 and -on the Macintosh. See CWI report CS-R8817. - -\warning{Using STDWIN is not recommended for new -applications. It has never been ported to Microsoft Windows or -Windows NT, and for X11 or the Macintosh it lacks important -functionality --- in particular, it has no tools for the construction -of dialogs. For most platforms, alternative, native solutions exist -(though none are currently documented in this manual): Tkinter for -\UNIX{} under X11, native Xt with Motif or Athena widgets for \UNIX{} -under X11, Win32 for Windows and Windows NT, and a collection of -native toolkit interfaces for the Macintosh.} - - -\section{\module{stdwin} --- - Platform-independent Graphical User Interface System} - -\declaremodule{builtin}{stdwin} -\modulesynopsis{Older graphical user interface system for X11 and Macintosh.} - - -This module defines several new object types and functions that -provide access to the functionality of STDWIN. - -On \UNIX{} running X11, it can only be used if the \envvar{DISPLAY} -environment variable is set or an explicit -\programopt{-display} \var{displayname} argument is passed to the -Python interpreter. - -Functions have names that usually resemble their C STDWIN counterparts -with the initial `w' dropped. Points are represented by pairs of -integers; rectangles by pairs of points. For a complete description -of STDWIN please refer to the documentation of STDWIN for C -programmers (aforementioned CWI report). - -\subsection{Functions Defined in Module \module{stdwin}} -\nodename{STDWIN Functions} - -The following functions are defined in the \module{stdwin} module: - -\begin{funcdesc}{open}{title} -Open a new window whose initial title is given by the string argument. -Return a window object; window object methods are described -below.\footnote{ - The Python version of STDWIN does not support draw procedures; - all drawing requests are reported as draw events.} -\end{funcdesc} - -\begin{funcdesc}{getevent}{} -Wait for and return the next event. -An event is returned as a triple: the first element is the event -type, a small integer; the second element is the window object to which -the event applies, or -\code{None} -if it applies to no window in particular; -the third element is type-dependent. -Names for event types and command codes are defined in the standard -module \refmodule{stdwinevents}. -\end{funcdesc} - -\begin{funcdesc}{pollevent}{} -Return the next event, if one is immediately available. -If no event is available, return \code{()}. -\end{funcdesc} - -\begin{funcdesc}{getactive}{} -Return the window that is currently active, or \code{None} if no -window is currently active. (This can be emulated by monitoring -WE_ACTIVATE and WE_DEACTIVATE events.) -\end{funcdesc} - -\begin{funcdesc}{listfontnames}{pattern} -Return the list of font names in the system that match the pattern (a -string). The pattern should normally be \code{'*'}; returns all -available fonts. If the underlying window system is X11, other -patterns follow the standard X11 font selection syntax (as used e.g. -in resource definitions), i.e. the wildcard character \code{'*'} -matches any sequence of characters (including none) and \code{'?'} -matches any single character. -On the Macintosh this function currently returns an empty list. -\end{funcdesc} - -\begin{funcdesc}{setdefscrollbars}{hflag, vflag} -Set the flags controlling whether subsequently opened windows will -have horizontal and/or vertical scroll bars. -\end{funcdesc} - -\begin{funcdesc}{setdefwinpos}{h, v} -Set the default window position for windows opened subsequently. -\end{funcdesc} - -\begin{funcdesc}{setdefwinsize}{width, height} -Set the default window size for windows opened subsequently. -\end{funcdesc} - -\begin{funcdesc}{getdefscrollbars}{} -Return the flags controlling whether subsequently opened windows will -have horizontal and/or vertical scroll bars. -\end{funcdesc} - -\begin{funcdesc}{getdefwinpos}{} -Return the default window position for windows opened subsequently. -\end{funcdesc} - -\begin{funcdesc}{getdefwinsize}{} -Return the default window size for windows opened subsequently. -\end{funcdesc} - -\begin{funcdesc}{getscrsize}{} -Return the screen size in pixels. -\end{funcdesc} - -\begin{funcdesc}{getscrmm}{} -Return the screen size in millimetres. -\end{funcdesc} - -\begin{funcdesc}{fetchcolor}{colorname} -Return the pixel value corresponding to the given color name. -Return the default foreground color for unknown color names. -Hint: the following code tests whether you are on a machine that -supports more than two colors: -\begin{verbatim} -if stdwin.fetchcolor('black') <> \ - stdwin.fetchcolor('red') <> \ - stdwin.fetchcolor('white'): - print 'color machine' -else: - print 'monochrome machine' -\end{verbatim} -\end{funcdesc} - -\begin{funcdesc}{setfgcolor}{pixel} -Set the default foreground color. -This will become the default foreground color of windows opened -subsequently, including dialogs. -\end{funcdesc} - -\begin{funcdesc}{setbgcolor}{pixel} -Set the default background color. -This will become the default background color of windows opened -subsequently, including dialogs. -\end{funcdesc} - -\begin{funcdesc}{getfgcolor}{} -Return the pixel value of the current default foreground color. -\end{funcdesc} - -\begin{funcdesc}{getbgcolor}{} -Return the pixel value of the current default background color. -\end{funcdesc} - -\begin{funcdesc}{setfont}{fontname} -Set the current default font. -This will become the default font for windows opened subsequently, -and is also used by the text measuring functions \function{textwidth()}, -\function{textbreak()}, \function{lineheight()} and -\function{baseline()} below. This accepts two more optional -parameters, size and style: Size is the font size (in `points'). -Style is a single character specifying the style, as follows: -\code{'b'} = bold, -\code{'i'} = italic, -\code{'o'} = bold + italic, -\code{'u'} = underline; -default style is roman. -Size and style are ignored under X11 but used on the Macintosh. -(Sorry for all this complexity --- a more uniform interface is being designed.) -\end{funcdesc} - -\begin{funcdesc}{menucreate}{title} -Create a menu object referring to a global menu (a menu that appears in -all windows). -Methods of menu objects are described below. -Note: normally, menus are created locally; see the window method -\method{menucreate()} below. -\warning{The menu only appears in a window as long as the object -returned by this call exists.} -\end{funcdesc} - -\begin{funcdesc}{newbitmap}{width, height} -Create a new bitmap object of the given dimensions. -Methods of bitmap objects are described below. -Not available on the Macintosh. -\end{funcdesc} - -\begin{funcdesc}{fleep}{} -Cause a beep or bell (or perhaps a `visual bell' or flash, hence the -name). -\end{funcdesc} - -\begin{funcdesc}{message}{string} -Display a dialog box containing the string. -The user must click OK before the function returns. -\end{funcdesc} - -\begin{funcdesc}{askync}{prompt, default} -Display a dialog that prompts the user to answer a question with yes or -no. Return 0 for no, 1 for yes. If the user hits the Return key, the -default (which must be 0 or 1) is returned. If the user cancels the -dialog, \exception{KeyboardInterrupt} is raised. -\end{funcdesc} - -\begin{funcdesc}{askstr}{prompt, default} -Display a dialog that prompts the user for a string. -If the user hits the Return key, the default string is returned. -If the user cancels the dialog, \exception{KeyboardInterrupt} is -raised. -\end{funcdesc} - -\begin{funcdesc}{askfile}{prompt, default, new} -Ask the user to specify a filename. If \var{new} is zero it must be -an existing file; otherwise, it must be a new file. If the user -cancels the dialog, \exception{KeyboardInterrupt} is raised. -\end{funcdesc} - -\begin{funcdesc}{setcutbuffer}{i, string} -Store the string in the system's cut buffer number \var{i}, where it -can be found (for pasting) by other applications. On X11, there are 8 -cut buffers (numbered 0..7). Cut buffer number 0 is the `clipboard' -on the Macintosh. -\end{funcdesc} - -\begin{funcdesc}{getcutbuffer}{i} -Return the contents of the system's cut buffer number \var{i}. -\end{funcdesc} - -\begin{funcdesc}{rotatecutbuffers}{n} -On X11, rotate the 8 cut buffers by \var{n}. Ignored on the -Macintosh. -\end{funcdesc} - -\begin{funcdesc}{getselection}{i} -Return X11 selection number \var{i.} Selections are not cut buffers. -Selection numbers are defined in module \refmodule{stdwinevents}. -Selection \constant{WS_PRIMARY} is the \dfn{primary} selection (used -by \program{xterm}, for instance); selection \constant{WS_SECONDARY} -is the \dfn{secondary} selection; selection \constant{WS_CLIPBOARD} is -the \dfn{clipboard} selection (used by \program{xclipboard}). On the -Macintosh, this always returns an empty string. -\end{funcdesc} - -\begin{funcdesc}{resetselection}{i} -Reset selection number \var{i}, if this process owns it. (See window -method \method{setselection()}). -\end{funcdesc} - -\begin{funcdesc}{baseline}{} -Return the baseline of the current font (defined by STDWIN as the -vertical distance between the baseline and the top of the -characters). -\end{funcdesc} - -\begin{funcdesc}{lineheight}{} -Return the total line height of the current font. -\end{funcdesc} - -\begin{funcdesc}{textbreak}{str, width} -Return the number of characters of the string that fit into a space of -\var{width} -bits wide when drawn in the current font. -\end{funcdesc} - -\begin{funcdesc}{textwidth}{str} -Return the width in bits of the string when drawn in the current font. -\end{funcdesc} - -\begin{funcdesc}{connectionnumber}{} -\funcline{fileno}{} -(X11 under \UNIX{} only) Return the ``connection number'' used by the -underlying X11 implementation. (This is normally the file number of -the socket.) Both functions return the same value; -\method{connectionnumber()} is named after the corresponding function in -X11 and STDWIN, while \method{fileno()} makes it possible to use the -\module{stdwin} module as a ``file'' object parameter to -\function{select.select()}. Note that if \constant{select()} implies that -input is possible on \module{stdwin}, this does not guarantee that an -event is ready --- it may be some internal communication going on -between the X server and the client library. Thus, you should call -\function{stdwin.pollevent()} until it returns \code{None} to check for -events if you don't want your program to block. Because of internal -buffering in X11, it is also possible that \function{stdwin.pollevent()} -returns an event while \function{select()} does not find \module{stdwin} to -be ready, so you should read any pending events with -\function{stdwin.pollevent()} until it returns \code{None} before entering -a blocking \function{select()} call. -\withsubitem{(in module select)}{\ttindex{select()}} -\end{funcdesc} - -\subsection{Window Objects} -\nodename{STDWIN Window Objects} - -Window objects are created by \function{stdwin.open()}. They are closed -by their \method{close()} method or when they are garbage-collected. -Window objects have the following methods: - -\begin{methoddesc}[window]{begindrawing}{} -Return a drawing object, whose methods (described below) allow drawing -in the window. -\end{methoddesc} - -\begin{methoddesc}[window]{change}{rect} -Invalidate the given rectangle; this may cause a draw event. -\end{methoddesc} - -\begin{methoddesc}[window]{gettitle}{} -Returns the window's title string. -\end{methoddesc} - -\begin{methoddesc}[window]{getdocsize}{} -\begin{sloppypar} -Return a pair of integers giving the size of the document as set by -\method{setdocsize()}. -\end{sloppypar} -\end{methoddesc} - -\begin{methoddesc}[window]{getorigin}{} -Return a pair of integers giving the origin of the window with respect -to the document. -\end{methoddesc} - -\begin{methoddesc}[window]{gettitle}{} -Return the window's title string. -\end{methoddesc} - -\begin{methoddesc}[window]{getwinsize}{} -Return a pair of integers giving the size of the window. -\end{methoddesc} - -\begin{methoddesc}[window]{getwinpos}{} -Return a pair of integers giving the position of the window's upper -left corner (relative to the upper left corner of the screen). -\end{methoddesc} - -\begin{methoddesc}[window]{menucreate}{title} -Create a menu object referring to a local menu (a menu that appears -only in this window). -Methods of menu objects are described below. -\warning{The menu only appears as long as the object -returned by this call exists.} -\end{methoddesc} - -\begin{methoddesc}[window]{scroll}{rect, point} -Scroll the given rectangle by the vector given by the point. -\end{methoddesc} - -\begin{methoddesc}[window]{setdocsize}{point} -Set the size of the drawing document. -\end{methoddesc} - -\begin{methoddesc}[window]{setorigin}{point} -Move the origin of the window (its upper left corner) -to the given point in the document. -\end{methoddesc} - -\begin{methoddesc}[window]{setselection}{i, str} -Attempt to set X11 selection number \var{i} to the string \var{str}. -(See \module{stdwin} function \function{getselection()} for the -meaning of \var{i}.) Return true if it succeeds. -If succeeds, the window ``owns'' the selection until -(a) another application takes ownership of the selection; or -(b) the window is deleted; or -(c) the application clears ownership by calling -\function{stdwin.resetselection(\var{i})}. When another application -takes ownership of the selection, a \constant{WE_LOST_SEL} event is -received for no particular window and with the selection number as -detail. Ignored on the Macintosh. -\end{methoddesc} - -\begin{methoddesc}[window]{settimer}{dsecs} -Schedule a timer event for the window in \code{\var{dsecs}/10} -seconds. -\end{methoddesc} - -\begin{methoddesc}[window]{settitle}{title} -Set the window's title string. -\end{methoddesc} - -\begin{methoddesc}[window]{setwincursor}{name} -\begin{sloppypar} -Set the window cursor to a cursor of the given name. It raises -\exception{RuntimeError} if no cursor of the given name exists. -Suitable names include -\code{'ibeam'}, -\code{'arrow'}, -\code{'cross'}, -\code{'watch'} -and -\code{'plus'}. -On X11, there are many more (see \code{}). -\end{sloppypar} -\end{methoddesc} - -\begin{methoddesc}[window]{setwinpos}{h, v} -Set the position of the window's upper left corner (relative to -the upper left corner of the screen). -\end{methoddesc} - -\begin{methoddesc}[window]{setwinsize}{width, height} -Set the window's size. -\end{methoddesc} - -\begin{methoddesc}[window]{show}{rect} -Try to ensure that the given rectangle of the document is visible in -the window. -\end{methoddesc} - -\begin{methoddesc}[window]{textcreate}{rect} -Create a text-edit object in the document at the given rectangle. -Methods of text-edit objects are described below. -\end{methoddesc} - -\begin{methoddesc}[window]{setactive}{} -Attempt to make this window the active window. If successful, this -will generate a WE_ACTIVATE event (and a WE_DEACTIVATE event in case -another window in this application became inactive). -\end{methoddesc} - -\begin{methoddesc}[window]{close}{} -Discard the window object. It should not be used again. -\end{methoddesc} - -\subsection{Drawing Objects} - -Drawing objects are created exclusively by the window method -\method{begindrawing()}. Only one drawing object can exist at any -given time; the drawing object must be deleted to finish drawing. No -drawing object may exist when \function{stdwin.getevent()} is called. -Drawing objects have the following methods: - -\begin{methoddesc}[drawing]{box}{rect} -Draw a box just inside a rectangle. -\end{methoddesc} - -\begin{methoddesc}[drawing]{circle}{center, radius} -Draw a circle with given center point and radius. -\end{methoddesc} - -\begin{methoddesc}[drawing]{elarc}{center, (rh, rv), (a1, a2)} -Draw an elliptical arc with given center point. -\code{(\var{rh}, \var{rv})} -gives the half sizes of the horizontal and vertical radii. -\code{(\var{a1}, \var{a2})} -gives the angles (in degrees) of the begin and end points. -0 degrees is at 3 o'clock, 90 degrees is at 12 o'clock. -\end{methoddesc} - -\begin{methoddesc}[drawing]{erase}{rect} -Erase a rectangle. -\end{methoddesc} - -\begin{methoddesc}[drawing]{fillcircle}{center, radius} -Draw a filled circle with given center point and radius. -\end{methoddesc} - -\begin{methoddesc}[drawing]{fillelarc}{center, (rh, rv), (a1, a2)} -Draw a filled elliptical arc; arguments as for \method{elarc()}. -\end{methoddesc} - -\begin{methoddesc}[drawing]{fillpoly}{points} -Draw a filled polygon given by a list (or tuple) of points. -\end{methoddesc} - -\begin{methoddesc}[drawing]{invert}{rect} -Invert a rectangle. -\end{methoddesc} - -\begin{methoddesc}[drawing]{line}{p1, p2} -Draw a line from point -\var{p1} -to -\var{p2}. -\end{methoddesc} - -\begin{methoddesc}[drawing]{paint}{rect} -Fill a rectangle. -\end{methoddesc} - -\begin{methoddesc}[drawing]{poly}{points} -Draw the lines connecting the given list (or tuple) of points. -\end{methoddesc} - -\begin{methoddesc}[drawing]{shade}{rect, percent} -Fill a rectangle with a shading pattern that is about -\var{percent} -percent filled. -\end{methoddesc} - -\begin{methoddesc}[drawing]{text}{p, str} -Draw a string starting at point p (the point specifies the -top left coordinate of the string). -\end{methoddesc} - -\begin{methoddesc}[drawing]{xorcircle}{center, radius} -\funcline{xorelarc}{center, (rh, rv), (a1, a2)} -\funcline{xorline}{p1, p2} -\funcline{xorpoly}{points} -Draw a circle, an elliptical arc, a line or a polygon, respectively, -in XOR mode. -\end{methoddesc} - -\begin{methoddesc}[drawing]{setfgcolor}{} -\funcline{setbgcolor}{} -\funcline{getfgcolor}{} -\funcline{getbgcolor}{} -These functions are similar to the corresponding functions described -above for the \module{stdwin} -module, but affect or return the colors currently used for drawing -instead of the global default colors. -When a drawing object is created, its colors are set to the window's -default colors, which are in turn initialized from the global default -colors when the window is created. -\end{methoddesc} - -\begin{methoddesc}[drawing]{setfont}{} -\funcline{baseline}{} -\funcline{lineheight}{} -\funcline{textbreak}{} -\funcline{textwidth}{} -These functions are similar to the corresponding functions described -above for the \module{stdwin} -module, but affect or use the current drawing font instead of -the global default font. -When a drawing object is created, its font is set to the window's -default font, which is in turn initialized from the global default -font when the window is created. -\end{methoddesc} - -\begin{methoddesc}[drawing]{bitmap}{point, bitmap, mask} -Draw the \var{bitmap} with its top left corner at \var{point}. -If the optional \var{mask} argument is present, it should be either -the same object as \var{bitmap}, to draw only those bits that are set -in the bitmap, in the foreground color, or \code{None}, to draw all -bits (ones are drawn in the foreground color, zeros in the background -color). -Not available on the Macintosh. -\end{methoddesc} - -\begin{methoddesc}[drawing]{cliprect}{rect} -Set the ``clipping region'' to a rectangle. -The clipping region limits the effect of all drawing operations, until -it is changed again or until the drawing object is closed. When a -drawing object is created the clipping region is set to the entire -window. When an object to be drawn falls partly outside the clipping -region, the set of pixels drawn is the intersection of the clipping -region and the set of pixels that would be drawn by the same operation -in the absence of a clipping region. -\end{methoddesc} - -\begin{methoddesc}[drawing]{noclip}{} -Reset the clipping region to the entire window. -\end{methoddesc} - -\begin{methoddesc}[drawing]{close}{} -\funcline{enddrawing}{} -Discard the drawing object. It should not be used again. -\end{methoddesc} - -\subsection{Menu Objects} - -A menu object represents a menu. -The menu is destroyed when the menu object is deleted. -The following methods are defined: - - -\begin{methoddesc}[menu]{additem}{text, shortcut} -Add a menu item with given text. -The shortcut must be a string of length 1, or omitted (to specify no -shortcut). -\end{methoddesc} - -\begin{methoddesc}[menu]{setitem}{i, text} -Set the text of item number \var{i}. -\end{methoddesc} - -\begin{methoddesc}[menu]{enable}{i, flag} -Enable or disables item \var{i}. -\end{methoddesc} - -\begin{methoddesc}[menu]{check}{i, flag} -Set or clear the \dfn{check mark} for item \var{i}. -\end{methoddesc} - -\begin{methoddesc}[menu]{close}{} -Discard the menu object. It should not be used again. -\end{methoddesc} - -\subsection{Bitmap Objects} - -A bitmap represents a rectangular array of bits. -The top left bit has coordinate (0, 0). -A bitmap can be drawn with the \method{bitmap()} method of a drawing object. -Bitmaps are currently not available on the Macintosh. - -The following methods are defined: - - -\begin{methoddesc}[bitmap]{getsize}{} -Return a tuple representing the width and height of the bitmap. -(This returns the values that have been passed to the -\function{newbitmap()} function.) -\end{methoddesc} - -\begin{methoddesc}[bitmap]{setbit}{point, bit} -Set the value of the bit indicated by \var{point} to \var{bit}. -\end{methoddesc} - -\begin{methoddesc}[bitmap]{getbit}{point} -Return the value of the bit indicated by \var{point}. -\end{methoddesc} - -\begin{methoddesc}[bitmap]{close}{} -Discard the bitmap object. It should not be used again. -\end{methoddesc} - -\subsection{Text-edit Objects} - -A text-edit object represents a text-edit block. -For semantics, see the STDWIN documentation for \C{} programmers. -The following methods exist: - - -\begin{methoddesc}[text-edit]{arrow}{code} -Pass an arrow event to the text-edit block. -The \var{code} must be one of \constant{WC_LEFT}, \constant{WC_RIGHT}, -\constant{WC_UP} or \constant{WC_DOWN} (see module -\refmodule{stdwinevents}). -\end{methoddesc} - -\begin{methoddesc}[text-edit]{draw}{rect} -Pass a draw event to the text-edit block. -The rectangle specifies the redraw area. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{event}{type, window, detail} -Pass an event gotten from -\function{stdwin.getevent()} -to the text-edit block. -Return true if the event was handled. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{getfocus}{} -Return 2 integers representing the start and end positions of the -focus, usable as slice indices on the string returned by -\method{gettext()}. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{getfocustext}{} -Return the text in the focus. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{getrect}{} -Return a rectangle giving the actual position of the text-edit block. -(The bottom coordinate may differ from the initial position because -the block automatically shrinks or grows to fit.) -\end{methoddesc} - -\begin{methoddesc}[text-edit]{gettext}{} -Return the entire text buffer. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{move}{rect} -Specify a new position for the text-edit block in the document. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{replace}{str} -Replace the text in the focus by the given string. -The new focus is an insert point at the end of the string. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{setfocus}{i, j} -Specify the new focus. -Out-of-bounds values are silently clipped. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{settext}{str} -Replace the entire text buffer by the given string and set the focus -to \code{(0, 0)}. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{setview}{rect} -Set the view rectangle to \var{rect}. If \var{rect} is \code{None}, -viewing mode is reset. In viewing mode, all output from the text-edit -object is clipped to the viewing rectangle. This may be useful to -implement your own scrolling text subwindow. -\end{methoddesc} - -\begin{methoddesc}[text-edit]{close}{} -Discard the text-edit object. It should not be used again. -\end{methoddesc} - -\subsection{Example} -\nodename{STDWIN Example} - -Here is a minimal example of using STDWIN in Python. -It creates a window and draws the string ``Hello world'' in the top -left corner of the window. -The window will be correctly redrawn when covered and re-exposed. -The program quits when the close icon or menu item is requested. - -\begin{verbatim} -import stdwin -from stdwinevents import * - -def main(): - mywin = stdwin.open('Hello') - # - while 1: - (type, win, detail) = stdwin.getevent() - if type == WE_DRAW: - draw = win.begindrawing() - draw.text((0, 0), 'Hello, world') - del draw - elif type == WE_CLOSE: - break - -main() -\end{verbatim} - - -\section{\module{stdwinevents} --- - Constants for use with \module{stdwin}} - -\declaremodule{standard}{stdwinevents} -\modulesynopsis{Constant definitions for use with \module{stdwin}} - - -This module defines constants used by STDWIN for event types -(\constant{WE_ACTIVATE} etc.), command codes (\constant{WC_LEFT} etc.) -and selection types (\constant{WS_PRIMARY} etc.). -Read the file for details. -Suggested usage is - -\begin{verbatim} ->>> from stdwinevents import * ->>> -\end{verbatim} - - -\section{\module{rect} --- - Functions for use with \module{stdwin}} - -\declaremodule{standard}{rect} -\modulesynopsis{Geometry-related utility function for use with - \module{stdwin}.} - - -This module contains useful operations on rectangles. -A rectangle is defined as in module \refmodule{stdwin}: -a pair of points, where a point is a pair of integers. -For example, the rectangle - -\begin{verbatim} -(10, 20), (90, 80) -\end{verbatim} - -is a rectangle whose left, top, right and bottom edges are 10, 20, 90 -and 80, respectively. Note that the positive vertical axis points -down (as in \refmodule{stdwin}). - -The module defines the following objects: - -\begin{excdesc}{error} -The exception raised by functions in this module when they detect an -error. The exception argument is a string describing the problem in -more detail. -\end{excdesc} - -\begin{datadesc}{empty} -The rectangle returned when some operations return an empty result. -This makes it possible to quickly check whether a result is empty: - -\begin{verbatim} ->>> import rect ->>> r1 = (10, 20), (90, 80) ->>> r2 = (0, 0), (10, 20) ->>> r3 = rect.intersect([r1, r2]) ->>> if r3 is rect.empty: print 'Empty intersection' -Empty intersection ->>> -\end{verbatim} -\end{datadesc} - -\begin{funcdesc}{is_empty}{r} -Returns true if the given rectangle is empty. -A rectangle -\code{(\var{left}, \var{top}), (\var{right}, \var{bottom})} -is empty if -\begin{math}\var{left} \geq \var{right}\end{math} or -\begin{math}\var{top} \geq \var{bottom}\end{math}. -\end{funcdesc} - -\begin{funcdesc}{intersect}{list} -Returns the intersection of all rectangles in the list argument. -It may also be called with a tuple argument. Raises -\exception{rect.error} if the list is empty. Returns -\constant{rect.empty} if the intersection of the rectangles is empty. -\end{funcdesc} - -\begin{funcdesc}{union}{list} -Returns the smallest rectangle that contains all non-empty rectangles in -the list argument. It may also be called with a tuple argument or -with two or more rectangles as arguments. Returns -\constant{rect.empty} if the list is empty or all its rectangles are -empty. -\end{funcdesc} - -\begin{funcdesc}{pointinrect}{point, rect} -Returns true if the point is inside the rectangle. By definition, a -point \code{(\var{h}, \var{v})} is inside a rectangle -\code{(\var{left}, \var{top}), (\var{right}, \var{bottom})} if -\begin{math}\var{left} \leq \var{h} < \var{right}\end{math} and -\begin{math}\var{top} \leq \var{v} < \var{bottom}\end{math}. -\end{funcdesc} - -\begin{funcdesc}{inset}{rect, (dh, dv)} -Returns a rectangle that lies inside the \var{rect} argument by -\var{dh} pixels horizontally and \var{dv} pixels vertically. If -\var{dh} or \var{dv} is negative, the result lies outside \var{rect}. -\end{funcdesc} - -\begin{funcdesc}{rect2geom}{rect} -Converts a rectangle to geometry representation: -\code{(\var{left}, \var{top}), (\var{width}, \var{height})}. -\end{funcdesc} - -\begin{funcdesc}{geom2rect}{geom} -Converts a rectangle given in geometry representation back to the -standard rectangle representation -\code{(\var{left}, \var{top}), (\var{right}, \var{bottom})}. -\end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libstring.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libstring.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libstring.tex Fri May 25 22:13:08 2007 @@ -419,7 +419,8 @@ Delete all characters from \var{s} that are in \var{deletechars} (if present), and then translate the characters using \var{table}, which must be a 256-character string giving the translation for each - character value, indexed by its ordinal. + character value, indexed by its ordinal. If \var{table} is \code{None}, + then only the character deletion step is performed. \end{funcdesc} \begin{funcdesc}{upper}{s} Modified: python/branches/bcannon-objcap/Doc/lib/libstruct.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libstruct.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libstruct.tex Fri May 25 22:13:08 2007 @@ -29,6 +29,15 @@ exactly. \end{funcdesc} +\begin{funcdesc}{pack_into}{fmt, buffer, offset, v1, v2, \moreargs} + Pack the values \code{\var{v1}, \var{v2}, \textrm{\ldots}} according to the given + format, write the packed bytes into the writable \var{buffer} starting at + \var{offset}. + Note that the offset is not an optional argument. + + \versionadded{2.5} +\end{funcdesc} + \begin{funcdesc}{unpack}{fmt, string} Unpack the string (presumably packed by \code{pack(\var{fmt}, \textrm{\ldots})}) according to the given format. The result is a @@ -37,6 +46,16 @@ (\code{len(\var{string})} must equal \code{calcsize(\var{fmt})}). \end{funcdesc} +\begin{funcdesc}{unpack_from}{fmt, buffer\optional{,offset \code{= 0}}} + Unpack the \var{buffer} according to tthe given format. + The result is a tuple even if it contains exactly one item. The + \var{buffer} must contain at least the amount of data required by the + format (\code{len(buffer[offset:])} must be at least + \code{calcsize(\var{fmt})}). + + \versionadded{2.5} +\end{funcdesc} + \begin{funcdesc}{calcsize}{fmt} Return the size of the struct (and hence of the string) corresponding to the given format. @@ -208,3 +227,43 @@ \seemodule{array}{Packed binary storage of homogeneous data.} \seemodule{xdrlib}{Packing and unpacking of XDR data.} \end{seealso} + +\subsection{Struct Objects \label{struct-objects}} + +The \module{struct} module also defines the following type: + +\begin{classdesc}{Struct}{format} + Return a new Struct object which writes and reads binary data according to + the format string \var{format}. Creating a Struct object once and calling + its methods is more efficient than calling the \module{struct} functions + with the same format since the format string only needs to be compiled once. + + \versionadded{2.5} +\end{classdesc} + +Compiled Struct objects support the following methods and attributes: + +\begin{methoddesc}[Struct]{pack}{v1, v2, \moreargs} + Identical to the \function{pack()} function, using the compiled format. + (\code{len(result)} will equal \member{self.size}.) +\end{methoddesc} + +\begin{methoddesc}[Struct]{pack_into}{buffer, offset, v1, v2, \moreargs} + Identical to the \function{pack_into()} function, using the compiled format. +\end{methoddesc} + +\begin{methoddesc}[Struct]{unpack}{string} + Identical to the \function{unpack()} function, using the compiled format. + (\code{len(string)} must equal \member{self.size}). +\end{methoddesc} + +\begin{methoddesc}[Struct]{unpack_from}{buffer\optional{,offset + \code{= 0}}} + Identical to the \function{unpack_from()} function, using the compiled format. + (\code{len(buffer[offset:])} must be at least \member{self.size}). +\end{methoddesc} + +\begin{memberdesc}[Struct]{format} + The format string used to construct this Struct object. +\end{memberdesc} + Modified: python/branches/bcannon-objcap/Doc/lib/libsubprocess.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsubprocess.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsubprocess.tex Fri May 25 22:13:08 2007 @@ -176,16 +176,16 @@ Instances of the \class{Popen} class have the following methods: -\begin{methoddesc}{poll}{} +\begin{methoddesc}[Popen]{poll}{} Check if child process has terminated. Returns returncode attribute. \end{methoddesc} -\begin{methoddesc}{wait}{} +\begin{methoddesc}[Popen]{wait}{} Wait for child process to terminate. Returns returncode attribute. \end{methoddesc} -\begin{methoddesc}{communicate}{input=None} +\begin{methoddesc}[Popen]{communicate}{input=None} Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional \var{input} argument should be a string to be sent to the @@ -199,29 +199,29 @@ The following attributes are also available: -\begin{memberdesc}{stdin} +\begin{memberdesc}[Popen]{stdin} If the \var{stdin} argument is \code{PIPE}, this attribute is a file object that provides input to the child process. Otherwise, it is \code{None}. \end{memberdesc} -\begin{memberdesc}{stdout} +\begin{memberdesc}[Popen]{stdout} If the \var{stdout} argument is \code{PIPE}, this attribute is a file object that provides output from the child process. Otherwise, it is \code{None}. \end{memberdesc} -\begin{memberdesc}{stderr} +\begin{memberdesc}[Popen]{stderr} If the \var{stderr} argument is \code{PIPE}, this attribute is file object that provides error output from the child process. Otherwise, it is \code{None}. \end{memberdesc} -\begin{memberdesc}{pid} +\begin{memberdesc}[Popen]{pid} The process ID of the child process. \end{memberdesc} -\begin{memberdesc}{returncode} +\begin{memberdesc}[Popen]{returncode} The child return code. A \code{None} value indicates that the process hasn't terminated yet. A negative value -N indicates that the child was terminated by signal N (\UNIX{} only). Modified: python/branches/bcannon-objcap/Doc/lib/libsun.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsun.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsun.tex Fri May 25 22:13:08 2007 @@ -3,3 +3,5 @@ The modules described in this chapter provide interfaces to features that are unique to SunOS 5 (also known as Solaris version 2). + +\localmoduletable Modified: python/branches/bcannon-objcap/Doc/lib/libsys.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsys.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsys.tex Fri May 25 22:13:08 2007 @@ -15,8 +15,8 @@ whether this is a full pathname or not). If the command was executed using the \programopt{-c} command line option to the interpreter, \code{argv[0]} is set to the string \code{'-c'}. If no - script name was passed to the Python interpreter, \code{argv} has - zero length. + script name was passed to the Python interpreter, \code{argv[0]} is + the empty string. \end{datadesc} \begin{datadesc}{byteorder} Modified: python/branches/bcannon-objcap/Doc/lib/libtarfile.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libtarfile.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libtarfile.tex Fri May 25 22:13:08 2007 @@ -12,21 +12,24 @@ \begin{itemize} \item reads and writes \module{gzip} and \module{bzip2} compressed archives. -\item creates \POSIX{} 1003.1-1990 compliant or GNU tar compatible archives. -\item reads GNU tar extensions \emph{longname}, \emph{longlink} and - \emph{sparse}. -\item stores pathnames of unlimited length using GNU tar extensions. +\item read/write support for the \POSIX{}.1-1988 (ustar) format. +\item read/write support for the GNU tar format including \emph{longname} and + \emph{longlink} extensions, read-only support for the \emph{sparse} + extension. +\item read/write support for the \POSIX{}.1-2001 (pax) format. + \versionadded{2.6} \item handles directories, regular files, hardlinks, symbolic links, fifos, character devices and block devices and is able to acquire and restore file information like timestamp, access permissions and owner. \item can handle tape devices. \end{itemize} -\begin{funcdesc}{open}{\optional{name\optional{, mode - \optional{, fileobj\optional{, bufsize}}}}} +\begin{funcdesc}{open}{name\optional{, mode\optional{, + fileobj\optional{, bufsize}}}, **kwargs} Return a \class{TarFile} object for the pathname \var{name}. - For detailed information on \class{TarFile} objects, - see \citetitle{TarFile Objects} (section \ref{tarfile-objects}). + For detailed information on \class{TarFile} objects and the keyword + arguments that are allowed, see \citetitle{TarFile Objects} + (section \ref{tarfile-objects}). \var{mode} has to be a string of the form \code{'filemode[:compression]'}, it defaults to \code{'r'}. Here is a full list of mode combinations: @@ -36,7 +39,8 @@ \lineii{'r:'}{Open for reading exclusively without compression.} \lineii{'r:gz'}{Open for reading with gzip compression.} \lineii{'r:bz2'}{Open for reading with bzip2 compression.} - \lineii{'a' or 'a:'}{Open for appending with no compression.} + \lineii{'a' or 'a:'}{Open for appending with no compression. The file + is created if it does not exist.} \lineii{'w' or 'w:'}{Open for uncompressed writing.} \lineii{'w:gz'}{Open for gzip compressed writing.} \lineii{'w:bz2'}{Open for bzip2 compressed writing.} @@ -48,8 +52,8 @@ avoid this. If a compression method is not supported, \exception{CompressionError} is raised. - If \var{fileobj} is specified, it is used as an alternative to - a file object opened for \var{name}. + If \var{fileobj} is specified, it is used as an alternative to a file + object opened for \var{name}. It is supposed to be at position 0. For special purposes, there is a second format for \var{mode}: \code{'filemode|[compression]'}. \function{open()} will return a @@ -129,6 +133,31 @@ \versionadded{2.6} \end{excdesc} +\begin{datadesc}{USTAR_FORMAT} + \POSIX{}.1-1988 (ustar) format. It supports filenames up to a length of + at best 256 characters and linknames up to 100 characters. The maximum + file size is 8 gigabytes. This is an old and limited but widely + supported format. +\end{datadesc} + +\begin{datadesc}{GNU_FORMAT} + GNU tar format. It supports arbitrarily long filenames and linknames and + files bigger than 8 gigabytes. It is the defacto standard on GNU/Linux + systems. +\end{datadesc} + +\begin{datadesc}{PAX_FORMAT} + \POSIX{}.1-2001 (pax) format. It is the most flexible format with + virtually no limits. It supports long filenames and linknames, large files + and stores pathnames in a portable way. However, not all tar + implementations today are able to handle pax archives properly. +\end{datadesc} + +\begin{datadesc}{DEFAULT_FORMAT} + The default format for creating archives. This is currently + \constant{GNU_FORMAT}. +\end{datadesc} + \begin{seealso} \seemodule{zipfile}{Documentation of the \refmodule{zipfile} standard module.} @@ -151,18 +180,70 @@ \class{TarInfo} object, see \citetitle{TarInfo Objects} (section \ref{tarinfo-objects}) for details. -\begin{classdesc}{TarFile}{\optional{name - \optional{, mode\optional{, fileobj}}}} - Open an \emph{(uncompressed)} tar archive \var{name}. +\begin{classdesc}{TarFile}{name=None, mode='r', fileobj=None, + format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, + ignore_zeros=False, encoding=None, pax_headers=None, debug=0, + errorlevel=0} + + All following arguments are optional and can be accessed as instance + attributes as well. + + \var{name} is the pathname of the archive. It can be omitted if + \var{fileobj} is given. In this case, the file object's \member{name} + attribute is used if it exists. + \var{mode} is either \code{'r'} to read from an existing archive, \code{'a'} to append data to an existing file or \code{'w'} to create a new - file overwriting an existing one. \var{mode} defaults to \code{'r'}. + file overwriting an existing one. If \var{fileobj} is given, it is used for reading or writing data. If it can be determined, \var{mode} is overridden by \var{fileobj}'s mode. + \var{fileobj} will be used from position 0. \begin{notice} \var{fileobj} is not closed, when \class{TarFile} is closed. \end{notice} + + \var{format} controls the archive format. It must be one of the constants + \constant{USTAR_FORMAT}, \constant{GNU_FORMAT} or \constant{PAX_FORMAT} + that are defined at module level. + \versionadded{2.6} + + The \var{tarinfo} argument can be used to replace the default + \class{TarInfo} class with a different one. + \versionadded{2.6} + + If \var{dereference} is \code{False}, add symbolic and hard links to the + archive. If it is \code{True}, add the content of the target files to the + archive. This has no effect on systems that do not support symbolic links. + + If \var{ignore_zeros} is \code{False}, treat an empty block as the end of + the archive. If it is \var{True}, skip empty (and invalid) blocks and try + to get as many members as possible. This is only useful for reading + concatenated or damaged archives. + + \var{debug} can be set from \code{0} (no debug messages) up to \code{3} + (all debug messages). The messages are written to \code{sys.stderr}. + + If \var{errorlevel} is \code{0}, all errors are ignored when using + \method{extract()}. Nevertheless, they appear as error messages in the + debug output, when debugging is enabled. If \code{1}, all \emph{fatal} + errors are raised as \exception{OSError} or \exception{IOError} exceptions. + If \code{2}, all \emph{non-fatal} errors are raised as \exception{TarError} + exceptions as well. + + The \var{encoding} argument defines the local character encoding. It + defaults to the value from \function{sys.getfilesystemencoding()} or if + that is \code{None} to \code{"ascii"}. \var{encoding} is used only in + connection with the pax format which stores text data in \emph{UTF-8}. If + it is not set correctly, character conversion will fail with a + \exception{UnicodeError}. + \versionadded{2.6} + + The \var{pax_headers} argument must be a dictionary whose elements are + either unicode objects, numbers or strings that can be decoded to unicode + using \var{encoding}. This information will be added to the archive as a + pax global header. + \versionadded{2.6} \end{classdesc} \begin{methoddesc}{open}{...} @@ -277,43 +358,11 @@ \end{methoddesc} \begin{memberdesc}{posix} - If true, create a \POSIX{} 1003.1-1990 compliant archive. GNU - extensions are not used, because they are not part of the \POSIX{} - standard. This limits the length of filenames to at most 256, - link names to 100 characters and the maximum file size to 8 - gigabytes. A \exception{ValueError} is raised if a file exceeds - this limit. If false, create a GNU tar compatible archive. It - will not be \POSIX{} compliant, but can store files without any - of the above restrictions. + Setting this to \constant{True} is equivalent to setting the + \member{format} attribute to \constant{USTAR_FORMAT}, + \constant{False} is equivalent to \constant{GNU_FORMAT}. \versionchanged[\var{posix} defaults to \constant{False}]{2.4} -\end{memberdesc} - -\begin{memberdesc}{dereference} - If false, add symbolic and hard links to archive. If true, add the - content of the target files to the archive. This has no effect on - systems that do not support symbolic links. -\end{memberdesc} - -\begin{memberdesc}{ignore_zeros} - If false, treat an empty block as the end of the archive. If true, - skip empty (and invalid) blocks and try to get as many members as - possible. This is only useful for concatenated or damaged - archives. -\end{memberdesc} - -\begin{memberdesc}{debug=0} - To be set from \code{0} (no debug messages; the default) up to - \code{3} (all debug messages). The messages are written to - \code{sys.stderr}. -\end{memberdesc} - -\begin{memberdesc}{errorlevel} - If \code{0} (the default), all errors are ignored when using - \method{extract()}. Nevertheless, they appear as error messages - in the debug output, when debugging is enabled. If \code{1}, all - \emph{fatal} errors are raised as \exception{OSError} or - \exception{IOError} exceptions. If \code{2}, all \emph{non-fatal} - errors are raised as \exception{TarError} exceptions as well. + \deprecated{2.6}{Use the \member{format} attribute instead.} \end{memberdesc} %----------------- @@ -341,12 +390,16 @@ invalid.]{2.6} \end{methoddesc} -\begin{methoddesc}{tobuf}{posix} - Create a string buffer from a \class{TarInfo} object. - See \class{TarFile}'s \member{posix} attribute for information - on the \var{posix} argument. It defaults to \constant{False}. +\begin{methoddesc}{fromtarfile}{tarfile} + Read the next member from the \class{TarFile} object \var{tarfile} and + return it as a \class{TarInfo} object. + \versionadded{2.6} +\end{methoddesc} - \versionadded[The \var{posix} parameter]{2.5} +\begin{methoddesc}{tobuf}{\optional{format}} + Create a string buffer from a \class{TarInfo} object. See + \class{TarFile}'s \member{format} argument for information. + \versionchanged[The \var{format} parameter]{2.6} \end{methoddesc} A \code{TarInfo} object has the following public data attributes: Modified: python/branches/bcannon-objcap/Doc/lib/libtelnetlib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libtelnetlib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libtelnetlib.tex Fri May 25 22:13:08 2007 @@ -23,13 +23,16 @@ SB (Subnegotiation Begin). -\begin{classdesc}{Telnet}{\optional{host\optional{, port}}} +\begin{classdesc}{Telnet}{\optional{host\optional{, port\optional{, timeout}}}} \class{Telnet} represents a connection to a Telnet server. The instance is initially not connected by default; the \method{open()} method must be used to establish a connection. Alternatively, the host name and optional port number can be passed to the constructor, to, in which case the connection to the server will be established before the constructor returns. +The optional \var{timeout} parameter specifies a timeout in seconds for the +connection attempt (if not specified, or passed as None, the global default +timeout setting will be used). Do not reopen an already connected instance. @@ -52,7 +55,7 @@ \class{Telnet} instances have the following methods: -\begin{methoddesc}{read_until}{expected\optional{, timeout}} +\begin{methoddesc}[Telnet]{read_until}{expected\optional{, timeout}} Read until a given string, \var{expected}, is encountered or until \var{timeout} seconds have passed. @@ -61,17 +64,17 @@ is closed and no cooked data is available. \end{methoddesc} -\begin{methoddesc}{read_all}{} +\begin{methoddesc}[Telnet]{read_all}{} Read all data until \EOF; block until connection closed. \end{methoddesc} -\begin{methoddesc}{read_some}{} +\begin{methoddesc}[Telnet]{read_some}{} Read at least one byte of cooked data unless \EOF{} is hit. Return \code{''} if \EOF{} is hit. Block if no data is immediately available. \end{methoddesc} -\begin{methoddesc}{read_very_eager}{} +\begin{methoddesc}[Telnet]{read_very_eager}{} Read everything that can be without blocking in I/O (eager). Raise \exception{EOFError} if connection closed and no cooked data @@ -79,7 +82,7 @@ Do not block unless in the midst of an IAC sequence. \end{methoddesc} -\begin{methoddesc}{read_eager}{} +\begin{methoddesc}[Telnet]{read_eager}{} Read readily available data. Raise \exception{EOFError} if connection closed and no cooked data @@ -87,7 +90,7 @@ Do not block unless in the midst of an IAC sequence. \end{methoddesc} -\begin{methoddesc}{read_lazy}{} +\begin{methoddesc}[Telnet]{read_lazy}{} Process and return data already in the queues (lazy). Raise \exception{EOFError} if connection closed and no data available. @@ -95,7 +98,7 @@ unless in the midst of an IAC sequence. \end{methoddesc} -\begin{methoddesc}{read_very_lazy}{} +\begin{methoddesc}[Telnet]{read_very_lazy}{} Return any data available in the cooked queue (very lazy). Raise \exception{EOFError} if connection closed and no data available. @@ -103,7 +106,7 @@ never blocks. \end{methoddesc} -\begin{methoddesc}{read_sb_data}{} +\begin{methoddesc}[Telnet]{read_sb_data}{} Return the data collected between a SB/SE pair (suboption begin/end). The callback should access these data when it was invoked with a \code{SE} command. This method never blocks. @@ -111,52 +114,55 @@ \versionadded{2.3} \end{methoddesc} -\begin{methoddesc}{open}{host\optional{, port}} +\begin{methoddesc}[Telnet]{open}{host\optional{, port\optional{, timeout}}} Connect to a host. The optional second argument is the port number, which defaults to the standard Telnet port (23). +The optional \var{timeout} parameter specifies a timeout in seconds for the +connection attempt (if not specified, or passed as None, the global default +timeout setting will be used). Do not try to reopen an already connected instance. \end{methoddesc} -\begin{methoddesc}{msg}{msg\optional{, *args}} +\begin{methoddesc}[Telnet]{msg}{msg\optional{, *args}} Print a debug message when the debug level is \code{>} 0. If extra arguments are present, they are substituted in the message using the standard string formatting operator. \end{methoddesc} -\begin{methoddesc}{set_debuglevel}{debuglevel} +\begin{methoddesc}[Telnet]{set_debuglevel}{debuglevel} Set the debug level. The higher the value of \var{debuglevel}, the more debug output you get (on \code{sys.stdout}). \end{methoddesc} -\begin{methoddesc}{close}{} +\begin{methoddesc}[Telnet]{close}{} Close the connection. \end{methoddesc} -\begin{methoddesc}{get_socket}{} +\begin{methoddesc}[Telnet]{get_socket}{} Return the socket object used internally. \end{methoddesc} -\begin{methoddesc}{fileno}{} +\begin{methoddesc}[Telnet]{fileno}{} Return the file descriptor of the socket object used internally. \end{methoddesc} -\begin{methoddesc}{write}{buffer} +\begin{methoddesc}[Telnet]{write}{buffer} Write a string to the socket, doubling any IAC characters. This can block if the connection is blocked. May raise \exception{socket.error} if the connection is closed. \end{methoddesc} -\begin{methoddesc}{interact}{} +\begin{methoddesc}[Telnet]{interact}{} Interaction function, emulates a very dumb Telnet client. \end{methoddesc} -\begin{methoddesc}{mt_interact}{} +\begin{methoddesc}[Telnet]{mt_interact}{} Multithreaded version of \method{interact()}. \end{methoddesc} -\begin{methoddesc}{expect}{list\optional{, timeout}} +\begin{methoddesc}[Telnet]{expect}{list\optional{, timeout}} Read until one from a list of a regular expressions matches. The first argument is a list of regular expressions, either @@ -178,7 +184,7 @@ results are indeterministic, and may depend on the I/O timing. \end{methoddesc} -\begin{methoddesc}{set_option_negotiation_callback}{callback} +\begin{methoddesc}[Telnet]{set_option_negotiation_callback}{callback} Each time a telnet option is read on the input flow, this \var{callback} (if set) is called with the following parameters : callback(telnet socket, command (DO/DONT/WILL/WONT), option). No other Modified: python/branches/bcannon-objcap/Doc/lib/libtempfile.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libtempfile.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libtempfile.tex Fri May 25 22:13:08 2007 @@ -53,7 +53,7 @@ \begin{funcdesc}{NamedTemporaryFile}{\optional{mode=\code{'w+b'}\optional{, bufsize=\code{-1}\optional{, suffix\optional{, prefix\optional{, - dir}}}}}} + dir\optional{, delete}}}}}}} This function operates exactly as \function{TemporaryFile()} does, except that the file is guaranteed to have a visible name in the file system (on \UNIX, the directory entry is not unlinked). That name can @@ -61,7 +61,27 @@ the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on \UNIX; it cannot on Windows NT or later). +If \var{delete} is true (the default), the file is deleted as soon as +it is closed. \versionadded{2.3} +\versionadded[The \var{delete} parameter]{2.6} +\end{funcdesc} + +\begin{funcdesc}{SpooledTemporaryFile}{\optional{max\_size=\code{0}, + \optional{mode=\code{'w+b'}\optional{, + bufsize=\code{-1}\optional{, + suffix\optional{, prefix\optional{, + dir}}}}}}} +This function operates exactly as \function{TemporaryFile()} does, +except that data is spooled in memory until the file size exceeds +\var{max_size}, or until the file's \function{fileno()} method is +called, at which point the contents are written to disk and operation +proceeds as with \function{TemporaryFile()}. + +The resulting file has one additional method, \function{rollover()}, +which causes the file to roll over to an on-disk file regardless of +its size. +\versionadded{2.6} \end{funcdesc} \begin{funcdesc}{mkstemp}{\optional{suffix\optional{, Modified: python/branches/bcannon-objcap/Doc/lib/libtest.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libtest.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libtest.tex Fri May 25 22:13:08 2007 @@ -14,11 +14,11 @@ Each module in the \module{test} package whose name starts with \samp{test_} is a testing suite for a specific module or feature. -All new tests should be written using the \refmodule{unittest} module; -using \refmodule{unittest} is not required but makes the tests more -flexible and maintenance of the tests easier. Some older tests are -written to use \refmodule{doctest} and a ``traditional'' testing -style; these styles of tests will not be covered. +All new tests should be written using the \refmodule{unittest} or +\refmodule{doctest} module. Some older tests are +written using a ``traditional'' testing style that compares output +printed to \code{sys.stdout}; this style of test is considered +deprecated. \begin{seealso} \seemodule{unittest}{Writing PyUnit regression tests.} @@ -29,8 +29,8 @@ \subsection{Writing Unit Tests for the \module{test} package% \label{writing-tests}} -It is preferred that tests for the \module{test} package use the -\refmodule{unittest} module and follow a few guidelines. +It is preferred that tests that use the \refmodule{unittest} module +follow a few guidelines. One is to name the test module by starting it with \samp{test_} and end it with the name of the module being tested. The test methods in the test module should start with \samp{test_} and end with @@ -196,7 +196,9 @@ This module defines the following exceptions: \begin{excdesc}{TestFailed} -Exception to be raised when a test fails. +Exception to be raised when a test fails. This is deprecated in favor +of \module{unittest}-based tests and \class{unittest.TestCase}'s +assertion methods. \end{excdesc} \begin{excdesc}{TestSkipped} @@ -273,18 +275,30 @@ Execute \class{unittest.TestCase} subclasses passed to the function. The function scans the classes for methods starting with the prefix \samp{test_} and executes the tests individually. -This is the preferred way to execute tests. -\end{funcdesc} -\begin{funcdesc}{run_suite}{suite\optional{, testclass}} -Execute the \class{unittest.TestSuite} instance \var{suite}. -The optional argument \var{testclass} accepts one of the test classes in the -suite so as to print out more detailed information on where the testing suite -originated from. +It is also legal to pass strings as parameters; these should be keys in +\code{sys.modules}. Each associated module will be scanned by +\code{unittest.TestLoader.loadTestsFromModule()}. This is usually seen in +the following \function{test_main()} function: + +\begin{verbatim} +def test_main(): + test_support.run_unittest(__name__) +\end{verbatim} + +This will run all tests defined in the named module. \end{funcdesc} The \module{test.test_support} module defines the following classes: +\begin{classdesc}{TransientResource}{exc\optional{, **kwargs}} +Create a context manager that raises \class{ResourceDenied} if the specified +exception type is raised. Any keyword arguments are treated as name/value +pairs to be compared against any exception raised with the \code{with} +statement. Only if all pairs match is \class{ResourceDenied} raised. +\versionadded{2.6} +\end{classdesc} + \begin{classdesc}{EnvironmentVarGuard}{} Class used to temporarily set or unset environment variables. Instances can be used as a context manager. Modified: python/branches/bcannon-objcap/Doc/lib/libtextwrap.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libtextwrap.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libtextwrap.tex Fri May 25 22:13:08 2007 @@ -54,7 +54,7 @@ in indented form. Note that tabs and spaces are both treated as whitespace, but they are -not equal: the lines \code{" {} hello"} and \code{"\textbackslash{}thello"} +not equal: the lines \code{" {} hello"} and \code{"\e thello"} are considered to have no common leading whitespace. (This behaviour is new in Python 2.5; older versions of this module incorrectly expanded tabs before searching for common leading whitespace.) @@ -115,6 +115,13 @@ expansion.} \end{memberdesc} +\begin{memberdesc}{drop_whitespace} +(default: \code{True}) If true, whitespace that, after wrapping, happens +to end up at the beginning or end of a line is dropped (leading whitespace +in the first line is always preserved, though). +\versionadded[Whitespace was always dropped in earlier versions]{2.6} +\end{memberdesc} + \begin{memberdesc}{initial_indent} (default: \code{''}) String that will be prepended to the first line of wrapped output. Counts towards the length of the first line. Modified: python/branches/bcannon-objcap/Doc/lib/libthreading.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libthreading.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libthreading.tex Fri May 25 22:13:08 2007 @@ -15,17 +15,16 @@ This module defines the following functions and objects: \begin{funcdesc}{activeCount}{} -Return the number of currently active \class{Thread} objects. -The returned count is equal to the length of the list returned by +Return the number of \class{Thread} objects currently alive. The +returned count is equal to the length of the list returned by \function{enumerate()}. -A function that returns the number of currently active threads. \end{funcdesc} -\begin{funcdesc}{Condition}{} +\begin{funcdescni}{Condition}{} A factory function that returns a new condition variable object. A condition variable allows one or more threads to wait until they are notified by another thread. -\end{funcdesc} +\end{funcdescni} \begin{funcdesc}{currentThread}{} Return the current \class{Thread} object, corresponding to the @@ -36,18 +35,18 @@ \end{funcdesc} \begin{funcdesc}{enumerate}{} -Return a list of all currently active \class{Thread} objects. -The list includes daemonic threads, dummy thread objects created -by \function{currentThread()}, and the main thread. It excludes terminated -threads and threads that have not yet been started. +Return a list of all \class{Thread} objects currently alive. The list +includes daemonic threads, dummy thread objects created by +\function{currentThread()}, and the main thread. It excludes +terminated threads and threads that have not yet been started. \end{funcdesc} -\begin{funcdesc}{Event}{} +\begin{funcdescni}{Event}{} A factory function that returns a new event object. An event manages a flag that can be set to true with the \method{set()} method and reset to false with the \method{clear()} method. The \method{wait()} method blocks until the flag is true. -\end{funcdesc} +\end{funcdescni} \begin{classdesc*}{local}{} A class that represents thread-local data. Thread-local data are data @@ -82,14 +81,14 @@ for each time it has acquired it. \end{funcdesc} -\begin{funcdesc}{Semaphore}{\optional{value}} +\begin{funcdescni}{Semaphore}{\optional{value}} A factory function that returns a new semaphore object. A semaphore manages a counter representing the number of \method{release()} calls minus the number of \method{acquire()} calls, plus an initial value. The \method{acquire()} method blocks if necessary until it can return without making the counter negative. If not given, \var{value} defaults to 1. -\end{funcdesc} +\end{funcdescni} \begin{funcdesc}{BoundedSemaphore}{\optional{value}} A factory function that returns a new bounded semaphore object. A bounded @@ -100,12 +99,12 @@ \var{value} defaults to 1. \end{funcdesc} -\begin{classdesc*}{Thread}{} +\begin{classdesc*}{Thread} A class that represents a thread of control. This class can be safely subclassed in a limited fashion. \end{classdesc*} -\begin{classdesc*}{Timer}{} +\begin{classdesc*}{Timer} A thread that executes a function after a specified interval has passed. \end{classdesc*} @@ -183,7 +182,7 @@ All methods are executed atomically. -\begin{methoddesc}{acquire}{\optional{blocking\code{ = 1}}} +\begin{methoddesc}[Lock]{acquire}{\optional{blocking\code{ = 1}}} Acquire a lock, blocking or non-blocking. When invoked without arguments, block until the lock is @@ -198,7 +197,7 @@ without arguments, and return true. \end{methoddesc} -\begin{methoddesc}{release}{} +\begin{methoddesc}[Lock]{release}{} Release a lock. When the lock is locked, reset it to unlocked, and return. If @@ -228,7 +227,7 @@ pair) resets the lock to unlocked and allows another thread blocked in \method{acquire()} to proceed. -\begin{methoddesc}{acquire}{\optional{blocking\code{ = 1}}} +\begin{methoddesc}[RLock]{acquire}{\optional{blocking\code{ = 1}}} Acquire a lock, blocking or non-blocking. When invoked without arguments: if this thread already owns @@ -250,7 +249,7 @@ without arguments, and return true. \end{methoddesc} -\begin{methoddesc}{release}{} +\begin{methoddesc}[RLock]{release}{} Release a lock, decrementing the recursion level. If after the decrement it is zero, reset the lock to unlocked (not owned by any thread), and if any other threads are blocked waiting for the lock to @@ -526,12 +525,9 @@ \method{run()} method in a separate thread of control. Once the thread's activity is started, the thread is considered -'alive' and 'active' (these concepts are almost, but not quite -exactly, the same; their definition is intentionally somewhat -vague). It stops being alive and active when its \method{run()} -method terminates -- either normally, or by raising an unhandled -exception. The \method{isAlive()} method tests whether the thread is -alive. +'alive'. It stops being alive when its \method{run()} method terminates +-- either normally, or by raising an unhandled exception. The +\method{isAlive()} method tests whether the thread is alive. Other threads can call a thread's \method{join()} method. This blocks the calling thread until the thread whose \method{join()} method is @@ -551,14 +547,13 @@ initial thread of control in the Python program. It is not a daemon thread. -There is the possibility that ``dummy thread objects'' are -created. These are thread objects corresponding to ``alien -threads''. These are threads of control started outside the -threading module, such as directly from C code. Dummy thread objects -have limited functionality; they are always considered alive, -active, and daemonic, and cannot be \method{join()}ed. They are never -deleted, since it is impossible to detect the termination of alien -threads. +There is the possibility that ``dummy thread objects'' are created. +These are thread objects corresponding to ``alien threads'', which +are threads of control started outside the threading module, such as +directly from C code. Dummy thread objects have limited +functionality; they are always considered alive and daemonic, and +cannot be \method{join()}ed. They are never deleted, since it is +impossible to detect the termination of alien threads. \begin{classdesc}{Thread}{group=None, target=None, name=None, @@ -646,7 +641,8 @@ Return whether the thread is alive. Roughly, a thread is alive from the moment the \method{start()} method -returns until its \method{run()} method terminates. +returns until its \method{run()} method terminates. The module +function \function{enumerate()} returns a list of all alive threads. \end{methoddesc} \begin{methoddesc}{isDaemon}{} @@ -659,8 +655,8 @@ The initial value is inherited from the creating thread. -The entire Python program exits when no active non-daemon -threads are left. +The entire Python program exits when no alive non-daemon threads are +left. \end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libtimeit.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libtimeit.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libtimeit.tex Fri May 25 22:13:08 2007 @@ -31,6 +31,13 @@ \method{timeit()} method. The \method{repeat()} method is a convenience to call \method{timeit()} multiple times and return a list of results. + +\versionchanged[The \var{stmt} and \var{setup} parameters can now also + take objects that are callable without arguments. This + will embed calls to them in a timer function that will + then be executed by \method{timeit()}. Note that the timing + overhead is a little larger in this case because of the + extra function calls]{2.6} \end{classdesc} \begin{methoddesc}{print_exc}{\optional{file=\constant{None}}} @@ -97,12 +104,30 @@ \end{methoddesc} +Starting with version 2.6, the module also defines two convenience functions: + +\begin{funcdesc}{repeat}{stmt\optional{, setup\optional{, timer\optional{, + repeat\code{=3} \optional{, number\code{=1000000}}}}}} +Create a \class{Timer} instance with the given statement, setup code and timer +function and run its \method{repeat} method with the given repeat count and +\var{number} executions. +\versionadded{2.6} +\end{funcdesc} + +\begin{funcdesc}{timeit}{stmt\optional{, setup\optional{, timer\optional{, + number\code{=1000000}}}}} +Create a \class{Timer} instance with the given statement, setup code and timer +function and run its \method{timeit} method with \var{number} executions. +\versionadded{2.6} +\end{funcdesc} + + \subsection{Command Line Interface} When called as a program from the command line, the following form is used: \begin{verbatim} -python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] +python -m timeit [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] \end{verbatim} where the following options are understood: Modified: python/branches/bcannon-objcap/Doc/lib/libturtle.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libturtle.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libturtle.tex Fri May 25 22:13:08 2007 @@ -261,7 +261,7 @@ \function{degrees()}, which takes an optional argument letting you specify the number of units corresponding to a full circle: -\begin{methoddesc}{degrees}{\optional{fullcircle}} +\begin{methoddesc}[Turtle]{degrees}{\optional{fullcircle}} \var{fullcircle} is by default 360. This can cause the pen to have any angular units whatever: give \var{fullcircle} 2*$\pi$ for radians, or 400 for gradians. Modified: python/branches/bcannon-objcap/Doc/lib/libunittest.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libunittest.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libunittest.tex Fri May 25 22:13:08 2007 @@ -91,7 +91,7 @@ \end{seealso} -\subsection{Basic example \label{minimal-example}} +\subsection{Basic example \label{unittest-minimal-example}} The \module{unittest} module provides a rich set of tools for constructing and running tests. This section demonstrates that a @@ -290,6 +290,7 @@ we would end up subclassing \class{SimpleWidgetTestCase} into many small one-method classes such as \class{DefaultWidgetSizeTestCase}. This is time-consuming and + discouraging, so in the same vein as JUnit, \module{unittest} provides a simpler mechanism: @@ -540,7 +541,7 @@ \begin{funcdesc}{main}{\optional{module\optional{, defaultTest\optional{, argv\optional{, - testRunner\optional{, testRunner}}}}}} + testRunner\optional{, testLoader}}}}}} A command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. The simplest use for this function is to include the following line at the end of a @@ -550,6 +551,9 @@ if __name__ == '__main__': unittest.main() \end{verbatim} + + The \var{testRunner} argument can either be a test runner class or + an already created instance of it. \end{funcdesc} In some cases, the existing tests may have been written using the @@ -615,14 +619,14 @@ report failures. \begin{methoddesc}[TestCase]{assert_}{expr\optional{, msg}} -\methodline{failUnless}{expr\optional{, msg}} +\methodline[TestCase]{failUnless}{expr\optional{, msg}} Signal a test failure if \var{expr} is false; the explanation for the error will be \var{msg} if given, otherwise it will be \constant{None}. \end{methoddesc} \begin{methoddesc}[TestCase]{assertEqual}{first, second\optional{, msg}} -\methodline{failUnlessEqual}{first, second\optional{, msg}} +\methodline[TestCase]{failUnlessEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by \var{msg}, or \constant{None}. Note that using \method{failUnlessEqual()} @@ -633,7 +637,7 @@ \end{methoddesc} \begin{methoddesc}[TestCase]{assertNotEqual}{first, second\optional{, msg}} -\methodline{failIfEqual}{first, second\optional{, msg}} +\methodline[TestCase]{failIfEqual}{first, second\optional{, msg}} Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by \var{msg}, or \constant{None}. Note that using \method{failIfEqual()} @@ -645,7 +649,7 @@ \begin{methoddesc}[TestCase]{assertAlmostEqual}{first, second\optional{, places\optional{, msg}}} -\methodline{failUnlessAlmostEqual}{first, second\optional{, +\methodline[TestCase]{failUnlessAlmostEqual}{first, second\optional{, places\optional{, msg}}} Test that \var{first} and \var{second} are approximately equal by computing the difference, rounding to the given number of \var{places}, @@ -657,7 +661,7 @@ \begin{methoddesc}[TestCase]{assertNotAlmostEqual}{first, second\optional{, places\optional{, msg}}} -\methodline{failIfAlmostEqual}{first, second\optional{, +\methodline[TestCase]{failIfAlmostEqual}{first, second\optional{, places\optional{, msg}}} Test that \var{first} and \var{second} are not approximately equal by computing the difference, rounding to the given number of \var{places}, @@ -668,7 +672,7 @@ \end{methoddesc} \begin{methoddesc}[TestCase]{assertRaises}{exception, callable, \moreargs} -\methodline{failUnlessRaises}{exception, callable, \moreargs} +\methodline[TestCase]{failUnlessRaises}{exception, callable, \moreargs} Test that an exception is raised when \var{callable} is called with any positional or keyword arguments that are also passed to \method{assertRaises()}. The test passes if \var{exception} is Modified: python/branches/bcannon-objcap/Doc/lib/liburllib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/liburllib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/liburllib.tex Fri May 25 22:13:08 2007 @@ -70,8 +70,8 @@ The \function{urlopen()} function works transparently with proxies which do not require authentication. In a \UNIX{} or Windows -environment, set the \envvar{http_proxy}, \envvar{ftp_proxy} or -\envvar{gopher_proxy} environment variables to a URL that identifies +environment, set the \envvar{http_proxy}, or \envvar{ftp_proxy} +environment variables to a URL that identifies the proxy server before starting the Python interpreter. For example (the \character{\%} is the command prompt): @@ -253,7 +253,7 @@ \begin{classdesc}{URLopener}{\optional{proxies\optional{, **x509}}} Base class for opening and reading URLs. Unless you need to support opening objects using schemes other than \file{http:}, \file{ftp:}, -\file{gopher:} or \file{file:}, you probably want to use +or \file{file:}, you probably want to use \class{FancyURLopener}. By default, the \class{URLopener} class sends a @@ -324,9 +324,8 @@ \item Currently, only the following protocols are supported: HTTP, (versions -0.9 and 1.0), Gopher (but not Gopher-+), FTP, and local files. +0.9 and 1.0), FTP, and local files. \indexii{HTTP}{protocol} -\indexii{Gopher}{protocol} \indexii{FTP}{protocol} \item @@ -355,9 +354,7 @@ (such as an image), plain text or (for example) HTML\index{HTML}. The HTTP\indexii{HTTP}{protocol} protocol provides type information in the reply header, which can be inspected by looking at the -\mailheader{Content-Type} header. For the -Gopher\indexii{Gopher}{protocol} protocol, type information is encoded -in the URL; there is currently no easy way to extract it. If the +\mailheader{Content-Type} header. If the returned data is HTML, you can use the module \refmodule{htmllib}\refstmodindex{htmllib} to parse it. Modified: python/branches/bcannon-objcap/Doc/lib/liburllib2.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/liburllib2.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/liburllib2.tex Fri May 25 22:13:08 2007 @@ -86,11 +86,6 @@ HTTP errors, such as requests for authentication. \end{excdesc} -\begin{excdesc}{GopherError} -A subclass of \exception{URLError}, this is the error raised by the -Gopher handler. -\end{excdesc} - The following classes are provided: @@ -241,10 +236,6 @@ delays. \end{classdesc} -\begin{classdesc}{GopherHandler}{} -Open gopher URLs. -\end{classdesc} - \begin{classdesc}{UnknownHandler}{} A catch-all class to handle unknown URLs. \end{classdesc} @@ -588,7 +579,7 @@ \class{HTTPCookieProcessor} instances have one attribute: -\begin{memberdesc}{cookiejar} +\begin{memberdesc}[HTTPCookieProcessor]{cookiejar} The \class{cookielib.CookieJar} in which cookies are stored. \end{memberdesc} @@ -744,13 +735,6 @@ \end{methoddesc} -\subsection{GopherHandler Objects \label{gopher-handler}} - -\begin{methoddesc}[GopherHandler]{gopher_open}{req} -Open the gopher resource indicated by \var{req}. -\end{methoddesc} - - \subsection{UnknownHandler Objects \label{unknown-handler-objects}} \begin{methoddesc}[UnknownHandler]{unknown_open}{} @@ -817,7 +801,10 @@ import urllib2 # Create an OpenerDirector with support for Basic HTTP Authentication... auth_handler = urllib2.HTTPBasicAuthHandler() -auth_handler.add_password('realm', 'host', 'username', 'password') +auth_handler.add_password(realm='PDQ Application', + uri='https://mahler:8092/site-updates.py', + user='klem', + passwd='kadidd!ehopper') opener = urllib2.build_opener(auth_handler) # ...and install it globally so it can be used with urlopen. urllib2.install_opener(opener) Modified: python/branches/bcannon-objcap/Doc/lib/liburlparse.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/liburlparse.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/liburlparse.tex Fri May 25 22:13:08 2007 @@ -157,7 +157,7 @@ for \function{urlparse()}. \note{If \var{url} is an absolute URL (that is, starting with \code{//} - or \code{scheme://}, the \var{url}'s host name and/or scheme + or \code{scheme://}), the \var{url}'s host name and/or scheme will be present in the result. For example:} \begin{verbatim} @@ -168,7 +168,7 @@ If you do not want that behavior, preprocess the \var{url} with \function{urlsplit()} and \function{urlunsplit()}, -removing possible \em{scheme} and \em{netloc} parts. +removing possible \emph{scheme} and \emph{netloc} parts. \end{funcdesc} \begin{funcdesc}{urldefrag}{url} Modified: python/branches/bcannon-objcap/Doc/lib/libwebbrowser.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libwebbrowser.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libwebbrowser.tex Fri May 25 22:13:08 2007 @@ -154,20 +154,20 @@ Browser controllers provide two methods which parallel two of the module-level convenience functions: -\begin{funcdesc}{open}{url\optional{, new\optional{, autoraise=1}}} +\begin{methoddesc}[controller]{open}{url\optional{, new\optional{, autoraise=1}}} Display \var{url} using the browser handled by this controller. If \var{new} is 1, a new browser window is opened if possible. If \var{new} is 2, a new browser page ("tab") is opened if possible. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{open_new}{url} +\begin{methoddesc}[controller]{open_new}{url} Open \var{url} in a new window of the browser handled by this controller, if possible, otherwise, open \var{url} in the only browser window. Alias \function{open_new}. -\end{funcdesc} +\end{methoddesc} -\begin{funcdesc}{open_new_tab}{url} +\begin{methoddesc}[controller]{open_new_tab}{url} Open \var{url} in a new page ("tab") of the browser handled by this controller, if possible, otherwise equivalent to \function{open_new}. \versionadded{2.5} -\end{funcdesc} +\end{methoddesc} Modified: python/branches/bcannon-objcap/Doc/lib/libwinreg.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libwinreg.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libwinreg.tex Fri May 25 22:13:08 2007 @@ -151,7 +151,7 @@ An application should only call \function{FlushKey()} if it requires absolute certainty that registry changes are on disk. - \emph{If you don't know whether a \function{FlushKey()} call is required, it + \note{If you don't know whether a \function{FlushKey()} call is required, it probably isn't.} \end{funcdesc} @@ -393,14 +393,14 @@ \method{Detach()} method to return the integer handle, and also disconnect the Windows handle from the handle object. -\begin{methoddesc}{Close}{} +\begin{methoddesc}[PyHKEY]{Close}{} Closes the underlying Windows handle. If the handle is already closed, no error is raised. \end{methoddesc} -\begin{methoddesc}{Detach}{} +\begin{methoddesc}[PyHKEY]{Detach}{} Detaches the Windows handle from the handle object. The result is an integer (or long on 64 bit Windows) that holds Modified: python/branches/bcannon-objcap/Doc/lib/libxmlrpclib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libxmlrpclib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libxmlrpclib.tex Fri May 25 22:13:08 2007 @@ -134,12 +134,12 @@ Servers that support the XML introspection API support some common methods grouped under the reserved \member{system} member: -\begin{methoddesc}{system.listMethods}{} +\begin{methoddesc}[ServerProxy]{system.listMethods}{} This method returns a list of strings, one for each (non-system) method supported by the XML-RPC server. \end{methoddesc} -\begin{methoddesc}{system.methodSignature}{name} +\begin{methoddesc}[ServerProxy]{system.methodSignature}{name} This method takes one parameter, the name of a method implemented by the XML-RPC server.It returns an array of possible signatures for this method. A signature is an array of types. The first of these types is @@ -159,7 +159,7 @@ value will be something other that list. \end{methoddesc} -\begin{methoddesc}{system.methodHelp}{name} +\begin{methoddesc}[ServerProxy]{system.methodHelp}{name} This method takes one parameter, the name of a method implemented by the XML-RPC server. It returns a documentation string describing the use of that method. If no such string is available, an empty string is @@ -184,7 +184,7 @@ It also has the following method, supported mainly for internal use by the unmarshalling code: -\begin{methoddesc}{encode}{out} +\begin{methoddesc}[Boolean]{encode}{out} Write the XML-RPC encoding of this Boolean item to the out stream object. \end{methoddesc} @@ -197,11 +197,11 @@ instance. It has the following methods, supported mainly for internal use by the marshalling/unmarshalling code: -\begin{methoddesc}{decode}{string} +\begin{methoddesc}[DateTime]{decode}{string} Accept a string as the instance's new time value. \end{methoddesc} -\begin{methoddesc}{encode}{out} +\begin{methoddesc}[DateTime]{encode}{out} Write the XML-RPC encoding of this \class{DateTime} item to the \var{out} stream object. \end{methoddesc} @@ -242,11 +242,11 @@ A \class{Fault} object encapsulates the content of an XML-RPC fault tag. Fault objects have the following members: -\begin{memberdesc}{faultCode} +\begin{memberdesc}[Fault]{faultCode} A string indicating the fault type. \end{memberdesc} -\begin{memberdesc}{faultString} +\begin{memberdesc}[Fault]{faultString} A string containing a diagnostic message associated with the fault. \end{memberdesc} @@ -258,19 +258,19 @@ server named by the URI does not exist). It has the following members: -\begin{memberdesc}{url} +\begin{memberdesc}[ProtocolError]{url} The URI or URL that triggered the error. \end{memberdesc} -\begin{memberdesc}{errcode} +\begin{memberdesc}[ProtocolError]{errcode} The error code. \end{memberdesc} -\begin{memberdesc}{errmsg} +\begin{memberdesc}[ProtocolError]{errmsg} The error message or diagnostic string. \end{memberdesc} -\begin{memberdesc}{headers} +\begin{memberdesc}[ProtocolError]{headers} A string containing the headers of the HTTP/HTTPS request that triggered the error. \end{memberdesc} @@ -287,7 +287,7 @@ Create an object used to boxcar method calls. \var{server} is the eventual target of the call. Calls can be made to the result object, -but they will immediately return \var{None}, and only store the +but they will immediately return \code{None}, and only store the call name and parameters in the \class{MultiCall} object. Calling the object itself causes all stored calls to be transmitted as a single \code{system.multicall} request. The result of this call Modified: python/branches/bcannon-objcap/Doc/lib/libzipfile.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libzipfile.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libzipfile.tex Fri May 25 22:13:08 2007 @@ -17,8 +17,10 @@ {PKZIP Application Note}. This module does not currently handle ZIP files which have appended -comments, or multi-disk ZIP files. It can handle ZIP files that use the -ZIP64 extensions (that is ZIP files that are more than 4 GByte in size). +comments, or multi-disk ZIP files. It can handle ZIP files that use +the ZIP64 extensions (that is ZIP files that are more than 4 GByte in +size). It supports decryption of encrypted files in ZIP archives, but +it cannot currently create an encrypted file. The available attributes of this module are: @@ -99,6 +101,8 @@ \end{verbatim} also works, and at least \program{WinZip} can read such files. + If \var{mode} is \code{a} and the file does not exist at all, + it is created. \var{compression} is the ZIP compression method to use when writing the archive, and should be \constant{ZIP_STORED} or \constant{ZIP_DEFLATED}; unrecognized values will cause @@ -112,6 +116,9 @@ ZIP file would require ZIP64 extensions. ZIP64 extensions are disabled by default because the default \program{zip} and \program{unzip} commands on \UNIX{} (the InfoZIP utilities) don't support these extensions. + + \versionchanged[If the file does not exist, it is created if the + mode is 'a']{2.6} \end{classdesc} \begin{methoddesc}{close}{} @@ -134,13 +141,50 @@ Return a list of archive members by name. \end{methoddesc} +\begin{methoddesc}{open}{name\optional{, mode\optional{, pwd}}} + Extract a member from the archive as a file-like object (ZipExtFile). + \var{name} is the name of the file in the archive. The \var{mode} + parameter, if included, must be one of the following: \code{'r'} (the + default), \code{'U'}, or \code{'rU'}. Choosing \code{'U'} or + \code{'rU'} will enable universal newline support in the read-only + object. \var{pwd} is the password used for encrypted files. + \begin{notice} + The file-like object is read-only and provides the following methods: + \method{read()}, \method{readline()}, \method{readlines()}, + \method{__iter__()}, \method{next()}. + \end{notice} + \begin{notice} + If the ZipFile was created by passing in a file-like object as the + first argument to the constructor, then the object returned by + \method{open()} shares the ZipFile's file pointer. Under these + circumstances, the object returned by \method{open()} should not + be used after any additional operations are performed on the + ZipFile object. If the ZipFile was created by passing in a string + (the filename) as the first argument to the constructor, then + \method{open()} will create a new file object that will be held + by the ZipExtFile, allowing it to operate independently of the + ZipFile. + \end{notice} + + \versionadded{2.6} +\end{methoddesc} + \begin{methoddesc}{printdir}{} Print a table of contents for the archive to \code{sys.stdout}. \end{methoddesc} -\begin{methoddesc}{read}{name} +\begin{methoddesc}{setpassword}{pwd} + Set \var{pwd} as default password to extract encrypted files. + \versionadded{2.6} +\end{methoddesc} + +\begin{methoddesc}{read}{name\optional{, pwd}} Return the bytes of the file in the archive. The archive must be - open for read or append. + open for read or append. \var{pwd} is the password used for encrypted + files and, if specified, it will override the default password set with + \method{setpassword()}. + + \versionchanged[\var{pwd} was added]{2.6} \end{methoddesc} \begin{methoddesc}{testzip}{} Modified: python/branches/bcannon-objcap/Doc/lib/libzlib.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libzlib.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libzlib.tex Fri May 25 22:13:08 2007 @@ -131,7 +131,7 @@ Decompression objects support the following methods, and two attributes: -\begin{memberdesc}{unused_data} +\begin{memberdesc}[Decompress]{unused_data} A string which contains any bytes past the end of the compressed data. That is, this remains \code{""} until the last byte that contains compression data is available. If the whole string turned out to @@ -145,7 +145,7 @@ \member{unused_data} attribute is no longer the empty string. \end{memberdesc} -\begin{memberdesc}{unconsumed_tail} +\begin{memberdesc}[Decompress]{unconsumed_tail} A string that contains any data that was not consumed by the last \method{decompress} call because it exceeded the limit for the uncompressed data buffer. This data has not yet been seen by the zlib Modified: python/branches/bcannon-objcap/Doc/mac/libframework.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/mac/libframework.tex (original) +++ python/branches/bcannon-objcap/Doc/mac/libframework.tex Fri May 25 22:13:08 2007 @@ -189,8 +189,6 @@ Window objects have the following methods, among others: -\setindexsubitem{(Window method)} - \begin{methoddesc}[Window]{open}{} Override this method to open a window. Store the MacOS window-id in \member{self.wid} and call the \method{do_postopen()} method to @@ -218,7 +216,7 @@ An update event for the window was received. Redraw the window. \end{methoddesc} -\begin{methoddesc}{do_activate}{activate, event} +\begin{methoddesc}[Window]{do_activate}{activate, event} The window was activated (\code{\var{activate} == 1}) or deactivated (\code{\var{activate} == 0}). Handle things like focus highlighting, etc. Deleted: /python/branches/bcannon-objcap/Doc/mac/libmacfs.tex ============================================================================== --- /python/branches/bcannon-objcap/Doc/mac/libmacfs.tex Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,241 +0,0 @@ -\section{\module{macfs} --- - Various file system services} - -\declaremodule{standard}{macfs} - \platform{Mac} -\modulesynopsis{Support for FSSpec, the Alias Manager, - \program{finder} aliases, and the Standard File package.} - -\deprecated{2.3}{The macfs module should be considered obsolete. For -\class{FSSpec}, \class{FSRef} and \class{Alias} handling use the -\module{Carbon.File} or \refmodule{Carbon.Folder} module. For file -dialogs use the \refmodule{EasyDialogs} module. Also, this module is -known to not work correctly with UFS partitions.} - -This module provides access to Macintosh \class{FSSpec} handling, the -Alias Manager, \program{finder} aliases and the Standard File package. -\index{Macintosh Alias Manager} -\index{Alias Manager, Macintosh} -\index{Standard File} - -Whenever a function or method expects a \var{file} argument, this -argument can be one of three things:\ (1) a full or partial Macintosh -pathname, (2) an \class{FSSpec} object or (3) a 3-tuple -\code{(\var{wdRefNum}, \var{parID}, \var{name})} as described in -\citetitle{Inside Macintosh:\ Files}. An \class{FSSpec} can point to -a non-existing file, as long as the folder containing the file exists. -Under MacPython the same is true for a pathname, but not under \UNIX-Python -because of the way pathnames and FSRefs works. See Apple's documentation -for details. - -A description of aliases and the -Standard File package can also be found there. - -\begin{funcdesc}{FSSpec}{file} -Create an \class{FSSpec} object for the specified file. -\end{funcdesc} - -\begin{funcdesc}{RawFSSpec}{data} -Create an \class{FSSpec} object given the raw data for the \C{} -structure for the \class{FSSpec} as a string. This is mainly useful -if you have obtained an \class{FSSpec} structure over a network. -\end{funcdesc} - -\begin{funcdesc}{RawAlias}{data} -Create an \class{Alias} object given the raw data for the \C{} -structure for the alias as a string. This is mainly useful if you -have obtained an \class{FSSpec} structure over a network. -\end{funcdesc} - -\begin{funcdesc}{FInfo}{} -Create a zero-filled \class{FInfo} object. -\end{funcdesc} - -\begin{funcdesc}{ResolveAliasFile}{file} -Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec}, -\var{isfolder}, \var{aliased})} where \var{fsspec} is the resulting -\class{FSSpec} object, \var{isfolder} is true if \var{fsspec} points -to a folder and \var{aliased} is true if the file was an alias in the -first place (otherwise the \class{FSSpec} object for the file itself -is returned). -\end{funcdesc} - -\begin{funcdesc}{StandardGetFile}{\optional{type, \moreargs}} -Present the user with a standard ``open input file'' -dialog. Optionally, you can pass up to four 4-character file types to limit -the files the user can choose from. The function returns an \class{FSSpec} -object and a flag indicating that the user completed the dialog -without cancelling. -\end{funcdesc} - -\begin{funcdesc}{PromptGetFile}{prompt\optional{, type, \moreargs}} -Similar to \function{StandardGetFile()} but allows you to specify a -prompt which will be displayed at the top of the dialog. -\end{funcdesc} - -\begin{funcdesc}{StandardPutFile}{prompt\optional{, default}} -Present the user with a standard ``open output file'' -dialog. \var{prompt} is the prompt string, and the optional -\var{default} argument initializes the output file name. The function -returns an \class{FSSpec} object and a flag indicating that the user -completed the dialog without cancelling. -\end{funcdesc} - -\begin{funcdesc}{GetDirectory}{\optional{prompt}} -Present the user with a non-standard ``select a directory'' dialog. You -have to first open the directory before clicking on the ``select current -directory'' button. \var{prompt} is the prompt string which will be -displayed at the top of the dialog. Return an \class{FSSpec} object and -a success-indicator. -\end{funcdesc} - -\begin{funcdesc}{SetFolder}{\optional{fsspec}} -Set the folder that is initially presented to the user when one of -the file selection dialogs is presented. \var{fsspec} should point to -a file in the folder, not the folder itself (the file need not exist, -though). If no argument is passed the folder will be set to the -current directory, i.e. what \function{os.getcwd()} returns. - -Note that starting with System 7.5 the user can change Standard File -behaviour with the ``general controls'' control panel, thereby making -this call inoperative. -\end{funcdesc} - -\begin{funcdesc}{FindFolder}{where, which, create} -Locates one of the ``special'' folders that Mac OS knows about, such as -the trash or the Preferences folder. \var{where} is the disk to -search, \var{which} is the 4-character string specifying which folder to -locate. Setting \var{create} causes the folder to be created if it -does not exist. Returns a \code{(\var{vrefnum}, \var{dirid})} tuple. - -The constants for \var{where} and \var{which} can be obtained from the -standard module \var{Carbon.Folders}. -\end{funcdesc} - -\begin{funcdesc}{NewAliasMinimalFromFullPath}{pathname} -Return a minimal \class{alias} object that points to the given file, which -must be specified as a full pathname. This is the only way to create an -\class{Alias} pointing to a non-existing file. - -\end{funcdesc} - -\begin{funcdesc}{FindApplication}{creator} -Locate the application with 4-character creator code \var{creator}. The -function returns an \class{FSSpec} object pointing to the application. -\end{funcdesc} - - -\subsection{FSSpec Objects \label{fsspec-objects}} - -\begin{memberdesc}[FSSpec]{data} -The raw data from the FSSpec object, suitable for passing -to other applications, for instance. -\end{memberdesc} - -\begin{methoddesc}[FSSpec]{as_pathname}{} -Return the full pathname of the file described by the \class{FSSpec} -object. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{as_tuple}{} -Return the \code{(\var{wdRefNum}, \var{parID}, \var{name})} tuple of -the file described by the \class{FSSpec} object. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{NewAlias}{\optional{file}} -Create an Alias object pointing to the file described by this -FSSpec. If the optional \var{file} parameter is present the alias -will be relative to that file, otherwise it will be absolute. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{NewAliasMinimal}{} -Create a minimal alias pointing to this file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{GetCreatorType}{} -Return the 4-character creator and type of the file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{SetCreatorType}{creator, type} -Set the 4-character creator and type of the file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{GetFInfo}{} -Return a \class{FInfo} object describing the finder info for the file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{SetFInfo}{finfo} -Set the finder info for the file to the values given as \var{finfo} -(an \class{FInfo} object). -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{GetDates}{} -Return a tuple with three floating point values representing the -creation date, modification date and backup date of the file. -\end{methoddesc} - -\begin{methoddesc}[FSSpec]{SetDates}{crdate, moddate, backupdate} -Set the creation, modification and backup date of the file. The values -are in the standard floating point format used for times throughout -Python. -\end{methoddesc} - - -\subsection{Alias Objects \label{alias-objects}} - -\begin{memberdesc}[Alias]{data} -The raw data for the Alias record, suitable for storing in a resource -or transmitting to other programs. -\end{memberdesc} - -\begin{methoddesc}[Alias]{Resolve}{\optional{file}} -Resolve the alias. If the alias was created as a relative alias you -should pass the file relative to which it is. Return the FSSpec for -the file pointed to and a flag indicating whether the \class{Alias} object -itself was modified during the search process. If the file does -not exist but the path leading up to it does exist a valid fsspec -is returned. -\end{methoddesc} - -\begin{methoddesc}[Alias]{GetInfo}{num} -An interface to the \C{} routine \cfunction{GetAliasInfo()}. -\end{methoddesc} - -\begin{methoddesc}[Alias]{Update}{file\optional{, file2}} -Update the alias to point to the \var{file} given. If \var{file2} is -present a relative alias will be created. -\end{methoddesc} - -Note that it is currently not possible to directly manipulate a -resource as an \class{Alias} object. Hence, after calling -\method{Update()} or after \method{Resolve()} indicates that the alias -has changed the Python program is responsible for getting the -\member{data} value from the \class{Alias} object and modifying the -resource. - - -\subsection{FInfo Objects \label{finfo-objects}} - -See \citetitle{Inside Macintosh: Files} for a complete description of what -the various fields mean. - -\begin{memberdesc}[FInfo]{Creator} -The 4-character creator code of the file. -\end{memberdesc} - -\begin{memberdesc}[FInfo]{Type} -The 4-character type code of the file. -\end{memberdesc} - -\begin{memberdesc}[FInfo]{Flags} -The finder flags for the file as 16-bit integer. The bit values in -\var{Flags} are defined in standard module \module{MACFS}. -\end{memberdesc} - -\begin{memberdesc}[FInfo]{Location} -A Point giving the position of the file's icon in its folder. -\end{memberdesc} - -\begin{memberdesc}[FInfo]{Fldr} -The folder the file is in (as an integer). -\end{memberdesc} Modified: python/branches/bcannon-objcap/Doc/mac/libmacic.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/mac/libmacic.tex (original) +++ python/branches/bcannon-objcap/Doc/mac/libmacic.tex Fri May 25 22:13:08 2007 @@ -68,14 +68,14 @@ following methods: -\begin{methoddesc}{launchurl}{url\optional{, hint}} +\begin{methoddesc}[IC]{launchurl}{url\optional{, hint}} Parse the given URL, launch the correct application and pass it the URL. The optional \var{hint} can be a scheme name such as \code{'mailto:'}, in which case incomplete URLs are completed with this scheme. If \var{hint} is not provided, incomplete URLs are invalid. \end{methoddesc} -\begin{methoddesc}{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}} +\begin{methoddesc}[IC]{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}} Find an URL somewhere in \var{data} and return start position, end position and the URL. The optional \var{start} and \var{end} can be used to limit the search, so for instance if a user clicks in a long @@ -85,7 +85,7 @@ complete incomplete URLs. \end{methoddesc} -\begin{methoddesc}{mapfile}{file} +\begin{methoddesc}[IC]{mapfile}{file} Return the mapping entry for the given \var{file}, which can be passed as either a filename or an \function{FSSpec()} result, and which need not exist. @@ -106,7 +106,7 @@ file and \var{entryname} is the name of this entry. \end{methoddesc} -\begin{methoddesc}{maptypecreator}{type, creator\optional{, filename}} +\begin{methoddesc}[IC]{maptypecreator}{type, creator\optional{, filename}} Return the mapping entry for files with given 4-character \var{type} and \var{creator} codes. The optional \var{filename} may be specified to further help finding the correct entry (if the creator code is @@ -115,7 +115,7 @@ The mapping entry is returned in the same format as for \var{mapfile}. \end{methoddesc} -\begin{methoddesc}{settypecreator}{file} +\begin{methoddesc}[IC]{settypecreator}{file} Given an existing \var{file}, specified either as a filename or as an \function{FSSpec()} result, set its creator and type correctly based on its extension. The finder is told about the change, so the finder Modified: python/branches/bcannon-objcap/Doc/mac/libmacostools.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/mac/libmacostools.tex (original) +++ python/branches/bcannon-objcap/Doc/mac/libmacostools.tex Fri May 25 22:13:08 2007 @@ -39,6 +39,7 @@ or type for file \var{dst} has changed. The file can be specified by pathname or fsspec. This call should tell the finder to redraw the files icon. +\deprecated{2.6}{The function is a no-op on OS X.} \end{funcdesc} \begin{datadesc}{BUFSIZ} Modified: python/branches/bcannon-objcap/Doc/mac/mac.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/mac/mac.tex (original) +++ python/branches/bcannon-objcap/Doc/mac/mac.tex Fri May 25 22:13:08 2007 @@ -51,7 +51,6 @@ \localmoduletable \input{libmac} -\input{libmacfs} \input{libmacic} \input{libmacos} \input{libmacostools} Modified: python/branches/bcannon-objcap/Doc/mac/undoc.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/mac/undoc.tex (original) +++ python/branches/bcannon-objcap/Doc/mac/undoc.tex Fri May 25 22:13:08 2007 @@ -21,7 +21,7 @@ \modulesynopsis{Helper module for BuildApplet, BuildApplication and macfreeze.} -\deprecated{2.4} +\deprecated{2.4}{} \section{\module{cfmfile} --- Code Fragment Resource module} \declaremodule{standard}{cfmfile} @@ -33,7 +33,7 @@ used by BuildApplication to combine all plugin modules to a single executable. -\deprecated{2.4} +\deprecated{2.4}{} \section{\module{icopen} --- Internet Config replacement for \method{open()}} \declaremodule{standard}{icopen} Modified: python/branches/bcannon-objcap/Doc/mac/using.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/mac/using.tex (original) +++ python/branches/bcannon-objcap/Doc/mac/using.tex Fri May 25 22:13:08 2007 @@ -2,7 +2,7 @@ \sectionauthor{Bob Savage}{bobsavage at mac.com} Python on a Macintosh running Mac OS X is in principle very similar to -Python on any other \UNIX platform, but there are a number of additional +Python on any other \UNIX{} platform, but there are a number of additional features such as the IDE and the Package Manager that are worth pointing out. Python on Mac OS 9 or earlier can be quite different from Python on @@ -13,206 +13,166 @@ \section{Getting and Installing MacPython \label{getting-OSX}} -Mac OS X 10.3 comes with Python 2.3 pre-installed by Apple. -This installation does not come with the IDE and other additions, however, -so to get these you need to install the \program{MacPython for Panther additions} -from the MacPython website, \url{http://www.cwi.nl/\textasciitilde jack/macpython}. - -For MacPython 2.4, or for any MacPython on earlier releases of Mac OS X, -you need to install a full distribution from the same website. +Mac OS X 10.4 comes with Python 2.3 pre-installed by Apple. However, you are +encouraged to install the most recent version of Python from the Python website +(\url{http://www.python.org}). A ``universal binary'' build of Python 2.5, which +runs natively on the Mac's new Intel and legacy PPC CPU's, is available there. What you get after installing is a number of things: \begin{itemize} - \item A \file{MacPython-2.3} folder in your \file{Applications} - folder. In here you find the PythonIDE Integrated Development Environment; - PythonLauncher, which handles double-clicking Python scripts from - the Finder; and the Package Manager. - - \item A fairly standard \UNIX{} commandline Python interpreter in - \file{/usr/local/bin/python}, but without the usual - \file{/usr/local/lib/python}. - - \item A framework \file{/Library/Frameworks/Python.framework}, where - all the action really is, but which you usually do not have to be aware of. +\item A \file{MacPython 2.5} folder in your \file{Applications} folder. In here + you find IDLE, the development environment that is a standard part of official + Python distributions; PythonLauncher, which handles double-clicking Python + scripts from the Finder; and the ``Build Applet'' tool, which allows you to + package Python scripts as standalone applications on your system. + +\item A framework \file{/Library/Frameworks/Python.framework}, which includes + the Python executable and libraries. The installer adds this location to your + shell path. To uninstall MacPython, you can simply remove these three + things. A symlink to the Python executable is placed in /usr/local/bin/. \end{itemize} -To uninstall MacPython you can simply remove these three things. +The Apple-provided build of Python is installed in +\file{/System/Library/Frameworks/Python.framework} and \file{/usr/bin/python}, +respectively. You should never modify or delete these, as they are +Apple-controlled and are used by Apple- or third-party software. + +IDLE includes a help menu that allows you to access Python documentation. If you +are completely new to Python you should start reading the tutorial introduction +in that document. -If you use the ``additions'' installer to install on top of an existing -Apple-Python you will not get the framework and the commandline interpreter, -as they have been installed by Apple already, in -\file{/System/Library/Frameworks/Python.framework} and -\file{/usr/bin/python}, respectively. You should in principle never modify -or delete these, as they are Apple-controlled and may be used by Apple- or -third-party software. - -PythonIDE contains an Apple Help Viewer book called "MacPython Help" -which you can access through its help menu. If you are completely new to -Python you should start reading the IDE introduction in that document. +If you are familiar with Python on other \UNIX{} platforms you should read the +section on running Python scripts from the \UNIX{} shell. -If you are familiar with Python on other \UNIX{} platforms you should -read the section on running Python scripts from the \UNIX{} shell. \subsection{How to run a Python script} -Your best way to get started with Python on Mac OS X is through the PythonIDE -integrated development environment, see section \ref{IDE} and use the Help -menu when the IDE is running. - -If you want to run Python scripts from the Terminal window command line -or from the Finder you first need an editor to create your script. -Mac OS X comes with a number of standard \UNIX{} command line editors, -\program{vim} and \program{emacs} among them. If you want a more Mac-like -editor \program{BBEdit} or \program{TextWrangler} from Bare Bones Software -(see \url{http://www.barebones.com/products/bbedit/index.shtml}) are -good choices. \program{AppleWorks} or any other -word processor that can save files in ASCII is also a possibility, including -\program{TextEdit} which is included with OS X. +Your best way to get started with Python on Mac OS X is through the IDLE +integrated development environment, see section \ref{IDE} and use the Help menu +when the IDE is running. + +If you want to run Python scripts from the Terminal window command line or from +the Finder you first need an editor to create your script. Mac OS X comes with a +number of standard \UNIX{} command line editors, \program{vim} and +\program{emacs} among them. If you want a more Mac-like editor, \program{BBEdit} +or \program{TextWrangler} from Bare Bones Software (see +\url{http://www.barebones.com/products/bbedit/index.shtml}) are good choices, as +is \program{TextMate} (see \url{http://macromates.com/}). Other editors include +\program{Gvim} (\url{http://macvim.org}) and \program{Aquamacs} +(\url{http://aquamacs.org}). To run your script from the Terminal window you must make sure that -\file{/usr/local/bin} is in your shell search path. +\file{/usr/local/bin} is in your shell search path. To run your script from the Finder you have two options: + \begin{itemize} - \item Drag it to \program{PythonLauncher} - \item Select \program{PythonLauncher} as the default application - to open your script (or any .py script) through the finder Info window - and double-click it. +\item Drag it to \program{PythonLauncher} +\item Select \program{PythonLauncher} as the default application to open your + script (or any .py script) through the finder Info window and double-click it. + \program{PythonLauncher} has various preferences to control how your script is + launched. Option-dragging allows you to change these for one invocation, or + use its Preferences menu to change things globally. \end{itemize} -PythonLauncher has various preferences to control how your script is launched. -Option-dragging allows you to change these for one invocation, or use its -Preferences menu to change things globally. \subsection{Running scripts with a GUI \label{osx-gui-scripts}} -There is one Mac OS X quirk that you need to be aware of: programs -that talk to the Aqua window manager (in other words, anything that has a GUI) -need to be run in a special way. Use \program{pythonw} instead of \program{python} -to start such scripts. - -\subsection{configuration} - -MacPython honours all standard \UNIX{} environment variables such as -\envvar{PYTHONPATH}, but setting these variables for programs started -from the Finder is non-standard -as the Finder does not read your \file{.profile} or \file{.cshrc} at startup. -You need to create a file \file{\textasciitilde /.MacOSX/environment.plist}. -See Apple's Technical Document QA1067 for details. +With older versions of Python, there is one Mac OS X quirk that you need to be +aware of: programs that talk to the Aqua window manager (in other words, +anything that has a GUI) need to be run in a special way. Use \program{pythonw} +instead of \program{python} to start such scripts. + +With Python 2.5, you can use either \program{python} or \program{pythonw}. + +\subsection{Configuration} + +Python on OS X honors all standard \UNIX{} environment variables such as +\envvar{PYTHONPATH}, but setting these variables for programs started from the +Finder is non-standard as the Finder does not read your \file{.profile} or +\file{.cshrc} at startup. You need to create a file \file{\textasciitilde + /.MacOSX/environment.plist}. See Apple's Technical Document QA1067 for +details. -Installing additional Python packages is most easily done through the -Package Manager, see the MacPython Help Book for details. +For more information on installation Python packages in MacPython, see section +\ref{mac-package-manager}, ``Installing Additional Python Packages.'' \section{The IDE\label{IDE}} -The \program{Python IDE} (Integrated Development Environment) is a -separate application that acts as a text editor for your Python code, -a class browser, a graphical debugger, and more. - -The online Python Help contains a quick walkthrough of the IDE that -shows the major features and how to use them. - -\subsection{Using the ``Python Interactive'' window} - -Use this window like you would use a normal \UNIX{} command line -interpreter. - -\subsection{Writing a Python Script \label{IDEwrite}} - -In addition to using the \program{Python IDE} interactively, you can -also type out a complete Python program, saving it incrementally, and -execute it or smaller selections of it. - -You can create a new script, open a previously saved script, and save -your currently open script by selecting the appropriate item in the -``File'' menu. Dropping a Python script onto the -\program{Python IDE} will open it for editing. - -When the \program{Python IDE} saves a script, it uses the creator code -settings which are available by clicking on the small black triangle -on the top right of the document window, and selecting ``save -options''. The default is to save the file with the \program{Python -IDE} as the creator, this means that you can open the file for editing -by simply double-clicking on its icon. You might want to change this -behaviour so that it will be opened by the -\program{PythonLauncher}, and run. To do this simply choose -``PythonLauncher'' from the ``save options''. Note that these -options are associated with the \emph{file} not the application. - - -\subsection{Executing a script from within the IDE - \label{IDEexecution}} - -You can run the script in the frontmost window of the \program{Python -IDE} by hitting the run all button. You should be aware, however that -if you use the Python convention \samp{if __name__ == "__main__":} the -script will \emph{not} be ``__main__'' by default. To get that -behaviour you must select the ``Run as __main__'' option from the -small black triangle on the top right of the document window. Note -that this option is associated with the \emph{file} not the -application. It \emph{will} stay active after a save, however; to shut -this feature off simply select it again. - - -\subsection{``Save as'' versus ``Save as Applet'' - \label{IDEapplet}} - -When you are done writing your Python script you have the option of -saving it as an ``applet'' (by selecting ``Save as applet'' from the -``File'' menu). This has a significant advantage in that you can drop -files or folders onto it, to pass them to the applet the way -command-line users would type them onto the command-line to pass them -as arguments to the script. However, you should make sure to save the -applet as a separate file, do not overwrite the script you are -writing, because you will not be able to edit it again. - -Accessing the items passed to the applet via ``drag-and-drop'' is done -using the standard \member{sys.argv} mechanism. See the general -documentation for more -% need to link to the appropriate place in non-Mac docs - -Note that saving a script as an applet will not make it runnable on a -system without a Python installation. - -%\subsection{Debugger} -% **NEED INFO HERE** - -%\subsection{Module Browser} -% **NEED INFO HERE** - -%\subsection{Profiler} -% **NEED INFO HERE** -% end IDE - -%\subsection{The ``Scripts'' menu} -% **NEED INFO HERE** - -\section{The Package Manager} - -Historically MacPython came with a number of useful extension packages -included, because most Macintosh users do not have access to a development -environment and C compiler. For Mac OS X that bundling is no longer done, -but a new mechanism has been made available to allow easy access to -extension packages. - -The Python Package Manager helps you installing additional packages -that enhance Python. It determines the exact MacOS version and Python -version you have and uses that information to download a database that -has packages that are tested and tried on that combination. In other -words: if something is in your Package Manager window but does not work -you are free to blame the database maintainer. - -PackageManager then checks which of the packages you have installed and -which ones are not. This should also work when you have installed packages -outside of PackageManager. You can select packages and install them, -and PackageManager will work out the requirements and install these too. - -Often PackageManager will list a package in two flavors: binary and -source. Binary should always work, source will only work if you have -installed the Apple Developer Tools. PackageManager will warn you about -this, and also about other external dependencies. +MacPython ships with the standard IDLE development environment. A good +introduction to using IDLE can be found at +\url{http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html}. + + +\section{Installing Additional Python Packages \label{mac-package-manager}} + +There are several methods to install additional Python packages: + +\begin{itemize} +\item \url{http://pythonmac.org/packages/} contains selected compiled packages + for Python 2.5, 2.4, and 2.3. +\item Packages can be installed via the standard Python distutils mode + (\samp{python setup.py install}). +\item Many packages can also be installed via the \program{setuptools} + extension. +\end{itemize} + + +\section{GUI Programming on the Mac} + +There are several options for building GUI applications on the Mac with Python. + +\emph{PyObjC} is a Python binding to Apple's Objective-C/Cocoa framework, which +is the foundation of most modern Mac development. Information on PyObjC is +available from \url{http://pybojc.sourceforge.net}. + +The standard Python GUI toolkit is \module{Tkinter}, based on the cross-platform +Tk toolkit (\url{http://www.tcl.tk}). An Aqua-native version of Tk is bundled +with OS X by Apple, and the latest version can be downloaded and installed from +\url{http://www.activestate.com}; it can also be built from source. + +\emph{wxPython} is another popular cross-platform GUI toolkit that runs natively +on Mac OS X. Packages and documentation are available from +\url{http://www.wxpython.org}. + +\emph{PyQt} is another popular cross-platform GUI toolkit that runs natively on +Mac OS X. More information can be found at +\url{http://www.riverbankcomputing.co.uk/pyqt/}. + + +\section{Distributing Python Applications on the Mac} + +The ``Build Applet'' tool that is placed in the MacPython 2.5 folder is fine for +packaging small Python scripts on your own machine to run as a standard Mac +application. This tool, however, is not robust enough to distribute Python +applications to other users. + +The standard tool for deploying standalone Python applications on the Mac is +\program{py2app}. More information on installing and using py2app can be found +at \url{http://undefined.org/python/\#py2app}. + +\section{Application Scripting} + +Python can also be used to script other Mac applications via Apple's Open +Scripting Architecture (OSA); see +\url{http://appscript.sourceforge.net}. Appscript is a high-level, user-friendly +Apple event bridge that allows you to control scriptable Mac OS X applications +using ordinary Python scripts. Appscript makes Python a serious alternative to +Apple's own \emph{AppleScript} language for automating your Mac. A related +package, \emph{PyOSA}, is an OSA language component for the Python scripting +language, allowing Python code to be executed by any OSA-enabled application +(Script Editor, Mail, iTunes, etc.). PyOSA makes Python a full peer to +AppleScript. + +\section{Other Resources} + +The MacPython mailing list is an excellent support resource for Python users and +developers on the Mac: + +\url{http://www.python.org/community/sigs/current/pythonmac-sig/} + +Another useful resource is the MacPython wiki: -PackageManager is available as a separate application and also as a -function of the IDE, through the File->Package Manager menu entry. +\url{http://wiki.python.org/moin/MacPython} Modified: python/branches/bcannon-objcap/Doc/ref/ref1.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/ref/ref1.tex (original) +++ python/branches/bcannon-objcap/Doc/ref/ref1.tex Fri May 25 22:13:08 2007 @@ -93,7 +93,7 @@ \index{syntax} \index{notation} -\begin{productionlist} +\begin{productionlist}[*] \production{name}{\token{lc_letter} (\token{lc_letter} | "_")*} \production{lc_letter}{"a"..."z"} \end{productionlist} Modified: python/branches/bcannon-objcap/Doc/ref/ref3.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/ref/ref3.tex (original) +++ python/branches/bcannon-objcap/Doc/ref/ref3.tex Fri May 25 22:13:08 2007 @@ -219,7 +219,7 @@ \indexii{integer}{representation} \item[Floating point numbers] -These represent machine-level double precision floating point numbers. +These represent machine-level double precision floating point numbers. You are at the mercy of the underlying machine architecture (and C or Java implementation) for the accepted range and handling of overflow. Python does not support single-precision floating point numbers; the @@ -471,7 +471,7 @@ \obindex{function} \obindex{user-defined function} -Special attributes: +Special attributes: \begin{tableiii}{lll}{member}{Attribute}{Meaning}{} \lineiii{func_doc}{The function's documentation string, or @@ -861,12 +861,12 @@ \begin{description} \item[Code objects] -Code objects represent \emph{byte-compiled} executable Python code, or +Code objects represent \emph{byte-compiled} executable Python code, or \emph{bytecode}. The difference between a code object and a function object is that the function object contains an explicit reference to the function's globals (the module in which it -was defined), while a code object contains no context; +was defined), while a code object contains no context; also the default argument values are stored in the function object, not in the code object (because they represent values calculated at run-time). Unlike function objects, code objects are immutable and @@ -1070,7 +1070,7 @@ %========================================================================= \section{New-style and classic classes} -Classes and instances come in two flavors: old-style or classic, and new-style. +Classes and instances come in two flavors: old-style or classic, and new-style. Up to Python 2.1, old-style classes were the only flavour available to the user. The concept of (old-style) class is unrelated to the concept of type: if @@ -1245,7 +1245,7 @@ string object. If a class defines \method{__repr__()} but not \method{__str__()}, then \method{__repr__()} is also used when an ``informal'' string -representation of instances of that class is required. +representation of instances of that class is required. This is typically used for debugging, so it is important that the representation is information-rich and unambiguous. @@ -1282,10 +1282,14 @@ \code{\var{x}.__ne__(\var{y})}, \code{\var{x}>\var{y}} calls \code{\var{x}.__gt__(\var{y})}, and \code{\var{x}>=\var{y}} calls \code{\var{x}.__ge__(\var{y})}. -These methods can return any value, but if the comparison operator is -used in a Boolean context, the return value should be interpretable as -a Boolean value, else a \exception{TypeError} will be raised. -By convention, \code{False} is used for false and \code{True} for true. + +A rich comparison method may return the singleton \code{NotImplemented} if it +does not implement the operation for a given pair of arguments. +By convention, \code{False} and \code{True} are returned for a successful +comparison. However, these methods can return any value, so if the +comparison operator is used in a Boolean context (e.g., in the condition +of an \code{if} statement), Python will call \function{bool()} on the +value to determine if the result is true or false. There are no implied relationships among the comparison operators. The truth of \code{\var{x}==\var{y}} does not imply that \code{\var{x}!=\var{y}} @@ -1299,9 +1303,7 @@ \method{__ge__()} are each other's reflection, and \method{__eq__()} and \method{__ne__()} are their own reflection. -Arguments to rich comparison methods are never coerced. A rich -comparison method may return \code{NotImplemented} if it does not -implement the operation for a given pair of arguments. +Arguments to rich comparison methods are never coerced. \end{methoddesc} \begin{methoddesc}[object]{__cmp__}{self, other} @@ -1401,7 +1403,7 @@ dictionary). \var{name} is the attribute name, \var{value} is the value to be assigned to it. -If \method{__setattr__()} wants to assign to an instance attribute, it +If \method{__setattr__()} wants to assign to an instance attribute, it should not simply execute \samp{self.\var{name} = value} --- this would cause a recursive call to itself. Instead, it should insert the value in the dictionary of instance attributes, e.g., @@ -1424,8 +1426,8 @@ \begin{methoddesc}[object]{__getattribute__}{self, name} Called unconditionally to implement attribute accesses for instances -of the class. If the class also defines \method{__getattr__()}, the latter -will not be called unless \method{__getattribute__()} either calls it +of the class. If the class also defines \method{__getattr__()}, the latter +will not be called unless \method{__getattribute__()} either calls it explicitly or raises an \exception{AttributeError}. This method should return the (computed) attribute value or raise an \exception{AttributeError} exception. @@ -1477,7 +1479,7 @@ The default behavior for attribute access is to get, set, or delete the attribute from an object's dictionary. For instance, \code{a.x} has a lookup chain starting with \code{a.__dict__['x']}, then -\code{type(a).__dict__['x']}, and continuing +\code{type(a).__dict__['x']}, and continuing through the base classes of \code{type(a)} excluding metaclasses. However, if the looked-up value is an object defining one of the descriptor @@ -1491,14 +1493,14 @@ How the arguments are assembled depends on \code{a}: \begin{itemize} - + \item[Direct Call] The simplest and least common call is when user code directly invokes a descriptor method: \code{x.__get__(a)}. \item[Instance Binding] If binding to a new-style object instance, \code{a.x} is transformed into the call: \code{type(a).__dict__['x'].__get__(a, type(a))}. - + \item[Class Binding] If binding to a new-style class, \code{A.x} is transformed into the call: \code{A.__dict__['x'].__get__(None, A)}. @@ -1507,7 +1509,7 @@ \code{obj.__class__.__mro__} for the base class \code{A} immediately preceding \code{B} and then invokes the descriptor with the call: \code{A.__dict__['m'].__get__(obj, A)}. - + \end{itemize} For instance bindings, the precedence of descriptor invocation depends @@ -1520,7 +1522,7 @@ Python methods (including \function{staticmethod()} and \function{classmethod()}) are implemented as non-data descriptors. Accordingly, instances can redefine and override methods. This allows individual instances to acquire -behaviors that differ from other instances of the same class. +behaviors that differ from other instances of the same class. The \function{property()} function is implemented as a data descriptor. Accordingly, instances cannot override the behavior of a property. @@ -1538,14 +1540,14 @@ variables and reserves just enough space in each instance to hold a value for each variable. Space is saved because \var{__dict__} is not created for each instance. - + \begin{datadesc}{__slots__} This class variable can be assigned a string, iterable, or sequence of strings with variable names used by instances. If defined in a new-style class, \var{__slots__} reserves space for the declared variables and prevents the automatic creation of \var{__dict__} and \var{__weakref__} for each instance. -\versionadded{2.2} +\versionadded{2.2} \end{datadesc} \noindent @@ -1557,23 +1559,23 @@ variables not listed in the \var{__slots__} definition. Attempts to assign to an unlisted variable name raises \exception{AttributeError}. If dynamic assignment of new variables is desired, then add \code{'__dict__'} to the -sequence of strings in the \var{__slots__} declaration. +sequence of strings in the \var{__slots__} declaration. \versionchanged[Previously, adding \code{'__dict__'} to the \var{__slots__} declaration would not enable the assignment of new attributes not -specifically listed in the sequence of instance variable names]{2.3} +specifically listed in the sequence of instance variable names]{2.3} \item Without a \var{__weakref__} variable for each instance, classes defining \var{__slots__} do not support weak references to its instances. If weak reference support is needed, then add \code{'__weakref__'} to the -sequence of strings in the \var{__slots__} declaration. +sequence of strings in the \var{__slots__} declaration. \versionchanged[Previously, adding \code{'__weakref__'} to the \var{__slots__} -declaration would not enable support for weak references]{2.3} +declaration would not enable support for weak references]{2.3} \item \var{__slots__} are implemented at the class level by creating descriptors (\ref{descriptors}) for each variable name. As a result, class attributes cannot be used to set default values for instance variables defined by \var{__slots__}; otherwise, the class attribute would -overwrite the descriptor assignment. +overwrite the descriptor assignment. \item If a class defines a slot also defined in a base class, the instance variable defined by the base class slot is inaccessible (except by retrieving @@ -1582,14 +1584,19 @@ \item The action of a \var{__slots__} declaration is limited to the class where it is defined. As a result, subclasses will have a \var{__dict__} -unless they also define \var{__slots__}. +unless they also define \var{__slots__}. \item \var{__slots__} do not work for classes derived from ``variable-length'' -built-in types such as \class{long}, \class{str} and \class{tuple}. +built-in types such as \class{long}, \class{str} and \class{tuple}. \item Any non-string iterable may be assigned to \var{__slots__}. Mappings may also be used; however, in the future, special meaning may -be assigned to the values corresponding to each key. +be assigned to the values corresponding to each key. + +\item \var{__class__} assignment works only if both classes have the +same \var{__slots__}. +\versionchanged[Previously, \var{__class__} assignment raised an error +if either new or old class had \var{__slots__}]{2.6} \end{itemize} @@ -1615,7 +1622,7 @@ This variable can be any callable accepting arguments for \code{name}, \code{bases}, and \code{dict}. Upon class creation, the callable is used instead of the built-in \function{type()}. -\versionadded{2.2} +\versionadded{2.2} \end{datadesc} The appropriate metaclass is determined by the following precedence rules: @@ -1632,7 +1639,7 @@ \item Otherwise, the old-style, classic metaclass (types.ClassType) is used. -\end{itemize} +\end{itemize} The potential uses for metaclasses are boundless. Some ideas that have been explored including logging, interface checking, automatic delegation, @@ -1665,15 +1672,15 @@ that mappings provide the methods \method{keys()}, \method{values()}, \method{items()}, \method{has_key()}, \method{get()}, \method{clear()}, \method{setdefault()}, \method{iterkeys()}, \method{itervalues()}, -\method{iteritems()}, \method{pop()}, \method{popitem()}, +\method{iteritems()}, \method{pop()}, \method{popitem()}, \method{copy()}, and \method{update()} behaving similar to those for Python's standard dictionary objects. The \module{UserDict} module provides a \class{DictMixin} class to help create those methods from a base set of \method{__getitem__()}, \method{__setitem__()}, -\method{__delitem__()}, and \method{keys()}. +\method{__delitem__()}, and \method{keys()}. Mutable sequences should provide methods \method{append()}, \method{count()}, \method{index()}, -\method{extend()}, +\method{extend()}, \method{insert()}, \method{pop()}, \method{remove()}, \method{reverse()} and \method{sort()}, like Python standard list objects. Finally, sequence types should implement addition (meaning concatenation) and @@ -1696,12 +1703,12 @@ \ttindex{items()} \ttindex{iterkeys()} \ttindex{itervalues()} - \ttindex{iteritems()} + \ttindex{iteritems()} \ttindex{has_key()} \ttindex{get()} \ttindex{setdefault()} - \ttindex{pop()} - \ttindex{popitem()} + \ttindex{pop()} + \ttindex{popitem()} \ttindex{clear()} \ttindex{copy()} \ttindex{update()} @@ -1709,7 +1716,7 @@ \withsubitem{(sequence object method)}{ \ttindex{append()} \ttindex{count()} - \ttindex{extend()} + \ttindex{extend()} \ttindex{index()} \ttindex{insert()} \ttindex{pop()} @@ -1723,7 +1730,7 @@ \ttindex{__rmul__()} \ttindex{__imul__()} \ttindex{__contains__()} - \ttindex{__iter__()}} + \ttindex{__iter__()}} \withsubitem{(numeric object method)}{\ttindex{__coerce__()}} \begin{methoddesc}[container object]{__len__}{self} @@ -1746,7 +1753,7 @@ (after any special interpretation of negative values), \exception{IndexError} should be raised. For mapping types, if \var{key} is missing (not in the container), -\exception{KeyError} should be raised. +\exception{KeyError} should be raised. \note{\keyword{for} loops expect that an \exception{IndexError} will be raised for illegal indexes to allow proper detection of the end of the sequence.} @@ -1945,7 +1952,7 @@ \methodline[numeric object]{__rmul__}{self, other} \methodline[numeric object]{__rdiv__}{self, other} \methodline[numeric object]{__rtruediv__}{self, other} -\methodline[numeric object]{__rfloordiv__}{self, other} +\methodline[numeric object]{__rfloordiv__}{self, other} \methodline[numeric object]{__rmod__}{self, other} \methodline[numeric object]{__rdivmod__}{self, other} \methodline[numeric object]{__rpow__}{self, other} @@ -1966,7 +1973,7 @@ For operands of the same type, it is assumed that if the non-reflected method (such as \method{__add__()}) fails the operation is not supported, which is why the reflected method - is not called.} + is not called.} For instance, to evaluate the expression \var{x}\code{-}\var{y}, where \var{y} is an instance of a class that has an \method{__rsub__()} method, \code{\var{y}.__rsub__(\var{x})} @@ -1991,7 +1998,7 @@ \methodline[numeric object]{__idiv__}{self, other} \methodline[numeric object]{__itruediv__}{self, other} \methodline[numeric object]{__ifloordiv__}{self, other} -\methodline[numeric object]{__imod__}{self, other} +\methodline[numeric object]{__imod__}{self, other} \methodline[numeric object]{__ipow__}{self, other\optional{, modulo}} \methodline[numeric object]{__ilshift__}{self, other} \methodline[numeric object]{__irshift__}{self, other} Modified: python/branches/bcannon-objcap/Doc/ref/ref5.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/ref/ref5.tex (original) +++ python/branches/bcannon-objcap/Doc/ref/ref5.tex Fri May 25 22:13:08 2007 @@ -56,7 +56,7 @@ \production{enclosure} {\token{parenth_form} | \token{list_display}} \productioncont{| \token{generator_expression} | \token{dict_display}} - \productioncont{| \token{string_conversion}} + \productioncont{| \token{string_conversion} | \token{yield_atom}} \end{productionlist} @@ -65,6 +65,7 @@ \index{identifier} An identifier occurring as an atom is a name. See +section \ref{identifiers} for lexical definition and section~\ref{naming} for documentation of naming and binding. When the name is bound to an object, evaluation of the atom yields @@ -154,22 +155,20 @@ square brackets: \begin{productionlist} - \production{test} - {\token{or_test} | \token{lambda_form}} - \production{testlist} - {\token{test} ( "," \token{test} )* [ "," ]} \production{list_display} - {"[" [\token{listmaker}] "]"} - \production{listmaker} - {\token{expression} ( \token{list_for} - | ( "," \token{expression} )* [","] )} - \production{list_iter} - {\token{list_for} | \token{list_if}} + {"[" [\token{expression_list} | \token{list_comprehension}] "]"} + \production{list_comprehension} + {\token{expression} \token{list_for}} \production{list_for} - {"for" \token{expression_list} "in" \token{testlist} + {"for" \token{target_list} "in" \token{old_expression_list} [\token{list_iter}]} + \production{old_expression_list} + {\token{old_expression} + [("," \token{old_expression})+ [","]]} + \production{list_iter} + {\token{list_for} | \token{list_if}} \production{list_if} - {"if" \token{test} [\token{list_iter}]} + {"if" \token{old_expression} [\token{list_iter}]} \end{productionlist} A list display yields a new list object. Its contents are specified @@ -200,19 +199,18 @@ \begin{productionlist} \production{generator_expression} - {"(" \token{test} \token{genexpr_for} ")"} + {"(" \token{expression} \token{genexpr_for} ")"} \production{genexpr_for} - {"for" \token{expression_list} "in" \token{test} + {"for" \token{target_list} "in" \token{or_test} [\token{genexpr_iter}]} \production{genexpr_iter} {\token{genexpr_for} | \token{genexpr_if}} \production{genexpr_if} - {"if" \token{test} [\token{genexpr_iter}]} + {"if" \token{old_expression} [\token{genexpr_iter}]} \end{productionlist} A generator expression yields a new generator object. \obindex{generator} -\obindex{generator expression} It consists of a single expression followed by at least one \keyword{for} clause and zero or more \keyword{for} or \keyword{if} clauses. The iterating values of the new generator are those that @@ -311,6 +309,142 @@ \bifuncindex{str} +\subsection{Yield expressions\label{yieldexpr}} +\kwindex{yield} +\indexii{yield}{expression} +\indexii{generator}{function} + +\begin{productionlist} + \production{yield_atom} + {"(" \token{yield_expression} ")"} + \production{yield_expression} + {"yield" [\token{expression_list}]} +\end{productionlist} + +\versionadded{2.5} + +The \keyword{yield} expression is only used when defining a generator +function, and can only be used in the body of a function definition. +Using a \keyword{yield} expression in a function definition is +sufficient to cause that definition to create a generator function +instead of a normal function. + +When a generator function is called, it returns an iterator known as a +generator. That generator then controls the execution of a generator +function. The execution starts when one of the generator's methods is +called. At that time, the execution proceeds to the first +\keyword{yield} expression, where it is suspended again, returning the +value of \grammartoken{expression_list} to generator's caller. By +suspended we mean that all local state is retained, including the +current bindings of local variables, the instruction pointer, and the +internal evaluation stack. When the execution is resumed by calling +one of the generator's methods, the function can proceed exactly as +if the \keyword{yield} expression was just another external call. +The value of the \keyword{yield} expression after resuming depends on +the method which resumed the execution. + +\index{coroutine} + +All of this makes generator functions quite similar to coroutines; they +yield multiple times, they have more than one entry point and their +execution can be suspended. The only difference is that a generator +function cannot control where should the execution continue after it +yields; the control is always transfered to the generator's caller. + +\obindex{generator} + +The following generator's methods can be used to control the execution +of a generator function: + +\exindex{StopIteration} + +\begin{methoddesc}[generator]{next}{} + Starts the execution of a generator function or resumes it at the + last executed \keyword{yield} expression. When a generator function + is resumed with a \method{next()} method, the current \keyword{yield} + expression always evaluates to \constant{None}. The execution then + continues to the next \keyword{yield} expression, where the generator + is suspended again, and the value of the + \grammartoken{expression_list} is returned to \method{next()}'s + caller. If the generator exits without yielding another value, a + \exception{StopIteration} exception is raised. +\end{methoddesc} + +\begin{methoddesc}[generator]{send}{value} + Resumes the execution and ``sends'' a value into the generator + function. The \code{value} argument becomes the result of the + current \keyword{yield} expression. The \method{send()} method + returns the next value yielded by the generator, or raises + \exception{StopIteration} if the generator exits without yielding + another value. + When \method{send()} is called to start the generator, it must be + called with \constant{None} as the argument, because there is no + \keyword{yield} expression that could receieve the value. +\end{methoddesc} + +\begin{methoddesc}[generator]{throw} + {type\optional{, value\optional{, traceback}}} + Raises an exception of type \code{type} at the point where generator + was paused, and returns the next value yielded by the generator + function. If the generator exits without yielding another value, a + \exception{StopIteration} exception is raised. If the generator + function does not catch the passed-in exception, or raises a + different exception, then that exception propagates to the caller. +\end{methoddesc} + +\exindex{GeneratorExit} + +\begin{methoddesc}[generator]{close}{} + Raises a \exception{GeneratorExit} at the point where the generator + function was paused. If the generator function then raises + \exception{StopIteration} (by exiting normally, or due to already + being closed) or \exception{GeneratorExit} (by not catching the + exception), close returns to its caller. If the generator yields a + value, a \exception{RuntimeError} is raised. If the generator raises + any other exception, it is propagated to the caller. \method{close} + does nothing if the generator has already exited due to an exception + or normal exit. +\end{methoddesc} + +Here is a simple example that demonstrates the behavior of generators +and generator functions: + +\begin{verbatim} +>>> def echo(value=None): +... print "Execution starts when 'next()' is called for the first time." +... try: +... while True: +... try: +... value = (yield value) +... except GeneratorExit: +... # never catch GeneratorExit +... raise +... except Exception, e: +... value = e +... finally: +... print "Don't forget to clean up when 'close()' is called." +... +>>> generator = echo(1) +>>> print generator.next() +Execution starts when 'next()' is called for the first time. +1 +>>> print generator.next() +None +>>> print generator.send(2) +2 +>>> generator.throw(TypeError, "spam") +TypeError('spam',) +>>> generator.close() +Don't forget to clean up when 'close()' is called. +\end{verbatim} + +\begin{seealso} + \seepep{0342}{Coroutines via Enhanced Generators} + {The proposal to enhance the API and syntax of generators, + making them usable as simple coroutines.} +\end{seealso} + + \section{Primaries\label{primaries}} \index{primary} @@ -474,9 +608,8 @@ \begin{productionlist} \production{call} - {\token{primary} "(" [\token{argument_list} [","]] ")"} - {\token{primary} "(" [\token{argument_list} [","] | - \token{test} \token{genexpr_for} ] ")"} + {\token{primary} "(" [\token{argument_list} [","]} + \productioncont{ | \token{expression} \token{genexpr_for}] ")"} \production{argument_list} {\token{positional_arguments} ["," \token{keyword_arguments}]} \productioncont{ ["," "*" \token{expression}]} @@ -571,7 +704,7 @@ this confusion does not arise. If the syntax \samp{**expression} appears in the function call, -\samp{expression} must evaluate to a (subclass of) dictionary, the +\samp{expression} must evaluate to a mapping, the contents of which are treated as additional keyword arguments. In the case of a keyword appearing in both \samp{expression} and as an explicit keyword argument, a \exception{TypeError} exception is @@ -809,10 +942,9 @@ operations: \begin{productionlist} - % The empty groups below prevent conversion to guillemets. \production{shift_expr} {\token{a_expr} - | \token{shift_expr} ( "<{}<" | ">{}>" ) \token{a_expr}} + | \token{shift_expr} ( "<<" | ">>" ) \token{a_expr}} \end{productionlist} These operators accept plain or long integers as arguments. The @@ -1015,14 +1147,18 @@ \section{Boolean operations\label{Booleans}} +\indexii{Conditional}{expression} \indexii{Boolean}{operation} Boolean operations have the lowest priority of all Python operations: \begin{productionlist} \production{expression} - {\token{or_test} [\token{if} \token{or_test} \token{else} - \token{test}] | \token{lambda_form}} + {\token{conditional_expression} | \token{lambda_form}} + \production{old_expression} + {\token{or_test} | \token{old_lambda_form}} + \production{conditional_expression} + {\token{or_test} ["if" \token{or_test} "else" \token{expression}]} \production{or_test} {\token{and_test} | \token{or_test} "or" \token{and_test}} \production{and_test} @@ -1074,6 +1210,8 @@ \begin{productionlist} \production{lambda_form} {"lambda" [\token{parameter_list}]: \token{expression}} + \production{old_lambda_form} + {"lambda" [\token{parameter_list}]: \token{old_expression}} \end{productionlist} Lambda forms (lambda expressions) have the same syntactic position as Modified: python/branches/bcannon-objcap/Doc/ref/ref6.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/ref/ref6.tex (original) +++ python/branches/bcannon-objcap/Doc/ref/ref6.tex Fri May 25 22:13:08 2007 @@ -108,7 +108,8 @@ \begin{productionlist} \production{assignment_stmt} - {(\token{target_list} "=")+ \token{expression_list}} + {(\token{target_list} "=")+ + (\token{expression_list} | \token{yield_expression})} \production{target_list} {\token{target} ("," \token{target})* [","]} \production{target} @@ -273,11 +274,11 @@ \begin{productionlist} \production{augmented_assignment_stmt} - {\token{target} \token{augop} \token{expression_list}} + {\token{target} \token{augop} + (\token{expression_list} | \token{yield_expression})} \production{augop} {"+=" | "-=" | "*=" | "/=" | "\%=" | "**="} - % The empty groups below prevent conversion to guillemets. - \productioncont{| ">{}>=" | "<{}<=" | "\&=" | "\textasciicircum=" | "|="} + \productioncont{| ">>=" | "<<=" | "\&=" | "\textasciicircum=" | "|="} \end{productionlist} (See section~\ref{primaries} for the syntax definitions for the last @@ -376,9 +377,9 @@ \begin{productionlist} \production{print_stmt} - {"print" ( \optional{\token{expression} ("," \token{expression})* \optional{","}}} + {"print" ([\token{expression} ("," \token{expression})* [","]} \productioncont{| ">>" \token{expression} - \optional{("," \token{expression})+ \optional{","}} )} + [("," \token{expression})+ [","])} \end{productionlist} \keyword{print} evaluates each expression in turn and writes the @@ -460,7 +461,7 @@ \begin{productionlist} \production{yield_stmt} - {"yield" \token{expression_list}} + {\token{yield_expression}} \end{productionlist} \index{generator!function} @@ -630,15 +631,19 @@ \production{import_stmt} {"import" \token{module} ["as" \token{name}] ( "," \token{module} ["as" \token{name}] )*} - \productioncont{| "from" \token{module} "import" \token{identifier} + \productioncont{| "from" \token{relative_module} "import" \token{identifier} ["as" \token{name}]} \productioncont{ ( "," \token{identifier} ["as" \token{name}] )*} - \productioncont{| "from" \token{module} "import" "(" \token{identifier} - ["as" \token{name}]} + \productioncont{| "from" \token{relative_module} "import" "(" + \token{identifier} ["as" \token{name}]} \productioncont{ ( "," \token{identifier} ["as" \token{name}] )* [","] ")"} \productioncont{| "from" \token{module} "import" "*"} \production{module} {(\token{identifier} ".")* \token{identifier}} + \production{relative_module} + {"."* \token{module} | "."+} + \production{name} + {\token{identifier}} \end{productionlist} Import statements are executed in two steps: (1) find a module, and @@ -757,8 +762,10 @@ \begin{productionlist}[*] \production{future_statement} - {"from" "__future__" "import" feature ["as" name] ("," feature ["as" name])*} - \productioncont{| "from" "__future__" "import" "(" feature ["as" name] ("," feature ["as" name])* [","] ")"} + {"from" "__future__" "import" feature ["as" name]} + \productioncont{ ("," feature ["as" name])*} + \productioncont{| "from" "__future__" "import" "(" feature ["as" name]} + \productioncont{ ("," feature ["as" name])* [","] ")"} \production{feature}{identifier} \production{name}{identifier} \end{productionlist} @@ -775,9 +782,10 @@ \end{itemize} -The features recognized by Python 2.3 are \samp{generators}, -\samp{division} and \samp{nested_scopes}. \samp{generators} and -\samp{nested_scopes} are redundant in 2.3 because they are always +The features recognized by Python 2.5 are \samp{absolute_import}, +\samp{division}, \samp{generators}, \samp{nested_scopes} and +\samp{with_statement}. \samp{generators} and \samp{nested_scopes} +are redundant in Python version 2.3 and above because they are always enabled. A future statement is recognized and treated specially at compile @@ -872,7 +880,7 @@ \begin{productionlist} \production{exec_stmt} - {"exec" \token{expression} + {"exec" \token{or_expr} ["in" \token{expression} ["," \token{expression}]]} \end{productionlist} @@ -916,3 +924,5 @@ + + Modified: python/branches/bcannon-objcap/Doc/ref/ref7.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/ref/ref7.tex (original) +++ python/branches/bcannon-objcap/Doc/ref/ref7.tex Fri May 25 22:13:08 2007 @@ -319,7 +319,7 @@ \begin{productionlist} \production{with_stmt} - {"with" \token{expression} ["as" target] ":" \token{suite}} + {"with" \token{expression} ["as" \token{target}] ":" \token{suite}} \end{productionlist} The execution of the \keyword{with} statement proceeds as follows: Modified: python/branches/bcannon-objcap/Doc/texinputs/python.sty ============================================================================== --- python/branches/bcannon-objcap/Doc/texinputs/python.sty (original) +++ python/branches/bcannon-objcap/Doc/texinputs/python.sty Fri May 25 22:13:08 2007 @@ -612,7 +612,7 @@ \newenvironment{cfuncdesc}[4][\py at badkey]{ \begin{fulllineitems} \cfuncline{#2}{#3}{#4} - \ifx#1\@undefined\else% + \ifx\@undefined#1\relax\else% \emph{Return value: \textbf{#1}.}\\ \fi }{\end{fulllineitems}} @@ -629,7 +629,7 @@ \newenvironment{ctypedesc}[2][\py at badkey]{ \begin{fulllineitems} \item[\bfcode{#2}% - \ifx#1\@undefined% + \ifx\@undefined#1\relax% \index{#2@{\py at idxcode{#2}} (C type)} \else% \index{#2@{\py at idxcode{#1}} (C type)} @@ -712,7 +712,7 @@ % \begin{methoddesc}[classname]{methodname}{args} \newcommand{\methodline}[3][\@undefined]{ \methodlineni{#2}{#3} - \ifx#1\@undefined + \ifx\@undefined#1\relax \index{#2@{\py at idxcode{#2()}} (\py at thisclass\ method)} \else \index{#2@{\py at idxcode{#2()}} (#1 method)} @@ -720,7 +720,7 @@ } \newenvironment{methoddesc}[3][\@undefined]{ \begin{fulllineitems} - \ifx#1\@undefined + \ifx\@undefined#1\relax \methodline{#2}{#3} \else \def\py at thisclass{#1} @@ -740,7 +740,7 @@ % object data attribute -------------------------------------------------- % \begin{memberdesc}[classname]{membername} \newcommand{\memberline}[2][\py at classbadkey]{% - \ifx#1\@undefined + \ifx\@undefined#1\relax \memberlineni{#2} \index{#2@{\py at idxcode{#2}} (\py at thisclass\ attribute)} \else @@ -750,7 +750,7 @@ } \newenvironment{memberdesc}[2][\py at classbadkey]{ \begin{fulllineitems} - \ifx#1\@undefined + \ifx\@undefined#1\relax \memberline{#2} \else \def\py at thisclass{#1} @@ -1046,14 +1046,14 @@ % \versionchanged[short explanation]{2.0} % \newcommand{\versionadded}[2][\py at badkey]{% - \ifx#1\@undefined% + \ifx\@undefined#1\relax% { New in version #2. }% \else% { New in version #2:\ #1. }% \fi% } \newcommand{\versionchanged}[2][\py at badkey]{% - \ifx#1\@undefined% + \ifx\@undefined#1\relax% { Changed in version #2. }% \else% { Changed in version #2:\ #1. }% Modified: python/branches/bcannon-objcap/Doc/tools/listmodules ============================================================================== --- python/branches/bcannon-objcap/Doc/tools/listmodules (original) +++ python/branches/bcannon-objcap/Doc/tools/listmodules Fri May 25 22:13:08 2007 @@ -34,12 +34,11 @@ import glob import os import re -import string import sys -REMOVE_DIRS = ["dos-8x3", "encodings", "distutils", - "lib-old", "lib-stdwin", "test"] +REMOVE_DIRS = ["encodings", "distutils", + "lib-old", ""test"] def main(): @@ -156,17 +155,17 @@ else: modules = modules_by_name.keys() modules.sort() - print string.join(modules, "\n") + print "\n".join(modules) def ignore_from_modulelist(data, ignore_dict): - for name in string.split(data): + for name in data.split(): ignore_dict[name] = name def ignore_from_idx(data, ignore_dict): - data = string.replace(data, r"\hackscore {}", "_") + data = data.replace(r"\hackscore {}", "_") rx = re.compile(r"\\indexentry\s*{([^@]*)@") - for line in string.split(data, "\n"): + for line in data.split("\n"): m = rx.match(line) if m: name = m.group(1) Modified: python/branches/bcannon-objcap/Doc/tut/tut.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/tut/tut.tex (original) +++ python/branches/bcannon-objcap/Doc/tut/tut.tex Fri May 25 22:13:08 2007 @@ -184,12 +184,12 @@ \file{/usr/local/python} is a popular alternative location.) On Windows machines, the Python installation is usually placed in -\file{C:\e Python24}, though you can change this when you're running +\file{C:\e Python26}, though you can change this when you're running the installer. To add this directory to your path, you can type the following command into the command prompt in a DOS box: \begin{verbatim} -set path=%path%;C:\python24 +set path=%path%;C:\python26 \end{verbatim} @@ -813,7 +813,7 @@ IndexError: string index out of range \end{verbatim} -The best way to remember how slices work is to think of the indices as +One way to remember how slices work is to think of the indices as pointing \emph{between} characters, with the left edge of the first character numbered 0. Then the right edge of the last character of a string of \var{n} characters has index \var{n}, for example: @@ -2629,8 +2629,8 @@ efficiency or to provide access to operating system primitives such as system calls. The set of such modules is a configuration option which also depends on the underlying platform For example, -the \module{amoeba} module is only provided on systems that somehow -support Amoeba primitives. One particular module deserves some +the \module{winreg} module is only provided on Windows systems. +One particular module deserves some attention: \ulink{\module{sys}}{../lib/module-sys.html}% \refstmodindex{sys}, which is built into every Python interpreter. The variables \code{sys.ps1} and @@ -3556,7 +3556,7 @@ ... print 'x =', x ... print 'y =', y ... - + ('spam', 'eggs') ('spam', 'eggs') x = spam @@ -4329,8 +4329,7 @@ \end{verbatim} -The only rule necessary to explain the semantics is the resolution -rule used for class attribute references. This is depth-first, +For old-style classes, the only rule is depth-first, left-to-right. Thus, if an attribute is not found in \class{DerivedClassName}, it is searched in \class{Base1}, then (recursively) in the base classes of \class{Base1}, and only if it is @@ -4345,16 +4344,26 @@ rule makes no differences between direct and inherited attributes of \class{Base1}.) -It is clear that indiscriminate use of multiple inheritance is a -maintenance nightmare, given the reliance in Python on conventions to -avoid accidental name conflicts. A well-known problem with multiple -inheritance is a class derived from two classes that happen to have a -common base class. While it is easy enough to figure out what happens -in this case (the instance will have a single copy of ``instance -variables'' or data attributes used by the common base class), it is -not clear that these semantics are in any way useful. +For new-style classes, the method resolution order changes dynamically +to support cooperative calls to \function{super()}. This approach +is known in some other multiple-inheritance languages as call-next-method +and is more powerful than the super call found in single-inheritance languages. + +With new-style classes, dynamic ordering is necessary because all +cases of multiple inheritance exhibit one or more diamond relationships +(where one at least one of the parent classes can be accessed through +multiple paths from the bottommost class). For example, all new-style +classes inherit from \class{object}, so any case of multiple inheritance +provides more than one path to reach \class{object}. To keep the +base classes from being accessed more than once, the dynamic algorithm +linearizes the search order in a way that preserves the left-to-right +ordering specified in each class, that calls each parent only once, and +that is monotonic (meaning that a class can be subclassed without affecting +the precedence order of its parents). Taken together, these properties +make it possible to design reliable and extensible classes with +multiple inheritance. For more detail, see +\url{http://www.python.org/download/releases/2.3/mro/}. -%% XXX Add rules for new-style MRO? \section{Private Variables \label{private}} @@ -4645,7 +4654,7 @@ >>> os.system('time 0:02') 0 >>> os.getcwd() # Return the current working directory -'C:\\Python24' +'C:\\Python26' >>> os.chdir('/server/accesslogs') \end{verbatim} @@ -5245,7 +5254,7 @@ Traceback (most recent call last): File "", line 1, in -toplevel- d['primary'] # entry was automatically removed - File "C:/PY24/lib/weakref.py", line 46, in __getitem__ + File "C:/python26/lib/weakref.py", line 46, in __getitem__ o = self.data[key]() KeyError: 'primary' \end{verbatim} Modified: python/branches/bcannon-objcap/Doc/whatsnew/whatsnew23.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/whatsnew/whatsnew23.tex (original) +++ python/branches/bcannon-objcap/Doc/whatsnew/whatsnew23.tex Fri May 25 22:13:08 2007 @@ -896,7 +896,7 @@ \end{seealso} %====================================================================== -\section{PEP 307: Pickle Enhancements \label{section-pep305}} +\section{PEP 307: Pickle Enhancements \label{section-pep307}} The \module{pickle} and \module{cPickle} modules received some attention during the 2.3 development cycle. In 2.2, new-style classes Modified: python/branches/bcannon-objcap/Doc/whatsnew/whatsnew24.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/whatsnew/whatsnew24.tex (original) +++ python/branches/bcannon-objcap/Doc/whatsnew/whatsnew24.tex Fri May 25 22:13:08 2007 @@ -1291,7 +1291,7 @@ [1, 2, 3] >>> list(i2) # Run the second iterator to exhaustion [1, 2, 3] ->\end{verbatim} +\end{verbatim} Note that \function{tee()} has to keep copies of the values returned by the iterator; in the worst case, it may need to keep all of them. Modified: python/branches/bcannon-objcap/Doc/whatsnew/whatsnew25.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/whatsnew/whatsnew25.tex (original) +++ python/branches/bcannon-objcap/Doc/whatsnew/whatsnew25.tex Fri May 25 22:13:08 2007 @@ -1294,6 +1294,17 @@ (Contributed by Alan McIntyre and committed at the NeedForSpeed sprint.) % Patch 1442927 +\item It's now illegal to mix iterating over a file +with \code{for line in \var{file}} and calling +the file object's \method{read()}/\method{readline()}/\method{readlines()} +methods. Iteration uses an internal buffer and the +\method{read*()} methods don't use that buffer. +Instead they would return the data following the buffer, causing the +data to appear out of order. Mixing iteration and these methods will +now trigger a \exception{ValueError} from the \method{read*()} method. +(Implemented by Thomas Wouters.) +% Patch 1397960 + \item The \module{struct} module now compiles structure format strings into an internal representation and caches this representation, yielding a 20\% speedup. (Contributed by Bob Ippolito @@ -1704,8 +1715,8 @@ In Python code, netlink addresses are represented as a tuple of 2 integers, \code{(\var{pid}, \var{group_mask})}. -Two new methods on socket objects, \method{recv_buf(\var{buffer})} and -\method{recvfrom_buf(\var{buffer})}, store the received data in an object +Two new methods on socket objects, \method{recv_into(\var{buffer})} and +\method{recvfrom_into(\var{buffer})}, store the received data in an object that supports the buffer protocol instead of returning the data as a string. This means you can put the data directly into an array or a memory-mapped file. Modified: python/branches/bcannon-objcap/Doc/whatsnew/whatsnew26.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/whatsnew/whatsnew26.tex (original) +++ python/branches/bcannon-objcap/Doc/whatsnew/whatsnew26.tex Fri May 25 22:13:08 2007 @@ -2,6 +2,46 @@ \usepackage{distutils} % $Id$ +% Rules for maintenance: +% +% * Anyone can add text to this document. Do not spend very much time +% on the wording of your changes, because your text will probably +% get rewritten to some degree. +% +% * The maintainer will go through Misc/NEWS periodically and add +% changes; it's therefore more important to add your changes to +% Misc/NEWS than to this file. +% +% * This is not a complete list of every single change; completeness +% is the purpose of Misc/NEWS. Some changes I consider too small +% or esoteric to include. If such a change is added to the text, +% I'll just remove it. (This is another reason you shouldn't spend +% too much time on writing your addition.) +% +% * If you want to draw your new text to the attention of the +% maintainer, add 'XXX' to the beginning of the paragraph or +% section. +% +% * It's OK to just add a fragmentary note about a change. For +% example: "XXX Describe the transmogrify() function added to the +% socket module." The maintainer will research the change and +% write the necessary text. +% +% * You can comment out your additions if you like, but it's not +% necessary (especially when a final release is some months away). +% +% * Credit the author of a patch or bugfix. Just the name is +% sufficient; the e-mail address isn't necessary. +% +% * It's helpful to add the bug/patch number as a comment: +% +% % Patch 12345 +% XXX Describe the transmogrify() function added to the socket +% module. +% (Contributed by P.Y. Developer.) +% +% This saves the maintainer the effort of going through the SVN log +% when researching a change. \title{What's New in Python 2.6} \release{0.0} @@ -29,6 +69,9 @@ % Large, PEP-level features and changes should be described here. +% Should there be a new section here for 3k migration? +% Or perhaps a more general section describing module changes/deprecation? +% sets module deprecated %====================================================================== \section{Other Language Changes} @@ -37,7 +80,13 @@ language. \begin{itemize} -\item TBD + +% Bug 1569356 +\item An obscure change: when you use the the \function{locals()} +function inside a \keyword{class} statement, the resulting dictionary +no longer returns free variables. (Free variables, in this case, are +variables referred to in the \keyword{class} statement +that aren't attributes of the class.) \end{itemize} @@ -47,7 +96,10 @@ \begin{itemize} -\item Optimizations should be described here. +% Patch 1624059 +\item Internally, a bit is now set in type objects to indicate some of +the standard built-in types. This speeds up checking if an object is +a subclass of one of these types. (Contributed by Neal Norwitz.) \end{itemize} @@ -67,6 +119,79 @@ \begin{itemize} +\item New data type in the \module{collections} module: +\class{NamedTuple(\var{typename}, \var{fieldnames})} is a factory function that +creates subclasses of the standard tuple whose fields are accessible +by name as well as index. For example: + +\begin{verbatim} +var_type = collections.NamedTuple('variable', + 'id name type size') +var = var_type(1, 'frequency', 'int', 4) + +print var[0], var.id # Equivalent +print var[2], var.type # Equivalent +\end{verbatim} + +(Contributed by Raymond Hettinger.) + +\item New method in the \module{curses} module: +for a window, \method{chgat()} changes the display characters for a +certain number of characters on a single line. + +\begin{verbatim} +# Boldface text starting at y=0,x=21 +# and affecting the rest of the line. +stdscr.chgat(0,21, curses.A_BOLD) +\end{verbatim} + +(Contributed by Fabian Kreutz.) + +\item The \module{gopherlib} module has been removed. + +\item New function in the \module{heapq} module: +\function{merge(iter1, iter2, ...)} +takes any number of iterables that return data +\emph{in sorted order}, +and +returns a new iterator that returns the contents of +all the iterators, also in sorted order. For example: + +\begin{verbatim} +heapq.merge([1, 3, 5, 9], [2, 8, 16]) -> + [1, 2, 3, 5, 8, 9, 16] +\end{verbatim} + +(Contributed by Raymond Hettinger.) + +\item New function in the \module{itertools} module: +\function{izip_longest(iter1, iter2, ...\optional{, fillvalue})} +makes tuples from each of the elements; if some of the iterables +are shorter than others, the missing values +are set to \var{fillvalue}. For example: + +\begin{verbatim} +itertools.izip_longest([1,2,3], [1,2,3,4,5]) -> + [(1, 1), (2, 2), (3, 3), (None, 4), (None, 5)] +\end{verbatim} + +(Contributed by Raymond Hettinger.) + +\item The \module{macfs} module has been removed. This in turn +required the \function{macostools.touched()} function to be removed +because it depended on the \module{macfs} module. + +% Patch #1490190 +\item New functions in the \module{posix} module: \function{chflags()} +and \function{lchflags()} are wrappers for the corresponding system +calls (where they're available). Constants for the flag values are +defined in the \module{stat} module; some possible values include +\constant{UF_IMMUTABLE} to signal the file may not be changed and +\constant{UF_APPEND} to indicate that data can only be appended to the +file. (Contributed by M. Levinson.) + +\item The \module{rgbimg} module has been removed. + \item The \module{smtplib} module now supports SMTP over SSL thanks to the addition of the \class{SMTP_SSL} class. This class supports an interface identical to the existing \class{SMTP} Modified: python/branches/bcannon-objcap/Grammar/Grammar ============================================================================== --- python/branches/bcannon-objcap/Grammar/Grammar (original) +++ python/branches/bcannon-objcap/Grammar/Grammar Fri May 25 22:13:08 2007 @@ -85,7 +85,7 @@ with_stmt: 'with' test [ with_var ] ':' suite with_var: 'as' expr # NB compile.c makes sure that the default except clause is last -except_clause: 'except' [test [',' test]] +except_clause: 'except' [test [('as' | ',') test]] suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT # Backward compatibility cruft to support: Modified: python/branches/bcannon-objcap/Include/Python-ast.h ============================================================================== --- python/branches/bcannon-objcap/Include/Python-ast.h (original) +++ python/branches/bcannon-objcap/Include/Python-ast.h Fri May 25 22:13:08 2007 @@ -1,4 +1,4 @@ -/* File automatically generated by Parser/asdl_c.py */ +/* File automatically generated by Parser/asdl_c.py. */ #include "asdl.h" Modified: python/branches/bcannon-objcap/Include/dictobject.h ============================================================================== --- python/branches/bcannon-objcap/Include/dictobject.h (original) +++ python/branches/bcannon-objcap/Include/dictobject.h Fri May 25 22:13:08 2007 @@ -90,7 +90,8 @@ PyAPI_DATA(PyTypeObject) PyDict_Type; -#define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) +#define PyDict_Check(op) \ + PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_DICT_SUBCLASS) #define PyDict_CheckExact(op) ((op)->ob_type == &PyDict_Type) PyAPI_FUNC(PyObject *) PyDict_New(void); @@ -100,12 +101,15 @@ PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); PyAPI_FUNC(int) PyDict_Next( PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); +PyAPI_FUNC(int) _PyDict_Next( + PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash); PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp); PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key); +PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash); /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); Modified: python/branches/bcannon-objcap/Include/fileobject.h ============================================================================== --- python/branches/bcannon-objcap/Include/fileobject.h (original) +++ python/branches/bcannon-objcap/Include/fileobject.h Fri May 25 22:13:08 2007 @@ -58,6 +58,11 @@ char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *); +/* A routine to do sanity checking on the file mode string. returns + non-zero on if an exception occurred +*/ +int _PyFile_SanitizeMode(char *mode); + #ifdef __cplusplus } #endif Modified: python/branches/bcannon-objcap/Include/intobject.h ============================================================================== --- python/branches/bcannon-objcap/Include/intobject.h (original) +++ python/branches/bcannon-objcap/Include/intobject.h Fri May 25 22:13:08 2007 @@ -27,7 +27,8 @@ PyAPI_DATA(PyTypeObject) PyInt_Type; -#define PyInt_Check(op) PyObject_TypeCheck(op, &PyInt_Type) +#define PyInt_Check(op) \ + PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS) #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type) PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int); Modified: python/branches/bcannon-objcap/Include/listobject.h ============================================================================== --- python/branches/bcannon-objcap/Include/listobject.h (original) +++ python/branches/bcannon-objcap/Include/listobject.h Fri May 25 22:13:08 2007 @@ -40,7 +40,8 @@ PyAPI_DATA(PyTypeObject) PyList_Type; -#define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type) +#define PyList_Check(op) \ + PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_LIST_SUBCLASS) #define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type) PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); Modified: python/branches/bcannon-objcap/Include/longobject.h ============================================================================== --- python/branches/bcannon-objcap/Include/longobject.h (original) +++ python/branches/bcannon-objcap/Include/longobject.h Fri May 25 22:13:08 2007 @@ -11,7 +11,8 @@ PyAPI_DATA(PyTypeObject) PyLong_Type; -#define PyLong_Check(op) PyObject_TypeCheck(op, &PyLong_Type) +#define PyLong_Check(op) \ + PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_LONG_SUBCLASS) #define PyLong_CheckExact(op) ((op)->ob_type == &PyLong_Type) PyAPI_FUNC(PyObject *) PyLong_FromLong(long); Modified: python/branches/bcannon-objcap/Include/object.h ============================================================================== --- python/branches/bcannon-objcap/Include/object.h (original) +++ python/branches/bcannon-objcap/Include/object.h Fri May 25 22:13:08 2007 @@ -376,7 +376,8 @@ PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */ -#define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) +#define PyType_Check(op) \ + PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TYPE_SUBCLASS) #define PyType_CheckExact(op) ((op)->ob_type == &PyType_Type) PyAPI_FUNC(int) PyType_Ready(PyTypeObject *); @@ -517,6 +518,17 @@ /* Objects support nb_index in PyNumberMethods */ #define Py_TPFLAGS_HAVE_INDEX (1L<<17) +/* These flags are used to determine if a type is a subclass. */ +#define Py_TPFLAGS_INT_SUBCLASS (1L<<23) +#define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) +#define Py_TPFLAGS_LIST_SUBCLASS (1L<<25) +#define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26) +#define Py_TPFLAGS_STRING_SUBCLASS (1L<<27) +#define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28) +#define Py_TPFLAGS_DICT_SUBCLASS (1L<<29) +#define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30) +#define Py_TPFLAGS_TYPE_SUBCLASS (1L<<31) + #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_GETCHARBUFFER | \ Py_TPFLAGS_HAVE_SEQUENCE_IN | \ @@ -530,6 +542,7 @@ 0) #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) +#define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) /* Modified: python/branches/bcannon-objcap/Include/pydebug.h ============================================================================== --- python/branches/bcannon-objcap/Include/pydebug.h (original) +++ python/branches/bcannon-objcap/Include/pydebug.h Fri May 25 22:13:08 2007 @@ -8,6 +8,7 @@ PyAPI_DATA(int) Py_DebugFlag; PyAPI_DATA(int) Py_VerboseFlag; PyAPI_DATA(int) Py_InteractiveFlag; +PyAPI_DATA(int) Py_InspectFlag; PyAPI_DATA(int) Py_OptimizeFlag; PyAPI_DATA(int) Py_NoSiteFlag; PyAPI_DATA(int) Py_UseClassExceptionsFlag; @@ -20,6 +21,8 @@ on the command line, and is used in 2.2 by ceval.c to make all "/" divisions true divisions (which they will be in 3.0). */ PyAPI_DATA(int) _Py_QnewFlag; +/* Warn about 3.x issues */ +PyAPI_DATA(int) Py_Py3kWarningFlag; /* this is a wrapper around getenv() that pays attention to Py_IgnoreEnvironmentFlag. It should be used for getting variables like Modified: python/branches/bcannon-objcap/Include/pyerrors.h ============================================================================== --- python/branches/bcannon-objcap/Include/pyerrors.h (original) +++ python/branches/bcannon-objcap/Include/pyerrors.h Fri May 25 22:13:08 2007 @@ -95,14 +95,12 @@ /* */ #define PyExceptionClass_Check(x) \ - (PyClass_Check((x)) \ - || (PyType_Check((x)) && PyType_IsSubtype( \ - (PyTypeObject*)(x), (PyTypeObject*)PyExc_BaseException))) - + (PyClass_Check((x)) || (PyType_Check((x)) && \ + PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))) #define PyExceptionInstance_Check(x) \ (PyInstance_Check((x)) || \ - (PyType_IsSubtype((x)->ob_type, (PyTypeObject*)PyExc_BaseException))) + PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)) #define PyExceptionClass_Name(x) \ (PyClass_Check((x)) \ Modified: python/branches/bcannon-objcap/Include/pymem.h ============================================================================== --- python/branches/bcannon-objcap/Include/pymem.h (original) +++ python/branches/bcannon-objcap/Include/pymem.h Fri May 25 22:13:08 2007 @@ -30,6 +30,8 @@ debugging info to dynamic memory blocks. The system routines have no idea what to do with that stuff, and the Python wrappers have no idea what to do with raw blocks obtained directly by the system routines then. + + The GIL must be held when using these APIs. */ /* Modified: python/branches/bcannon-objcap/Include/pystate.h ============================================================================== --- python/branches/bcannon-objcap/Include/pystate.h (original) +++ python/branches/bcannon-objcap/Include/pystate.h Fri May 25 22:13:08 2007 @@ -21,6 +21,7 @@ PyObject *modules; PyObject *sysdict; PyObject *builtins; + PyObject *modules_reloading; PyObject *codec_search_path; PyObject *codec_search_cache; Modified: python/branches/bcannon-objcap/Include/setobject.h ============================================================================== --- python/branches/bcannon-objcap/Include/setobject.h (original) +++ python/branches/bcannon-objcap/Include/setobject.h Fri May 25 22:13:08 2007 @@ -82,7 +82,8 @@ PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key); PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key); -PyAPI_FUNC(int) _PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **entry); +PyAPI_FUNC(int) _PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **key); +PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash); PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); Modified: python/branches/bcannon-objcap/Include/stringobject.h ============================================================================== --- python/branches/bcannon-objcap/Include/stringobject.h (original) +++ python/branches/bcannon-objcap/Include/stringobject.h Fri May 25 22:13:08 2007 @@ -55,7 +55,8 @@ PyAPI_DATA(PyTypeObject) PyBaseString_Type; PyAPI_DATA(PyTypeObject) PyString_Type; -#define PyString_Check(op) PyObject_TypeCheck(op, &PyString_Type) +#define PyString_Check(op) \ + PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_STRING_SUBCLASS) #define PyString_CheckExact(op) ((op)->ob_type == &PyString_Type) PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); Modified: python/branches/bcannon-objcap/Include/tupleobject.h ============================================================================== --- python/branches/bcannon-objcap/Include/tupleobject.h (original) +++ python/branches/bcannon-objcap/Include/tupleobject.h Fri May 25 22:13:08 2007 @@ -33,7 +33,8 @@ PyAPI_DATA(PyTypeObject) PyTuple_Type; -#define PyTuple_Check(op) PyObject_TypeCheck(op, &PyTuple_Type) +#define PyTuple_Check(op) \ + PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TUPLE_SUBCLASS) #define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type) PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); Modified: python/branches/bcannon-objcap/Include/unicodeobject.h ============================================================================== --- python/branches/bcannon-objcap/Include/unicodeobject.h (original) +++ python/branches/bcannon-objcap/Include/unicodeobject.h Fri May 25 22:13:08 2007 @@ -392,7 +392,8 @@ PyAPI_DATA(PyTypeObject) PyUnicode_Type; -#define PyUnicode_Check(op) PyObject_TypeCheck(op, &PyUnicode_Type) +#define PyUnicode_Check(op) \ + PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_UNICODE_SUBCLASS) #define PyUnicode_CheckExact(op) ((op)->ob_type == &PyUnicode_Type) /* Fast access macros */ Modified: python/branches/bcannon-objcap/LICENSE ============================================================================== --- python/branches/bcannon-objcap/LICENSE (original) +++ python/branches/bcannon-objcap/LICENSE Fri May 25 22:13:08 2007 @@ -52,7 +52,9 @@ 2.4.1 2.4 2005 PSF yes 2.4.2 2.4.1 2005 PSF yes 2.4.3 2.4.2 2006 PSF yes + 2.4.4 2.4.3 2006 PSF yes 2.5 2.4 2006 PSF yes + 2.5.1 2.5 2007 PSF yes Footnotes: Modified: python/branches/bcannon-objcap/Lib/Bastion.py ============================================================================== --- python/branches/bcannon-objcap/Lib/Bastion.py (original) +++ python/branches/bcannon-objcap/Lib/Bastion.py Fri May 25 22:13:08 2007 @@ -97,7 +97,7 @@ """ - raise RuntimeError, "This code is not secure in Python 2.2 and 2.3" + raise RuntimeError, "This code is not secure in Python 2.2 and later" # Note: we define *two* ad-hoc functions here, get1 and get2. # Both are intended to be called in the same way: get(name). Modified: python/branches/bcannon-objcap/Lib/CGIHTTPServer.py ============================================================================== --- python/branches/bcannon-objcap/Lib/CGIHTTPServer.py (original) +++ python/branches/bcannon-objcap/Lib/CGIHTTPServer.py Fri May 25 22:13:08 2007 @@ -197,6 +197,9 @@ length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length + referer = self.headers.getheader('referer') + if referer: + env['HTTP_REFERER'] = referer accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in "\t\n\r ": @@ -214,7 +217,7 @@ # Since we're setting the env in the parent, provide empty # values to override previously set values for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', - 'HTTP_USER_AGENT', 'HTTP_COOKIE'): + 'HTTP_USER_AGENT', 'HTTP_COOKIE', 'HTTP_REFERER'): env.setdefault(k, "") os.environ.update(env) Modified: python/branches/bcannon-objcap/Lib/ConfigParser.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ConfigParser.py (original) +++ python/branches/bcannon-objcap/Lib/ConfigParser.py Fri May 25 22:13:08 2007 @@ -106,6 +106,21 @@ class Error(Exception): """Base class for ConfigParser exceptions.""" + def _get_message(self): + """Getter for 'message'; needed only to override deprecation in + BaseException.""" + return self.__message + + def _set_message(self, value): + """Setter for 'message'; needed only to override deprecation in + BaseException.""" + self.__message = value + + # BaseException.message has been deprecated since Python 2.6. To prevent + # DeprecationWarning from popping up over this pre-existing attribute, use + # a new property that takes lookup precedence. + message = property(_get_message, _set_message) + def __init__(self, msg=''): self.message = msg Exception.__init__(self, msg) @@ -594,7 +609,8 @@ self._interpolate_some(option, L, rawval, section, vars, 1) return ''.join(L) - _interpvar_match = re.compile(r"%\(([^)]+)\)s").match + _interpvar_re = re.compile(r"%\(([^)]+)\)s") + _badpercent_re = re.compile(r"%[^%]|%$") def _interpolate_some(self, option, accum, rest, section, map, depth): if depth > MAX_INTERPOLATION_DEPTH: @@ -613,7 +629,7 @@ accum.append("%") rest = rest[2:] elif c == "(": - m = self._interpvar_match(rest) + m = self._interpvar_re.match(rest) if m is None: raise InterpolationSyntaxError(option, section, "bad interpolation variable reference %r" % rest) @@ -638,4 +654,12 @@ """Set an option. Extend ConfigParser.set: check for string values.""" if not isinstance(value, basestring): raise TypeError("option values must be strings") + # check for bad percent signs: + # first, replace all "good" interpolations + tmp_value = self._interpvar_re.sub('', value) + # then, check if there's a lone percent sign left + m = self._badpercent_re.search(tmp_value) + if m: + raise ValueError("invalid interpolation syntax in %r at " + "position %d" % (value, m.start())) ConfigParser.set(self, section, option, value) Modified: python/branches/bcannon-objcap/Lib/DocXMLRPCServer.py ============================================================================== --- python/branches/bcannon-objcap/Lib/DocXMLRPCServer.py (original) +++ python/branches/bcannon-objcap/Lib/DocXMLRPCServer.py Fri May 25 22:13:08 2007 @@ -252,8 +252,10 @@ """ def __init__(self, addr, requestHandler=DocXMLRPCRequestHandler, - logRequests=1): - SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests) + logRequests=1, allow_none=False, encoding=None, + bind_and_activate=True): + SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests, + allow_none, encoding, bind_and_activate) XMLRPCDocGenerator.__init__(self) class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler, Modified: python/branches/bcannon-objcap/Lib/HTMLParser.py ============================================================================== --- python/branches/bcannon-objcap/Lib/HTMLParser.py (original) +++ python/branches/bcannon-objcap/Lib/HTMLParser.py Fri May 25 22:13:08 2007 @@ -358,12 +358,30 @@ self.error("unknown declaration: %r" % (data,)) # Internal -- helper to remove special character quoting + entitydefs = None def unescape(self, s): if '&' not in s: return s - s = s.replace("<", "<") - s = s.replace(">", ">") - s = s.replace("'", "'") - s = s.replace(""", '"') - s = s.replace("&", "&") # Must be last - return s + def replaceEntities(s): + s = s.groups()[0] + if s[0] == "#": + s = s[1:] + if s[0] in ['x','X']: + c = int(s[1:], 16) + else: + c = int(s) + return unichr(c) + else: + # Cannot use name2codepoint directly, because HTMLParser supports apos, + # which is not part of HTML 4 + import htmlentitydefs + if HTMLParser.entitydefs is None: + entitydefs = HTMLParser.entitydefs = {'apos':u"'"} + for k, v in htmlentitydefs.name2codepoint.iteritems(): + entitydefs[k] = unichr(v) + try: + return self.entitydefs[s] + except KeyError: + return '&'+s+';' + + return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));", replaceEntities, s) Modified: python/branches/bcannon-objcap/Lib/SimpleXMLRPCServer.py ============================================================================== --- python/branches/bcannon-objcap/Lib/SimpleXMLRPCServer.py (original) +++ python/branches/bcannon-objcap/Lib/SimpleXMLRPCServer.py Fri May 25 22:13:08 2007 @@ -518,11 +518,11 @@ allow_reuse_address = True def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, - logRequests=True, allow_none=False, encoding=None): + logRequests=True, allow_none=False, encoding=None, bind_and_activate=True): self.logRequests = logRequests SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding) - SocketServer.TCPServer.__init__(self, addr, requestHandler) + SocketServer.TCPServer.__init__(self, addr, requestHandler, bind_and_activate) # [Bug #1222790] If possible, set close-on-exec flag; if a # method spawns a subprocess, the subprocess shouldn't have Modified: python/branches/bcannon-objcap/Lib/SocketServer.py ============================================================================== --- python/branches/bcannon-objcap/Lib/SocketServer.py (original) +++ python/branches/bcannon-objcap/Lib/SocketServer.py Fri May 25 22:13:08 2007 @@ -279,7 +279,7 @@ Methods for the caller: - - __init__(server_address, RequestHandlerClass) + - __init__(server_address, RequestHandlerClass, bind_and_activate=True) - serve_forever() - handle_request() # if you don't use serve_forever() - fileno() -> int # for select() @@ -322,13 +322,14 @@ allow_reuse_address = False - def __init__(self, server_address, RequestHandlerClass): + def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True): """Constructor. May be extended, do not override.""" BaseServer.__init__(self, server_address, RequestHandlerClass) self.socket = socket.socket(self.address_family, self.socket_type) - self.server_bind() - self.server_activate() + if bind_and_activate: + self.server_bind() + self.server_activate() def server_bind(self): """Called by constructor to bind the socket. @@ -339,6 +340,7 @@ if self.allow_reuse_address: self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.socket.bind(self.server_address) + self.server_address = self.socket.getsockname() def server_activate(self): """Called by constructor to activate the server. Modified: python/branches/bcannon-objcap/Lib/_strptime.py ============================================================================== --- python/branches/bcannon-objcap/Lib/_strptime.py (original) +++ python/branches/bcannon-objcap/Lib/_strptime.py Fri May 25 22:13:08 2007 @@ -295,17 +295,16 @@ """Return a time struct based on the input string and the format string.""" global _TimeRE_cache, _regex_cache with _cache_lock: - time_re = _TimeRE_cache - locale_time = time_re.locale_time - if _getlang() != locale_time.lang: + if _getlang() != _TimeRE_cache.locale_time.lang: _TimeRE_cache = TimeRE() - _regex_cache = {} + _regex_cache.clear() if len(_regex_cache) > _CACHE_MAX_SIZE: _regex_cache.clear() + locale_time = _TimeRE_cache.locale_time format_regex = _regex_cache.get(format) if not format_regex: try: - format_regex = time_re.compile(format) + format_regex = _TimeRE_cache.compile(format) # KeyError raised when a bad format is found; can be specified as # \\, in which case it was a stray % but with a space after it except KeyError, err: Modified: python/branches/bcannon-objcap/Lib/binhex.py ============================================================================== --- python/branches/bcannon-objcap/Lib/binhex.py (original) +++ python/branches/bcannon-objcap/Lib/binhex.py Fri May 25 22:13:08 2007 @@ -510,14 +510,7 @@ ifp.close() def _test(): - if os.name == 'mac': - import macfs - fss, ok = macfs.PromptGetFile('File to convert:') - if not ok: - sys.exit(0) - fname = fss.as_pathname() - else: - fname = sys.argv[1] + fname = sys.argv[1] binhex(fname, fname+'.hqx') hexbin(fname+'.hqx', fname+'.viahqx') #hexbin(fname, fname+'.unpacked') Modified: python/branches/bcannon-objcap/Lib/bisect.py ============================================================================== --- python/branches/bcannon-objcap/Lib/bisect.py (original) +++ python/branches/bcannon-objcap/Lib/bisect.py Fri May 25 22:13:08 2007 @@ -23,8 +23,8 @@ """Return the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e <= x, and all e in - a[i:] have e > x. So if x already appears in the list, i points just - beyond the rightmost x already there. + a[i:] have e > x. So if x already appears in the list, a.insert(x) will + insert just after the rightmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. @@ -62,8 +62,8 @@ """Return the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e < x, and all e in - a[i:] have e >= x. So if x already appears in the list, i points just - before the leftmost x already there. + a[i:] have e >= x. So if x already appears in the list, a.insert(x) will + insert just before the leftmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. Modified: python/branches/bcannon-objcap/Lib/bsddb/test/test_recno.py ============================================================================== --- python/branches/bcannon-objcap/Lib/bsddb/test/test_recno.py (original) +++ python/branches/bcannon-objcap/Lib/bsddb/test/test_recno.py Fri May 25 22:13:08 2007 @@ -118,7 +118,7 @@ assert not d.has_key(13) data = d.get_both(26, "z" * 60) - assert data == "z" * 60 + assert data == "z" * 60, 'was %r' % data if verbose: print data Modified: python/branches/bcannon-objcap/Lib/calendar.py ============================================================================== --- python/branches/bcannon-objcap/Lib/calendar.py (original) +++ python/branches/bcannon-objcap/Lib/calendar.py Fri May 25 22:13:08 2007 @@ -45,7 +45,7 @@ class _localized_month: - _months = [datetime.date(2001, i+1, 1).strftime for i in xrange(12)] + _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)] _months.insert(0, lambda x: "") def __init__(self, format): @@ -65,7 +65,7 @@ class _localized_day: # January 1, 2001, was a Monday. - _days = [datetime.date(2001, 1, i+1).strftime for i in xrange(7)] + _days = [datetime.date(2001, 1, i+1).strftime for i in range(7)] def __init__(self, format): self.format = format @@ -144,7 +144,7 @@ Return a iterator for one week of weekday numbers starting with the configured first one. """ - for i in xrange(self.firstweekday, self.firstweekday + 7): + for i in range(self.firstweekday, self.firstweekday + 7): yield i%7 def itermonthdates(self, year, month): @@ -192,7 +192,7 @@ Each row represents a week; week entries are datetime.date values. """ dates = list(self.itermonthdates(year, month)) - return [ dates[i:i+7] for i in xrange(0, len(dates), 7) ] + return [ dates[i:i+7] for i in range(0, len(dates), 7) ] def monthdays2calendar(self, year, month): """ @@ -202,7 +202,7 @@ are zero. """ days = list(self.itermonthdays2(year, month)) - return [ days[i:i+7] for i in xrange(0, len(days), 7) ] + return [ days[i:i+7] for i in range(0, len(days), 7) ] def monthdayscalendar(self, year, month): """ @@ -210,7 +210,7 @@ Each row represents a week; days outside this month are zero. """ days = list(self.itermonthdays(year, month)) - return [ days[i:i+7] for i in xrange(0, len(days), 7) ] + return [ days[i:i+7] for i in range(0, len(days), 7) ] def yeardatescalendar(self, year, width=3): """ @@ -221,9 +221,9 @@ """ months = [ self.monthdatescalendar(year, i) - for i in xrange(January, January+12) + for i in range(January, January+12) ] - return [months[i:i+width] for i in xrange(0, len(months), width) ] + return [months[i:i+width] for i in range(0, len(months), width) ] def yeardays2calendar(self, year, width=3): """ @@ -234,9 +234,9 @@ """ months = [ self.monthdays2calendar(year, i) - for i in xrange(January, January+12) + for i in range(January, January+12) ] - return [months[i:i+width] for i in xrange(0, len(months), width) ] + return [months[i:i+width] for i in range(0, len(months), width) ] def yeardayscalendar(self, year, width=3): """ @@ -246,9 +246,9 @@ """ months = [ self.monthdayscalendar(year, i) - for i in xrange(January, January+12) + for i in range(January, January+12) ] - return [months[i:i+width] for i in xrange(0, len(months), width) ] + return [months[i:i+width] for i in range(0, len(months), width) ] class TextCalendar(Calendar): @@ -341,7 +341,7 @@ header = self.formatweekheader(w) for (i, row) in enumerate(self.yeardays2calendar(theyear, m)): # months in this row - months = xrange(m*i+1, min(m*(i+1)+1, 13)) + months = range(m*i+1, min(m*(i+1)+1, 13)) a('\n'*l) names = (self.formatmonthname(theyear, k, colwidth, False) for k in months) @@ -352,7 +352,7 @@ a('\n'*l) # max number of weeks for this row height = max(len(cal) for cal in row) - for j in xrange(height): + for j in range(height): weeks = [] for cal in row: if j >= len(cal): @@ -444,9 +444,9 @@ a('') a('\n') a('' % (width, theyear)) - for i in xrange(January, January+12, width): + for i in range(January, January+12, width): # months in this row - months = xrange(i, min(i+width, 13)) + months = range(i, min(i+width, 13)) a('') for m in months: a('%s' + \ '%s\n' for i in range(len(flaglist)): @@ -1954,9 +1953,9 @@ # mdiff yields None on separator lines skip the bogus ones # generated for the first line if i > 0: - s.write(' \n \n') + s.append(' \n \n') else: - s.write( fmt % (next_id[i],next_href[i],fromlist[i], + s.append( fmt % (next_id[i],next_href[i],fromlist[i], next_href[i],tolist[i])) if fromdesc or todesc: header_row = '%s%s%s%s' % ( @@ -1968,7 +1967,7 @@ header_row = '' table = self._table_template % dict( - data_rows=s.getvalue(), + data_rows=''.join(s), header_row=header_row, prefix=self._prefix[1]) Modified: python/branches/bcannon-objcap/Lib/distutils/__init__.py ============================================================================== --- python/branches/bcannon-objcap/Lib/distutils/__init__.py (original) +++ python/branches/bcannon-objcap/Lib/distutils/__init__.py Fri May 25 22:13:08 2007 @@ -20,4 +20,4 @@ # In general, major and minor version should loosely follow the Python # version number the distutils code was shipped with. # -__version__ = "2.5.0" +__version__ = "2.5.1" Modified: python/branches/bcannon-objcap/Lib/distutils/command/build_ext.py ============================================================================== --- python/branches/bcannon-objcap/Lib/distutils/command/build_ext.py (original) +++ python/branches/bcannon-objcap/Lib/distutils/command/build_ext.py Fri May 25 22:13:08 2007 @@ -185,10 +185,8 @@ # for extensions under Cygwin and AtheOS Python's library directory must be # appended to library_dirs - if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos' or \ - ((sys.platform.startswith('linux') or sys.platform.startswith('gnu')) and - sysconfig.get_config_var('Py_ENABLE_SHARED')): - if string.find(sys.executable, sys.exec_prefix) != -1: + if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos': + if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): # building third party extensions self.library_dirs.append(os.path.join(sys.prefix, "lib", "python" + get_python_version(), @@ -197,6 +195,17 @@ # building python standard extensions self.library_dirs.append('.') + # for extensions under Linux with a shared Python library, + # Python's library directory must be appended to library_dirs + if (sys.platform.startswith('linux') or sys.platform.startswith('gnu')) \ + and sysconfig.get_config_var('Py_ENABLE_SHARED'): + if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")): + # building third party extensions + self.library_dirs.append(sysconfig.get_config_var('LIBDIR')) + else: + # building python standard extensions + self.library_dirs.append('.') + # The argument parsing will result in self.define being a string, but # it has to be a list of 2-tuples. All the preprocessor symbols # specified by the 'define' option will be set to '1'. Multiple @@ -524,7 +533,8 @@ if self.swig_cpp: log.warn("--swig-cpp is deprecated - use --swig-opts=-c++") - if self.swig_cpp or ('-c++' in self.swig_opts): + if self.swig_cpp or ('-c++' in self.swig_opts) or \ + ('-c++' in extension.swig_opts): target_ext = '.cpp' else: target_ext = '.c' Modified: python/branches/bcannon-objcap/Lib/distutils/msvccompiler.py ============================================================================== --- python/branches/bcannon-objcap/Lib/distutils/msvccompiler.py (original) +++ python/branches/bcannon-objcap/Lib/distutils/msvccompiler.py Fri May 25 22:13:08 2007 @@ -187,6 +187,19 @@ j = string.find(sys.version, ")", i) return sys.version[i+len(prefix):j] +def normalize_and_reduce_paths(paths): + """Return a list of normalized paths with duplicates removed. + + The current order of paths is maintained. + """ + # Paths are normalized so things like: /a and /a/ aren't both preserved. + reduced_paths = [] + for p in paths: + np = os.path.normpath(p) + # XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set. + if np not in reduced_paths: + reduced_paths.append(np) + return reduced_paths class MSVCCompiler (CCompiler) : @@ -270,6 +283,7 @@ self.__paths.append(p) except KeyError: pass + self.__paths = normalize_and_reduce_paths(self.__paths) os.environ['path'] = string.join(self.__paths, ';') self.preprocess_options = None Modified: python/branches/bcannon-objcap/Lib/doctest.py ============================================================================== --- python/branches/bcannon-objcap/Lib/doctest.py (original) +++ python/branches/bcannon-objcap/Lib/doctest.py Fri May 25 22:13:08 2007 @@ -2630,8 +2630,23 @@ } def _test(): - r = unittest.TextTestRunner() - r.run(DocTestSuite()) + testfiles = [arg for arg in sys.argv[1:] if arg and arg[0] != '-'] + if testfiles: + for filename in testfiles: + if filename.endswith(".py"): + # It is a module -- insert its dir into sys.path and try to + # import it. If it is part of a package, that possibly won't work + # because of package imports. + dirname, filename = os.path.split(filename) + sys.path.insert(0, dirname) + m = __import__(filename[:-3]) + del sys.path[0] + testmod(m) + else: + testfile(filename, module_relative=False) + else: + r = unittest.TextTestRunner() + r.run(DocTestSuite()) if __name__ == "__main__": _test() Modified: python/branches/bcannon-objcap/Lib/email/_parseaddr.py ============================================================================== --- python/branches/bcannon-objcap/Lib/email/_parseaddr.py (original) +++ python/branches/bcannon-objcap/Lib/email/_parseaddr.py Fri May 25 22:13:08 2007 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2006 Python Software Foundation +# Copyright (C) 2002-2007 Python Software Foundation # Contact: email-sig at python.org """Email address parsing code. @@ -172,6 +172,7 @@ self.pos = 0 self.LWS = ' \t' self.CR = '\r\n' + self.FWS = self.LWS + self.CR self.atomends = self.specials + self.LWS + self.CR # Note that RFC 2822 now specifies `.' as obs-phrase, meaning that it # is obsolete syntax. RFC 2822 requires that we recognize obsolete @@ -418,7 +419,7 @@ plist = [] while self.pos < len(self.field): - if self.field[self.pos] in self.LWS: + if self.field[self.pos] in self.FWS: self.pos += 1 elif self.field[self.pos] == '"': plist.append(self.getquote()) Modified: python/branches/bcannon-objcap/Lib/email/header.py ============================================================================== --- python/branches/bcannon-objcap/Lib/email/header.py (original) +++ python/branches/bcannon-objcap/Lib/email/header.py Fri May 25 22:13:08 2007 @@ -39,7 +39,8 @@ \? # literal ? (?P.*?) # non-greedy up to the next ?= is the encoded string \?= # literal ?= - ''', re.VERBOSE | re.IGNORECASE) + (?=[ \t]|$) # whitespace or the end of the string + ''', re.VERBOSE | re.IGNORECASE | re.MULTILINE) # Field name regexp, including trailing colon, but not separating whitespace, # according to RFC 2822. Character range is from tilde to exclamation mark. Modified: python/branches/bcannon-objcap/Lib/email/message.py ============================================================================== --- python/branches/bcannon-objcap/Lib/email/message.py (original) +++ python/branches/bcannon-objcap/Lib/email/message.py Fri May 25 22:13:08 2007 @@ -238,7 +238,7 @@ self.del_param('charset') self._charset = None return - if isinstance(charset, str): + if isinstance(charset, basestring): charset = email.charset.Charset(charset) if not isinstance(charset, email.charset.Charset): raise TypeError(charset) @@ -756,7 +756,9 @@ charset = charset[2] # charset character must be in us-ascii range try: - charset = unicode(charset, 'us-ascii').encode('us-ascii') + if isinstance(charset, str): + charset = unicode(charset, 'us-ascii') + charset = charset.encode('us-ascii') except UnicodeError: return failobj # RFC 2046, $4.1.2 says charsets are not case sensitive Modified: python/branches/bcannon-objcap/Lib/email/test/test_email.py ============================================================================== --- python/branches/bcannon-objcap/Lib/email/test/test_email.py (original) +++ python/branches/bcannon-objcap/Lib/email/test/test_email.py Fri May 25 22:13:08 2007 @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2006 Python Software Foundation +# Copyright (C) 2001-2007 Python Software Foundation # Contact: email-sig at python.org # email package unit tests @@ -502,6 +502,13 @@ msg.set_payload(x) self.assertEqual(msg.get_payload(decode=True), x) + def test_get_content_charset(self): + msg = Message() + msg.set_charset('us-ascii') + self.assertEqual('us-ascii', msg.get_content_charset()) + msg.set_charset(u'us-ascii') + self.assertEqual('us-ascii', msg.get_content_charset()) + # Test the email.Encoders module @@ -1520,6 +1527,18 @@ hu = make_header(dh).__unicode__() eq(hu, u'The quick brown fox jumped over the lazy dog') + def test_rfc2047_without_whitespace(self): + s = 'Sm=?ISO-8859-1?B?9g==?=rg=?ISO-8859-1?B?5Q==?=sbord' + dh = decode_header(s) + self.assertEqual(dh, [(s, None)]) + + def test_rfc2047_with_whitespace(self): + s = 'Sm =?ISO-8859-1?B?9g==?= rg =?ISO-8859-1?B?5Q==?= sbord' + dh = decode_header(s) + self.assertEqual(dh, [('Sm', None), ('\xf6', 'iso-8859-1'), + ('rg', None), ('\xe5', 'iso-8859-1'), + ('sbord', None)]) + # Test the MIMEMessage class @@ -2165,6 +2184,12 @@ # formataddr() quotes the name if there's a dot in it self.assertEqual(Utils.formataddr((a, b)), y) + def test_multiline_from_comment(self): + x = """\ +Foo +\tBar """ + self.assertEqual(Utils.parseaddr(x), ('Foo Bar', 'foo at example.com')) + def test_quote_dump(self): self.assertEqual( Utils.formataddr(('A Silly; Person', 'person at dom.ain')), Modified: python/branches/bcannon-objcap/Lib/email/test/test_email_renamed.py ============================================================================== --- python/branches/bcannon-objcap/Lib/email/test/test_email_renamed.py (original) +++ python/branches/bcannon-objcap/Lib/email/test/test_email_renamed.py Fri May 25 22:13:08 2007 @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2006 Python Software Foundation +# Copyright (C) 2001-2007 Python Software Foundation # Contact: email-sig at python.org # email package unit tests @@ -1525,6 +1525,18 @@ hu = make_header(dh).__unicode__() eq(hu, u'The quick brown fox jumped over the lazy dog') + def test_rfc2047_missing_whitespace(self): + s = 'Sm=?ISO-8859-1?B?9g==?=rg=?ISO-8859-1?B?5Q==?=sbord' + dh = decode_header(s) + self.assertEqual(dh, [(s, None)]) + + def test_rfc2047_with_whitespace(self): + s = 'Sm =?ISO-8859-1?B?9g==?= rg =?ISO-8859-1?B?5Q==?= sbord' + dh = decode_header(s) + self.assertEqual(dh, [('Sm', None), ('\xf6', 'iso-8859-1'), + ('rg', None), ('\xe5', 'iso-8859-1'), + ('sbord', None)]) + # Test the MIMEMessage class @@ -2171,6 +2183,12 @@ # formataddr() quotes the name if there's a dot in it self.assertEqual(utils.formataddr((a, b)), y) + def test_multiline_from_comment(self): + x = """\ +Foo +\tBar """ + self.assertEqual(utils.parseaddr(x), ('Foo Bar', 'foo at example.com')) + def test_quote_dump(self): self.assertEqual( utils.formataddr(('A Silly; Person', 'person at dom.ain')), Modified: python/branches/bcannon-objcap/Lib/encodings/__init__.py ============================================================================== --- python/branches/bcannon-objcap/Lib/encodings/__init__.py (original) +++ python/branches/bcannon-objcap/Lib/encodings/__init__.py Fri May 25 22:13:08 2007 @@ -93,8 +93,10 @@ if not modname or '.' in modname: continue try: - mod = __import__('encodings.' + modname, - globals(), locals(), _import_tail) + # Import is absolute to prevent the possibly malicious import of a + # module with side-effects that is not in the 'encodings' package. + mod = __import__('encodings.' + modname, fromlist=_import_tail, + level=0) except ImportError: pass else: Modified: python/branches/bcannon-objcap/Lib/encodings/utf_8_sig.py ============================================================================== --- python/branches/bcannon-objcap/Lib/encodings/utf_8_sig.py (original) +++ python/branches/bcannon-objcap/Lib/encodings/utf_8_sig.py Fri May 25 22:13:08 2007 @@ -44,14 +44,19 @@ self.first = True def _buffer_decode(self, input, errors, final): - if self.first and codecs.BOM_UTF8.startswith(input): # might be a BOM + if self.first: if len(input) < 3: - # not enough data to decide if this really is a BOM - # => try again on the next call - return (u"", 0) - (output, consumed) = codecs.utf_8_decode(input[3:], errors, final) - self.first = False - return (output, consumed+3) + if codecs.BOM_UTF8.startswith(input): + # not enough data to decide if this really is a BOM + # => try again on the next call + return (u"", 0) + else: + self.first = None + else: + self.first = None + if input[:3] == codecs.BOM_UTF8: + (output, consumed) = codecs.utf_8_decode(input[3:], errors, final) + return (output, consumed+3) return codecs.utf_8_decode(input, errors, final) def reset(self): Modified: python/branches/bcannon-objcap/Lib/ftplib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ftplib.py (original) +++ python/branches/bcannon-objcap/Lib/ftplib.py Fri May 25 22:13:08 2007 @@ -76,9 +76,15 @@ '''An FTP client class. - To create a connection, call the class using these argument: - host, user, passwd, acct - These are all strings, and have default value ''. + To create a connection, call the class using these arguments: + host, user, passwd, acct, timeout + + The first four arguments are all strings, and have default value ''. + timeout must be numeric and defaults to None if not passed, + meaning that no timeout will be set on any ftp socket(s) + If a timeout is passed, then this is now the default timeout for all ftp + socket operations for this instance. + Then use self.connect() with optional host and port argument. To download a file, use ftp.retrlines('RETR ' + filename), @@ -102,32 +108,26 @@ # Initialize host to localhost, port to standard ftp port # Optional arguments are host (for connect()), # and user, passwd, acct (for login()) - def __init__(self, host='', user='', passwd='', acct=''): + def __init__(self, host='', user='', passwd='', acct='', timeout=None): + self.timeout = timeout if host: self.connect(host) - if user: self.login(user, passwd, acct) + if user: + self.login(user, passwd, acct) - def connect(self, host = '', port = 0): + def connect(self, host='', port=0, timeout=None): '''Connect to host. Arguments are: - - host: hostname to connect to (string, default previous host) - - port: port to connect to (integer, default previous port)''' - if host: self.host = host - if port: self.port = port - msg = "getaddrinfo returns an empty list" - for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): - af, socktype, proto, canonname, sa = res - try: - self.sock = socket.socket(af, socktype, proto) - self.sock.connect(sa) - except socket.error, msg: - if self.sock: - self.sock.close() - self.sock = None - continue - break - if not self.sock: - raise socket.error, msg - self.af = af + - host: hostname to connect to (string, default previous host) + - port: port to connect to (integer, default previous port) + ''' + if host != '': + self.host = host + if port > 0: + self.port = port + if timeout is not None: + self.timeout = timeout + self.sock = socket.create_connection((self.host, self.port), self.timeout) + self.af = self.sock.family self.file = self.sock.makefile('rb') self.welcome = self.getresp() return self.welcome Modified: python/branches/bcannon-objcap/Lib/genericpath.py ============================================================================== --- python/branches/bcannon-objcap/Lib/genericpath.py (original) +++ python/branches/bcannon-objcap/Lib/genericpath.py Fri May 25 22:13:08 2007 @@ -70,8 +70,36 @@ if not m: return '' s1 = min(m) s2 = max(m) - n = min(len(s1), len(s2)) - for i in xrange(n): - if s1[i] != s2[i]: + for i, c in enumerate(s1): + if c != s2[i]: return s1[:i] - return s1[:n] + return s1 + +# Split a path in root and extension. +# The extension is everything starting at the last dot in the last +# pathname component; the root is everything before that. +# It is always true that root + ext == p. + +# Generic implementation of splitext, to be parametrized with +# the separators +def _splitext(p, sep, altsep, extsep): + """Split the extension from a pathname. + + Extension is everything from the last dot to the end, ignoring + leading dots. Returns "(root, ext)"; ext may be empty.""" + + sepIndex = p.rfind(sep) + if altsep: + altsepIndex = p.rfind(altsep) + sepIndex = max(sepIndex, altsepIndex) + + dotIndex = p.rfind(extsep) + if dotIndex > sepIndex: + # skip all leading dots + filenameIndex = sepIndex + 1 + while filenameIndex < dotIndex: + if p[filenameIndex] != extsep: + return p[:dotIndex], p[dotIndex:] + filenameIndex += 1 + + return p, '' Modified: python/branches/bcannon-objcap/Lib/glob.py ============================================================================== --- python/branches/bcannon-objcap/Lib/glob.py (original) +++ python/branches/bcannon-objcap/Lib/glob.py Fri May 25 22:13:08 2007 @@ -1,8 +1,9 @@ """Filename globbing utility.""" +import sys import os -import fnmatch import re +import fnmatch __all__ = ["glob", "iglob"] @@ -48,13 +49,16 @@ def glob1(dirname, pattern): if not dirname: dirname = os.curdir + if isinstance(pattern, unicode) and not isinstance(dirname, unicode): + dirname = unicode(dirname, sys.getfilesystemencoding() or + sys.getdefaultencoding()) try: names = os.listdir(dirname) except os.error: return [] - if pattern[0]!='.': - names=filter(lambda x: x[0]!='.',names) - return fnmatch.filter(names,pattern) + if pattern[0] != '.': + names = filter(lambda x: x[0] != '.', names) + return fnmatch.filter(names, pattern) def glob0(dirname, basename): if basename == '': Deleted: /python/branches/bcannon-objcap/Lib/gopherlib.py ============================================================================== --- /python/branches/bcannon-objcap/Lib/gopherlib.py Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,209 +0,0 @@ -"""Gopher protocol client interface.""" - -__all__ = ["send_selector","send_query"] - -import warnings -warnings.warn("the gopherlib module is deprecated", DeprecationWarning, - stacklevel=2) - -# Default selector, host and port -DEF_SELECTOR = '1/' -DEF_HOST = 'gopher.micro.umn.edu' -DEF_PORT = 70 - -# Recognized file types -A_TEXT = '0' -A_MENU = '1' -A_CSO = '2' -A_ERROR = '3' -A_MACBINHEX = '4' -A_PCBINHEX = '5' -A_UUENCODED = '6' -A_INDEX = '7' -A_TELNET = '8' -A_BINARY = '9' -A_DUPLICATE = '+' -A_SOUND = 's' -A_EVENT = 'e' -A_CALENDAR = 'c' -A_HTML = 'h' -A_TN3270 = 'T' -A_MIME = 'M' -A_IMAGE = 'I' -A_WHOIS = 'w' -A_QUERY = 'q' -A_GIF = 'g' -A_HTML = 'h' # HTML file -A_WWW = 'w' # WWW address -A_PLUS_IMAGE = ':' -A_PLUS_MOVIE = ';' -A_PLUS_SOUND = '<' - - -_names = dir() -_type_to_name_map = {} -def type_to_name(gtype): - """Map all file types to strings; unknown types become TYPE='x'.""" - global _type_to_name_map - if _type_to_name_map=={}: - for name in _names: - if name[:2] == 'A_': - _type_to_name_map[eval(name)] = name[2:] - if gtype in _type_to_name_map: - return _type_to_name_map[gtype] - return 'TYPE=%r' % (gtype,) - -# Names for characters and strings -CRLF = '\r\n' -TAB = '\t' - -def send_selector(selector, host, port = 0): - """Send a selector to a given host and port, return a file with the reply.""" - import socket - if not port: - i = host.find(':') - if i >= 0: - host, port = host[:i], int(host[i+1:]) - if not port: - port = DEF_PORT - elif type(port) == type(''): - port = int(port) - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.connect((host, port)) - s.sendall(selector + CRLF) - s.shutdown(1) - return s.makefile('rb') - -def send_query(selector, query, host, port = 0): - """Send a selector and a query string.""" - return send_selector(selector + '\t' + query, host, port) - -def path_to_selector(path): - """Takes a path as returned by urlparse and returns the appropriate selector.""" - if path=="/": - return "/" - else: - return path[2:] # Cuts initial slash and data type identifier - -def path_to_datatype_name(path): - """Takes a path as returned by urlparse and maps it to a string. - See section 3.4 of RFC 1738 for details.""" - if path=="/": - # No way to tell, although "INDEX" is likely - return "TYPE='unknown'" - else: - return type_to_name(path[1]) - -# The following functions interpret the data returned by the gopher -# server according to the expected type, e.g. textfile or directory - -def get_directory(f): - """Get a directory in the form of a list of entries.""" - entries = [] - while 1: - line = f.readline() - if not line: - print '(Unexpected EOF from server)' - break - if line[-2:] == CRLF: - line = line[:-2] - elif line[-1:] in CRLF: - line = line[:-1] - if line == '.': - break - if not line: - print '(Empty line from server)' - continue - gtype = line[0] - parts = line[1:].split(TAB) - if len(parts) < 4: - print '(Bad line from server: %r)' % (line,) - continue - if len(parts) > 4: - if parts[4:] != ['+']: - print '(Extra info from server:', - print parts[4:], ')' - else: - parts.append('') - parts.insert(0, gtype) - entries.append(parts) - return entries - -def get_textfile(f): - """Get a text file as a list of lines, with trailing CRLF stripped.""" - lines = [] - get_alt_textfile(f, lines.append) - return lines - -def get_alt_textfile(f, func): - """Get a text file and pass each line to a function, with trailing CRLF stripped.""" - while 1: - line = f.readline() - if not line: - print '(Unexpected EOF from server)' - break - if line[-2:] == CRLF: - line = line[:-2] - elif line[-1:] in CRLF: - line = line[:-1] - if line == '.': - break - if line[:2] == '..': - line = line[1:] - func(line) - -def get_binary(f): - """Get a binary file as one solid data block.""" - data = f.read() - return data - -def get_alt_binary(f, func, blocksize): - """Get a binary file and pass each block to a function.""" - while 1: - data = f.read(blocksize) - if not data: - break - func(data) - -def test(): - """Trivial test program.""" - import sys - import getopt - opts, args = getopt.getopt(sys.argv[1:], '') - selector = DEF_SELECTOR - type = selector[0] - host = DEF_HOST - if args: - host = args[0] - args = args[1:] - if args: - type = args[0] - args = args[1:] - if len(type) > 1: - type, selector = type[0], type - else: - selector = '' - if args: - selector = args[0] - args = args[1:] - query = '' - if args: - query = args[0] - args = args[1:] - if type == A_INDEX: - f = send_query(selector, query, host) - else: - f = send_selector(selector, host) - if type == A_TEXT: - lines = get_textfile(f) - for item in lines: print item - elif type in (A_MENU, A_INDEX): - entries = get_directory(f) - for item in entries: print item - else: - data = get_binary(f) - print 'binary data:', len(data), 'bytes:', repr(data[:100])[:40] - -# Run the test when run as script -if __name__ == '__main__': - test() Modified: python/branches/bcannon-objcap/Lib/gzip.py ============================================================================== --- python/branches/bcannon-objcap/Lib/gzip.py (original) +++ python/branches/bcannon-objcap/Lib/gzip.py Fri May 25 22:13:08 2007 @@ -106,7 +106,7 @@ self._new_member = True self.extrabuf = "" self.extrasize = 0 - self.filename = filename + self.name = filename # Starts small, scales exponentially self.min_readsize = 100 @@ -127,14 +127,20 @@ if self.mode == WRITE: self._write_gzip_header() + @property + def filename(self): + import warnings + warnings.warn("use the name attribute", DeprecationWarning) + if self.mode == WRITE and self.name[-3:] != ".gz": + return self.name + ".gz" + return self.name + def __repr__(self): s = repr(self.fileobj) return '' def _init_write(self, filename): - if filename[-3:] != '.gz': - filename = filename + '.gz' - self.filename = filename + self.name = filename self.crc = zlib.crc32("") self.size = 0 self.writebuf = [] @@ -143,7 +149,9 @@ def _write_gzip_header(self): self.fileobj.write('\037\213') # magic header self.fileobj.write('\010') # compression method - fname = self.filename[:-3] + fname = self.name + if fname.endswith(".gz"): + fname = fname[:-3] flags = 0 if fname: flags = FNAME Modified: python/branches/bcannon-objcap/Lib/heapq.py ============================================================================== --- python/branches/bcannon-objcap/Lib/heapq.py (original) +++ python/branches/bcannon-objcap/Lib/heapq.py Fri May 25 22:13:08 2007 @@ -126,8 +126,8 @@ From all times, sorting has always been a Great Art! :-) """ -__all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'nlargest', - 'nsmallest'] +__all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge', + 'nlargest', 'nsmallest'] from itertools import islice, repeat, count, imap, izip, tee from operator import itemgetter, neg @@ -308,6 +308,41 @@ except ImportError: pass +def merge(*iterables): + '''Merge multiple sorted inputs into a single sorted output. + + Similar to sorted(itertools.chain(*iterables)) but returns a generator, + does not pull the data into memory all at once, and assumes that each of + the input streams is already sorted (smallest to largest). + + >>> list(merge([1,3,5,7], [0,2,4,8], [5,10,15,20], [], [25])) + [0, 1, 2, 3, 4, 5, 5, 7, 8, 10, 15, 20, 25] + + ''' + _heappop, _heapreplace, _StopIteration = heappop, heapreplace, StopIteration + + h = [] + h_append = h.append + for itnum, it in enumerate(map(iter, iterables)): + try: + next = it.next + h_append([next(), itnum, next]) + except _StopIteration: + pass + heapify(h) + + while 1: + try: + while 1: + v, itnum, next = s = h[0] # raises IndexError when h is empty + yield v + s[0] = next() # raises StopIteration when exhausted + _heapreplace(h, s) # restore heap condition + except _StopIteration: + _heappop(h) # remove empty iterator + except IndexError: + return + # Extend the implementations of nsmallest and nlargest to use a key= argument _nsmallest = nsmallest def nsmallest(n, iterable, key=None): @@ -341,3 +376,6 @@ while heap: sort.append(heappop(heap)) print sort + + import doctest + doctest.testmod() Modified: python/branches/bcannon-objcap/Lib/httplib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/httplib.py (original) +++ python/branches/bcannon-objcap/Lib/httplib.py Fri May 25 22:13:08 2007 @@ -625,7 +625,8 @@ debuglevel = 0 strict = 0 - def __init__(self, host, port=None, strict=None): + def __init__(self, host, port=None, strict=None, timeout=None): + self.timeout = timeout self.sock = None self._buffer = [] self.__response = None @@ -658,25 +659,8 @@ def connect(self): """Connect to the host and port specified in __init__.""" - msg = "getaddrinfo returns an empty list" - for res in socket.getaddrinfo(self.host, self.port, 0, - socket.SOCK_STREAM): - af, socktype, proto, canonname, sa = res - try: - self.sock = socket.socket(af, socktype, proto) - if self.debuglevel > 0: - print "connect: (%s, %s)" % (self.host, self.port) - self.sock.connect(sa) - except socket.error, msg: - if self.debuglevel > 0: - print 'connect fail:', (self.host, self.port) - if self.sock: - self.sock.close() - self.sock = None - continue - break - if not self.sock: - raise socket.error, msg + self.sock = socket.create_connection((self.host,self.port), + self.timeout) def close(self): """Close the connection to the HTTP server.""" @@ -948,8 +932,8 @@ self.__state = _CS_IDLE if response.will_close: - # Pass the socket to the response - self.sock = None + # this effectively passes the connection to the response + self.close() else: # remember this, so we can tell when it is complete self.__response = response @@ -1140,16 +1124,15 @@ default_port = HTTPS_PORT def __init__(self, host, port=None, key_file=None, cert_file=None, - strict=None): - HTTPConnection.__init__(self, host, port, strict) + strict=None, timeout=None): + HTTPConnection.__init__(self, host, port, strict, timeout) self.key_file = key_file self.cert_file = cert_file def connect(self): "Connect to a host on a given (SSL) port." - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) + sock = socket.create_connection((self.host, self.port), self.timeout) ssl = socket.ssl(sock, self.key_file, self.cert_file) self.sock = FakeSocket(sock, ssl) Modified: python/branches/bcannon-objcap/Lib/idlelib/AutoCompleteWindow.py ============================================================================== --- python/branches/bcannon-objcap/Lib/idlelib/AutoCompleteWindow.py (original) +++ python/branches/bcannon-objcap/Lib/idlelib/AutoCompleteWindow.py Fri May 25 22:13:08 2007 @@ -10,13 +10,14 @@ KEYPRESS_VIRTUAL_EVENT_NAME = "<>" # We need to bind event beyond so that the function will be called # before the default specific IDLE function -KEYPRESS_SEQUENCES = ("", "", "", - "", "", "", "") +KEYPRESS_SEQUENCES = ("", "", "", "", + "", "", "", "", + "", "") KEYRELEASE_VIRTUAL_EVENT_NAME = "<>" KEYRELEASE_SEQUENCE = "" -LISTUPDATE_SEQUENCE = "" +LISTUPDATE_SEQUENCE = "" WINCONFIG_SEQUENCE = "" -DOUBLECLICK_SEQUENCE = "" +DOUBLECLICK_SEQUENCE = "" class AutoCompleteWindow: @@ -49,6 +50,8 @@ # event ids self.hideid = self.keypressid = self.listupdateid = self.winconfigid \ = self.keyreleaseid = self.doubleclickid = None + # Flag set if last keypress was a tab + self.lastkey_was_tab = False def _change_start(self, newstart): i = 0 @@ -118,11 +121,6 @@ i = 0 while i < len(lts) and i < len(selstart) and lts[i] == selstart[i]: i += 1 - previous_completion = self.completions[cursel - 1] - while cursel > 0 and selstart[:i] <= previous_completion: - i += 1 - if selstart == previous_completion: - break # maybe we have a duplicate? newstart = selstart[:i] self._change_start(newstart) @@ -206,7 +204,7 @@ self.keyrelease_event) self.widget.event_add(KEYRELEASE_VIRTUAL_EVENT_NAME,KEYRELEASE_SEQUENCE) self.listupdateid = listbox.bind(LISTUPDATE_SEQUENCE, - self.listupdate_event) + self.listselect_event) self.winconfigid = acw.bind(WINCONFIG_SEQUENCE, self.winconfig_event) self.doubleclickid = listbox.bind(DOUBLECLICK_SEQUENCE, self.doubleclick_event) @@ -215,24 +213,34 @@ if not self.is_active(): return # Position the completion list window + text = self.widget + text.see(self.startindex) + x, y, cx, cy = text.bbox(self.startindex) acw = self.autocompletewindow - self.widget.see(self.startindex) - x, y, cx, cy = self.widget.bbox(self.startindex) - acw.wm_geometry("+%d+%d" % (x + self.widget.winfo_rootx(), - y + self.widget.winfo_rooty() \ - -acw.winfo_height())) - + acw_width, acw_height = acw.winfo_width(), acw.winfo_height() + text_width, text_height = text.winfo_width(), text.winfo_height() + new_x = text.winfo_rootx() + min(x, max(0, text_width - acw_width)) + new_y = text.winfo_rooty() + y + if (text_height - (y + cy) >= acw_height # enough height below + or y < acw_height): # not enough height above + # place acw below current line + new_y += cy + else: + # place acw above current line + new_y -= acw_height + acw.wm_geometry("+%d+%d" % (new_x, new_y)) def hide_event(self, event): if not self.is_active(): return self.hide_window() - def listupdate_event(self, event): + def listselect_event(self, event): if not self.is_active(): return self.userwantswindow = True - self._selection_changed() + cursel = int(self.listbox.curselection()[0]) + self._change_start(self.completions[cursel]) def doubleclick_event(self, event): # Put the selected completion in the text, and close the list @@ -248,7 +256,8 @@ state = event.mc_state else: state = 0 - + if keysym != "Tab": + self.lastkey_was_tab = False if (len(keysym) == 1 or keysym in ("underscore", "BackSpace") or (self.mode==AutoComplete.COMPLETE_FILES and keysym in ("period", "minus"))) \ @@ -330,13 +339,21 @@ self.listbox.select_clear(cursel) self.listbox.select_set(newsel) self._selection_changed() + self._change_start(self.completions[newsel]) return "break" elif (keysym == "Tab" and not state): - # The user wants a completion, but it is handled by AutoComplete - # (not AutoCompleteWindow), so ignore. - self.userwantswindow = True - return + if self.lastkey_was_tab: + # two tabs in a row; insert current selection and close acw + cursel = int(self.listbox.curselection()[0]) + self._change_start(self.completions[cursel]) + self.hide_window() + return "break" + else: + # first tab; let AutoComplete handle the completion + self.userwantswindow = True + self.lastkey_was_tab = True + return elif reduce(lambda x, y: x or y, [keysym.find(s) != -1 for s in ("Shift", "Control", "Alt", Modified: python/branches/bcannon-objcap/Lib/idlelib/CallTips.py ============================================================================== --- python/branches/bcannon-objcap/Lib/idlelib/CallTips.py (original) +++ python/branches/bcannon-objcap/Lib/idlelib/CallTips.py Fri May 25 22:13:08 2007 @@ -3,7 +3,9 @@ Call Tips are floating windows which display function, class, and method parameter and docstring information when you type an opening parenthesis, and which disappear when you type a closing parenthesis. + """ +import re import sys import types @@ -89,6 +91,8 @@ two unrelated modules are being edited some calltips in the current module may be inoperative if the module was not the last to run. + To find methods, fetch_tip must be fed a fully qualified name. + """ try: rpcclt = self.editwin.flist.pyshell.interp.rpcclt @@ -108,7 +112,7 @@ namespace.update(__main__.__dict__) try: return eval(name, namespace) - except: + except (NameError, AttributeError): return None def _find_constructor(class_ob): @@ -124,39 +128,37 @@ def get_arg_text(ob): """Get a string describing the arguments for the given object""" - argText = "" + arg_text = "" if ob is not None: - argOffset = 0 + arg_offset = 0 if type(ob) in (types.ClassType, types.TypeType): # Look for the highest __init__ in the class chain. fob = _find_constructor(ob) if fob is None: fob = lambda: None else: - argOffset = 1 + arg_offset = 1 elif type(ob)==types.MethodType: # bit of a hack for methods - turn it into a function # but we drop the "self" param. fob = ob.im_func - argOffset = 1 + arg_offset = 1 else: fob = ob - # Try and build one for Python defined functions + # Try to build one for Python defined functions if type(fob) in [types.FunctionType, types.LambdaType]: - try: - realArgs = fob.func_code.co_varnames[argOffset:fob.func_code.co_argcount] - defaults = fob.func_defaults or [] - defaults = list(map(lambda name: "=%s" % repr(name), defaults)) - defaults = [""] * (len(realArgs)-len(defaults)) + defaults - items = map(lambda arg, dflt: arg+dflt, realArgs, defaults) - if fob.func_code.co_flags & 0x4: - items.append("...") - if fob.func_code.co_flags & 0x8: - items.append("***") - argText = ", ".join(items) - argText = "(%s)" % argText - except: - pass + argcount = fob.func_code.co_argcount + real_args = fob.func_code.co_varnames[arg_offset:argcount] + defaults = fob.func_defaults or [] + defaults = list(map(lambda name: "=%s" % repr(name), defaults)) + defaults = [""] * (len(real_args) - len(defaults)) + defaults + items = map(lambda arg, dflt: arg + dflt, real_args, defaults) + if fob.func_code.co_flags & 0x4: + items.append("...") + if fob.func_code.co_flags & 0x8: + items.append("***") + arg_text = ", ".join(items) + arg_text = "(%s)" % re.sub("\.\d+", "", arg_text) # See if we can use the docstring doc = getattr(ob, "__doc__", "") if doc: @@ -164,10 +166,10 @@ pos = doc.find("\n") if pos < 0 or pos > 70: pos = 70 - if argText: - argText += "\n" - argText += doc[:pos] - return argText + if arg_text: + arg_text += "\n" + arg_text += doc[:pos] + return arg_text ################################################# # @@ -181,16 +183,18 @@ def t4(*args): "(...)" def t5(a, *args): "(a, ...)" def t6(a, b=None, *args, **kw): "(a, b=None, ..., ***)" + def t7((a, b), c, (d, e)): "(, c, )" - class TC: - "(a=None, ...)" - def __init__(self, a=None, *b): "(a=None, ...)" + class TC(object): + "(ai=None, ...)" + def __init__(self, ai=None, *b): "(ai=None, ...)" def t1(self): "()" - def t2(self, a, b=None): "(a, b=None)" - def t3(self, a, *args): "(a, ...)" + def t2(self, ai, b=None): "(ai, b=None)" + def t3(self, ai, *args): "(ai, ...)" def t4(self, *args): "(...)" - def t5(self, a, *args): "(a, ...)" - def t6(self, a, b=None, *args, **kw): "(a, b=None, ..., ***)" + def t5(self, ai, *args): "(ai, ...)" + def t6(self, ai, b=None, *args, **kw): "(ai, b=None, ..., ***)" + def t7(self, (ai, b), c, (d, e)): "(, c, )" def test(tests): ct = CallTips() @@ -198,15 +202,20 @@ for t in tests: expected = t.__doc__ + "\n" + t.__doc__ name = t.__name__ - arg_text = ct.fetch_tip(name) + # exercise fetch_tip(), not just get_arg_text() + try: + qualified_name = "%s.%s" % (t.im_class.__name__, name) + except AttributeError: + qualified_name = name + arg_text = ct.fetch_tip(qualified_name) if arg_text != expected: failed.append(t) - print "%s - expected %s, but got %s" % (t, expected, - get_arg_text(entity)) + fmt = "%s - expected %s, but got %s" + print fmt % (t.__name__, expected, get_arg_text(t)) print "%d of %d tests failed" % (len(failed), len(tests)) tc = TC() - tests = (t1, t2, t3, t4, t5, t6, - TC, tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6) + tests = (t1, t2, t3, t4, t5, t6, t7, + TC, tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6, tc.t7) test(tests) Modified: python/branches/bcannon-objcap/Lib/idlelib/CodeContext.py ============================================================================== --- python/branches/bcannon-objcap/Lib/idlelib/CodeContext.py (original) +++ python/branches/bcannon-objcap/Lib/idlelib/CodeContext.py Fri May 25 22:13:08 2007 @@ -10,6 +10,7 @@ """ import Tkinter +from Tkconstants import TOP, LEFT, X, W, SUNKEN from configHandler import idleConf import re from sys import maxint as INFINITY @@ -24,7 +25,6 @@ class CodeContext: menudefs = [('options', [('!Code Conte_xt', '<>')])] - context_depth = idleConf.GetOption("extensions", "CodeContext", "numlines", type="int", default=3) bgcolor = idleConf.GetOption("extensions", "CodeContext", @@ -54,66 +54,33 @@ def toggle_code_context_event(self, event=None): if not self.label: - # The following code attempts to figure out the required border - # width and vertical padding required for the CodeContext widget - # to be perfectly aligned with the text in the main Text widget. - # This is done by retrieving the appropriate attributes from the - # editwin.text and editwin.text_frame widgets. + # Calculate the border width and horizontal padding required to + # align the context with the text in the main Text widget. # # All values are passed through int(str()), since some - # values may be pixel objects, which can't simply be added added - # to ints. - # - # This code is considered somewhat unstable since it relies on - # some of Tk's inner workings. However its effect is merely - # cosmetic; failure will only cause the CodeContext text to be - # somewhat misaligned with the text in the main Text widget. - # - # To avoid possible errors, all references to the inner workings - # of Tk are executed inside try/except blocks. - - widgets_for_width_calc = self.editwin.text, self.editwin.text_frame - - # calculate the required vertical padding + # values may be pixel objects, which can't simply be added to ints. + widgets = self.editwin.text, self.editwin.text_frame + # Calculate the required vertical padding padx = 0 - for widget in widgets_for_width_calc: - try: - # retrieve the "padx" attribte from widget's pack info - padx += int(str( widget.pack_info()['padx'] )) - except: - pass - try: - # retrieve the widget's "padx" attribte - padx += int(str( widget.cget('padx') )) - except: - pass - - # calculate the required border width - border_width = 0 - for widget in widgets_for_width_calc: - try: - # retrieve the widget's "border" attribte - border_width += int(str( widget.cget('border') )) - except: - pass - + for widget in widgets: + padx += int(str( widget.pack_info()['padx'] )) + padx += int(str( widget.cget('padx') )) + # Calculate the required border width + border = 0 + for widget in widgets: + border += int(str( widget.cget('border') )) self.label = Tkinter.Label(self.editwin.top, text="\n" * (self.context_depth - 1), - anchor="w", justify="left", + anchor=W, justify=LEFT, font=self.textfont, bg=self.bgcolor, fg=self.fgcolor, width=1, #don't request more than we get - padx=padx, #line up with text widget - border=border_width, #match border width - relief="sunken", - ) - - # CodeContext's label widget is packed before and above the - # text_frame widget, thus ensuring that it will appear directly - # above it. - self.label.pack(side="top", fill="x", expand=False, + padx=padx, border=border, + relief=SUNKEN) + # Pack the label widget before and above the text_frame widget, + # thus ensuring that it will appear directly above text_frame + self.label.pack(side=TOP, fill=X, expand=False, before=self.editwin.text_frame) - else: self.label.destroy() self.label = None @@ -190,7 +157,6 @@ stopindent) self.info.extend(lines) self.topvisible = new_topvisible - # empty lines in context pane: context_strings = [""] * max(0, self.context_depth - len(self.info)) # followed by the context hint lines: Modified: python/branches/bcannon-objcap/Lib/idlelib/IOBinding.py ============================================================================== --- python/branches/bcannon-objcap/Lib/idlelib/IOBinding.py (original) +++ python/branches/bcannon-objcap/Lib/idlelib/IOBinding.py Fri May 25 22:13:08 2007 @@ -209,7 +209,7 @@ # gets set to "not modified" at every new prompt. try: interp = self.editwin.interp - except: + except AttributeError: interp = None if not self.filename and self.get_saved() and not interp: self.editwin.flist.open(filename, self.loadfile) Modified: python/branches/bcannon-objcap/Lib/idlelib/MultiCall.py ============================================================================== --- python/branches/bcannon-objcap/Lib/idlelib/MultiCall.py (original) +++ python/branches/bcannon-objcap/Lib/idlelib/MultiCall.py Fri May 25 22:13:08 2007 @@ -349,6 +349,8 @@ triplets.append(triplet) def event_delete(self, virtual, *sequences): + if virtual not in self.__eventinfo: + return func, triplets = self.__eventinfo[virtual] for seq in sequences: triplet = _parse_sequence(seq) Modified: python/branches/bcannon-objcap/Lib/idlelib/NEWS.txt ============================================================================== --- python/branches/bcannon-objcap/Lib/idlelib/NEWS.txt (original) +++ python/branches/bcannon-objcap/Lib/idlelib/NEWS.txt Fri May 25 22:13:08 2007 @@ -3,6 +3,19 @@ *Release date: XX-XXX-200X* +- Corrected some bugs in AutoComplete. Also, Page Up/Down in ACW implemented; + mouse and cursor selection in ACWindow implemented; double Tab inserts + current selection and closes ACW (similar to double-click and Return); scroll + wheel now works in ACW. Added AutoComplete instructions to IDLE Help. + +- AutoCompleteWindow moved below input line, will move above if there + isn't enough space. Patch 1621265 Tal Einat + +- Calltips now 'handle' tuples in the argument list (display '' :) + Suggested solution by Christos Georgiou, Bug 791968. + +- Add 'raw' support to configHandler. Patch 1650174 Tal Einat. + - Avoid hang when encountering a duplicate in a completion list. Bug 1571112. - Patch #1362975: Rework CodeContext indentation algorithm to Modified: python/branches/bcannon-objcap/Lib/idlelib/PyShell.py ============================================================================== --- python/branches/bcannon-objcap/Lib/idlelib/PyShell.py (original) +++ python/branches/bcannon-objcap/Lib/idlelib/PyShell.py Fri May 25 22:13:08 2007 @@ -706,35 +706,37 @@ debugger = self.debugger try: self.tkconsole.beginexecuting() - try: - if not debugger and self.rpcclt is not None: - self.active_seq = self.rpcclt.asyncqueue("exec", "runcode", - (code,), {}) - elif debugger: - debugger.run(code, self.locals) - else: - exec code in self.locals - except SystemExit: - if not self.tkconsole.closing: - if tkMessageBox.askyesno( - "Exit?", - "Do you want to exit altogether?", - default="yes", - master=self.tkconsole.text): - raise - else: - self.showtraceback() - else: + if not debugger and self.rpcclt is not None: + self.active_seq = self.rpcclt.asyncqueue("exec", "runcode", + (code,), {}) + elif debugger: + debugger.run(code, self.locals) + else: + exec code in self.locals + except SystemExit: + if not self.tkconsole.closing: + if tkMessageBox.askyesno( + "Exit?", + "Do you want to exit altogether?", + default="yes", + master=self.tkconsole.text): raise - except: - if use_subprocess: - # When run w/o subprocess, both user and IDLE errors - # are printed here; skip message in that case. - print >> self.tkconsole.stderr, \ - "IDLE internal error in runcode()" + else: + self.showtraceback() + else: + raise + except: + if use_subprocess: + print >>self.tkconsole.stderr, \ + "IDLE internal error in runcode()" self.showtraceback() - if use_subprocess: - self.tkconsole.endexecuting() + self.tkconsole.endexecuting() + else: + if self.tkconsole.canceled: + self.tkconsole.canceled = False + print >>self.tkconsole.stderr, "KeyboardInterrupt" + else: + self.showtraceback() finally: if not use_subprocess: try: Modified: python/branches/bcannon-objcap/Lib/idlelib/configHandler.py ============================================================================== --- python/branches/bcannon-objcap/Lib/idlelib/configHandler.py (original) +++ python/branches/bcannon-objcap/Lib/idlelib/configHandler.py Fri May 25 22:13:08 2007 @@ -39,22 +39,19 @@ self.file=cfgFile ConfigParser.__init__(self,defaults=cfgDefaults) - def Get(self, section, option, type=None, default=None): + def Get(self, section, option, type=None, default=None, raw=False): """ Get an option value for given section/option or return default. If type is specified, return as type. """ + if not self.has_option(section, option): + return default if type=='bool': - getVal=self.getboolean + return self.getboolean(section, option) elif type=='int': - getVal=self.getint - else: - getVal=self.get - if self.has_option(section,option): - #return getVal(section, option, raw, vars, default) - return getVal(section, option) + return self.getint(section, option) else: - return default + return self.get(section, option, raw=raw) def GetOptionList(self,section): """ @@ -219,7 +216,7 @@ return userDir def GetOption(self, configType, section, option, default=None, type=None, - warn_on_default=True): + warn_on_default=True, raw=False): """ Get an option value for given config type and given general configuration section/option or return a default. If type is specified, @@ -233,9 +230,11 @@ """ if self.userCfg[configType].has_option(section,option): - return self.userCfg[configType].Get(section, option, type=type) + return self.userCfg[configType].Get(section, option, + type=type, raw=raw) elif self.defaultCfg[configType].has_option(section,option): - return self.defaultCfg[configType].Get(section, option, type=type) + return self.defaultCfg[configType].Get(section, option, + type=type, raw=raw) else: #returning default, print warning if warn_on_default: warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n' Modified: python/branches/bcannon-objcap/Lib/idlelib/help.txt ============================================================================== --- python/branches/bcannon-objcap/Lib/idlelib/help.txt (original) +++ python/branches/bcannon-objcap/Lib/idlelib/help.txt Fri May 25 22:13:08 2007 @@ -44,6 +44,10 @@ Find in Files... -- Open a search dialog box for searching files Replace... -- Open a search-and-replace dialog box Go to Line -- Ask for a line number and show that line + Show Calltip -- Open a small window with function param hints + Show Completions -- Open a scroll window allowing selection keywords + and attributes. (see '*TIPS*', below) + Show Parens -- Highlight the surrounding parenthesis Expand Word -- Expand the word you have typed to match another word in the same buffer; repeat to get a different expansion @@ -91,6 +95,7 @@ Code Context -- Open a pane at the top of the edit window which shows the block context of the section of code which is scrolling off the top or the window. + (Not present in Shell window.) Windows Menu: @@ -138,8 +143,11 @@ Control-left/right Arrow moves by words in a strange but useful way. Home/End go to begin/end of line. Control-Home/End go to begin/end of file. - Some useful Emacs bindings (Control-a, Control-e, Control-k, etc.) - are inherited from Tcl/Tk. + Some useful Emacs bindings are inherited from Tcl/Tk: + Control-a beginning of line + Control-e end of line + Control-k kill line (but doesn't put it in clipboard) + Control-l center window around the insertion point Standard Windows bindings may work on that platform. Keybindings are selected in the Settings Dialog, look there. @@ -155,6 +163,52 @@ See also the indent/dedent region commands in the edit menu. +Completions: + + Completions are supplied for functions, classes, and attributes of + classes, both built-in and user-defined. Completions are also provided + for filenames. + + The AutoCompleteWindow (ACW) will open after a predefined delay + (default is two seconds) after a '.' or (in a string) an os.sep is + typed. If after one of those characters (plus zero or more other + characters) you type a Tab the ACW will open immediately if a possible + continuation is found. + + If there is only one possible completion for the characters entered, a + Tab will supply that completion without opening the ACW. + + 'Show Completions' will force open a completions window. In an empty + string, this will contain the files in the current directory. On a + blank line, it will contain the built-in and user-defined functions and + classes in the current name spaces, plus any modules imported. If some + characters have been entered, the ACW will attempt to be more specific. + + If string of characters is typed, the ACW selection will jump to the + entry most closely matching those characters. Entering a Tab will cause + the longest non-ambiguous match to be entered in the Edit window or + Shell. Two Tabs in a row will supply the current ACW selection, as + will Return or a double click. Cursor keys, Page Up/Down, mouse + selection, and the scrollwheel all operate on the ACW. + + 'Hidden' attributes can be accessed by typing the beginning of hidden + name after a '.'. e.g. '_'. This allows access to modules with + '__all__' set, or to class-private attributes. + + Completions and the 'Expand Word' facility can save a lot of typing! + + Completions are currently limited to those in the namespaces. Names in + an Edit window which are not via __main__ or sys.modules will not be + found. Run the module once with your imports to correct this + situation. Note that IDLE itself places quite a few modules in + sys.modules, so much can be found by default, e.g. the re module. + + If you don't like the ACW popping up unbidden, simply make the delay + longer or disable the extension. OTOH, you could make the delay zero. + + You could also switch off the CallTips extension. (We will be adding + a delay to the call tip window.) + Python Shell window: Control-c interrupts executing command. @@ -165,7 +219,7 @@ Alt-p retrieves previous command matching what you have typed. Alt-n retrieves next. - (These are Control-p, Control-n on the Mac) + (These are Control-p, Control-n on the Mac) Return while cursor is on a previous command retrieves that command. Expand word is also useful to reduce typing. @@ -196,7 +250,7 @@ be changed using the Settings dialog. Command line usage: - + Enter idle -h at the command prompt to get a usage message. Running without a subprocess: @@ -211,3 +265,18 @@ re-import any specific items (e.g. from foo import baz) if the changes are to take effect. For these reasons, it is preferable to run IDLE with the default subprocess if at all possible. + +Extensions: + + IDLE contains an extension facility. See the beginning of + config-extensions.def in the idlelib directory for further information. + The default extensions are currently: + + FormatParagraph + AutoExpand + ZoomHeight + ScriptBinding + CallTips + ParenMatch + AutoComplete + CodeContext Modified: python/branches/bcannon-objcap/Lib/imaplib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/imaplib.py (original) +++ python/branches/bcannon-objcap/Lib/imaplib.py Fri May 25 22:13:08 2007 @@ -746,8 +746,10 @@ if not command in Commands: raise self.error("Unknown IMAP4 UID command: %s" % command) if self.state not in Commands[command]: - raise self.error('command %s illegal in state %s' - % (command, self.state)) + raise self.error("command %s illegal in state %s, " + "only allowed in states %s" % + (command, self.state, + ', '.join(Commands[command]))) name = 'UID' typ, dat = self._simple_command(name, command, *args) if command in ('SEARCH', 'SORT'): @@ -811,8 +813,10 @@ if self.state not in Commands[name]: self.literal = None - raise self.error( - 'command %s illegal in state %s' % (name, self.state)) + raise self.error("command %s illegal in state %s, " + "only allowed in states %s" % + (name, self.state, + ', '.join(Commands[name]))) for typ in ('OK', 'NO', 'BAD'): if typ in self.untagged_responses: Modified: python/branches/bcannon-objcap/Lib/imputil.py ============================================================================== --- python/branches/bcannon-objcap/Lib/imputil.py (original) +++ python/branches/bcannon-objcap/Lib/imputil.py Fri May 25 22:13:08 2007 @@ -552,6 +552,10 @@ # This method is only used when we look for a module within a package. assert parent + for submodule_path in parent.__path__: + code = self._import_pathname(_os_path_join(submodule_path, modname), fqname) + if code is not None: + return code return self._import_pathname(_os_path_join(parent.__pkgdir__, modname), fqname) Modified: python/branches/bcannon-objcap/Lib/locale.py ============================================================================== --- python/branches/bcannon-objcap/Lib/locale.py (original) +++ python/branches/bcannon-objcap/Lib/locale.py Fri May 25 22:13:08 2007 @@ -19,9 +19,11 @@ # Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before # trying the import. So __all__ is also fiddled at the end of the file. -__all__ = ["setlocale","Error","localeconv","strcoll","strxfrm", - "format","str","atof","atoi","LC_CTYPE","LC_COLLATE", - "LC_TIME","LC_MONETARY","LC_NUMERIC", "LC_ALL","CHAR_MAX"] +__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error", + "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm", + "str", "atof", "atoi", "format", "format_string", "currency", + "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY", + "LC_NUMERIC", "LC_ALL", "CHAR_MAX"] try: Modified: python/branches/bcannon-objcap/Lib/logging/__init__.py ============================================================================== --- python/branches/bcannon-objcap/Lib/logging/__init__.py (original) +++ python/branches/bcannon-objcap/Lib/logging/__init__.py Fri May 25 22:13:08 2007 @@ -1,4 +1,4 @@ -# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2007 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -21,7 +21,7 @@ Should work under Python versions >= 1.5.2, except that source line information is not available unless 'sys._getframe()' is. -Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ @@ -41,8 +41,8 @@ __author__ = "Vinay Sajip " __status__ = "production" -__version__ = "0.5.0.1" -__date__ = "09 January 2007" +__version__ = "0.5.0.2" +__date__ = "16 February 2007" #--------------------------------------------------------------------------- # Miscellaneous module data @@ -68,7 +68,7 @@ except: return sys.exc_traceback.tb_frame.f_back -if hasattr(sys, '_getframe'): currentframe = sys._getframe +if hasattr(sys, '_getframe'): currentframe = lambda: sys._getframe(3) # done filching # _srcfile is only used in conjunction with sys._getframe(). Modified: python/branches/bcannon-objcap/Lib/logging/handlers.py ============================================================================== --- python/branches/bcannon-objcap/Lib/logging/handlers.py (original) +++ python/branches/bcannon-objcap/Lib/logging/handlers.py Fri May 25 22:13:08 2007 @@ -361,12 +361,14 @@ self.retryMax = 30.0 self.retryFactor = 2.0 - def makeSocket(self): + def makeSocket(self, timeout=1): """ A factory method which allows subclasses to define the precise type of socket they want. """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + if hasattr(s, 'settimeout'): + s.settimeout(timeout) s.connect((self.host, self.port)) return s @@ -720,22 +722,25 @@ """ A handler class which sends an SMTP email for each logging event. """ - def __init__(self, mailhost, fromaddr, toaddrs, subject): + def __init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None): """ Initialize the handler. Initialize the instance with the from and to addresses and subject line of the email. To specify a non-standard SMTP port, use the - (host, port) tuple format for the mailhost argument. + (host, port) tuple format for the mailhost argument. To specify + authentication credentials, supply a (username, password) tuple + for the credentials argument. """ logging.Handler.__init__(self) if type(mailhost) == types.TupleType: - host, port = mailhost - self.mailhost = host - self.mailport = port + self.mailhost, self.mailport = mailhost + else: + self.mailhost, self.mailport = mailhost, None + if type(credentials) == types.TupleType: + self.username, self.password = credentials else: - self.mailhost = mailhost - self.mailport = None + self.username = None self.fromaddr = fromaddr if type(toaddrs) == types.StringType: toaddrs = [toaddrs] @@ -791,6 +796,8 @@ string.join(self.toaddrs, ","), self.getSubject(record), formatdate(), msg) + if self.username: + smtp.login(self.username, self.password) smtp.sendmail(self.fromaddr, self.toaddrs, msg) smtp.quit() except (KeyboardInterrupt, SystemExit): Modified: python/branches/bcannon-objcap/Lib/macpath.py ============================================================================== --- python/branches/bcannon-objcap/Lib/macpath.py (original) +++ python/branches/bcannon-objcap/Lib/macpath.py Fri May 25 22:13:08 2007 @@ -2,6 +2,7 @@ import os from stat import * +import genericpath from genericpath import * __all__ = ["normcase","isabs","join","splitdrive","split","splitext", @@ -69,17 +70,8 @@ def splitext(p): - """Split a path into root and extension. - The extension is everything starting at the last dot in the last - pathname component; the root is everything before that. - It is always true that root + ext == p.""" - - i = p.rfind('.') - if i<=p.rfind(':'): - return p, '' - else: - return p[:i], p[i:] - + return genericpath._splitext(p, sep, altsep, extsep) +splitext.__doc__ = genericpath._splitext.__doc__ def splitdrive(p): """Split a pathname into a drive specification and the rest of the Modified: python/branches/bcannon-objcap/Lib/mimetypes.py ============================================================================== --- python/branches/bcannon-objcap/Lib/mimetypes.py (original) +++ python/branches/bcannon-objcap/Lib/mimetypes.py Fri May 25 22:13:08 2007 @@ -329,11 +329,13 @@ '.tgz': '.tar.gz', '.taz': '.tar.gz', '.tz': '.tar.gz', + '.tbz2': '.tar.bz2', } encodings_map = { '.gz': 'gzip', '.Z': 'compress', + '.bz2': 'bzip2', } # Before adding new types, make sure they are either registered with IANA, Modified: python/branches/bcannon-objcap/Lib/ntpath.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ntpath.py (original) +++ python/branches/bcannon-objcap/Lib/ntpath.py Fri May 25 22:13:08 2007 @@ -8,6 +8,7 @@ import os import stat import sys +import genericpath from genericpath import * __all__ = ["normcase","isabs","join","splitdrive","split","splitext", @@ -15,7 +16,7 @@ "getatime","getctime", "islink","exists","lexists","isdir","isfile", "ismount","walk","expanduser","expandvars","normpath","abspath", "splitunc","curdir","pardir","sep","pathsep","defpath","altsep", - "extsep","devnull","realpath","supports_unicode_filenames"] + "extsep","devnull","realpath","supports_unicode_filenames","relpath"] # strings representing various path-related bits and pieces curdir = '.' @@ -182,16 +183,8 @@ # It is always true that root + ext == p. def splitext(p): - """Split the extension from a pathname. - - Extension is everything from the last dot to the end. - Return (root, ext), either part may be empty.""" - - i = p.rfind('.') - if i<=max(p.rfind('/'), p.rfind('\\')): - return p, '' - else: - return p[:i], p[i:] + return genericpath._splitext(p, sep, altsep, extsep) +splitext.__doc__ = genericpath._splitext.__doc__ # Return the tail (basename) part of a path. @@ -285,36 +278,44 @@ i, n = 1, len(path) while i < n and path[i] not in '/\\': i = i + 1 - if i == 1: - if 'HOME' in os.environ: - userhome = os.environ['HOME'] - elif not 'HOMEPATH' in os.environ: - return path - else: - try: - drive = os.environ['HOMEDRIVE'] - except KeyError: - drive = '' - userhome = join(drive, os.environ['HOMEPATH']) - else: + + if 'HOME' in os.environ: + userhome = os.environ['HOME'] + elif 'USERPROFILE' in os.environ: + userhome = os.environ['USERPROFILE'] + elif not 'HOMEPATH' in os.environ: return path + else: + try: + drive = os.environ['HOMEDRIVE'] + except KeyError: + drive = '' + userhome = join(drive, os.environ['HOMEPATH']) + + if i != 1: #~user + userhome = join(dirname(userhome), path[1:i]) + return userhome + path[i:] # Expand paths containing shell variable substitutions. # The following rules apply: # - no expansion within single quotes -# - no escape character, except for '$$' which is translated into '$' +# - '$$' is translated into '$' +# - '%%' is translated into '%' if '%%' are not seen in %var1%%var2% # - ${varname} is accepted. -# - varnames can be made out of letters, digits and the character '_' +# - $varname is accepted. +# - %varname% is accepted. +# - varnames can be made out of letters, digits and the characters '_-' +# (though is not verifed in the ${varname} and %varname% cases) # XXX With COMMAND.COM you can use any characters in a variable name, # XXX except '^|<>='. def expandvars(path): - """Expand shell variables of form $var and ${var}. + """Expand shell variables of the forms $var, ${var} and %var%. Unknown variables are left unchanged.""" - if '$' not in path: + if '$' not in path and '%' not in path: return path import string varchars = string.ascii_letters + string.digits + '_-' @@ -332,6 +333,24 @@ except ValueError: res = res + path index = pathlen - 1 + elif c == '%': # variable or '%' + if path[index + 1:index + 2] == '%': + res = res + c + index = index + 1 + else: + path = path[index+1:] + pathlen = len(path) + try: + index = path.index('%') + except ValueError: + res = res + '%' + path + index = pathlen - 1 + else: + var = path[:index] + if var in os.environ: + res = res + os.environ[var] + else: + res = res + '%' + var + '%' elif c == '$': # variable or '$$' if path[index + 1:index + 2] == '$': res = res + c @@ -446,3 +465,29 @@ # Win9x family and earlier have no Unicode filename support. supports_unicode_filenames = (hasattr(sys, "getwindowsversion") and sys.getwindowsversion()[3] >= 2) + +def relpath(path, start=curdir): + """Return a relative version of a path""" + + if not path: + raise ValueError("no path specified") + start_list = abspath(start).split(sep) + path_list = abspath(path).split(sep) + if start_list[0].lower() != path_list[0].lower(): + unc_path, rest = splitunc(path) + unc_start, rest = splitunc(start) + if bool(unc_path) ^ bool(unc_start): + raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)" + % (path, start)) + else: + raise ValueError("path is on drive %s, start on drive %s" + % (path_list[0], start_list[0])) + # Work out how much of the filepath is shared by start and path. + for i in range(min(len(start_list), len(path_list))): + if start_list[i].lower() != path_list[i].lower(): + break + else: + i += 1 + + rel_list = [pardir] * (len(start_list)-i) + path_list[i:] + return join(*rel_list) Modified: python/branches/bcannon-objcap/Lib/os.py ============================================================================== --- python/branches/bcannon-objcap/Lib/os.py (original) +++ python/branches/bcannon-objcap/Lib/os.py Fri May 25 22:13:08 2007 @@ -221,7 +221,7 @@ __all__.extend(["makedirs", "removedirs", "renames"]) -def walk(top, topdown=True, onerror=None): +def walk(top, topdown=True, onerror=None, followlinks=False): """Directory tree generator. For each directory in the directory tree rooted at top (including top @@ -257,6 +257,10 @@ to abort the walk. Note that the filename is available as the filename attribute of the exception object. + By default, os.walk does not follow symbolic links to subdirectories on + systems that support them. In order to get this functionality, set the + optional argument 'followlinks' to true. + Caution: if you pass a relative pathname for top, don't change the current working directory between resumptions of walk. walk never changes the current directory, and assumes that the client doesn't @@ -300,8 +304,8 @@ yield top, dirs, nondirs for name in dirs: path = join(top, name) - if not islink(path): - for x in walk(path, topdown, onerror): + if followlinks or not islink(path): + for x in walk(path, topdown, onerror, followlinks): yield x if not topdown: yield top, dirs, nondirs @@ -662,9 +666,15 @@ is a string it will be passed to the shell (as with os.system()). If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects (child_stdin, child_stdout) are returned.""" - import popen2 - stdout, stdin = popen2.popen2(cmd, bufsize) - return stdin, stdout + import warnings + msg = "os.popen2 is deprecated. Use the subprocess module." + warnings.warn(msg, DeprecationWarning, stacklevel=2) + + import subprocess + PIPE = subprocess.PIPE + p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, close_fds=True) + return p.stdin, p.stdout __all__.append("popen2") if not _exists("popen3"): @@ -675,9 +685,16 @@ is a string it will be passed to the shell (as with os.system()). If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects (child_stdin, child_stdout, child_stderr) are returned.""" - import popen2 - stdout, stdin, stderr = popen2.popen3(cmd, bufsize) - return stdin, stdout, stderr + import warnings + msg = "os.popen3 is deprecated. Use the subprocess module." + warnings.warn(msg, DeprecationWarning, stacklevel=2) + + import subprocess + PIPE = subprocess.PIPE + p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, stderr=PIPE, + close_fds=True) + return p.stdin, p.stdout, p.stderr __all__.append("popen3") if not _exists("popen4"): @@ -688,9 +705,16 @@ is a string it will be passed to the shell (as with os.system()). If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects (child_stdin, child_stdout_stderr) are returned.""" - import popen2 - stdout, stdin = popen2.popen4(cmd, bufsize) - return stdin, stdout + import warnings + msg = "os.popen4 is deprecated. Use the subprocess module." + warnings.warn(msg, DeprecationWarning, stacklevel=2) + + import subprocess + PIPE = subprocess.PIPE + p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, + stderr=subprocess.STDOUT, close_fds=True) + return p.stdin, p.stdout __all__.append("popen4") import copy_reg as _copy_reg Modified: python/branches/bcannon-objcap/Lib/pdb.doc ============================================================================== --- python/branches/bcannon-objcap/Lib/pdb.doc (original) +++ python/branches/bcannon-objcap/Lib/pdb.doc Fri May 25 22:13:08 2007 @@ -131,6 +131,12 @@ r(eturn) Continue execution until the current function returns. +run [args...] + Restart the debugged python program. If a string is supplied it is + splitted with "shlex", and the result is used as the new sys.argv. + History, breakpoints, actions and debugger options are preserved. + "restart" is an alias for "run". + c(ont(inue)) Continue execution, only stop when a breakpoint is encountered. Modified: python/branches/bcannon-objcap/Lib/pdb.py ============================================================================== --- python/branches/bcannon-objcap/Lib/pdb.py (original) +++ python/branches/bcannon-objcap/Lib/pdb.py Fri May 25 22:13:08 2007 @@ -13,6 +13,12 @@ import re import pprint import traceback + + +class Restart(Exception): + """Causes a debugger to be restarted for the debugged python program.""" + pass + # Create a custom safe Repr instance and increase its maxstring. # The default of 30 truncates error messages too easily. _repr = Repr() @@ -480,11 +486,16 @@ # something went wrong print >>self.stdout, \ 'Breakpoint index %r is not a number' % args[0] + return try: cond = args[1] except: cond = None - bp = bdb.Breakpoint.bpbynumber[bpnum] + try: + bp = bdb.Breakpoint.bpbynumber[bpnum] + except IndexError: + print >>self.stdout, 'Breakpoint index %r is not valid' % args[0] + return if bp: bp.cond = cond if not cond: @@ -500,11 +511,16 @@ # something went wrong print >>self.stdout, \ 'Breakpoint index %r is not a number' % args[0] + return try: count = int(args[1].strip()) except: count = 0 - bp = bdb.Breakpoint.bpbynumber[bpnum] + try: + bp = bdb.Breakpoint.bpbynumber[bpnum] + except IndexError: + print >>self.stdout, 'Breakpoint index %r is not valid' % args[0] + return if bp: bp.ignore = count if count > 0: @@ -598,6 +614,18 @@ return 1 do_n = do_next + def do_run(self, arg): + """Restart program by raising an exception to be caught in the main debugger + loop. If arguments were given, set them in sys.argv.""" + if arg: + import shlex + argv0 = sys.argv[0:1] + sys.argv = shlex.split(arg) + sys.argv[:0] = argv0 + raise Restart + + do_restart = do_run + def do_return(self, arg): self.set_return(self.curframe) return 1 @@ -1002,6 +1030,15 @@ (Pdb) global list_options; list_options = ['-l'] (Pdb)""" + def help_run(self): + print """run [args...] +Restart the debugged python program. If a string is supplied, it is +splitted with "shlex" and the result is used as the new sys.argv. +History, breakpoints, actions and debugger options are preserved. +"restart" is an alias for "run".""" + + help_restart = help_run + def help_quit(self): self.help_q() @@ -1110,11 +1147,17 @@ return None def _runscript(self, filename): - # Start with fresh empty copy of globals and locals and tell the script - # that it's being run as __main__ to avoid scripts being able to access - # the pdb.py namespace. - globals_ = {"__name__" : "__main__"} - locals_ = globals_ + # The script has to run in __main__ namespace (or imports from + # __main__ will break). + # + # So we clear up the __main__ and set several special variables + # (this gets rid of pdb's globals and cleans old variables on restarts). + import __main__ + __main__.__dict__.clear() + __main__.__dict__.update({"__name__" : "__main__", + "__file__" : filename, + "__builtins__": __builtins__, + }) # When bdb sets tracing, a number of call and line events happens # BEFORE debugger even reaches user's code (and the exact sequence of @@ -1125,7 +1168,7 @@ self.mainpyfile = self.canonic(filename) self._user_requested_quit = 0 statement = 'execfile( "%s")' % filename - self.run(statement, globals=globals_, locals=locals_) + self.run(statement) # Simplified interface @@ -1194,9 +1237,8 @@ # Note on saving/restoring sys.argv: it's a good idea when sys.argv was # modified by the script being debugged. It's a bad idea when it was - # changed by the user from the command line. The best approach would be to - # have a "restart" command which would allow explicit specification of - # command line arguments. + # changed by the user from the command line. There is a "restart" command which + # allows explicit specification of command line arguments. pdb = Pdb() while 1: try: @@ -1204,6 +1246,9 @@ if pdb._user_requested_quit: break print "The program finished and will be restarted" + except Restart: + print "Restarting", mainpyfile, "with arguments:" + print "\t" + " ".join(sys.argv[1:]) except SystemExit: # In most cases SystemExit does not warrant a post-mortem session. print "The program exited via sys.exit(). Exit status: ", @@ -1220,5 +1265,6 @@ # When invoked as main program, invoke the debugger on a script -if __name__=='__main__': - main() +if __name__ == '__main__': + import pdb + pdb.main() Deleted: /python/branches/bcannon-objcap/Lib/plat-mac/macfs.py ============================================================================== --- /python/branches/bcannon-objcap/Lib/plat-mac/macfs.py Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,198 +0,0 @@ -"""macfs - Pure Python module designed to be backward compatible with -macfs and MACFS. -""" -import sys -import struct -import Carbon.Res -import Carbon.File -import warnings - -warnings.warn("macfs is deprecated, use Carbon.File, Carbon.Folder or EasyDialogs", - DeprecationWarning, stacklevel=2) - -# First step: ensure we also emulate the MACFS module, which contained -# all the constants - -sys.modules['MACFS'] = sys.modules[__name__] - -# Import all those constants -from Carbon.Files import * -from Carbon.Folders import * - -# For some obscure historical reason these are here too: -READ = 1 -WRITE = 2 -smAllScripts = -3 - -# -# Find the epoch conversion for file dates in a way that works on OS9 and OSX -import time -if time.gmtime(0)[0] == 1970: - _EPOCHCONVERT = -((1970-1904)*365 + 17) * (24*60*60) + 0x100000000L - def _utc2time(utc): - t = utc[1] + _EPOCHCONVERT - return int(t) - def _time2utc(t): - t = int(t) - _EPOCHCONVERT - if t < -0x7fffffff: - t = t + 0x10000000L - return (0, int(t), 0) -else: - def _utc2time(utc): - t = utc[1] - if t < 0: - t = t + 0x100000000L - return t - def _time2utc(t): - if t > 0x7fffffff: - t = t - 0x100000000L - return (0, int(t), 0) - -# The old name of the error object: -error = Carbon.File.Error - -# -# The various objects macfs used to export. We override them here, because some -# of the method names are subtly different. -# -class FSSpec(Carbon.File.FSSpec): - def as_fsref(self): - return FSRef(self) - - def NewAlias(self, src=None): - return Alias(Carbon.File.NewAlias(src, self)) - - def GetCreatorType(self): - finfo = self.FSpGetFInfo() - return finfo.Creator, finfo.Type - - def SetCreatorType(self, ctor, tp): - finfo = self.FSpGetFInfo() - finfo.Creator = ctor - finfo.Type = tp - self.FSpSetFInfo(finfo) - - def GetFInfo(self): - return self.FSpGetFInfo() - - def SetFInfo(self, info): - return self.FSpSetFInfo(info) - - def GetDates(self): - catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate - catinfo, d1, d2, d3 = FSRef(self).FSGetCatalogInfo(catInfoFlags) - cdate = catinfo.createDate - mdate = catinfo.contentModDate - bdate = catinfo.backupDate - return _utc2time(cdate), _utc2time(mdate), _utc2time(bdate) - - def SetDates(self, cdate, mdate, bdate): - catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate - catinfo = Carbon.File.FSCatalogInfo( - createDate = _time2utc(cdate), - contentModDate = _time2utc(mdate), - backupDate = _time2utc(bdate)) - FSRef(self).FSSetCatalogInfo(catInfoFlags, catinfo) - -class FSRef(Carbon.File.FSRef): - def as_fsspec(self): - return FSSpec(self) - -class Alias(Carbon.File.Alias): - - def GetInfo(self, index): - return self.GetAliasInfo(index) - - def Update(self, *args): - pass # print "Alias.Update not yet implemented" - - def Resolve(self, src=None): - fss, changed = self.ResolveAlias(src) - return FSSpec(fss), changed - -from Carbon.File import FInfo - -# Backward-compatible type names: -FSSpecType = FSSpec -FSRefType = FSRef -AliasType = Alias -FInfoType = FInfo - -# Global functions: -def ResolveAliasFile(fss, chain=1): - fss, isdir, isalias = Carbon.File.ResolveAliasFile(fss, chain) - return FSSpec(fss), isdir, isalias - -def RawFSSpec(data): - return FSSpec(rawdata=data) - -def RawAlias(data): - return Alias(rawdata=data) - -def FindApplication(*args): - raise NotImplementedError, "FindApplication no longer implemented" - -def NewAliasMinimalFromFullPath(path): - return Alias(Carbon.File.NewAliasMinimalFromFullPath(path, '', '')) - -# Another global function: -from Carbon.Folder import FindFolder - -# -# Finally the old Standard File routine emulators. -# - -_curfolder = None - -def StandardGetFile(*typelist): - """Ask for an input file, optionally specifying 4-char file types that are - allowable""" - return PromptGetFile('', *typelist) - -def PromptGetFile(prompt, *typelist): - """Ask for an input file giving the user a prompt message. Optionally you can - specifying 4-char file types that are allowable""" - import EasyDialogs - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - if not typelist: - typelist = None - fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec, - typeList=typelist, defaultLocation=_handleSetFolder()) - return fss, not fss is None - -def StandardPutFile(prompt, default=None): - """Ask the user for an output file, with a prompt. Optionally you cn supply a - default output filename""" - import EasyDialogs - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt, - savedFileName=default, defaultLocation=_handleSetFolder()) - return fss, not fss is None - -def SetFolder(folder): - global _curfolder - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - if _curfolder: - rv = FSSpec(_curfolder) - else: - rv = None - _curfolder = folder - return rv - -def _handleSetFolder(): - global _curfolder - rv = _curfolder - _curfolder = None - return rv - -def GetDirectory(prompt=None): - """Ask the user to select a folder. Optionally you can give a prompt.""" - import EasyDialogs - warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen", - DeprecationWarning, stacklevel=2) - fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec, - defaultLocation=_handleSetFolder()) - return fss, not fss is None Modified: python/branches/bcannon-objcap/Lib/plat-mac/macostools.py ============================================================================== --- python/branches/bcannon-objcap/Lib/plat-mac/macostools.py (original) +++ python/branches/bcannon-objcap/Lib/plat-mac/macostools.py Fri May 25 22:13:08 2007 @@ -65,21 +65,9 @@ def touched(dst): """Tell the finder a file has changed. No-op on MacOSX.""" - if sys.platform != 'mac': return import warnings - warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) - import macfs - file_fss = macfs.FSSpec(dst) - vRefNum, dirID, name = file_fss.as_tuple() - dir_fss = macfs.FSSpec((vRefNum, dirID, '')) - crdate, moddate, bkdate = dir_fss.GetDates() - now = time.time() - if now == moddate: - now = now + 1 - try: - dir_fss.SetDates(crdate, now, bkdate) - except macfs.error: - pass + warnings.warn("macostools.touched() has been deprecated", + DeprecationWarning, 2) def touched_ae(dst): """Tell the finder a file has changed""" @@ -129,7 +117,6 @@ dstfsr = File.FSRef(dst) catinfo, _, _, _ = srcfsr.FSGetCatalogInfo(Files.kFSCatInfoAllDates) dstfsr.FSSetCatalogInfo(Files.kFSCatInfoAllDates, catinfo) - touched(dstfss) def copytree(src, dst, copydates=1): """Copy a complete file tree to a new destination""" Modified: python/branches/bcannon-objcap/Lib/plat-mac/pimp.py ============================================================================== --- python/branches/bcannon-objcap/Lib/plat-mac/pimp.py (original) +++ python/branches/bcannon-objcap/Lib/plat-mac/pimp.py Fri May 25 22:13:08 2007 @@ -14,7 +14,7 @@ """ import sys import os -import popen2 +import subprocess import urllib import urllib2 import urlparse @@ -101,10 +101,11 @@ output.write("+ %s\n" % cmd) if NO_EXECUTE: return 0 - child = popen2.Popen4(cmd) - child.tochild.close() + child = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + child.stdin.close() while 1: - line = child.fromchild.readline() + line = child.stdout.readline() if not line: break if output: Modified: python/branches/bcannon-objcap/Lib/popen2.py ============================================================================== --- python/branches/bcannon-objcap/Lib/popen2.py (original) +++ python/branches/bcannon-objcap/Lib/popen2.py Fri May 25 22:13:08 2007 @@ -8,6 +8,9 @@ import os import sys +import warnings +warnings.warn("The popen2 module is deprecated. Use the subprocess module.", + DeprecationWarning, stacklevel=2) __all__ = ["popen2", "popen3", "popen4"] @@ -200,45 +203,3 @@ return inst.fromchild, inst.tochild __all__.extend(["Popen3", "Popen4"]) - -def _test(): - # When the test runs, there shouldn't be any open pipes - _cleanup() - assert not _active, "Active pipes when test starts " + repr([c.cmd for c in _active]) - cmd = "cat" - teststr = "ab cd\n" - if os.name == "nt": - cmd = "more" - # "more" doesn't act the same way across Windows flavors, - # sometimes adding an extra newline at the start or the - # end. So we strip whitespace off both ends for comparison. - expected = teststr.strip() - print "testing popen2..." - r, w = popen2(cmd) - w.write(teststr) - w.close() - got = r.read() - if got.strip() != expected: - raise ValueError("wrote %r read %r" % (teststr, got)) - print "testing popen3..." - try: - r, w, e = popen3([cmd]) - except: - r, w, e = popen3(cmd) - w.write(teststr) - w.close() - got = r.read() - if got.strip() != expected: - raise ValueError("wrote %r read %r" % (teststr, got)) - got = e.read() - if got: - raise ValueError("unexpected %r on stderr" % (got,)) - for inst in _active[:]: - inst.wait() - _cleanup() - if _active: - raise ValueError("_active not empty") - print "All OK" - -if __name__ == '__main__': - _test() Modified: python/branches/bcannon-objcap/Lib/poplib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/poplib.py (original) +++ python/branches/bcannon-objcap/Lib/poplib.py Fri May 25 22:13:08 2007 @@ -76,24 +76,10 @@ """ - def __init__(self, host, port = POP3_PORT): + def __init__(self, host, port=POP3_PORT, timeout=None): self.host = host self.port = port - msg = "getaddrinfo returns an empty list" - self.sock = None - for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): - af, socktype, proto, canonname, sa = res - try: - self.sock = socket.socket(af, socktype, proto) - self.sock.connect(sa) - except socket.error, msg: - if self.sock: - self.sock.close() - self.sock = None - continue - break - if not self.sock: - raise socket.error, msg + self.sock = socket.create_connection((host, port), timeout) self.file = self.sock.makefile('rb') self._debugging = 0 self.welcome = self._getresp() Modified: python/branches/bcannon-objcap/Lib/posixfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/posixfile.py (original) +++ python/branches/bcannon-objcap/Lib/posixfile.py Fri May 25 22:13:08 2007 @@ -52,7 +52,9 @@ note: - the '?' modifier prevents a region from being locked; it is query only """ - +import warnings +warnings.warn("The posixfile module is deprecated; " + "fcntl.lockf() provides better locking", DeprecationWarning, 2) class _posixfile_: """File wrapper class that provides extra POSIX file routines.""" Modified: python/branches/bcannon-objcap/Lib/posixpath.py ============================================================================== --- python/branches/bcannon-objcap/Lib/posixpath.py (original) +++ python/branches/bcannon-objcap/Lib/posixpath.py Fri May 25 22:13:08 2007 @@ -12,6 +12,7 @@ import os import stat +import genericpath from genericpath import * __all__ = ["normcase","isabs","join","splitdrive","split","splitext", @@ -20,7 +21,7 @@ "ismount","walk","expanduser","expandvars","normpath","abspath", "samefile","sameopenfile","samestat", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", - "devnull","realpath","supports_unicode_filenames"] + "devnull","realpath","supports_unicode_filenames","relpath"] # strings representing various path-related bits and pieces curdir = '.' @@ -88,14 +89,8 @@ # It is always true that root + ext == p. def splitext(p): - """Split the extension from a pathname. Extension is everything from the - last dot to the end. Returns "(root, ext)", either part may be empty.""" - i = p.rfind('.') - if i<=p.rfind('/'): - return p, '' - else: - return p[:i], p[i:] - + return genericpath._splitext(p, sep, altsep, extsep) +splitext.__doc__ = genericpath._splitext.__doc__ # Split a pathname into a drive specification and the rest of the # path. Useful on DOS/Windows/NT; on Unix, the drive is always empty. @@ -387,3 +382,18 @@ return path supports_unicode_filenames = False + +def relpath(path, start=curdir): + """Return a relative version of a path""" + + if not path: + raise ValueError("no path specified") + + start_list = abspath(start).split(sep) + path_list = abspath(path).split(sep) + + # Work out how much of the filepath is shared by start and path. + i = len(commonprefix([start_list, path_list])) + + rel_list = [pardir] * (len(start_list)-i) + path_list[i:] + return join(*rel_list) Modified: python/branches/bcannon-objcap/Lib/pydoc.py ============================================================================== --- python/branches/bcannon-objcap/Lib/pydoc.py (original) +++ python/branches/bcannon-objcap/Lib/pydoc.py Fri May 25 22:13:08 2007 @@ -855,7 +855,7 @@ if imclass is not cl: note = ' from ' + self.classlink(imclass, mod) else: - if object.im_self: + if object.im_self is not None: note = ' method of %s instance' % self.classlink( object.im_self.__class__, mod) else: @@ -1226,7 +1226,7 @@ if imclass is not cl: note = ' from ' + classname(imclass, mod) else: - if object.im_self: + if object.im_self is not None: note = ' method of %s instance' % classname( object.im_self.__class__, mod) else: @@ -1461,31 +1461,35 @@ else: return thing, getattr(thing, '__name__', None) +def render_doc(thing, title='Python Library Documentation: %s', forceload=0): + """Render text documentation, given an object or a path to an object.""" + object, name = resolve(thing, forceload) + desc = describe(object) + module = inspect.getmodule(object) + if name and '.' in name: + desc += ' in ' + name[:name.rfind('.')] + elif module and module is not object: + desc += ' in module ' + module.__name__ + if type(object) is _OLD_INSTANCE_TYPE: + # If the passed object is an instance of an old-style class, + # document its available methods instead of its value. + object = object.__class__ + elif not (inspect.ismodule(object) or + inspect.isclass(object) or + inspect.isroutine(object) or + inspect.isgetsetdescriptor(object) or + inspect.ismemberdescriptor(object) or + isinstance(object, property)): + # If the passed object is a piece of data or an instance, + # document its available methods instead of its value. + object = type(object) + desc += ' object' + return title % desc + '\n\n' + text.document(object, name) + def doc(thing, title='Python Library Documentation: %s', forceload=0): """Display text documentation, given an object or a path to an object.""" try: - object, name = resolve(thing, forceload) - desc = describe(object) - module = inspect.getmodule(object) - if name and '.' in name: - desc += ' in ' + name[:name.rfind('.')] - elif module and module is not object: - desc += ' in module ' + module.__name__ - if type(object) is _OLD_INSTANCE_TYPE: - # If the passed object is an instance of an old-style class, - # document its available methods instead of its value. - object = object.__class__ - elif not (inspect.ismodule(object) or - inspect.isclass(object) or - inspect.isroutine(object) or - inspect.isgetsetdescriptor(object) or - inspect.ismemberdescriptor(object) or - isinstance(object, property)): - # If the passed object is a piece of data or an instance, - # document its available methods instead of its value. - object = type(object) - desc += ' object' - pager(title % desc + '\n\n' + text.document(object, name)) + pager(render_doc(thing, title, forceload)) except (ImportError, ErrorDuringImport), value: print value @@ -1511,6 +1515,7 @@ class Helper: keywords = { 'and': 'BOOLEAN', + 'as': 'with', 'assert': ('ref/assert', ''), 'break': ('ref/break', 'while for'), 'class': ('ref/class', 'CLASSES SPECIALMETHODS'), @@ -1538,6 +1543,7 @@ 'return': ('ref/return', 'FUNCTIONS'), 'try': ('ref/try', 'EXCEPTIONS'), 'while': ('ref/while', 'break continue if TRUTHVALUE'), + 'with': ('ref/with', 'CONTEXTMANAGERS EXCEPTIONS yield'), 'yield': ('ref/yield', ''), } @@ -1619,6 +1625,7 @@ 'LOOPING': ('ref/compound', 'for while break continue'), 'TRUTHVALUE': ('lib/truth', 'if while and or not BASICMETHODS'), 'DEBUGGING': ('lib/module-pdb', 'pdb'), + 'CONTEXTMANAGERS': ('ref/context-managers', 'with'), } def __init__(self, input, output): @@ -1627,16 +1634,21 @@ self.docdir = None execdir = os.path.dirname(sys.executable) homedir = os.environ.get('PYTHONHOME') + join = os.path.join for dir in [os.environ.get('PYTHONDOCS'), homedir and os.path.join(homedir, 'doc'), - os.path.join(execdir, 'doc'), - '/usr/doc/python-docs-' + split(sys.version)[0], - '/usr/doc/python-' + split(sys.version)[0], - '/usr/doc/python-docs-' + sys.version[:3], - '/usr/doc/python-' + sys.version[:3], - os.path.join(sys.prefix, 'Resources/English.lproj/Documentation')]: - if dir and os.path.isdir(os.path.join(dir, 'lib')): + join(execdir, 'doc'), # for Windows + join(sys.prefix, 'doc/python-docs-' + split(sys.version)[0]), + join(sys.prefix, 'doc/python-' + split(sys.version)[0]), + join(sys.prefix, 'doc/python-docs-' + sys.version[:3]), + join(sys.prefix, 'doc/python-' + sys.version[:3]), + join(sys.prefix, 'Resources/English.lproj/Documentation')]: + if dir and os.path.isdir(join(dir, 'lib')): self.docdir = dir + break + if dir and os.path.isdir(join(dir, 'html', 'lib')): + self.docdir = join(dir, 'html') + break def __repr__(self): if inspect.stack()[1][3] == '?': Modified: python/branches/bcannon-objcap/Lib/rexec.py ============================================================================== --- python/branches/bcannon-objcap/Lib/rexec.py (original) +++ python/branches/bcannon-objcap/Lib/rexec.py Fri May 25 22:13:08 2007 @@ -181,7 +181,7 @@ """ - raise RuntimeError, "This code is not secure in Python 2.2 and 2.3" + raise RuntimeError, "This code is not secure in Python 2.2 and later" ihooks._Verbose.__init__(self, verbose) # XXX There's a circular reference here: Modified: python/branches/bcannon-objcap/Lib/robotparser.py ============================================================================== --- python/branches/bcannon-objcap/Lib/robotparser.py (original) +++ python/branches/bcannon-objcap/Lib/robotparser.py Fri May 25 22:13:08 2007 @@ -65,7 +65,7 @@ lines.append(line.strip()) line = f.readline() self.errcode = opener.errcode - if self.errcode == 401 or self.errcode == 403: + if self.errcode in (401, 403): self.disallow_all = True _debug("disallow all") elif self.errcode >= 400: @@ -168,10 +168,7 @@ def __str__(self): - ret = "" - for entry in self.entries: - ret = ret + str(entry) + "\n" - return ret + return ''.join([str(entry) + "\n" for entry in self.entries]) class RuleLine: @@ -198,12 +195,12 @@ self.rulelines = [] def __str__(self): - ret = "" + ret = [] for agent in self.useragents: - ret = ret + "User-agent: "+agent+"\n" + ret.extend(["User-agent: ", agent, "\n"]) for line in self.rulelines: - ret = ret + str(line) + "\n" - return ret + ret.extend([str(line), "\n"]) + return ''.join(ret) def applies_to(self, useragent): """check if this entry applies to the specified agent""" Modified: python/branches/bcannon-objcap/Lib/sched.py ============================================================================== --- python/branches/bcannon-objcap/Lib/sched.py (original) +++ python/branches/bcannon-objcap/Lib/sched.py Fri May 25 22:13:08 2007 @@ -72,7 +72,7 @@ def empty(self): """Check whether the queue is empty.""" - return not not self.queue + return not self.queue def run(self): """Execute events until the queue is empty. Modified: python/branches/bcannon-objcap/Lib/shlex.py ============================================================================== --- python/branches/bcannon-objcap/Lib/shlex.py (original) +++ python/branches/bcannon-objcap/Lib/shlex.py Fri May 25 22:13:08 2007 @@ -271,8 +271,8 @@ raise StopIteration return token -def split(s, comments=False): - lex = shlex(s, posix=True) +def split(s, comments=False, posix=True): + lex = shlex(s, posix=posix) lex.whitespace_split = True if not comments: lex.commenters = '' Modified: python/branches/bcannon-objcap/Lib/shutil.py ============================================================================== --- python/branches/bcannon-objcap/Lib/shutil.py (original) +++ python/branches/bcannon-objcap/Lib/shutil.py Fri May 25 22:13:08 2007 @@ -60,13 +60,15 @@ os.chmod(dst, mode) def copystat(src, dst): - """Copy all stat info (mode bits, atime and mtime) from src to dst""" + """Copy all stat info (mode bits, atime, mtime, flags) from src to dst""" st = os.stat(src) mode = stat.S_IMODE(st.st_mode) if hasattr(os, 'utime'): os.utime(dst, (st.st_atime, st.st_mtime)) if hasattr(os, 'chmod'): os.chmod(dst, mode) + if hasattr(os, 'chflags') and hasattr(st, 'st_flags'): + os.chflags(dst, st.st_flags) def copy(src, dst): Modified: python/branches/bcannon-objcap/Lib/site.py ============================================================================== --- python/branches/bcannon-objcap/Lib/site.py (original) +++ python/branches/bcannon-objcap/Lib/site.py Fri May 25 22:13:08 2007 @@ -118,8 +118,10 @@ return d def addpackage(sitedir, name, known_paths): - """Add a new path to known_paths by combining sitedir and 'name' or execute - sitedir if it starts with 'import'""" + """Process a .pth file within the site-packages directory: + For each line in the file, either combine it with sitedir to a path + and add that to known_paths, or execute it if it starts with 'import '. + """ if known_paths is None: _init_pathinfo() reset = 1 @@ -134,7 +136,7 @@ for line in f: if line.startswith("#"): continue - if line.startswith("import"): + if line.startswith("import ") or line.startswith("import\t"): exec line continue line = line.rstrip() Modified: python/branches/bcannon-objcap/Lib/smtplib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/smtplib.py (original) +++ python/branches/bcannon-objcap/Lib/smtplib.py Fri May 25 22:13:08 2007 @@ -226,10 +226,11 @@ debuglevel = 0 file = None helo_resp = None + ehlo_msg = "ehlo" ehlo_resp = None does_esmtp = 0 - def __init__(self, host = '', port = 0, local_hostname = None): + def __init__(self, host='', port=0, local_hostname=None, timeout=None): """Initialize a new instance. If specified, `host' is the name of the remote host to which to @@ -240,6 +241,7 @@ the local hostname is found using socket.getfqdn(). """ + self.timeout = timeout self.esmtp_features = {} self.default_port = SMTP_PORT if host: @@ -273,12 +275,11 @@ """ self.debuglevel = debuglevel - def _get_socket(self,af, socktype, proto,sa): + def _get_socket(self, port, host, timeout): # This makes it simpler for SMTP_SSL to use the SMTP connect code # and just alter the socket connection bit. - self.sock = socket.socket(af, socktype, proto) if self.debuglevel > 0: print>>stderr, 'connect:', (host, port) - self.sock.connect(sa) + return socket.create_connection((port, host), timeout) def connect(self, host='localhost', port = 0): """Connect to a host on a given port. @@ -300,21 +301,7 @@ raise socket.error, "nonnumeric port" if not port: port = self.default_port if self.debuglevel > 0: print>>stderr, 'connect:', (host, port) - msg = "getaddrinfo returns an empty list" - self.sock = None - for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM): - af, socktype, proto, canonname, sa = res - try: - self._get_socket(af,socktype,proto,sa) - except socket.error, msg: - if self.debuglevel > 0: print>>stderr, 'connect fail:', msg - if self.sock: - self.sock.close() - self.sock = None - continue - break - if not self.sock: - raise socket.error, msg + self.sock = self._get_socket(host, port, self.timeout) (code, msg) = self.getreply() if self.debuglevel > 0: print>>stderr, "connect:", msg return (code, msg) @@ -401,7 +388,7 @@ host. """ self.esmtp_features = {} - self.putcmd("ehlo", name or self.local_hostname) + self.putcmd(self.ehlo_msg, name or self.local_hostname) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MTA's will disconnect on an ehlo. Toss an exception if @@ -731,21 +718,64 @@ are also optional - they can contain a PEM formatted private key and certificate chain file for the SSL connection. """ - def __init__(self, host = '', port = 0, local_hostname = None, - keyfile = None, certfile = None): + def __init__(self, host='', port=0, local_hostname=None, + keyfile=None, certfile=None, timeout=None): self.keyfile = keyfile self.certfile = certfile - SMTP.__init__(self,host,port,local_hostname) + SMTP.__init__(self, host, port, local_hostname, timeout) self.default_port = SMTP_SSL_PORT - def _get_socket(self,af, socktype, proto,sa): - self.sock = socket.socket(af, socktype, proto) + def _get_socket(self, host, port, timeout): if self.debuglevel > 0: print>>stderr, 'connect:', (host, port) - self.sock.connect(sa) + self.sock = socket.create_connection((host, port), timeout) sslobj = socket.ssl(self.sock, self.keyfile, self.certfile) self.sock = SSLFakeSocket(self.sock, sslobj) self.file = SSLFakeFile(sslobj) +# +# LMTP extension +# +LMTP_PORT = 2003 + +class LMTP(SMTP): + """LMTP - Local Mail Transfer Protocol + + The LMTP protocol, which is very similar to ESMTP, is heavily based + on the standard SMTP client. It's common to use Unix sockets for LMTP, + so our connect() method must support that as well as a regular + host:port server. To specify a Unix socket, you must use an absolute + path as the host, starting with a '/'. + + Authentication is supported, using the regular SMTP mechanism. When + using a Unix socket, LMTP generally don't support or require any + authentication, but your mileage might vary.""" + + ehlo_msg = "lhlo" + + def __init__(self, host = '', port = LMTP_PORT, local_hostname = None): + """Initialize a new instance.""" + SMTP.__init__(self, host, port, local_hostname) + + def connect(self, host = 'localhost', port = 0): + """Connect to the LMTP daemon, on either a Unix or a TCP socket.""" + if host[0] != '/': + return SMTP.connect(self, host, port) + + # Handle Unix-domain sockets. + try: + self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + self.sock.connect(host) + except socket.error, msg: + if self.debuglevel > 0: print>>stderr, 'connect fail:', host + if self.sock: + self.sock.close() + self.sock = None + raise socket.error, msg + (code, msg) = self.getreply() + if self.debuglevel > 0: print>>stderr, "connect:", msg + return (code, msg) + + # Test the sendmail method, which tests most of the others. # Note: This always sends to localhost. if __name__ == '__main__': Modified: python/branches/bcannon-objcap/Lib/socket.py ============================================================================== --- python/branches/bcannon-objcap/Lib/socket.py (original) +++ python/branches/bcannon-objcap/Lib/socket.py Fri May 25 22:13:08 2007 @@ -24,6 +24,7 @@ ssl() -- secure socket layer support (only available if configured) socket.getdefaulttimeout() -- get the default timeout value socket.setdefaulttimeout() -- set the default timeout value +create_connection() -- connects to an address, with an optional timeout [*] not available on all platforms! @@ -139,8 +140,6 @@ __slots__ = [] def _dummy(*args): raise error(EBADF, 'Bad file descriptor') - def close(self): - pass # All _delegate_methods must also be initialized here. send = recv = recv_into = sendto = recvfrom = recvfrom_into = _dummy __getattr__ = _dummy @@ -159,7 +158,6 @@ setattr(self, method, getattr(_sock, method)) def close(self): - self._sock.close() self._sock = _closedsocket() dummy = self._sock._dummy for method in _delegate_methods: @@ -415,3 +413,31 @@ if not line: raise StopIteration return line + + +def create_connection(address, timeout=None): + """Connect to address (host, port) with an optional timeout. + + Provides access to socketobject timeout for higher-level + protocols. Passing a timeout will set the timeout on the + socket instance (if not present, or passed as None, the + default global timeout setting will be used). + """ + + msg = "getaddrinfo returns an empty list" + host, port = address + for res in getaddrinfo(host, port, 0, SOCK_STREAM): + af, socktype, proto, canonname, sa = res + sock = None + try: + sock = socket(af, socktype, proto) + if timeout is not None: + sock.settimeout(timeout) + sock.connect(sa) + return sock + + except error, msg: + if sock is not None: + sock.close() + + raise error, msg Modified: python/branches/bcannon-objcap/Lib/sre.py ============================================================================== --- python/branches/bcannon-objcap/Lib/sre.py (original) +++ python/branches/bcannon-objcap/Lib/sre.py Fri May 25 22:13:08 2007 @@ -8,3 +8,6 @@ from re import * from re import __all__ + +# old pickles expect the _compile() reconstructor in this module +from re import _compile Modified: python/branches/bcannon-objcap/Lib/stat.py ============================================================================== --- python/branches/bcannon-objcap/Lib/stat.py (original) +++ python/branches/bcannon-objcap/Lib/stat.py Fri May 25 22:13:08 2007 @@ -84,3 +84,16 @@ S_IROTH = 00004 S_IWOTH = 00002 S_IXOTH = 00001 + +# Names for file flags + +UF_NODUMP = 0x00000001 +UF_IMMUTABLE = 0x00000002 +UF_APPEND = 0x00000004 +UF_OPAQUE = 0x00000008 +UF_NOUNLINK = 0x00000010 +SF_ARCHIVED = 0x00010000 +SF_IMMUTABLE = 0x00020000 +SF_APPEND = 0x00040000 +SF_NOUNLINK = 0x00100000 +SF_SNAPSHOT = 0x00200000 Modified: python/branches/bcannon-objcap/Lib/string.py ============================================================================== --- python/branches/bcannon-objcap/Lib/string.py (original) +++ python/branches/bcannon-objcap/Lib/string.py Fri May 25 22:13:08 2007 @@ -487,7 +487,7 @@ deletions argument is not allowed for Unicode strings. """ - if deletions: + if deletions or table is None: return s.translate(table, deletions) else: # Add s[:0] so that if s is Unicode and table is an 8-bit string, Modified: python/branches/bcannon-objcap/Lib/subprocess.py ============================================================================== --- python/branches/bcannon-objcap/Lib/subprocess.py (original) +++ python/branches/bcannon-objcap/Lib/subprocess.py Fri May 25 22:13:08 2007 @@ -340,7 +340,7 @@ stdin=PIPE, stdout=PIPE, close_fds=True) (child_stdout, child_stdin) = (p.stdout, p.stdin) -The popen2.Popen3 and popen3.Popen4 basically works as subprocess.Popen, +The popen2.Popen3 and popen2.Popen4 basically works as subprocess.Popen, except that: * subprocess.Popen raises an exception if the execution fails @@ -348,8 +348,6 @@ * stdin=PIPE and stdout=PIPE must be specified. * popen2 closes all filedescriptors by default, but you have to specify close_fds=True with subprocess.Popen. - - """ import sys @@ -592,14 +590,30 @@ c2pread, c2pwrite, errread, errwrite) - if p2cwrite: + # On Windows, you cannot just redirect one or two handles: You + # either have to redirect all three or none. If the subprocess + # user has only redirected one or two handles, we are + # automatically creating PIPEs for the rest. We should close + # these after the process is started. See bug #1124861. + if mswindows: + if stdin is None and p2cwrite is not None: + os.close(p2cwrite) + p2cwrite = None + if stdout is None and c2pread is not None: + os.close(c2pread) + c2pread = None + if stderr is None and errread is not None: + os.close(errread) + errread = None + + if p2cwrite is not None: self.stdin = os.fdopen(p2cwrite, 'wb', bufsize) - if c2pread: + if c2pread is not None: if universal_newlines: self.stdout = os.fdopen(c2pread, 'rU', bufsize) else: self.stdout = os.fdopen(c2pread, 'rb', bufsize) - if errread: + if errread is not None: if universal_newlines: self.stderr = os.fdopen(errread, 'rU', bufsize) else: @@ -612,7 +626,7 @@ return data - def __del__(self): + def __del__(self, sys=sys): if not self._child_created: # We didn't get to successfully create a child process. return @@ -668,7 +682,9 @@ if stdin is None: p2cread = GetStdHandle(STD_INPUT_HANDLE) - elif stdin == PIPE: + if p2cread is not None: + pass + elif stdin is None or stdin == PIPE: p2cread, p2cwrite = CreatePipe(None, 0) # Detach and turn into fd p2cwrite = p2cwrite.Detach() @@ -682,7 +698,9 @@ if stdout is None: c2pwrite = GetStdHandle(STD_OUTPUT_HANDLE) - elif stdout == PIPE: + if c2pwrite is not None: + pass + elif stdout is None or stdout == PIPE: c2pread, c2pwrite = CreatePipe(None, 0) # Detach and turn into fd c2pread = c2pread.Detach() @@ -696,7 +714,9 @@ if stderr is None: errwrite = GetStdHandle(STD_ERROR_HANDLE) - elif stderr == PIPE: + if errwrite is not None: + pass + elif stderr is None or stderr == PIPE: errread, errwrite = CreatePipe(None, 0) # Detach and turn into fd errread = errread.Detach() @@ -986,29 +1006,29 @@ # Child try: # Close parent's pipe ends - if p2cwrite: + if p2cwrite is not None: os.close(p2cwrite) - if c2pread: + if c2pread is not None: os.close(c2pread) - if errread: + if errread is not None: os.close(errread) os.close(errpipe_read) # Dup fds for child - if p2cread: + if p2cread is not None: os.dup2(p2cread, 0) - if c2pwrite: + if c2pwrite is not None: os.dup2(c2pwrite, 1) - if errwrite: + if errwrite is not None: os.dup2(errwrite, 2) # Close pipe fds. Make sure we don't close the same # fd more than once, or standard fds. - if p2cread and p2cread not in (0,): + if p2cread is not None and p2cread not in (0,): os.close(p2cread) - if c2pwrite and c2pwrite not in (p2cread, 1): + if c2pwrite is not None and c2pwrite not in (p2cread, 1): os.close(c2pwrite) - if errwrite and errwrite not in (p2cread, c2pwrite, 2): + if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2): os.close(errwrite) # Close all other fds, if asked for @@ -1041,11 +1061,11 @@ # Parent os.close(errpipe_write) - if p2cread and p2cwrite: + if p2cread is not None and p2cwrite is not None: os.close(p2cread) - if c2pwrite and c2pread: + if c2pwrite is not None and c2pread is not None: os.close(c2pwrite) - if errwrite and errread: + if errwrite is not None and errread is not None: os.close(errwrite) # Wait for exec to fail or succeed; possibly raising exception Modified: python/branches/bcannon-objcap/Lib/tarfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/tarfile.py (original) +++ python/branches/bcannon-objcap/Lib/tarfile.py Fri May 25 22:13:08 2007 @@ -33,7 +33,7 @@ __version__ = "$Revision$" # $Source$ -version = "0.8.0" +version = "0.9.0" __author__ = "Lars Gust?bel (lars at gustaebel.de)" __date__ = "$Date$" __cvsid__ = "$Id$" @@ -50,6 +50,9 @@ import time import struct import copy +import re + +builtin_open = open if sys.platform == 'mac': # This module needs work for MacOS9, especially in the area of pathname @@ -66,47 +69,63 @@ # from tarfile import * __all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError"] -from __builtin__ import open as _open # Since 'open' is TarFile.open - #--------------------------------------------------------- # tar constants #--------------------------------------------------------- -NUL = "\0" # the null character -BLOCKSIZE = 512 # length of processing blocks +NUL = "\0" # the null character +BLOCKSIZE = 512 # length of processing blocks RECORDSIZE = BLOCKSIZE * 20 # length of records -MAGIC = "ustar" # magic tar string -VERSION = "00" # version number +GNU_MAGIC = "ustar \0" # magic gnu tar string +POSIX_MAGIC = "ustar\x0000" # magic posix tar string -LENGTH_NAME = 100 # maximum length of a filename -LENGTH_LINK = 100 # maximum length of a linkname -LENGTH_PREFIX = 155 # maximum length of the prefix field -MAXSIZE_MEMBER = 077777777777L # maximum size of a file (11 octal digits) +LENGTH_NAME = 100 # maximum length of a filename +LENGTH_LINK = 100 # maximum length of a linkname +LENGTH_PREFIX = 155 # maximum length of the prefix field -REGTYPE = "0" # regular file +REGTYPE = "0" # regular file AREGTYPE = "\0" # regular file -LNKTYPE = "1" # link (inside tarfile) -SYMTYPE = "2" # symbolic link -CHRTYPE = "3" # character special device -BLKTYPE = "4" # block special device -DIRTYPE = "5" # directory +LNKTYPE = "1" # link (inside tarfile) +SYMTYPE = "2" # symbolic link +CHRTYPE = "3" # character special device +BLKTYPE = "4" # block special device +DIRTYPE = "5" # directory FIFOTYPE = "6" # fifo special device CONTTYPE = "7" # contiguous file -GNUTYPE_LONGNAME = "L" # GNU tar extension for longnames -GNUTYPE_LONGLINK = "K" # GNU tar extension for longlink -GNUTYPE_SPARSE = "S" # GNU tar extension for sparse file +GNUTYPE_LONGNAME = "L" # GNU tar longname +GNUTYPE_LONGLINK = "K" # GNU tar longlink +GNUTYPE_SPARSE = "S" # GNU tar sparse file + +XHDTYPE = "x" # POSIX.1-2001 extended header +XGLTYPE = "g" # POSIX.1-2001 global header +SOLARIS_XHDTYPE = "X" # Solaris extended header + +USTAR_FORMAT = 0 # POSIX.1-1988 (ustar) format +GNU_FORMAT = 1 # GNU tar format +PAX_FORMAT = 2 # POSIX.1-2001 (pax) format +DEFAULT_FORMAT = GNU_FORMAT #--------------------------------------------------------- # tarfile constants #--------------------------------------------------------- -SUPPORTED_TYPES = (REGTYPE, AREGTYPE, LNKTYPE, # file types that tarfile - SYMTYPE, DIRTYPE, FIFOTYPE, # can cope with. +# File types that tarfile supports: +SUPPORTED_TYPES = (REGTYPE, AREGTYPE, LNKTYPE, + SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_LONGNAME, GNUTYPE_LONGLINK, GNUTYPE_SPARSE) -REGULAR_TYPES = (REGTYPE, AREGTYPE, # file types that somehow - CONTTYPE, GNUTYPE_SPARSE) # represent regular files +# File types that will be treated as a regular file. +REGULAR_TYPES = (REGTYPE, AREGTYPE, + CONTTYPE, GNUTYPE_SPARSE) + +# File types that are part of the GNU tar format. +GNU_TYPES = (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK, + GNUTYPE_SPARSE) + +# Fields from a pax header that override a TarInfo attribute. +PAX_FIELDS = ("path", "linkpath", "size", "mtime", + "uid", "gid", "uname", "gname") #--------------------------------------------------------- # Bits used in the mode field, values in octal. @@ -133,6 +152,13 @@ TOEXEC = 0001 # execute/search by other #--------------------------------------------------------- +# initialization +#--------------------------------------------------------- +ENCODING = sys.getfilesystemencoding() +if ENCODING is None: + ENCODING = "ascii" + +#--------------------------------------------------------- # Some useful functions #--------------------------------------------------------- @@ -141,6 +167,15 @@ """ return s[:length] + (length - len(s)) * NUL +def nts(s): + """Convert a null-terminated string field to a python string. + """ + # Use the string up to the first null char. + p = s.find("\0") + if p == -1: + return s + return s[:p] + def nti(s): """Convert a number field to a python number. """ @@ -148,7 +183,7 @@ # itn() below. if s[0] != chr(0200): try: - n = int(s.rstrip(NUL + " ") or "0", 8) + n = int(nts(s) or "0", 8) except ValueError: raise HeaderError("invalid header") else: @@ -158,7 +193,7 @@ n += ord(s[i + 1]) return n -def itn(n, digits=8, posix=False): +def itn(n, digits=8, format=DEFAULT_FORMAT): """Convert a python number to a number field. """ # POSIX 1003.1-1988 requires numbers to be encoded as a string of @@ -170,7 +205,7 @@ if 0 <= n < 8 ** (digits - 1): s = "%0*o" % (digits - 1, n) + NUL else: - if posix: + if format != GNU_FORMAT or n >= 256 ** (digits - 1): raise ValueError("overflow in number field") if n < 0: @@ -516,7 +551,10 @@ buf = self.__read(self.bufsize) if not buf: break - buf = self.cmp.decompress(buf) + try: + buf = self.cmp.decompress(buf) + except IOError: + raise ReadError("invalid compressed data") t.append(buf) c += len(buf) t = "".join(t) @@ -577,6 +615,7 @@ def __init__(self, fileobj, mode): self.fileobj = fileobj self.mode = mode + self.name = getattr(self.fileobj, "name", None) self.init() def init(self): @@ -849,8 +888,8 @@ """Construct a TarInfo object. name is the optional name of the member. """ - self.name = name # member name (dirnames must end with '/') - self.mode = 0666 # file permissions + self.name = name # member name + self.mode = 0644 # file permissions self.uid = 0 # user id self.gid = 0 # group id self.size = 0 # file size @@ -858,17 +897,274 @@ self.chksum = 0 # header checksum self.type = REGTYPE # member type self.linkname = "" # link name - self.uname = "user" # user name - self.gname = "group" # group name + self.uname = "root" # user name + self.gname = "root" # group name self.devmajor = 0 # device major number self.devminor = 0 # device minor number self.offset = 0 # the tar header starts here self.offset_data = 0 # the file's data starts here + self.pax_headers = {} # pax header information + + # In pax headers the "name" and "linkname" field are called + # "path" and "linkpath". + def _getpath(self): + return self.name + def _setpath(self, name): + self.name = name + path = property(_getpath, _setpath) + + def _getlinkpath(self): + return self.linkname + def _setlinkpath(self, linkname): + self.linkname = linkname + linkpath = property(_getlinkpath, _setlinkpath) + def __repr__(self): return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self)) + def get_info(self): + """Return the TarInfo's attributes as a dictionary. + """ + info = { + "name": normpath(self.name), + "mode": self.mode & 07777, + "uid": self.uid, + "gid": self.gid, + "size": self.size, + "mtime": self.mtime, + "chksum": self.chksum, + "type": self.type, + "linkname": normpath(self.linkname) if self.linkname else "", + "uname": self.uname, + "gname": self.gname, + "devmajor": self.devmajor, + "devminor": self.devminor + } + + if info["type"] == DIRTYPE and not info["name"].endswith("/"): + info["name"] += "/" + + return info + + def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING): + """Return a tar header as a string of 512 byte blocks. + """ + if format == USTAR_FORMAT: + return self.create_ustar_header() + elif format == GNU_FORMAT: + return self.create_gnu_header() + elif format == PAX_FORMAT: + return self.create_pax_header(encoding) + else: + raise ValueError("invalid format") + + def create_ustar_header(self): + """Return the object as a ustar header block. + """ + info = self.get_info() + info["magic"] = POSIX_MAGIC + + if len(info["linkname"]) > LENGTH_LINK: + raise ValueError("linkname is too long") + + if len(info["name"]) > LENGTH_NAME: + info["prefix"], info["name"] = self._posix_split_name(info["name"]) + + return self._create_header(info, USTAR_FORMAT) + + def create_gnu_header(self): + """Return the object as a GNU header block sequence. + """ + info = self.get_info() + info["magic"] = GNU_MAGIC + + buf = "" + if len(info["linkname"]) > LENGTH_LINK: + buf += self._create_gnu_long_header(info["linkname"], GNUTYPE_LONGLINK) + + if len(info["name"]) > LENGTH_NAME: + buf += self._create_gnu_long_header(info["name"], GNUTYPE_LONGNAME) + + return buf + self._create_header(info, GNU_FORMAT) + + def create_pax_header(self, encoding): + """Return the object as a ustar header block. If it cannot be + represented this way, prepend a pax extended header sequence + with supplement information. + """ + info = self.get_info() + info["magic"] = POSIX_MAGIC + pax_headers = self.pax_headers.copy() + + # Test string fields for values that exceed the field length or cannot + # be represented in ASCII encoding. + for name, hname, length in ( + ("name", "path", LENGTH_NAME), ("linkname", "linkpath", LENGTH_LINK), + ("uname", "uname", 32), ("gname", "gname", 32)): + + val = info[name].decode(encoding) + + # Try to encode the string as ASCII. + try: + val.encode("ascii") + except UnicodeEncodeError: + pax_headers[hname] = val + continue + + if len(val) > length: + if name == "name": + # Try to squeeze a longname in the prefix and name fields as in + # ustar format. + try: + info["prefix"], info["name"] = self._posix_split_name(info["name"]) + except ValueError: + pax_headers[hname] = val + else: + continue + else: + pax_headers[hname] = val + + # Test number fields for values that exceed the field limit or values + # that like to be stored as float. + for name, digits in (("uid", 8), ("gid", 8), ("size", 12), ("mtime", 12)): + val = info[name] + if not 0 <= val < 8 ** (digits - 1) or isinstance(val, float): + pax_headers[name] = unicode(val) + info[name] = 0 + + if pax_headers: + buf = self._create_pax_generic_header(pax_headers) + else: + buf = "" + + return buf + self._create_header(info, USTAR_FORMAT) + + @classmethod + def create_pax_global_header(cls, pax_headers, encoding): + """Return the object as a pax global header block sequence. + """ + new_headers = {} + for key, val in pax_headers.iteritems(): + key = cls._to_unicode(key, encoding) + val = cls._to_unicode(val, encoding) + new_headers[key] = val + return cls._create_pax_generic_header(new_headers, type=XGLTYPE) + + @staticmethod + def _to_unicode(value, encoding): + if isinstance(value, unicode): + return value + elif isinstance(value, (int, long, float)): + return unicode(value) + elif isinstance(value, str): + return unicode(value, encoding) + else: + raise ValueError("unable to convert to unicode: %r" % value) + + def _posix_split_name(self, name): + """Split a name longer than 100 chars into a prefix + and a name part. + """ + prefix = name[:LENGTH_PREFIX + 1] + while prefix and prefix[-1] != "/": + prefix = prefix[:-1] + + name = name[len(prefix):] + prefix = prefix[:-1] + + if not prefix or len(name) > LENGTH_NAME: + raise ValueError("name is too long") + return prefix, name + + @staticmethod + def _create_header(info, format): + """Return a header block. info is a dictionary with file + information, format must be one of the *_FORMAT constants. + """ + parts = [ + stn(info.get("name", ""), 100), + itn(info.get("mode", 0) & 07777, 8, format), + itn(info.get("uid", 0), 8, format), + itn(info.get("gid", 0), 8, format), + itn(info.get("size", 0), 12, format), + itn(info.get("mtime", 0), 12, format), + " ", # checksum field + info.get("type", REGTYPE), + stn(info.get("linkname", ""), 100), + stn(info.get("magic", ""), 8), + stn(info.get("uname", ""), 32), + stn(info.get("gname", ""), 32), + itn(info.get("devmajor", 0), 8, format), + itn(info.get("devminor", 0), 8, format), + stn(info.get("prefix", ""), 155) + ] + + buf = struct.pack("%ds" % BLOCKSIZE, "".join(parts)) + chksum = calc_chksums(buf[-BLOCKSIZE:])[0] + buf = buf[:-364] + "%06o\0" % chksum + buf[-357:] + return buf + + @staticmethod + def _create_payload(payload): + """Return the string payload filled with zero bytes + up to the next 512 byte border. + """ + blocks, remainder = divmod(len(payload), BLOCKSIZE) + if remainder > 0: + payload += (BLOCKSIZE - remainder) * NUL + return payload + + @classmethod + def _create_gnu_long_header(cls, name, type): + """Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence + for name. + """ + name += NUL + + info = {} + info["name"] = "././@LongLink" + info["type"] = type + info["size"] = len(name) + info["magic"] = GNU_MAGIC + + # create extended header + name blocks. + return cls._create_header(info, USTAR_FORMAT) + \ + cls._create_payload(name) + + @classmethod + def _create_pax_generic_header(cls, pax_headers, type=XHDTYPE): + """Return a POSIX.1-2001 extended or global header sequence + that contains a list of keyword, value pairs. The values + must be unicode objects. + """ + records = [] + for keyword, value in pax_headers.iteritems(): + keyword = keyword.encode("utf8") + value = value.encode("utf8") + l = len(keyword) + len(value) + 3 # ' ' + '=' + '\n' + n = p = 0 + while True: + n = l + len(str(p)) + if n == p: + break + p = n + records.append("%d %s=%s\n" % (p, keyword, value)) + records = "".join(records) + + # We use a hardcoded "././@PaxHeader" name like star does + # instead of the one that POSIX recommends. + info = {} + info["name"] = "././@PaxHeader" + info["type"] = type + info["size"] = len(records) + info["magic"] = POSIX_MAGIC + + # Create pax header + record blocks. + return cls._create_header(info, USTAR_FORMAT) + \ + cls._create_payload(records) + @classmethod def frombuf(cls, buf): """Construct a TarInfo object from a 512 byte string buffer. @@ -882,125 +1178,251 @@ if chksum not in calc_chksums(buf): raise HeaderError("bad checksum") - tarinfo = cls() - tarinfo.buf = buf - tarinfo.name = buf[0:100].rstrip(NUL) - tarinfo.mode = nti(buf[100:108]) - tarinfo.uid = nti(buf[108:116]) - tarinfo.gid = nti(buf[116:124]) - tarinfo.size = nti(buf[124:136]) - tarinfo.mtime = nti(buf[136:148]) - tarinfo.chksum = chksum - tarinfo.type = buf[156:157] - tarinfo.linkname = buf[157:257].rstrip(NUL) - tarinfo.uname = buf[265:297].rstrip(NUL) - tarinfo.gname = buf[297:329].rstrip(NUL) - tarinfo.devmajor = nti(buf[329:337]) - tarinfo.devminor = nti(buf[337:345]) - prefix = buf[345:500].rstrip(NUL) + obj = cls() + obj.buf = buf + obj.name = nts(buf[0:100]) + obj.mode = nti(buf[100:108]) + obj.uid = nti(buf[108:116]) + obj.gid = nti(buf[116:124]) + obj.size = nti(buf[124:136]) + obj.mtime = nti(buf[136:148]) + obj.chksum = chksum + obj.type = buf[156:157] + obj.linkname = nts(buf[157:257]) + obj.uname = nts(buf[265:297]) + obj.gname = nts(buf[297:329]) + obj.devmajor = nti(buf[329:337]) + obj.devminor = nti(buf[337:345]) + prefix = nts(buf[345:500]) - if prefix and not tarinfo.issparse(): - tarinfo.name = prefix + "/" + tarinfo.name + # Old V7 tar format represents a directory as a regular + # file with a trailing slash. + if obj.type == AREGTYPE and obj.name.endswith("/"): + obj.type = DIRTYPE - return tarinfo + # Remove redundant slashes from directories. + if obj.isdir(): + obj.name = obj.name.rstrip("/") + + # Reconstruct a ustar longname. + if prefix and obj.type not in GNU_TYPES: + obj.name = prefix + "/" + obj.name + return obj - def tobuf(self, posix=False): - """Return a tar header as a string of 512 byte blocks. + @classmethod + def fromtarfile(cls, tarfile): + """Return the next TarInfo object from TarFile object + tarfile. """ - buf = "" - type = self.type - prefix = "" + buf = tarfile.fileobj.read(BLOCKSIZE) + if not buf: + return + obj = cls.frombuf(buf) + obj.offset = tarfile.fileobj.tell() - BLOCKSIZE + return obj._proc_member(tarfile) - if self.name.endswith("/"): - type = DIRTYPE + #-------------------------------------------------------------------------- + # The following are methods that are called depending on the type of a + # member. The entry point is _proc_member() which can be overridden in a + # subclass to add custom _proc_*() methods. A _proc_*() method MUST + # implement the following + # operations: + # 1. Set self.offset_data to the position where the data blocks begin, + # if there is data that follows. + # 2. Set tarfile.offset to the position where the next member's header will + # begin. + # 3. Return self or another valid TarInfo object. + def _proc_member(self, tarfile): + """Choose the right processing method depending on + the type and call it. + """ + if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK): + return self._proc_gnulong(tarfile) + elif self.type == GNUTYPE_SPARSE: + return self._proc_sparse(tarfile) + elif self.type in (XHDTYPE, XGLTYPE, SOLARIS_XHDTYPE): + return self._proc_pax(tarfile) + else: + return self._proc_builtin(tarfile) + + def _proc_builtin(self, tarfile): + """Process a builtin type or an unknown type which + will be treated as a regular file. + """ + self.offset_data = tarfile.fileobj.tell() + offset = self.offset_data + if self.isreg() or self.type not in SUPPORTED_TYPES: + # Skip the following data blocks. + offset += self._block(self.size) + tarfile.offset = offset - if type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK): - # Prevent "././@LongLink" from being normalized. - name = self.name - else: - name = normpath(self.name) + # Patch the TarInfo object with saved extended + # header information. + for keyword, value in tarfile.pax_headers.iteritems(): + if keyword in PAX_FIELDS: + setattr(self, keyword, value) + self.pax_headers[keyword] = value - if type == DIRTYPE: - # directories should end with '/' - name += "/" + return self - linkname = self.linkname - if linkname: - # if linkname is empty we end up with a '.' - linkname = normpath(linkname) + def _proc_gnulong(self, tarfile): + """Process the blocks that hold a GNU longname + or longlink member. + """ + buf = tarfile.fileobj.read(self._block(self.size)) - if posix: - if self.size > MAXSIZE_MEMBER: - raise ValueError("file is too large (>= 8 GB)") + # Fetch the next header and process it. + b = tarfile.fileobj.read(BLOCKSIZE) + t = self.frombuf(b) + t.offset = self.offset + next = t._proc_member(tarfile) - if len(self.linkname) > LENGTH_LINK: - raise ValueError("linkname is too long (>%d)" % (LENGTH_LINK)) + # Patch the TarInfo object from the next header with + # the longname information. + next.offset = self.offset + if self.type == GNUTYPE_LONGNAME: + next.name = buf.rstrip(NUL) + elif self.type == GNUTYPE_LONGLINK: + next.linkname = buf.rstrip(NUL) - if len(name) > LENGTH_NAME: - prefix = name[:LENGTH_PREFIX + 1] - while prefix and prefix[-1] != "/": - prefix = prefix[:-1] + return next - name = name[len(prefix):] - prefix = prefix[:-1] + def _proc_sparse(self, tarfile): + """Process a GNU sparse header plus extra headers. + """ + buf = self.buf + sp = _ringbuffer() + pos = 386 + lastpos = 0L + realpos = 0L + # There are 4 possible sparse structs in the + # first header. + for i in xrange(4): + try: + offset = nti(buf[pos:pos + 12]) + numbytes = nti(buf[pos + 12:pos + 24]) + except ValueError: + break + if offset > lastpos: + sp.append(_hole(lastpos, offset - lastpos)) + sp.append(_data(offset, numbytes, realpos)) + realpos += numbytes + lastpos = offset + numbytes + pos += 24 - if not prefix or len(name) > LENGTH_NAME: - raise ValueError("name is too long") + isextended = ord(buf[482]) + origsize = nti(buf[483:495]) - else: - if len(self.linkname) > LENGTH_LINK: - buf += self._create_gnulong(self.linkname, GNUTYPE_LONGLINK) + # If the isextended flag is given, + # there are extra headers to process. + while isextended == 1: + buf = tarfile.fileobj.read(BLOCKSIZE) + pos = 0 + for i in xrange(21): + try: + offset = nti(buf[pos:pos + 12]) + numbytes = nti(buf[pos + 12:pos + 24]) + except ValueError: + break + if offset > lastpos: + sp.append(_hole(lastpos, offset - lastpos)) + sp.append(_data(offset, numbytes, realpos)) + realpos += numbytes + lastpos = offset + numbytes + pos += 24 + isextended = ord(buf[504]) - if len(name) > LENGTH_NAME: - buf += self._create_gnulong(name, GNUTYPE_LONGNAME) + if lastpos < origsize: + sp.append(_hole(lastpos, origsize - lastpos)) - parts = [ - stn(name, 100), - itn(self.mode & 07777, 8, posix), - itn(self.uid, 8, posix), - itn(self.gid, 8, posix), - itn(self.size, 12, posix), - itn(self.mtime, 12, posix), - " ", # checksum field - type, - stn(self.linkname, 100), - stn(MAGIC, 6), - stn(VERSION, 2), - stn(self.uname, 32), - stn(self.gname, 32), - itn(self.devmajor, 8, posix), - itn(self.devminor, 8, posix), - stn(prefix, 155) - ] + self.sparse = sp - buf += struct.pack("%ds" % BLOCKSIZE, "".join(parts)) - chksum = calc_chksums(buf[-BLOCKSIZE:])[0] - buf = buf[:-364] + "%06o\0" % chksum + buf[-357:] - self.buf = buf - return buf + self.offset_data = tarfile.fileobj.tell() + tarfile.offset = self.offset_data + self._block(self.size) + self.size = origsize - def _create_gnulong(self, name, type): - """Create a GNU longname/longlink header from name. - It consists of an extended tar header, with the length - of the longname as size, followed by data blocks, - which contain the longname as a null terminated string. - """ - name += NUL + return self - tarinfo = self.__class__() - tarinfo.name = "././@LongLink" - tarinfo.type = type - tarinfo.mode = 0 - tarinfo.size = len(name) + def _proc_pax(self, tarfile): + """Process an extended or global header as described in + POSIX.1-2001. + """ + # Read the header information. + buf = tarfile.fileobj.read(self._block(self.size)) + + # A pax header stores supplemental information for either + # the following file (extended) or all following files + # (global). + if self.type == XGLTYPE: + pax_headers = tarfile.pax_headers + else: + pax_headers = tarfile.pax_headers.copy() + + # Fields in POSIX.1-2001 that are numbers, all other fields + # are treated as UTF-8 strings. + type_mapping = { + "atime": float, + "ctime": float, + "mtime": float, + "uid": int, + "gid": int, + "size": int + } + + # Parse pax header information. A record looks like that: + # "%d %s=%s\n" % (length, keyword, value). length is the size + # of the complete record including the length field itself and + # the newline. + regex = re.compile(r"(\d+) ([^=]+)=", re.U) + pos = 0 + while True: + match = regex.match(buf, pos) + if not match: + break - # create extended header - buf = tarinfo.tobuf() - # create name blocks - buf += name - blocks, remainder = divmod(len(name), BLOCKSIZE) - if remainder > 0: - buf += (BLOCKSIZE - remainder) * NUL - return buf + length, keyword = match.groups() + length = int(length) + value = buf[match.end(2) + 1:match.start(1) + length - 1] + + keyword = keyword.decode("utf8") + keyword = keyword.encode(tarfile.encoding) + + value = value.decode("utf8") + if keyword in type_mapping: + try: + value = type_mapping[keyword](value) + except ValueError: + value = 0 + else: + value = value.encode(tarfile.encoding) + + pax_headers[keyword] = value + pos += length + + # Fetch the next header that will be patched with the + # supplement information from the pax header (extended + # only). + t = self.fromtarfile(tarfile) + + if self.type != XGLTYPE and t is not None: + # Patch the TarInfo object from the next header with + # the pax header's information. + for keyword, value in pax_headers.items(): + if keyword in PAX_FIELDS: + setattr(t, keyword, value) + pax_headers[keyword] = value + t.pax_headers = pax_headers.copy() + + return t + + def _block(self, count): + """Round up a byte count by BLOCKSIZE and return it, + e.g. _block(834) => 1024. + """ + blocks, remainder = divmod(count, BLOCKSIZE) + if remainder: + blocks += 1 + return blocks * BLOCKSIZE def isreg(self): return self.type in REGULAR_TYPES @@ -1040,12 +1462,18 @@ # messages (if debug >= 0). If > 0, errors # are passed to the caller as exceptions. - posix = False # If True, generates POSIX.1-1990-compliant - # archives (no GNU extensions!) + format = DEFAULT_FORMAT # The format to use when creating an archive. + + encoding = ENCODING # Transfer UTF-8 strings from POSIX.1-2001 + # headers to this encoding. - fileobject = ExFileObject + tarinfo = TarInfo # The default TarInfo class to use. - def __init__(self, name=None, mode="r", fileobj=None): + fileobject = ExFileObject # The default ExFileObject class to use. + + def __init__(self, name=None, mode="r", fileobj=None, format=None, + tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, + pax_headers=None, debug=None, errorlevel=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' @@ -1054,53 +1482,86 @@ can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. """ - self.name = os.path.abspath(name) - if len(mode) > 1 or mode not in "raw": raise ValueError("mode must be 'r', 'a' or 'w'") - self._mode = mode - self.mode = {"r": "rb", "a": "r+b", "w": "wb"}[mode] + self.mode = mode + self._mode = {"r": "rb", "a": "r+b", "w": "wb"}[mode] if not fileobj: - fileobj = _open(self.name, self.mode) + if self.mode == "a" and not os.path.exists(name): + # Create nonexistent files in append mode. + self.mode = "w" + self._mode = "wb" + fileobj = builtin_open(name, self._mode) self._extfileobj = False else: - if self.name is None and hasattr(fileobj, "name"): - self.name = os.path.abspath(fileobj.name) + if name is None and hasattr(fileobj, "name"): + name = fileobj.name if hasattr(fileobj, "mode"): - self.mode = fileobj.mode + self._mode = fileobj.mode self._extfileobj = True + self.name = os.path.abspath(name) self.fileobj = fileobj - # Init datastructures + # Init attributes. + if format is not None: + self.format = format + if tarinfo is not None: + self.tarinfo = tarinfo + if dereference is not None: + self.dereference = dereference + if ignore_zeros is not None: + self.ignore_zeros = ignore_zeros + if encoding is not None: + self.encoding = encoding + if debug is not None: + self.debug = debug + if errorlevel is not None: + self.errorlevel = errorlevel + + # Init datastructures. self.closed = False self.members = [] # list of members as TarInfo objects self._loaded = False # flag if all members have been read self.offset = 0L # current position in the archive file self.inodes = {} # dictionary caching the inodes of # archive members already added + self.pax_headers = {} # save contents of global pax headers - if self._mode == "r": + if self.mode == "r": self.firstmember = None self.firstmember = self.next() - if self._mode == "a": + if self.mode == "a": # Move to the end of the archive, # before the first empty block. self.firstmember = None while True: - try: - tarinfo = self.next() - except ReadError: - self.fileobj.seek(0) - break - if tarinfo is None: - self.fileobj.seek(- BLOCKSIZE, 1) + if self.next() is None: + if self.offset > 0: + self.fileobj.seek(- BLOCKSIZE, 1) break - if self._mode in "aw": + if self.mode in "aw": self._loaded = True + if pax_headers: + buf = self.tarinfo.create_pax_global_header( + pax_headers.copy(), self.encoding) + self.fileobj.write(buf) + self.offset += len(buf) + + def _getposix(self): + return self.format == USTAR_FORMAT + def _setposix(self, value): + import warnings + warnings.warn("use the format attribute instead", DeprecationWarning) + if value: + self.format = USTAR_FORMAT + else: + self.format = GNU_FORMAT + posix = property(_getposix, _setposix) + #-------------------------------------------------------------------------- # Below are the classmethods which act as alternate constructors to the # TarFile class. The open() method is the only one that is needed for @@ -1113,7 +1574,7 @@ # by adding it to the mapping in OPEN_METH. @classmethod - def open(cls, name=None, mode="r", fileobj=None, bufsize=20*512): + def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs): """Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. @@ -1122,7 +1583,7 @@ 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression 'r:bz2' open for reading with bzip2 compression - 'a' or 'a:' open for appending + 'a' or 'a:' open for appending, creating the file if necessary 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression @@ -1146,8 +1607,8 @@ if fileobj is not None: saved_pos = fileobj.tell() try: - return func(name, "r", fileobj) - except (ReadError, CompressionError): + return func(name, "r", fileobj, **kwargs) + except (ReadError, CompressionError), e: if fileobj is not None: fileobj.seek(saved_pos) continue @@ -1164,7 +1625,7 @@ func = getattr(cls, cls.OPEN_METH[comptype]) else: raise CompressionError("unknown compression type %r" % comptype) - return func(name, filemode, fileobj) + return func(name, filemode, fileobj, **kwargs) elif "|" in mode: filemode, comptype = mode.split("|", 1) @@ -1175,25 +1636,26 @@ raise ValueError("mode must be 'r' or 'w'") t = cls(name, filemode, - _Stream(name, filemode, comptype, fileobj, bufsize)) + _Stream(name, filemode, comptype, fileobj, bufsize), + **kwargs) t._extfileobj = False return t elif mode in "aw": - return cls.taropen(name, mode, fileobj) + return cls.taropen(name, mode, fileobj, **kwargs) raise ValueError("undiscernible mode") @classmethod - def taropen(cls, name, mode="r", fileobj=None): + def taropen(cls, name, mode="r", fileobj=None, **kwargs): """Open uncompressed tar archive name for reading or writing. """ if len(mode) > 1 or mode not in "raw": raise ValueError("mode must be 'r', 'a' or 'w'") - return cls(name, mode, fileobj) + return cls(name, mode, fileobj, **kwargs) @classmethod - def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): + def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ @@ -1207,18 +1669,19 @@ raise CompressionError("gzip module is not available") if fileobj is None: - fileobj = _open(name, mode + "b") + fileobj = builtin_open(name, mode + "b") try: t = cls.taropen(name, mode, - gzip.GzipFile(name, mode, compresslevel, fileobj)) + gzip.GzipFile(name, mode, compresslevel, fileobj), + **kwargs) except IOError: raise ReadError("not a gzip file") t._extfileobj = False return t @classmethod - def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9): + def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): """Open bzip2 compressed tar archive name for reading or writing. Appending is not allowed. """ @@ -1236,7 +1699,7 @@ fileobj = bz2.BZ2File(name, mode, compresslevel=compresslevel) try: - t = cls.taropen(name, mode, fileobj) + t = cls.taropen(name, mode, fileobj, **kwargs) except IOError: raise ReadError("not a bzip2 file") t._extfileobj = False @@ -1259,7 +1722,7 @@ if self.closed: return - if self._mode in "aw": + if self.mode in "aw": self.fileobj.write(NUL * (BLOCKSIZE * 2)) self.offset += (BLOCKSIZE * 2) # fill up the end with zero-blocks @@ -1325,7 +1788,8 @@ # Now, fill the TarInfo object with # information specific for the file. - tarinfo = TarInfo() + tarinfo = self.tarinfo() + tarinfo.tarfile = self # Use os.stat or os.lstat, depending on platform # and if symlinks shall be resolved. @@ -1341,8 +1805,8 @@ stmd = statres.st_mode if stat.S_ISREG(stmd): inode = (statres.st_ino, statres.st_dev) - if not self.dereference and \ - statres.st_nlink > 1 and inode in self.inodes: + if not self.dereference and statres.st_nlink > 1 and \ + inode in self.inodes and arcname != self.inodes[inode]: # Is it a hardlink to an already # archived file? type = LNKTYPE @@ -1419,7 +1883,7 @@ print "%d-%02d-%02d %02d:%02d:%02d" \ % time.localtime(tarinfo.mtime)[:6], - print tarinfo.name, + print tarinfo.name + ("/" if tarinfo.isdir() else ""), if verbose: if tarinfo.issym(): @@ -1451,7 +1915,7 @@ if recursive: if arcname == ".": arcname = "" - for f in os.listdir("."): + for f in os.listdir(name): self.add(f, os.path.join(arcname, f)) return @@ -1466,7 +1930,7 @@ # Append the tar header and data to the archive. if tarinfo.isreg(): - f = _open(name, "rb") + f = builtin_open(name, "rb") self.addfile(tarinfo, f) f.close() @@ -1490,7 +1954,7 @@ tarinfo = copy.copy(tarinfo) - buf = tarinfo.tobuf(self.posix) + buf = tarinfo.tobuf(self.format, self.encoding) self.fileobj.write(buf) self.offset += len(buf) @@ -1522,7 +1986,7 @@ # Extract directory with a safe mode, so that # all files below can be extracted as well. try: - os.makedirs(os.path.join(path, tarinfo.name), 0777) + os.makedirs(os.path.join(path, tarinfo.name), 0700) except EnvironmentError: pass directories.append(tarinfo) @@ -1554,10 +2018,10 @@ """ self._check("r") - if isinstance(member, TarInfo): - tarinfo = member - else: + if isinstance(member, basestring): tarinfo = self.getmember(member) + else: + tarinfo = member # Prepare the link target for makelink(). if tarinfo.islnk(): @@ -1590,10 +2054,10 @@ """ self._check("r") - if isinstance(member, TarInfo): - tarinfo = member - else: + if isinstance(member, basestring): tarinfo = self.getmember(member) + else: + tarinfo = member if tarinfo.isreg(): return self.fileobject(self, tarinfo) @@ -1677,7 +2141,7 @@ """Make a file called targetpath. """ source = self.extractfile(tarinfo) - target = _open(targetpath, "wb") + target = builtin_open(targetpath, "wb") copyfileobj(source, target) source.close() target.close() @@ -1806,20 +2270,11 @@ # Read the next block. self.fileobj.seek(self.offset) while True: - buf = self.fileobj.read(BLOCKSIZE) - if not buf: - return None - try: - tarinfo = TarInfo.frombuf(buf) - - # Set the TarInfo object's offset to the current position of the - # TarFile and set self.offset to the position where the data blocks - # should begin. - tarinfo.offset = self.offset - self.offset += BLOCKSIZE - - tarinfo = self.proc_member(tarinfo) + tarinfo = self.tarinfo.fromtarfile(self) + if tarinfo is None: + return + self.members.append(tarinfo) except HeaderError, e: if self.ignore_zeros: @@ -1832,149 +2287,11 @@ return None break - # Some old tar programs represent a directory as a regular - # file with a trailing slash. - if tarinfo.isreg() and tarinfo.name.endswith("/"): - tarinfo.type = DIRTYPE - - # Directory names should have a '/' at the end. - if tarinfo.isdir(): - tarinfo.name += "/" - - self.members.append(tarinfo) - return tarinfo - - #-------------------------------------------------------------------------- - # The following are methods that are called depending on the type of a - # member. The entry point is proc_member() which is called with a TarInfo - # object created from the header block from the current offset. The - # proc_member() method can be overridden in a subclass to add custom - # proc_*() methods. A proc_*() method MUST implement the following - # operations: - # 1. Set tarinfo.offset_data to the position where the data blocks begin, - # if there is data that follows. - # 2. Set self.offset to the position where the next member's header will - # begin. - # 3. Return tarinfo or another valid TarInfo object. - def proc_member(self, tarinfo): - """Choose the right processing method for tarinfo depending - on its type and call it. - """ - if tarinfo.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK): - return self.proc_gnulong(tarinfo) - elif tarinfo.type == GNUTYPE_SPARSE: - return self.proc_sparse(tarinfo) - else: - return self.proc_builtin(tarinfo) - - def proc_builtin(self, tarinfo): - """Process a builtin type member or an unknown member - which will be treated as a regular file. - """ - tarinfo.offset_data = self.offset - if tarinfo.isreg() or tarinfo.type not in SUPPORTED_TYPES: - # Skip the following data blocks. - self.offset += self._block(tarinfo.size) - return tarinfo - - def proc_gnulong(self, tarinfo): - """Process the blocks that hold a GNU longname - or longlink member. - """ - buf = "" - count = tarinfo.size - while count > 0: - block = self.fileobj.read(BLOCKSIZE) - buf += block - self.offset += BLOCKSIZE - count -= BLOCKSIZE - - # Fetch the next header and process it. - b = self.fileobj.read(BLOCKSIZE) - t = TarInfo.frombuf(b) - t.offset = self.offset - self.offset += BLOCKSIZE - next = self.proc_member(t) - - # Patch the TarInfo object from the next header with - # the longname information. - next.offset = tarinfo.offset - if tarinfo.type == GNUTYPE_LONGNAME: - next.name = buf.rstrip(NUL) - elif tarinfo.type == GNUTYPE_LONGLINK: - next.linkname = buf.rstrip(NUL) - - return next - - def proc_sparse(self, tarinfo): - """Process a GNU sparse header plus extra headers. - """ - buf = tarinfo.buf - sp = _ringbuffer() - pos = 386 - lastpos = 0L - realpos = 0L - # There are 4 possible sparse structs in the - # first header. - for i in xrange(4): - try: - offset = nti(buf[pos:pos + 12]) - numbytes = nti(buf[pos + 12:pos + 24]) - except ValueError: - break - if offset > lastpos: - sp.append(_hole(lastpos, offset - lastpos)) - sp.append(_data(offset, numbytes, realpos)) - realpos += numbytes - lastpos = offset + numbytes - pos += 24 - - isextended = ord(buf[482]) - origsize = nti(buf[483:495]) - - # If the isextended flag is given, - # there are extra headers to process. - while isextended == 1: - buf = self.fileobj.read(BLOCKSIZE) - self.offset += BLOCKSIZE - pos = 0 - for i in xrange(21): - try: - offset = nti(buf[pos:pos + 12]) - numbytes = nti(buf[pos + 12:pos + 24]) - except ValueError: - break - if offset > lastpos: - sp.append(_hole(lastpos, offset - lastpos)) - sp.append(_data(offset, numbytes, realpos)) - realpos += numbytes - lastpos = offset + numbytes - pos += 24 - isextended = ord(buf[504]) - - if lastpos < origsize: - sp.append(_hole(lastpos, origsize - lastpos)) - - tarinfo.sparse = sp - - tarinfo.offset_data = self.offset - self.offset += self._block(tarinfo.size) - tarinfo.size = origsize - return tarinfo #-------------------------------------------------------------------------- # Little helper methods: - def _block(self, count): - """Round up a byte count by BLOCKSIZE and return it, - e.g. _block(834) => 1024. - """ - blocks, remainder = divmod(count, BLOCKSIZE) - if remainder: - blocks += 1 - return blocks * BLOCKSIZE - def _getmember(self, name, tarinfo=None): """Find an archive member by name from bottom to top. If tarinfo is given, it is used as the starting point. @@ -2007,8 +2324,8 @@ """ if self.closed: raise IOError("%s is closed" % self.__class__.__name__) - if mode is not None and self._mode not in mode: - raise IOError("bad operation for mode %r" % self._mode) + if mode is not None and self.mode not in mode: + raise IOError("bad operation for mode %r" % self.mode) def __iter__(self): """Provide an iterator object. Modified: python/branches/bcannon-objcap/Lib/telnetlib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/telnetlib.py (original) +++ python/branches/bcannon-objcap/Lib/telnetlib.py Fri May 25 22:13:08 2007 @@ -184,7 +184,7 @@ """ - def __init__(self, host=None, port=0): + def __init__(self, host=None, port=0, timeout=None): """Constructor. When called without arguments, create an unconnected instance. @@ -195,6 +195,7 @@ self.debuglevel = DEBUGLEVEL self.host = host self.port = port + self.timeout = timeout self.sock = None self.rawq = '' self.irawq = 0 @@ -205,9 +206,9 @@ self.sbdataq = '' self.option_callback = None if host is not None: - self.open(host, port) + self.open(host, port, timeout) - def open(self, host, port=0): + def open(self, host, port=0, timeout=None): """Connect to a host. The optional second argument is the port number, which @@ -221,20 +222,9 @@ port = TELNET_PORT self.host = host self.port = port - msg = "getaddrinfo returns an empty list" - for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM): - af, socktype, proto, canonname, sa = res - try: - self.sock = socket.socket(af, socktype, proto) - self.sock.connect(sa) - except socket.error, msg: - if self.sock: - self.sock.close() - self.sock = None - continue - break - if not self.sock: - raise socket.error, msg + if timeout is not None: + self.timeout = timeout + self.sock = socket.create_connection((host, port), self.timeout) def __del__(self): """Destructor -- close the connection.""" @@ -661,7 +651,7 @@ port = socket.getservbyname(portstr, 'tcp') tn = Telnet() tn.set_debuglevel(debuglevel) - tn.open(host, port) + tn.open(host, port, timeout=0.5) tn.interact() tn.close() Modified: python/branches/bcannon-objcap/Lib/tempfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/tempfile.py (original) +++ python/branches/bcannon-objcap/Lib/tempfile.py Fri May 25 22:13:08 2007 @@ -19,6 +19,7 @@ __all__ = [ "NamedTemporaryFile", "TemporaryFile", # high level safe interfaces + "SpooledTemporaryFile", "mkstemp", "mkdtemp", # low level safe interfaces "mktemp", # deprecated unsafe interface "TMP_MAX", "gettempprefix", # constants @@ -37,6 +38,11 @@ import Carbon.Folders as _Folders try: + from cStringIO import StringIO as _StringIO +except: + from StringIO import StringIO as _StringIO + +try: import fcntl as _fcntl except ImportError: def _set_cloexec(fd): @@ -114,7 +120,7 @@ characters = ("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + - "0123456789-_") + "0123456789_") def __init__(self): self.mutex = _allocate_lock() @@ -372,10 +378,11 @@ remove the file when it is no longer needed. """ - def __init__(self, file, name): + def __init__(self, file, name, delete=True): self.file = file self.name = name self.close_called = False + self.delete = delete def __getattr__(self, name): file = self.__dict__['file'] @@ -400,23 +407,25 @@ if not self.close_called: self.close_called = True self.file.close() - self.unlink(self.name) + if self.delete: + self.unlink(self.name) def __del__(self): self.close() def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", - prefix=template, dir=None): + prefix=template, dir=None, delete=True): """Create and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the mode argument to os.fdopen (default "w+b"). 'bufsize' -- the buffer size argument to os.fdopen (default -1). + 'delete' -- whether the file is deleted on close (default True). The file is created as mkstemp() would do it. Returns an object with a file-like interface; the name of the file is accessible as file.name. The file will be automatically deleted - when it is closed. + when it is closed unless the 'delete' argument is set to False. """ if dir is None: @@ -429,12 +438,12 @@ # Setting O_TEMPORARY in the flags causes the OS to delete # the file when it is closed. This is only supported by Windows. - if _os.name == 'nt': + if _os.name == 'nt' and delete: flags |= _os.O_TEMPORARY (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags) file = _os.fdopen(fd, mode, bufsize) - return _TemporaryFileWrapper(file, name) + return _TemporaryFileWrapper(file, name, delete) if _os.name != 'posix' or _os.sys.platform == 'cygwin': # On non-POSIX and Cygwin systems, assume that we cannot unlink a file @@ -470,3 +479,111 @@ except: _os.close(fd) raise + +class SpooledTemporaryFile: + """Temporary file wrapper, specialized to switch from + StringIO to a real file when it exceeds a certain size or + when a fileno is needed. + """ + _rolled = False + + def __init__(self, max_size=0, mode='w+b', bufsize=-1, + suffix="", prefix=template, dir=None): + self._file = _StringIO() + self._max_size = max_size + self._rolled = False + self._TemporaryFileArgs = (mode, bufsize, suffix, prefix, dir) + + def _check(self, file): + if self._rolled: return + max_size = self._max_size + if max_size and file.tell() > max_size: + self.rollover() + + def rollover(self): + if self._rolled: return + file = self._file + newfile = self._file = TemporaryFile(*self._TemporaryFileArgs) + del self._TemporaryFileArgs + + newfile.write(file.getvalue()) + newfile.seek(file.tell(), 0) + + self._rolled = True + + # file protocol + def __iter__(self): + return self._file.__iter__() + + def close(self): + self._file.close() + + @property + def closed(self): + return self._file.closed + + @property + def encoding(self): + return self._file.encoding + + def fileno(self): + self.rollover() + return self._file.fileno() + + def flush(self): + self._file.flush() + + def isatty(self): + return self._file.isatty() + + @property + def mode(self): + return self._file.mode + + @property + def name(self): + return self._file.name + + @property + def newlines(self): + return self._file.newlines + + def next(self): + return self._file.next + + def read(self, *args): + return self._file.read(*args) + + def readline(self, *args): + return self._file.readline(*args) + + def readlines(self, *args): + return self._file.readlines(*args) + + def seek(self, *args): + self._file.seek(*args) + + @property + def softspace(self): + return self._file.softspace + + def tell(self): + return self._file.tell() + + def truncate(self): + self._file.truncate() + + def write(self, s): + file = self._file + rv = file.write(s) + self._check(file) + return rv + + def writelines(self, iterable): + file = self._file + rv = file.writelines(iterable) + self._check(file) + return rv + + def xreadlines(self, *args): + return self._file.xreadlines(*args) Modified: python/branches/bcannon-objcap/Lib/test/README ============================================================================== --- python/branches/bcannon-objcap/Lib/test/README (original) +++ python/branches/bcannon-objcap/Lib/test/README Fri May 25 22:13:08 2007 @@ -15,7 +15,7 @@ one of these options. Each option requires writing a test module using the conventions of the selected option: - - PyUnit_ based tests + - unittest_ based tests - doctest_ based tests - "traditional" Python test modules @@ -28,31 +28,34 @@ able to refer to the C and Python code in the CVS repository when writing your regression test cases. -.. _PyUnit: .. _unittest: http://www.python.org/doc/current/lib/module-unittest.html .. _doctest: http://www.python.org/doc/current/lib/module-doctest.html -PyUnit based tests +unittest-based tests ------------------ -The PyUnit_ framework is based on the ideas of unit testing as espoused +The unittest_ framework is based on the ideas of unit testing as espoused by Kent Beck and the `Extreme Programming`_ (XP) movement. The specific interface provided by the framework is tightly based on the JUnit_ Java implementation of Beck's original SmallTalk test framework. Please see the documentation of the unittest_ module for detailed information on -the interface and general guidelines on writing PyUnit based tests. +the interface and general guidelines on writing unittest-based tests. -The test_support helper module provides two functions for use by -PyUnit based tests in the Python regression testing framework: - -- ``run_unittest()`` takes a ``unittest.TestCase`` derived class as a - parameter and runs the tests defined in that class - -- ``run_suite()`` takes a populated ``TestSuite`` instance and runs the - tests +The test_support helper module provides a function for use by +unittest-based tests in the Python regression testing framework, +``run_unittest()``. This is the primary way of running tests in the +standard library. You can pass it any number of the following: + +- classes derived from or instances of ``unittest.TestCase`` or + ``unittest.TestSuite``. These will be handed off to unittest for + converting into a proper TestSuite instance. + +- a string; this must be a key in sys.modules. The module associated with + that string will be scanned by ``unittest.TestLoader.loadTestsFromModule``. + This is usually seen as ``test_support.run_unittest(__name__)`` in a test + module's ``test_main()`` function. This has the advantage of picking up + new tests automatically, without you having to add each new test case + manually. -``run_suite()`` is preferred because unittest files typically grow multiple -test classes, and you might as well be prepared. - All test methods in the Python regression framework have names that start with "``test_``" and use lower-case names with words separated with underscores. @@ -63,7 +66,7 @@ latter information makes it easier to find the source for the test than the docstring. -All PyUnit-based tests in the Python test suite use boilerplate that +All unittest-based tests in the Python test suite use boilerplate that looks like this (with minor variations):: import unittest @@ -97,11 +100,7 @@ ...etc... def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(MyTestCase1)) - suite.addTest(unittest.makeSuite(MyTestCase2)) - ...add more suites... - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() @@ -415,7 +414,7 @@ This is rarely required with the "traditional" Python tests, and you shouldn't create a module global with name test_main unless you're specifically exploiting this gimmick. This usage does - prove useful with PyUnit-based tests as well, however; defining + prove useful with unittest-based tests as well, however; defining a ``test_main()`` which is run by regrtest and a script-stub in the test module ("``if __name__ == '__main__': test_main()``") allows the test to be used like any other Python test and also work Deleted: /python/branches/bcannon-objcap/Lib/test/crashers/dangerous_subclassing.py ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/crashers/dangerous_subclassing.py Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,12 +0,0 @@ - -# http://python.org/sf/1174712 - -import types - -class X(types.ModuleType, str): - """Such a subclassing is incorrectly allowed -- - see the SF bug report for explanations""" - -if __name__ == '__main__': - X('name') # segfault: ModuleType.__init__() reads - # the dict at the wrong offset Deleted: /python/branches/bcannon-objcap/Lib/test/crashers/modify_dict_attr.py ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/crashers/modify_dict_attr.py Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,19 +0,0 @@ - -# http://python.org/sf/1303614 - -class Y(object): - pass - -class type_with_modifiable_dict(Y, type): - pass - -class MyClass(object): - """This class has its __dict__ attribute completely exposed: - user code can read, reassign and even delete it. - """ - __metaclass__ = type_with_modifiable_dict - - -if __name__ == '__main__': - del MyClass.__dict__ # if we set tp_dict to NULL, - print MyClass # doing anything with MyClass segfaults Modified: python/branches/bcannon-objcap/Lib/test/output/test_extcall ============================================================================== --- python/branches/bcannon-objcap/Lib/test/output/test_extcall (original) +++ python/branches/bcannon-objcap/Lib/test/output/test_extcall Fri May 25 22:13:08 2007 @@ -9,6 +9,9 @@ (1, 2, 3) {'a': 4, 'b': 5} (1, 2, 3, 4, 5) {'a': 6, 'b': 7} (1, 2, 3, 6, 7) {'a': 8, 'b': 9, 'x': 4, 'y': 5} +(1, 2, 3) {'a': 4, 'b': 5} +(1, 2, 3, 4, 5) {'a': 6, 'b': 7} +(1, 2, 3, 6, 7) {'a': 8, 'b': 9, 'x': 4, 'y': 5} TypeError: g() takes at least 1 argument (0 given) TypeError: g() takes at least 1 argument (0 given) TypeError: g() takes at least 1 argument (0 given) @@ -25,12 +28,12 @@ g() got multiple values for keyword argument 'b' f() keywords must be strings h() got an unexpected keyword argument 'e' -h() argument after * must be a sequence -dir() argument after * must be a sequence -NoneType object argument after * must be a sequence -h() argument after ** must be a dictionary -dir() argument after ** must be a dictionary -NoneType object argument after ** must be a dictionary +h() argument after * must be a sequence, not function +dir() argument after * must be a sequence, not function +NoneType object argument after * must be a sequence, not function +h() argument after ** must be a mapping, not function +dir() argument after ** must be a mapping, not function +NoneType object argument after ** must be a mapping, not function dir() got multiple values for keyword argument 'b' 3 512 True 3 Deleted: /python/branches/bcannon-objcap/Lib/test/output/test_operations ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/output/test_operations Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,21 +0,0 @@ -test_operations -3. Operations -XXX Mostly not yet implemented -3.1 Dictionary lookups fail if __cmp__() raises an exception -raising error -d[x2] = 2: caught the RuntimeError outside -raising error -z = d[x2]: caught the RuntimeError outside -raising error -x2 in d: caught the RuntimeError outside -raising error -d.has_key(x2): caught the RuntimeError outside -raising error -d.get(x2): caught the RuntimeError outside -raising error -d.setdefault(x2, 42): caught the RuntimeError outside -raising error -d.pop(x2): caught the RuntimeError outside -raising error -d.update({x2: 2}): caught the RuntimeError outside -resize bugs not triggered. Deleted: /python/branches/bcannon-objcap/Lib/test/output/test_popen2 ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/output/test_popen2 Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,9 +0,0 @@ -test_popen2 -Test popen2 module: -testing popen2... -testing popen3... -All OK -Testing os module: -testing popen2... -testing popen3... -All OK Deleted: /python/branches/bcannon-objcap/Lib/test/output/test_pty ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/output/test_pty Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,3 +0,0 @@ -test_pty -I wish to buy a fish license. -For my pet fish, Eric. Deleted: /python/branches/bcannon-objcap/Lib/test/output/test_pyexpat ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/output/test_pyexpat Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,110 +0,0 @@ -test_pyexpat -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -PI: - 'xml-stylesheet' 'href="stylesheet.css"' -Comment: - ' comment data ' -Notation declared: ('notation', None, 'notation.jpeg', None) -Unparsed entity decl: - ('unparsed_entity', None, 'entity.file', None, 'notation') -Start element: - 'root' {'attr1': 'value1', 'attr2': 'value2\xe1\xbd\x80'} -NS decl: - 'myns' 'http://www.python.org/namespace' -Start element: - 'http://www.python.org/namespace!subelement' {} -Character data: - 'Contents of subelements' -End element: - 'http://www.python.org/namespace!subelement' -End of NS decl: - 'myns' -Start element: - 'sub2' {} -Start of CDATA section -Character data: - 'contents of CDATA section' -End of CDATA section -End element: - 'sub2' -External entity ref: (None, 'entity.file', None) -End element: - 'root' -PI: - u'xml-stylesheet' u'href="stylesheet.css"' -Comment: - u' comment data ' -Notation declared: (u'notation', None, u'notation.jpeg', None) -Unparsed entity decl: - (u'unparsed_entity', None, u'entity.file', None, u'notation') -Start element: - u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'} -NS decl: - u'myns' u'http://www.python.org/namespace' -Start element: - u'http://www.python.org/namespace!subelement' {} -Character data: - u'Contents of subelements' -End element: - u'http://www.python.org/namespace!subelement' -End of NS decl: - u'myns' -Start element: - u'sub2' {} -Start of CDATA section -Character data: - u'contents of CDATA section' -End of CDATA section -End element: - u'sub2' -External entity ref: (None, u'entity.file', None) -End element: - u'root' -PI: - u'xml-stylesheet' u'href="stylesheet.css"' -Comment: - u' comment data ' -Notation declared: (u'notation', None, u'notation.jpeg', None) -Unparsed entity decl: - (u'unparsed_entity', None, u'entity.file', None, u'notation') -Start element: - u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'} -NS decl: - u'myns' u'http://www.python.org/namespace' -Start element: - u'http://www.python.org/namespace!subelement' {} -Character data: - u'Contents of subelements' -End element: - u'http://www.python.org/namespace!subelement' -End of NS decl: - u'myns' -Start element: - u'sub2' {} -Start of CDATA section -Character data: - u'contents of CDATA section' -End of CDATA section -End element: - u'sub2' -External entity ref: (None, u'entity.file', None) -End element: - u'root' - -Testing constructor for proper handling of namespace_separator values: -Legal values tested o.k. -Caught expected TypeError: -ParserCreate() argument 2 must be string or None, not int -Caught expected ValueError: -namespace_separator must be at most one character, omitted, or None Deleted: /python/branches/bcannon-objcap/Lib/test/output/test_threadedtempfile ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/output/test_threadedtempfile Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,5 +0,0 @@ -test_threadedtempfile -Creating -Starting -Reaping -Done: errors 0 ok 1000 Deleted: /python/branches/bcannon-objcap/Lib/test/output/xmltests ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/output/xmltests Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,364 +0,0 @@ -xmltests -Passed testAAA -Passed setAttribute() sets ownerDocument -Passed setAttribute() sets ownerElement -Test Succeeded testAAA -Passed assertion: len(Node.allnodes) == 0 -Passed testAAB -Test Succeeded testAAB -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Test Succeeded testAddAttr -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testAppendChild -Passed assertion: len(Node.allnodes) == 0 -Passed appendChild() -Test Succeeded testAppendChildFragment -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListItem -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListItemNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListItems -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListKeys -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListKeysNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListLength -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrListValues -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrList__getitem__ -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testAttrList__setitem__ -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testAttributeRepr -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Passed Test -Passed Test -Passed Test -Test Succeeded testChangeAttr -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testChildNodes -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCloneAttributeDeep -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCloneAttributeShallow -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCloneDocumentDeep -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCloneDocumentShallow -Passed assertion: len(Node.allnodes) == 0 -Passed clone of element has same attribute keys -Passed clone of attribute node has proper attribute values -Passed clone of attribute node correctly owned -Passed testCloneElementDeep -Test Succeeded testCloneElementDeep -Passed assertion: len(Node.allnodes) == 0 -Passed clone of element has same attribute keys -Passed clone of attribute node has proper attribute values -Passed clone of attribute node correctly owned -Passed testCloneElementShallow -Test Succeeded testCloneElementShallow -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testClonePIDeep -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testClonePIShallow -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testComment -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCreateAttributeNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testCreateElementNS -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Passed Test -Test Succeeded testDeleteAttr -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testDocumentElement -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testElement -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testElementReprAndStr -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testFirstChild -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttrLength -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttrList -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttrValues -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttribute -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttributeNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetAttributeNode -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testGetElementsByTagName -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testGetElementsByTagNameNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testGetEmptyNodeListFromElementsByTagNameNS -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testHasChildNodes -Passed assertion: len(Node.allnodes) == 0 -Passed testInsertBefore -- node properly placed in tree -Passed testInsertBefore -- node properly placed in tree -Passed testInsertBefore -- node properly placed in tree -Test Succeeded testInsertBefore -Passed assertion: len(Node.allnodes) == 0 -Passed insertBefore(, None) -Passed insertBefore(, orig) -Test Succeeded testInsertBeforeFragment -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testLegalChildren -Passed assertion: len(Node.allnodes) == 0 -Passed NamedNodeMap.__setitem__() sets ownerDocument -Passed NamedNodeMap.__setitem__() sets ownerElement -Passed NamedNodeMap.__setitem__() sets value -Passed NamedNodeMap.__setitem__() sets nodeValue -Test Succeeded testNamedNodeMapSetItem -Passed assertion: len(Node.allnodes) == 0 -Passed test NodeList.item() -Test Succeeded testNodeListItem -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testNonZero -Passed assertion: len(Node.allnodes) == 0 -Passed testNormalize -- preparation -Passed testNormalize -- result -Passed testNormalize -- single empty node removed -Test Succeeded testNormalize -Passed assertion: len(Node.allnodes) == 0 -Passed testParents -Test Succeeded testParents -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParse -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseAttributeNamespaces -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseAttributes -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseElement -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseElementNamespaces -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Test Succeeded testParseFromFile -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseProcessingInstructions -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testParseString -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testProcessingInstruction -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testProcessingInstructionRepr -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testRemoveAttr -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testRemoveAttrNS -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testRemoveAttributeNode -Passed assertion: len(Node.allnodes) == 0 -Passed replaceChild() -Test Succeeded testReplaceChildFragment -Passed assertion: len(Node.allnodes) == 0 -Passed testSAX2DOM - siblings -Passed testSAX2DOM - parents -Test Succeeded testSAX2DOM -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testSetAttrValueandNodeValue -Passed assertion: len(Node.allnodes) == 0 -Passed testSiblings -Test Succeeded testSiblings -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testTextNodeRepr -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testTextRepr -Passed assertion: len(Node.allnodes) == 0 -Caught expected exception when adding extra document element. -Test Succeeded testTooManyDocumentElements -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testUnlink -Passed assertion: len(Node.allnodes) == 0 -Test Succeeded testWriteText -Passed assertion: len(Node.allnodes) == 0 -Passed Test -Passed Test -Test Succeeded testWriteXML -Passed assertion: len(Node.allnodes) == 0 -All tests succeeded -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -OK. -PI: - 'xml-stylesheet' 'href="stylesheet.css"' -Comment: - ' comment data ' -Notation declared: ('notation', None, 'notation.jpeg', None) -Unparsed entity decl: - ('unparsed_entity', None, 'entity.file', None, 'notation') -Start element: - 'root' {'attr1': 'value1', 'attr2': 'value2\xe1\xbd\x80'} -NS decl: - 'myns' 'http://www.python.org/namespace' -Start element: - 'http://www.python.org/namespace!subelement' {} -Character data: - 'Contents of subelements' -End element: - 'http://www.python.org/namespace!subelement' -End of NS decl: - 'myns' -Start element: - 'sub2' {} -Start of CDATA section -Character data: - 'contents of CDATA section' -End of CDATA section -End element: - 'sub2' -External entity ref: (None, 'entity.file', None) -End element: - 'root' -PI: - u'xml-stylesheet' u'href="stylesheet.css"' -Comment: - u' comment data ' -Notation declared: (u'notation', None, u'notation.jpeg', None) -Unparsed entity decl: - (u'unparsed_entity', None, u'entity.file', None, u'notation') -Start element: - u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'} -NS decl: - u'myns' u'http://www.python.org/namespace' -Start element: - u'http://www.python.org/namespace!subelement' {} -Character data: - u'Contents of subelements' -End element: - u'http://www.python.org/namespace!subelement' -End of NS decl: - u'myns' -Start element: - u'sub2' {} -Start of CDATA section -Character data: - u'contents of CDATA section' -End of CDATA section -End element: - u'sub2' -External entity ref: (None, u'entity.file', None) -End element: - u'root' -PI: - u'xml-stylesheet' u'href="stylesheet.css"' -Comment: - u' comment data ' -Notation declared: (u'notation', None, u'notation.jpeg', None) -Unparsed entity decl: - (u'unparsed_entity', None, u'entity.file', None, u'notation') -Start element: - u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'} -NS decl: - u'myns' u'http://www.python.org/namespace' -Start element: - u'http://www.python.org/namespace!subelement' {} -Character data: - u'Contents of subelements' -End element: - u'http://www.python.org/namespace!subelement' -End of NS decl: - u'myns' -Start element: - u'sub2' {} -Start of CDATA section -Character data: - u'contents of CDATA section' -End of CDATA section -End element: - u'sub2' -External entity ref: (None, u'entity.file', None) -End element: - u'root' - -Testing constructor for proper handling of namespace_separator values: -Legal values tested o.k. -Caught expected TypeError: -ParserCreate() argument 2 must be string or None, not int -Caught expected ValueError: -namespace_separator must be at most one character, omitted, or None -Passed test_attrs_empty -Passed test_attrs_wattr -Passed test_double_quoteattr -Passed test_escape_all -Passed test_escape_basic -Passed test_escape_extra -Passed test_expat_attrs_empty -Passed test_expat_attrs_wattr -Passed test_expat_dtdhandler -Passed test_expat_entityresolver -Passed test_expat_file -Passed test_expat_incomplete -Passed test_expat_incremental -Passed test_expat_incremental_reset -Passed test_expat_inpsource_filename -Passed test_expat_inpsource_location -Passed test_expat_inpsource_stream -Passed test_expat_inpsource_sysid -Passed test_expat_locator_noinfo -Passed test_expat_locator_withinfo -Passed test_expat_nsattrs_empty -Passed test_expat_nsattrs_wattr -Passed test_filter_basic -Passed test_make_parser -Passed test_make_parser2 -Passed test_nsattrs_empty -Passed test_nsattrs_wattr -Passed test_quoteattr_basic -Passed test_single_double_quoteattr -Passed test_single_quoteattr -Passed test_xmlgen_attr_escape -Passed test_xmlgen_basic -Passed test_xmlgen_content -Passed test_xmlgen_content_escape -Passed test_xmlgen_ignorable -Passed test_xmlgen_ns -Passed test_xmlgen_pi -37 tests, 0 failures Modified: python/branches/bcannon-objcap/Lib/test/outstanding_bugs.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/outstanding_bugs.py (original) +++ python/branches/bcannon-objcap/Lib/test/outstanding_bugs.py Fri May 25 22:13:08 2007 @@ -10,13 +10,44 @@ from test import test_support # -# No test cases for outstanding bugs at the moment. +# One test case for outstanding bugs at the moment: # +class TestDifflibLongestMatch(unittest.TestCase): + # From Patch #1678339: + # The find_longest_match method in the difflib's SequenceMatcher has a bug. + + # The bug is in turn caused by a problem with creating a b2j mapping which + # should contain a list of indices for each of the list elements in b. + # However, when the b2j mapping is being created (this is being done in + # __chain_b method in the SequenceMatcher) the mapping becomes broken. The + # cause of this is that for the frequently used elements the list of indices + # is removed and the element is being enlisted in the populardict mapping. + + # The test case tries to match two strings like: + # abbbbbb.... and ...bbbbbbc + + # The number of b is equal and the find_longest_match should have returned + # the proper amount. However, in case the number of "b"s is large enough, the + # method reports that the length of the longest common substring is 0. It + # simply can't find it. + + # A bug was raised some time ago on this matter. It's ID is 1528074. + + def test_find_longest_match(self): + import difflib + for i in (190, 200, 210): + text1 = "a" + "b"*i + text2 = "b"*i + "c" + m = difflib.SequenceMatcher(None, text1, text2) + (aptr, bptr, l) = m.find_longest_match(0, len(text1), 0, len(text2)) + self.assertEquals(i, l) + self.assertEquals(aptr, 1) + self.assertEquals(bptr, 0) + def test_main(): - #test_support.run_unittest() - pass + test_support.run_unittest(TestDifflibLongestMatch) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/pickletester.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/pickletester.py (original) +++ python/branches/bcannon-objcap/Lib/test/pickletester.py Fri May 25 22:13:08 2007 @@ -831,6 +831,24 @@ y = self.loads(s) self.assertEqual(y._proto, None) + def test_reduce_ex_calls_base(self): + for proto in 0, 1, 2: + x = REX_four() + self.assertEqual(x._proto, None) + s = self.dumps(x, proto) + self.assertEqual(x._proto, proto) + y = self.loads(s) + self.assertEqual(y._proto, proto) + + def test_reduce_calls_base(self): + for proto in 0, 1, 2: + x = REX_five() + self.assertEqual(x._reduce_called, 0) + s = self.dumps(x, proto) + self.assertEqual(x._reduce_called, 1) + y = self.loads(s) + self.assertEqual(y._reduce_called, 1) + # Test classes for reduce_ex class REX_one(object): @@ -855,6 +873,20 @@ def __reduce__(self): raise TestFailed, "This __reduce__ shouldn't be called" +class REX_four(object): + _proto = None + def __reduce_ex__(self, proto): + self._proto = proto + return object.__reduce_ex__(self, proto) + # Calling base class method should succeed + +class REX_five(object): + _reduce_called = 0 + def __reduce__(self): + self._reduce_called = 1 + return object.__reduce__(self) + # This one used to fail with infinite recursion + # Test classes for newobj class MyInt(int): Modified: python/branches/bcannon-objcap/Lib/test/regrtest.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/regrtest.py (original) +++ python/branches/bcannon-objcap/Lib/test/regrtest.py Fri May 25 22:13:08 2007 @@ -470,10 +470,13 @@ STDTESTS = [ 'test_grammar', 'test_opcodes', - 'test_operations', + 'test_dict', 'test_builtin', 'test_exceptions', 'test_types', + 'test_unittest', + 'test_doctest', + 'test_doctest2', ] NOTTESTS = [ @@ -679,9 +682,10 @@ deltas.append(sys.gettotalrefcount() - rc - 2) print >> sys.stderr if any(deltas): - print >> sys.stderr, test, 'leaked', deltas, 'references' + msg = '%s leaked %s references, sum=%s' % (test, deltas, sum(deltas)) + print >> sys.stderr, msg refrep = open(fname, "a") - print >> refrep, test, 'leaked', deltas, 'references' + print >> refrep, msg refrep.close() def dash_R_cleanup(fs, ps, pic): @@ -1194,7 +1198,6 @@ test_imgfile test_linuxaudiodev test_locale - test_macfs test_macostools test_nis test_ossaudiodev @@ -1231,7 +1234,6 @@ test_gzip test_imgfile test_linuxaudiodev - test_macfs test_macostools test_nis test_ossaudiodev @@ -1260,7 +1262,6 @@ test_imgfile test_linuxaudiodev test_locale - test_macfs test_macostools test_nis test_normalization @@ -1294,7 +1295,6 @@ test_imgfile test_linuxaudiodev test_locale - test_macfs test_macostools test_nis test_ossaudiodev @@ -1333,11 +1333,10 @@ self.expected.add('test_timeout') if sys.maxint == 9223372036854775807L: - self.expected.add('test_rgbimg') self.expected.add('test_imageop') if not sys.platform in ("mac", "darwin"): - MAC_ONLY = ["test_macostools", "test_macfs", "test_aepack", + MAC_ONLY = ["test_macostools", "test_aepack", "test_plistlib", "test_scriptpackages"] for skip in MAC_ONLY: self.expected.add(skip) @@ -1348,6 +1347,11 @@ for skip in WIN_ONLY: self.expected.add(skip) + if sys.platform != 'irix': + IRIX_ONLY =["test_imageop"] + for skip in IRIX_ONLY: + self.expected.add(skip) + self.valid = True def isvalid(self): Modified: python/branches/bcannon-objcap/Lib/test/string_tests.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/string_tests.py (original) +++ python/branches/bcannon-objcap/Lib/test/string_tests.py Fri May 25 22:13:08 2007 @@ -2,7 +2,7 @@ Common tests shared by test_str, test_unicode, test_userstring and test_string. """ -import unittest, string, sys +import unittest, string, sys, struct from test import test_support from UserList import UserList @@ -671,7 +671,7 @@ def test_replace_overflow(self): # Check for overflow checking on 32 bit machines - if sys.maxint != 2147483647: + if sys.maxint != 2147483647 or struct.calcsize("P") > 4: return A2_16 = "A" * (2**16) self.checkraises(OverflowError, A2_16, "replace", "", A2_16) @@ -1096,6 +1096,9 @@ self.checkequal('Abc', 'abc', 'translate', table) self.checkequal('xyz', 'xyz', 'translate', table) self.checkequal('yz', 'xyz', 'translate', table, 'x') + self.checkequal('yx', 'zyzzx', 'translate', None, 'z') + self.checkequal('zyzzx', 'zyzzx', 'translate', None, '') + self.checkequal('zyzzx', 'zyzzx', 'translate', None) self.checkraises(ValueError, 'xyz', 'translate', 'too short', 'strip') self.checkraises(ValueError, 'xyz', 'translate', 'too short') Modified: python/branches/bcannon-objcap/Lib/test/test___all__.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test___all__.py (original) +++ python/branches/bcannon-objcap/Lib/test/test___all__.py Fri May 25 22:13:08 2007 @@ -1,16 +1,12 @@ import unittest -from test import test_support - -from test.test_support import verify, verbose +from test.test_support import verbose, run_unittest import sys import warnings -warnings.filterwarnings("ignore", - "the gopherlib module is deprecated", - DeprecationWarning, - "") warnings.filterwarnings("ignore", "the sets module is deprecated", DeprecationWarning, "") +warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*", + DeprecationWarning) class AllTest(unittest.TestCase): @@ -22,15 +18,15 @@ # Silent fail here seems the best route since some modules # may not be available in all environments. return - verify(hasattr(sys.modules[modname], "__all__"), - "%s has no __all__ attribute" % modname) + self.failUnless(hasattr(sys.modules[modname], "__all__"), + "%s has no __all__ attribute" % modname) names = {} exec "from %s import *" % modname in names - if names.has_key("__builtins__"): + if "__builtins__" in names: del names["__builtins__"] keys = set(names) all = set(sys.modules[modname].__all__) - verify(keys==all, "%s != %s" % (keys, all)) + self.assertEqual(keys, all) def test_all(self): if not sys.platform.startswith('java'): @@ -84,7 +80,6 @@ self.check_all("getpass") self.check_all("gettext") self.check_all("glob") - self.check_all("gopherlib") self.check_all("gzip") self.check_all("heapq") self.check_all("htmllib") @@ -181,7 +176,7 @@ def test_main(): - test_support.run_unittest(AllTest) + run_unittest(AllTest) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_array.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_array.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_array.py Fri May 25 22:13:08 2007 @@ -111,6 +111,21 @@ self.assertEqual(a.x, b.x) self.assertEqual(type(a), type(b)) + def test_pickle_for_empty_array(self): + for protocol in (0, 1, 2): + a = array.array(self.typecode) + b = loads(dumps(a, protocol)) + self.assertNotEqual(id(a), id(b)) + self.assertEqual(a, b) + + a = ArraySubclass(self.typecode) + a.x = 10 + b = loads(dumps(a, protocol)) + self.assertNotEqual(id(a), id(b)) + self.assertEqual(a, b) + self.assertEqual(a.x, b.x) + self.assertEqual(type(a), type(b)) + def test_insert(self): a = array.array(self.typecode, self.example) a.insert(0, self.example[0]) @@ -713,7 +728,6 @@ return array.array.__new__(cls, 'c', s) def __init__(self, s, color='blue'): - array.array.__init__(self, 'c', s) self.color = color def strip(self): Modified: python/branches/bcannon-objcap/Lib/test/test_base64.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_base64.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_base64.py Fri May 25 22:13:08 2007 @@ -183,16 +183,8 @@ -def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(LegacyBase64TestCase)) - suite.addTest(unittest.makeSuite(BaseXYTestCase)) - return suite - - def test_main(): - test_support.run_suite(suite()) - + test_support.run_unittest(__name__) if __name__ == '__main__': - unittest.main(defaultTest='suite') + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_binascii.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_binascii.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_binascii.py Fri May 25 22:13:08 2007 @@ -148,6 +148,15 @@ "0"*75+"=\r\n=FF\r\n=FF\r\n=FF" ) + self.assertEqual(binascii.b2a_qp('\0\n'), '=00\n') + self.assertEqual(binascii.b2a_qp('\0\n', quotetabs=True), '=00\n') + self.assertEqual(binascii.b2a_qp('foo\tbar\t\n'), 'foo\tbar=09\n') + self.assertEqual(binascii.b2a_qp('foo\tbar\t\n', quotetabs=True), 'foo=09bar=09\n') + + self.assertEqual(binascii.b2a_qp('.'), '=2E') + self.assertEqual(binascii.b2a_qp('.\n'), '=2E\n') + self.assertEqual(binascii.b2a_qp('a.\n'), 'a.\n') + def test_empty_string(self): # A test for SF bug #1022953. Make sure SystemError is not raised. for n in ['b2a_qp', 'a2b_hex', 'b2a_base64', 'a2b_uu', 'a2b_qp', Modified: python/branches/bcannon-objcap/Lib/test/test_bsddb.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_bsddb.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_bsddb.py Fri May 25 22:13:08 2007 @@ -205,7 +205,7 @@ # create iterator i = self.f.iteritems() nc2 = len(self.f._cursor_refs) - # use the iterator (should run to the first yeild, creating the cursor) + # use the iterator (should run to the first yield, creating the cursor) k, v = i.next() nc3 = len(self.f._cursor_refs) # destroy the iterator; this should cause the weakref callback Modified: python/branches/bcannon-objcap/Lib/test/test_bsddb3.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_bsddb3.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_bsddb3.py Fri May 25 22:13:08 2007 @@ -4,11 +4,11 @@ """ import sys import unittest -from test.test_support import requires, verbose, run_suite, unlink +from test.test_support import requires, verbose, run_unittest, unlink # When running as a script instead of within the regrtest framework, skip the # requires test, since it's obvious we want to run them. -if __name__ <> '__main__': +if __name__ != '__main__': requires('bsddb') verbose = False @@ -58,9 +58,7 @@ # For invocation through regrtest def test_main(): - tests = suite() - run_suite(tests) - + run_unittest(suite()) # For invocation as a script if __name__ == '__main__': @@ -73,4 +71,4 @@ print 'python version: %s' % sys.version print '-=' * 38 - unittest.main(defaultTest='suite') + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_builtin.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_builtin.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_builtin.py Fri May 25 22:13:08 2007 @@ -107,9 +107,12 @@ __import__('sys') __import__('time') __import__('string') + __import__(name='sys') + __import__(name='time', level=0) self.assertRaises(ImportError, __import__, 'spamspam') self.assertRaises(TypeError, __import__, 1, 2, 3, 4) self.assertRaises(ValueError, __import__, '') + self.assertRaises(TypeError, __import__, 'sys', name='sys') def test_abs(self): # int @@ -243,15 +246,21 @@ compile('print 1\n', '', 'exec') bom = '\xef\xbb\xbf' compile(bom + 'print 1\n', '', 'exec') + compile(source='pass', filename='?', mode='exec') + compile(dont_inherit=0, filename='tmp', source='0', mode='eval') + compile('pass', '?', dont_inherit=1, mode='exec') self.assertRaises(TypeError, compile) self.assertRaises(ValueError, compile, 'print 42\n', '', 'badmode') self.assertRaises(ValueError, compile, 'print 42\n', '', 'single', 0xff) self.assertRaises(TypeError, compile, chr(0), 'f', 'exec') + self.assertRaises(TypeError, compile, 'pass', '?', 'exec', + mode='eval', source='0', filename='tmp') if have_unicode: compile(unicode('print u"\xc3\xa5"\n', 'utf8'), '', 'exec') self.assertRaises(TypeError, compile, unichr(0), 'f', 'exec') self.assertRaises(ValueError, compile, unicode('a = 1'), 'f', 'bad') + def test_delattr(self): import sys sys.spam = 1 @@ -259,12 +268,67 @@ self.assertRaises(TypeError, delattr) def test_dir(self): - x = 1 - self.assert_('x' in dir()) - import sys - self.assert_('modules' in dir(sys)) + # dir(wrong number of arguments) self.assertRaises(TypeError, dir, 42, 42) + # dir() - local scope + local_var = 1 + self.assert_('local_var' in dir()) + + # dir(module) + import sys + self.assert_('exit' in dir(sys)) + + # dir(module_with_invalid__dict__) + import types + class Foo(types.ModuleType): + __dict__ = 8 + f = Foo("foo") + self.assertRaises(TypeError, dir, f) + + # dir(type) + self.assert_("strip" in dir(str)) + self.assert_("__mro__" not in dir(str)) + + # dir(obj) + class Foo(object): + def __init__(self): + self.x = 7 + self.y = 8 + self.z = 9 + f = Foo() + self.assert_("y" in dir(f)) + + # dir(obj_no__dict__) + class Foo(object): + __slots__ = [] + f = Foo() + self.assert_("__repr__" in dir(f)) + + # dir(obj_no__class__with__dict__) + # (an ugly trick to cause getattr(f, "__class__") to fail) + class Foo(object): + __slots__ = ["__class__", "__dict__"] + def __init__(self): + self.bar = "wow" + f = Foo() + self.assert_("__repr__" not in dir(f)) + self.assert_("bar" in dir(f)) + + # dir(obj_using __dir__) + class Foo(object): + def __dir__(self): + return ["kan", "ga", "roo"] + f = Foo() + self.assert_(dir(f) == ["ga", "kan", "roo"]) + + # dir(obj__dir__not_list) + class Foo(object): + def __dir__(self): + return 7 + f = Foo() + self.assertRaises(TypeError, dir, f) + def test_divmod(self): self.assertEqual(divmod(12, 7), (1, 5)) self.assertEqual(divmod(-12, 7), (-2, 2)) @@ -1017,6 +1081,11 @@ self.assertRaises(ValueError, long, '53', 40) self.assertRaises(TypeError, long, 1, 12) + # SF patch #1638879: embedded NULs were not detected with + # explicit base + self.assertRaises(ValueError, long, '123\0', 10) + self.assertRaises(ValueError, long, '123\x00 245', 20) + self.assertEqual(long('100000000000000000000000000000000', 2), 4294967296) self.assertEqual(long('102002022201221111211', 3), 4294967296) Modified: python/branches/bcannon-objcap/Lib/test/test_bz2.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_bz2.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_bz2.py Fri May 25 22:13:08 2007 @@ -5,7 +5,7 @@ import unittest from cStringIO import StringIO import os -import popen2 +import subprocess import sys import bz2 @@ -21,18 +21,20 @@ if has_cmdline_bunzip2: def decompress(self, data): - pop = popen2.Popen3("bunzip2", capturestderr=1) - pop.tochild.write(data) - pop.tochild.close() - ret = pop.fromchild.read() - pop.fromchild.close() + pop = subprocess.Popen("bunzip2", shell=True, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + pop.stdin.write(data) + pop.stdin.close() + ret = pop.stdout.read() + pop.stdout.close() if pop.wait() != 0: ret = bz2.decompress(data) return ret else: - # popen2.Popen3 doesn't exist on Windows, and even if it did, bunzip2 - # isn't available to run. + # bunzip2 isn't available to run on Windows. def decompress(self, data): return bz2.decompress(data) Modified: python/branches/bcannon-objcap/Lib/test/test_cfgparser.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_cfgparser.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_cfgparser.py Fri May 25 22:13:08 2007 @@ -422,6 +422,18 @@ self.assertEqual(cf.get("section", "ok"), "xxx/%s") self.assertEqual(cf.get("section", "not_ok"), "xxx/xxx/%s") + def test_set_malformatted_interpolation(self): + cf = self.fromstring("[sect]\n" + "option1=foo\n") + + self.assertEqual(cf.get('sect', "option1"), "foo") + + self.assertRaises(ValueError, cf.set, "sect", "option1", "%foo") + self.assertRaises(ValueError, cf.set, "sect", "option1", "foo%") + self.assertRaises(ValueError, cf.set, "sect", "option1", "f%oo") + + self.assertEqual(cf.get('sect', "option1"), "foo") + def test_set_nonstring_types(self): cf = self.fromstring("[sect]\n" "option1=foo\n") Modified: python/branches/bcannon-objcap/Lib/test/test_cmath.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_cmath.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_cmath.py Fri May 25 22:13:08 2007 @@ -1,52 +1,196 @@ -#! /usr/bin/env python -""" Simple test script for cmathmodule.c - Roger E. Masse -""" +from test.test_support import run_unittest +import unittest import cmath, math -from test.test_support import verbose, verify, TestFailed -verify(abs(cmath.log(10) - math.log(10)) < 1e-9) -verify(abs(cmath.log(10,2) - math.log(10,2)) < 1e-9) -try: - cmath.log('a') -except TypeError: - pass -else: - raise TestFailed - -try: - cmath.log(10, 'a') -except TypeError: - pass -else: - raise TestFailed - - -testdict = {'acos' : 1.0, - 'acosh' : 1.0, - 'asin' : 1.0, - 'asinh' : 1.0, - 'atan' : 0.2, - 'atanh' : 0.2, - 'cos' : 1.0, - 'cosh' : 1.0, - 'exp' : 1.0, - 'log' : 1.0, - 'log10' : 1.0, - 'sin' : 1.0, - 'sinh' : 1.0, - 'sqrt' : 1.0, - 'tan' : 1.0, - 'tanh' : 1.0} - -for func in testdict.keys(): - f = getattr(cmath, func) - r = f(testdict[func]) - if verbose: - print 'Calling %s(%f) = %f' % (func, testdict[func], abs(r)) - -p = cmath.pi -e = cmath.e -if verbose: - print 'PI = ', abs(p) - print 'E = ', abs(e) +class CMathTests(unittest.TestCase): + # list of all functions in cmath + test_functions = [getattr(cmath, fname) for fname in [ + 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', + 'cos', 'cosh', 'exp', 'log', 'log10', 'sin', 'sinh', + 'sqrt', 'tan', 'tanh']] + # test first and second arguments independently for 2-argument log + test_functions.append(lambda x : cmath.log(x, 1729. + 0j)) + test_functions.append(lambda x : cmath.log(14.-27j, x)) + + def cAssertAlmostEqual(self, a, b, rel_eps = 1e-10, abs_eps = 1e-100): + """Check that two complex numbers are almost equal.""" + # the two complex numbers are considered almost equal if + # either the relative error is <= rel_eps or the absolute error + # is tiny, <= abs_eps. + if a == b == 0: + return + absolute_error = abs(a-b) + relative_error = absolute_error/max(abs(a), abs(b)) + if relative_error > rel_eps and absolute_error > abs_eps: + self.fail("%s and %s are not almost equal" % (a, b)) + + def test_constants(self): + e_expected = 2.71828182845904523536 + pi_expected = 3.14159265358979323846 + self.assertAlmostEqual(cmath.pi, pi_expected, 9, + "cmath.pi is %s; should be %s" % (cmath.pi, pi_expected)) + self.assertAlmostEqual(cmath.e, e_expected, 9, + "cmath.e is %s; should be %s" % (cmath.e, e_expected)) + + def test_user_object(self): + # Test automatic calling of __complex__ and __float__ by cmath + # functions + + # some random values to use as test values; we avoid values + # for which any of the functions in cmath is undefined + # (i.e. 0., 1., -1., 1j, -1j) or would cause overflow + cx_arg = 4.419414439 + 1.497100113j + flt_arg = -6.131677725 + + # a variety of non-complex numbers, used to check that + # non-complex return values from __complex__ give an error + non_complexes = ["not complex", 1, 5L, 2., None, + object(), NotImplemented] + + # Now we introduce a variety of classes whose instances might + # end up being passed to the cmath functions + + # usual case: new-style class implementing __complex__ + class MyComplex(object): + def __init__(self, value): + self.value = value + def __complex__(self): + return self.value + + # old-style class implementing __complex__ + class MyComplexOS: + def __init__(self, value): + self.value = value + def __complex__(self): + return self.value + + # classes for which __complex__ raises an exception + class SomeException(Exception): + pass + class MyComplexException(object): + def __complex__(self): + raise SomeException + class MyComplexExceptionOS: + def __complex__(self): + raise SomeException + + # some classes not providing __float__ or __complex__ + class NeitherComplexNorFloat(object): + pass + class NeitherComplexNorFloatOS: + pass + class MyInt(object): + def __int__(self): return 2 + def __long__(self): return 2L + def __index__(self): return 2 + class MyIntOS: + def __int__(self): return 2 + def __long__(self): return 2L + def __index__(self): return 2 + + # other possible combinations of __float__ and __complex__ + # that should work + class FloatAndComplex(object): + def __float__(self): + return flt_arg + def __complex__(self): + return cx_arg + class FloatAndComplexOS: + def __float__(self): + return flt_arg + def __complex__(self): + return cx_arg + class JustFloat(object): + def __float__(self): + return flt_arg + class JustFloatOS: + def __float__(self): + return flt_arg + + for f in self.test_functions: + # usual usage + self.cAssertAlmostEqual(f(MyComplex(cx_arg)), f(cx_arg)) + self.cAssertAlmostEqual(f(MyComplexOS(cx_arg)), f(cx_arg)) + # other combinations of __float__ and __complex__ + self.cAssertAlmostEqual(f(FloatAndComplex()), f(cx_arg)) + self.cAssertAlmostEqual(f(FloatAndComplexOS()), f(cx_arg)) + self.cAssertAlmostEqual(f(JustFloat()), f(flt_arg)) + self.cAssertAlmostEqual(f(JustFloatOS()), f(flt_arg)) + # TypeError should be raised for classes not providing + # either __complex__ or __float__, even if they provide + # __int__, __long__ or __index__. An old-style class + # currently raises AttributeError instead of a TypeError; + # this could be considered a bug. + self.assertRaises(TypeError, f, NeitherComplexNorFloat()) + self.assertRaises(TypeError, f, MyInt()) + self.assertRaises(Exception, f, NeitherComplexNorFloatOS()) + self.assertRaises(Exception, f, MyIntOS()) + # non-complex return value from __complex__ -> TypeError + for bad_complex in non_complexes: + self.assertRaises(TypeError, f, MyComplex(bad_complex)) + self.assertRaises(TypeError, f, MyComplexOS(bad_complex)) + # exceptions in __complex__ should be propagated correctly + self.assertRaises(SomeException, f, MyComplexException()) + self.assertRaises(SomeException, f, MyComplexExceptionOS()) + + def test_input_type(self): + # ints and longs should be acceptable inputs to all cmath + # functions, by virtue of providing a __float__ method + for f in self.test_functions: + for arg in [2, 2L, 2.]: + self.cAssertAlmostEqual(f(arg), f(arg.__float__())) + + # but strings should give a TypeError + for f in self.test_functions: + for arg in ["a", "long_string", "0", "1j", ""]: + self.assertRaises(TypeError, f, arg) + + def test_cmath_matches_math(self): + # check that corresponding cmath and math functions are equal + # for floats in the appropriate range + + # test_values in (0, 1) + test_values = [0.01, 0.1, 0.2, 0.5, 0.9, 0.99] + + # test_values for functions defined on [-1., 1.] + unit_interval = test_values + [-x for x in test_values] + \ + [0., 1., -1.] + + # test_values for log, log10, sqrt + positive = test_values + [1.] + [1./x for x in test_values] + nonnegative = [0.] + positive + + # test_values for functions defined on the whole real line + real_line = [0.] + positive + [-x for x in positive] + + test_functions = { + 'acos' : unit_interval, + 'asin' : unit_interval, + 'atan' : real_line, + 'cos' : real_line, + 'cosh' : real_line, + 'exp' : real_line, + 'log' : positive, + 'log10' : positive, + 'sin' : real_line, + 'sinh' : real_line, + 'sqrt' : nonnegative, + 'tan' : real_line, + 'tanh' : real_line} + + for fn, values in test_functions.items(): + float_fn = getattr(math, fn) + complex_fn = getattr(cmath, fn) + for v in values: + self.cAssertAlmostEqual(float_fn(v), complex_fn(v)) + + # test two-argument version of log with various bases + for base in [0.5, 2., 10.]: + for v in positive: + self.cAssertAlmostEqual(cmath.log(v, base), math.log(v, base)) + +def test_main(): + run_unittest(CMathTests) + +if __name__ == "__main__": + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_cmd_line.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_cmd_line.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_cmd_line.py Fri May 25 22:13:08 2007 @@ -1,18 +1,19 @@ import test.test_support, unittest import sys -import popen2 import subprocess class CmdLineTest(unittest.TestCase): def start_python(self, cmd_line): - outfp, infp = popen2.popen4('%s %s' % (sys.executable, cmd_line)) - infp.close() - data = outfp.read() - outfp.close() + cmd = '"%s" %s' % (sys.executable, cmd_line) + p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + p.stdin.close() + data = p.stdout.read() + p.stdout.close() # try to cleanup the child so we don't appear to leak when running # with regrtest -R. This should be a no-op on Windows. - popen2._cleanup() + subprocess._cleanup() return data def exit_code(self, *args): Modified: python/branches/bcannon-objcap/Lib/test/test_codecencodings_cn.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecencodings_cn.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecencodings_cn.py Fri May 25 22:13:08 2007 @@ -51,11 +51,7 @@ has_iso10646 = True def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_GB2312)) - suite.addTest(unittest.makeSuite(Test_GBK)) - suite.addTest(unittest.makeSuite(Test_GB18030)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecencodings_hk.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecencodings_hk.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecencodings_hk.py Fri May 25 22:13:08 2007 @@ -21,9 +21,7 @@ ) def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_Big5HKSCS)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecencodings_jp.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecencodings_jp.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecencodings_jp.py Fri May 25 22:13:08 2007 @@ -99,13 +99,7 @@ ) def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_CP932)) - suite.addTest(unittest.makeSuite(Test_EUC_JISX0213)) - suite.addTest(unittest.makeSuite(Test_EUC_JP_COMPAT)) - suite.addTest(unittest.makeSuite(Test_SJIS_COMPAT)) - suite.addTest(unittest.makeSuite(Test_SJISX0213)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecencodings_kr.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecencodings_kr.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecencodings_kr.py Fri May 25 22:13:08 2007 @@ -45,11 +45,7 @@ ) def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_CP949)) - suite.addTest(unittest.makeSuite(Test_EUCKR)) - suite.addTest(unittest.makeSuite(Test_JOHAB)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecencodings_tw.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecencodings_tw.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecencodings_tw.py Fri May 25 22:13:08 2007 @@ -21,9 +21,7 @@ ) def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_Big5)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecmaps_cn.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecmaps_cn.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecmaps_cn.py Fri May 25 22:13:08 2007 @@ -20,10 +20,7 @@ 'MICSFT/WINDOWS/CP936.TXT' def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestGB2312Map)) - suite.addTest(unittest.makeSuite(TestGBKMap)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecmaps_hk.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecmaps_hk.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecmaps_hk.py Fri May 25 22:13:08 2007 @@ -14,9 +14,7 @@ mapfileurl = 'http://people.freebsd.org/~perky/i18n/BIG5HKSCS.TXT' def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestBig5HKSCSMap)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecmaps_jp.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecmaps_jp.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecmaps_jp.py Fri May 25 22:13:08 2007 @@ -61,13 +61,7 @@ def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestCP932Map)) - suite.addTest(unittest.makeSuite(TestEUCJPCOMPATMap)) - suite.addTest(unittest.makeSuite(TestSJISCOMPATMap)) - suite.addTest(unittest.makeSuite(TestEUCJISX0213Map)) - suite.addTest(unittest.makeSuite(TestSJISX0213Map)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecmaps_kr.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecmaps_kr.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecmaps_kr.py Fri May 25 22:13:08 2007 @@ -34,11 +34,7 @@ pass_dectest = [('\\', u'\u20a9')] def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestCP949Map)) - suite.addTest(unittest.makeSuite(TestEUCKRMap)) - suite.addTest(unittest.makeSuite(TestJOHABMap)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecmaps_tw.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecmaps_tw.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecmaps_tw.py Fri May 25 22:13:08 2007 @@ -25,10 +25,7 @@ ] def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestBIG5Map)) - suite.addTest(unittest.makeSuite(TestCP950Map)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_codecs.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_codecs.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_codecs.py Fri May 25 22:13:08 2007 @@ -429,6 +429,11 @@ # SF bug #1601501: check that the codec works with a buffer unicode("\xef\xbb\xbf", "utf-8-sig") + def test_bom(self): + d = codecs.getincrementaldecoder("utf-8-sig")() + s = u"spam" + self.assertEqual(d.decode(s.encode("utf-8-sig")), s) + class EscapeDecodeTest(unittest.TestCase): def test_empty(self): self.assertEquals(codecs.escape_decode(""), ("", 0)) Modified: python/branches/bcannon-objcap/Lib/test/test_commands.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_commands.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_commands.py Fri May 25 22:13:08 2007 @@ -4,6 +4,10 @@ ''' import unittest import os, tempfile, re +import warnings + +warnings.filterwarnings('ignore', r".*commands.getstatus.. is deprecated", + DeprecationWarning) from test.test_support import TestSkipped, run_unittest, reap_children from commands import * Modified: python/branches/bcannon-objcap/Lib/test/test_compile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_compile.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_compile.py Fri May 25 22:13:08 2007 @@ -394,6 +394,19 @@ del d[..., ...] self.assertEqual((Ellipsis, Ellipsis) in d, False) + def test_mangling(self): + class A: + def f(): + __mangled = 1 + __not_mangled__ = 2 + import __mangled_mod + import __package__.module + + self.assert_("_A__mangled" in A.f.func_code.co_varnames) + self.assert_("__not_mangled__" in A.f.func_code.co_varnames) + self.assert_("_A__mangled_mod" in A.f.func_code.co_varnames) + self.assert_("__package__" in A.f.func_code.co_varnames) + def test_main(): test_support.run_unittest(TestSpecifics) Modified: python/branches/bcannon-objcap/Lib/test/test_complex.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_complex.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_complex.py Fri May 25 22:13:08 2007 @@ -215,6 +215,8 @@ self.assertAlmostEqual(complex(), 0) self.assertAlmostEqual(complex("-1"), -1) self.assertAlmostEqual(complex("+1"), +1) + self.assertAlmostEqual(complex("(1+2j)"), 1+2j) + self.assertAlmostEqual(complex("(1.3+2.2j)"), 1.3+2.2j) class complex2(complex): pass self.assertAlmostEqual(complex(complex2(1+1j)), 1+1j) @@ -244,12 +246,17 @@ self.assertRaises(ValueError, complex, "") self.assertRaises(TypeError, complex, None) self.assertRaises(ValueError, complex, "\0") + self.assertRaises(ValueError, complex, "3\09") self.assertRaises(TypeError, complex, "1", "2") self.assertRaises(TypeError, complex, "1", 42) self.assertRaises(TypeError, complex, 1, "2") self.assertRaises(ValueError, complex, "1+") self.assertRaises(ValueError, complex, "1+1j+1j") self.assertRaises(ValueError, complex, "--") + self.assertRaises(ValueError, complex, "(1+2j") + self.assertRaises(ValueError, complex, "1+2j)") + self.assertRaises(ValueError, complex, "1+(2j)") + self.assertRaises(ValueError, complex, "(1+2j)123") if test_support.have_unicode: self.assertRaises(ValueError, complex, unicode("1"*500)) self.assertRaises(ValueError, complex, unicode("x")) @@ -312,6 +319,11 @@ self.assertNotEqual(repr(-(1+0j)), '(-1+-0j)') + self.assertEqual(1-6j,complex(repr(1-6j))) + self.assertEqual(1+6j,complex(repr(1+6j))) + self.assertEqual(-6j,complex(repr(-6j))) + self.assertEqual(6j,complex(repr(6j))) + def test_neg(self): self.assertEqual(-(1+6j), -1-6j) Modified: python/branches/bcannon-objcap/Lib/test/test_contextlib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_contextlib.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_contextlib.py Fri May 25 22:13:08 2007 @@ -9,7 +9,7 @@ import unittest import threading from contextlib import * # Tests __all__ -from test.test_support import run_suite +from test import test_support class ContextManagerTestCase(unittest.TestCase): @@ -332,9 +332,7 @@ # This is needed to make the test actually run under regrtest.py! def test_main(): - run_suite( - unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) - ) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_crypt.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_crypt.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_crypt.py Fri May 25 22:13:08 2007 @@ -3,7 +3,7 @@ Roger E. Masse """ -from test.test_support import verify, verbose +from test.test_support import verbose import crypt c = crypt.crypt('mypassword', 'ab') Modified: python/branches/bcannon-objcap/Lib/test/test_csv.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_csv.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_csv.py Fri May 25 22:13:08 2007 @@ -484,12 +484,16 @@ self.readerAssertEqual('a"b"c', [['a"b"c']]) def test_quotes_and_more(self): + # Excel would never write a field containing '"a"b', but when + # reading one, it will return 'ab'. self.readerAssertEqual('"a"b', [['ab']]) def test_lone_quote(self): self.readerAssertEqual('a"b', [['a"b']]) def test_quote_and_quote(self): + # Excel would never write a field containing '"a" "b"', but when + # reading one, it will return 'a "b"'. self.readerAssertEqual('"a" "b"', [['a "b"']]) def test_space_and_quote(self): Modified: python/branches/bcannon-objcap/Lib/test/test_ctypes.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_ctypes.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_ctypes.py Fri May 25 22:13:08 2007 @@ -1,12 +1,12 @@ import unittest -from test.test_support import run_suite +from test.test_support import run_unittest import ctypes.test def test_main(): skipped, testcases = ctypes.test.get_tests(ctypes.test, "test_*.py", verbosity=0) suites = [unittest.makeSuite(t) for t in testcases] - run_suite(unittest.TestSuite(suites)) + run_unittest(unittest.TestSuite(suites)) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_curses.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_curses.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_curses.py Fri May 25 22:13:08 2007 @@ -129,6 +129,12 @@ stdscr.touchline(5,5,0) stdscr.vline('a', 3) stdscr.vline('a', 3, curses.A_STANDOUT) + stdscr.chgat(5, 2, 3, curses.A_BLINK) + stdscr.chgat(3, curses.A_BOLD) + stdscr.chgat(5, 8, curses.A_UNDERLINE) + stdscr.chgat(curses.A_BLINK) + stdscr.refresh() + stdscr.vline(1,1, 'a', 3) stdscr.vline(1,1, 'a', 3, curses.A_STANDOUT) @@ -241,12 +247,21 @@ except curses.panel.error: pass +def test_resize_term(stdscr): + if hasattr(curses, 'resizeterm'): + lines, cols = curses.LINES, curses.COLS + curses.resizeterm(lines - 1, cols + 1) + + if curses.LINES != lines - 1 or curses.COLS != cols + 1: + raise RuntimeError, "Expected resizeterm to update LINES and COLS" + def main(stdscr): curses.savetty() try: module_funcs(stdscr) window_funcs(stdscr) test_userptr_without_set(stdscr) + test_resize_term(stdscr) finally: curses.resetty() Modified: python/branches/bcannon-objcap/Lib/test/test_datetime.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_datetime.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_datetime.py Fri May 25 22:13:08 2007 @@ -3,6 +3,7 @@ See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases """ +import os import sys import pickle import cPickle @@ -127,7 +128,7 @@ # Base clase for testing a particular aspect of timedelta, time, date and # datetime comparisons. -class HarmlessMixedComparison(unittest.TestCase): +class HarmlessMixedComparison: # Test that __eq__ and __ne__ don't complain for mixed-type comparisons. # Subclasses must define 'theclass', and theclass(1, 1, 1) must be a @@ -166,7 +167,7 @@ ############################################################################# # timedelta tests -class TestTimeDelta(HarmlessMixedComparison): +class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase): theclass = timedelta @@ -513,7 +514,7 @@ class SubclassDate(date): sub_var = 1 -class TestDate(HarmlessMixedComparison): +class TestDate(HarmlessMixedComparison, unittest.TestCase): # Tests here should pass for both dates and datetimes, except for a # few tests that TestDateTime overrides. @@ -1425,6 +1426,21 @@ self.assertRaises(ValueError, self.theclass.utcfromtimestamp, insane) + def test_negative_float_fromtimestamp(self): + # Windows doesn't accept negative timestamps + if os.name == "nt": + return + # The result is tz-dependent; at least test that this doesn't + # fail (like it did before bug 1646728 was fixed). + self.theclass.fromtimestamp(-1.05) + + def test_negative_float_utcfromtimestamp(self): + # Windows doesn't accept negative timestamps + if os.name == "nt": + return + d = self.theclass.utcfromtimestamp(-1.05) + self.assertEquals(d, self.theclass(1969, 12, 31, 23, 59, 58, 950000)) + def test_utcnow(self): import time @@ -1580,7 +1596,7 @@ class SubclassTime(time): sub_var = 1 -class TestTime(HarmlessMixedComparison): +class TestTime(HarmlessMixedComparison, unittest.TestCase): theclass = time @@ -1740,6 +1756,11 @@ self.assertEqual(t.isoformat(), "00:00:00.100000") self.assertEqual(t.isoformat(), str(t)) + def test_1653736(self): + # verify it doesn't accept extra keyword arguments + t = self.theclass(second=1) + self.assertRaises(TypeError, t.isoformat, foo=3) + def test_strftime(self): t = self.theclass(1, 2, 3, 4) self.assertEqual(t.strftime('%H %M %S'), "01 02 03") @@ -1858,7 +1879,7 @@ # A mixin for classes with a tzinfo= argument. Subclasses must define # theclass as a class atribute, and theclass(1, 1, 1, tzinfo=whatever) # must be legit (which is true for time and datetime). -class TZInfoBase(unittest.TestCase): +class TZInfoBase: def test_argument_passing(self): cls = self.theclass @@ -2018,7 +2039,7 @@ # Testing time objects with a non-None tzinfo. -class TestTimeTZ(TestTime, TZInfoBase): +class TestTimeTZ(TestTime, TZInfoBase, unittest.TestCase): theclass = time def test_empty(self): @@ -2266,7 +2287,7 @@ # Testing datetime objects with a non-None tzinfo. -class TestDateTimeTZ(TestDateTime, TZInfoBase): +class TestDateTimeTZ(TestDateTime, TZInfoBase, unittest.TestCase): theclass = datetime def test_trivial(self): @@ -3227,45 +3248,8 @@ self.assertEqual(as_datetime, datetime_sc) self.assertEqual(datetime_sc, as_datetime) -def test_suite(): - allsuites = [unittest.makeSuite(klass, 'test') - for klass in (TestModule, - TestTZInfo, - TestTimeDelta, - TestDateOnly, - TestDate, - TestDateTime, - TestTime, - TestTimeTZ, - TestDateTimeTZ, - TestTimezoneConversions, - Oddballs, - ) - ] - return unittest.TestSuite(allsuites) - def test_main(): - import gc - import sys - - thesuite = test_suite() - lastrc = None - while True: - test_support.run_suite(thesuite) - if 1: # change to 0, under a debug build, for some leak detection - break - gc.collect() - if gc.garbage: - raise SystemError("gc.garbage not empty after test run: %r" % - gc.garbage) - if hasattr(sys, 'gettotalrefcount'): - thisrc = sys.gettotalrefcount() - print >> sys.stderr, '*' * 10, 'total refs:', thisrc, - if lastrc: - print >> sys.stderr, 'delta:', thisrc - lastrc - else: - print >> sys.stderr - lastrc = thisrc + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_dbm.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_dbm.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_dbm.py Fri May 25 22:13:08 2007 @@ -6,11 +6,11 @@ import random import dbm from dbm import error -from test.test_support import verbose, verify, TestSkipped +from test.test_support import verbose, verify, TestSkipped, TESTFN # make filename unique to allow multiple concurrent tests # and to minimize the likelihood of a problem from an old file -filename = '/tmp/delete_me_' + str(random.random())[-6:] +filename = TESTFN def cleanup(): for suffix in ['', '.pag', '.dir', '.db']: Modified: python/branches/bcannon-objcap/Lib/test/test_defaultdict.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_defaultdict.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_defaultdict.py Fri May 25 22:13:08 2007 @@ -47,6 +47,7 @@ self.assertEqual(err.args, (15,)) else: self.fail("d2[15] didn't raise KeyError") + self.assertRaises(TypeError, defaultdict, 1) def test_missing(self): d1 = defaultdict() @@ -60,10 +61,10 @@ self.assertEqual(repr(d1), "defaultdict(None, {})") d1[11] = 41 self.assertEqual(repr(d1), "defaultdict(None, {11: 41})") - d2 = defaultdict(0) - self.assertEqual(d2.default_factory, 0) + d2 = defaultdict(int) + self.assertEqual(d2.default_factory, int) d2[12] = 42 - self.assertEqual(repr(d2), "defaultdict(0, {12: 42})") + self.assertEqual(repr(d2), "defaultdict(, {12: 42})") def foo(): return 43 d3 = defaultdict(foo) self.assert_(d3.default_factory is foo) @@ -131,6 +132,15 @@ self.assertEqual(d2.default_factory, list) self.assertEqual(d2, d1) + def test_keyerror_without_factory(self): + d1 = defaultdict() + try: + d1[(1,)] + except KeyError, err: + self.assertEqual(err.args[0], (1,)) + else: + self.fail("expected KeyError") + def test_main(): test_support.run_unittest(TestDefaultDict) Modified: python/branches/bcannon-objcap/Lib/test/test_descr.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_descr.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_descr.py Fri May 25 22:13:08 2007 @@ -4,6 +4,7 @@ from copy import deepcopy import warnings import objcap +import types warnings.filterwarnings("ignore", r'complex divmod\(\), // and % are deprecated$', @@ -821,6 +822,22 @@ except TypeError: pass else: raise TestFailed, "calling object w/o call method should raise TypeError" + # Testing code to find most derived baseclass + class A(type): + def __new__(*args, **kwargs): + return type.__new__(*args, **kwargs) + + class B(object): + pass + + class C(object): + __metaclass__ = A + + # The most derived metaclass of D is A rather than type. + class D(B, C): + pass + + def pymods(): if verbose: print "Testing Python subclass of module..." log = [] @@ -846,6 +863,16 @@ ("getattr", "foo"), ("delattr", "foo")]) + # http://python.org/sf/1174712 + try: + class Module(types.ModuleType, str): + pass + except TypeError: + pass + else: + raise TestFailed("inheriting from ModuleType and str at the " + "same time should fail") + def multi(): if verbose: print "Testing multiple inheritance..." class C(object): @@ -1210,6 +1237,45 @@ raise TestFailed, "[''] slots not caught" class C(object): __slots__ = ["a", "a_b", "_a", "A0123456789Z"] + # XXX(nnorwitz): was there supposed to be something tested + # from the class above? + + # Test a single string is not expanded as a sequence. + class C(object): + __slots__ = "abc" + c = C() + c.abc = 5 + vereq(c.abc, 5) + + # Test unicode slot names + try: + unicode + except NameError: + pass + else: + # Test a single unicode string is not expanded as a sequence. + class C(object): + __slots__ = unicode("abc") + c = C() + c.abc = 5 + vereq(c.abc, 5) + + # _unicode_to_string used to modify slots in certain circumstances + slots = (unicode("foo"), unicode("bar")) + class C(object): + __slots__ = slots + x = C() + x.foo = 5 + vereq(x.foo, 5) + veris(type(slots[0]), unicode) + # this used to leak references + try: + class C(object): + __slots__ = [unichr(128)] + except (TypeError, UnicodeEncodeError): + pass + else: + raise TestFailed, "[unichr(128)] slots not caught" # Test leaks class Counted(object): @@ -1456,6 +1522,22 @@ else: verify(0, "__slots__ = [1] should be illegal") + class M1(type): + pass + class M2(type): + pass + class A1(object): + __metaclass__ = M1 + class A2(object): + __metaclass__ = M2 + try: + class B(A1, A2): + pass + except TypeError: + pass + else: + verify(0, "finding the most derived metaclass should have failed") + def classmethods(): if verbose: print "Testing class methods..." class C(object): @@ -2227,7 +2309,6 @@ __slots__ = ['prec'] def __init__(self, value=0.0, prec=12): self.prec = int(prec) - float.__init__(value) def __repr__(self): return "%.*g" % (self.prec, self) vereq(repr(precfloat(1.1)), "1.1") @@ -2782,6 +2863,51 @@ cant(o, type(1)) cant(o, type(None)) del o + class G(object): + __slots__ = ["a", "b"] + class H(object): + __slots__ = ["b", "a"] + try: + unicode + except NameError: + class I(object): + __slots__ = ["a", "b"] + else: + class I(object): + __slots__ = [unicode("a"), unicode("b")] + class J(object): + __slots__ = ["c", "b"] + class K(object): + __slots__ = ["a", "b", "d"] + class L(H): + __slots__ = ["e"] + class M(I): + __slots__ = ["e"] + class N(J): + __slots__ = ["__weakref__"] + class P(J): + __slots__ = ["__dict__"] + class Q(J): + pass + class R(J): + __slots__ = ["__dict__", "__weakref__"] + + for cls, cls2 in ((G, H), (G, I), (I, H), (Q, R), (R, Q)): + x = cls() + x.a = 1 + x.__class__ = cls2 + verify(x.__class__ is cls2, + "assigning %r as __class__ for %r silently failed" % (cls2, x)) + vereq(x.a, 1) + x.__class__ = cls + verify(x.__class__ is cls, + "assigning %r as __class__ for %r silently failed" % (cls, x)) + vereq(x.a, 1) + for cls in G, J, K, L, M, N, P, R, list, Int: + for cls2 in G, J, K, L, M, N, P, R, list, Int: + if cls is cls2: + continue + cant(cls(), cls2) def setdict(): if verbose: print "Testing __dict__ assignment..." @@ -2800,8 +2926,73 @@ cant(a, []) cant(a, 1) del a.__dict__ # Deleting __dict__ is allowed - # Classes don't allow __dict__ assignment - cant(C, {}) + + class Base(object): + pass + def verify_dict_readonly(x): + """ + x has to be an instance of a class inheriting from Base. + """ + cant(x, {}) + try: + del x.__dict__ + except (AttributeError, TypeError): + pass + else: + raise TestFailed, "shouldn't allow del %r.__dict__" % x + dict_descr = Base.__dict__["__dict__"] + try: + dict_descr.__set__(x, {}) + except (AttributeError, TypeError): + pass + else: + raise TestFailed, "dict_descr allowed access to %r's dict" % x + + # Classes don't allow __dict__ assignment and have readonly dicts + class Meta1(type, Base): + pass + class Meta2(Base, type): + pass + class D(object): + __metaclass__ = Meta1 + class E(object): + __metaclass__ = Meta2 + for cls in C, D, E: + verify_dict_readonly(cls) + class_dict = cls.__dict__ + try: + class_dict["spam"] = "eggs" + except TypeError: + pass + else: + raise TestFailed, "%r's __dict__ can be modified" % cls + + # Modules also disallow __dict__ assignment + class Module1(types.ModuleType, Base): + pass + class Module2(Base, types.ModuleType): + pass + for ModuleType in Module1, Module2: + mod = ModuleType("spam") + verify_dict_readonly(mod) + mod.__dict__["spam"] = "eggs" + + # Exception's __dict__ can be replaced, but not deleted + class Exception1(Exception, Base): + pass + class Exception2(Base, Exception): + pass + for ExceptionType in Exception, Exception1, Exception2: + e = ExceptionType() + e.__dict__ = {"a": 1} + vereq(e.a, 1) + try: + del e.__dict__ + except (TypeError, AttributeError): + pass + else: + raise TestFaied, "%r's __dict__ can be deleted" % e + def pickles(): if verbose: @@ -4157,6 +4348,19 @@ check(iexpr, c, N1) check(iexpr, c, N2) +def test_assign_slice(): + # ceval.c's assign_slice used to check for + # tp->tp_as_sequence->sq_slice instead of + # tp->tp_as_sequence->sq_ass_slice + + class C(object): + def __setslice__(self, start, stop, value): + self.value = value + + c = C() + c[1:2] = 3 + vereq(c.value, 3) + def test_main(): weakref_segfault() # Must be first, somehow wrapper_segfault() @@ -4253,6 +4457,7 @@ test_init() methodwrapper() notimplemented() + test_assign_slice() if verbose: print "All OK" Modified: python/branches/bcannon-objcap/Lib/test/test_dict.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_dict.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_dict.py Fri May 25 22:13:08 2007 @@ -189,6 +189,14 @@ self.assertRaises(ValueError, {}.update, [(1, 2, 3)]) + # SF #1615701: make d.update(m) honor __getitem__() and keys() in dict subclasses + class KeyUpperDict(dict): + def __getitem__(self, key): + return key.upper() + d.clear() + d.update(KeyUpperDict.fromkeys('abc')) + self.assertEqual(d, {'a':'A', 'b':'B', 'c':'C'}) + def test_fromkeys(self): self.assertEqual(dict.fromkeys('abc'), {'a':None, 'b':None, 'c':None}) d = {} @@ -422,7 +430,7 @@ except RuntimeError, err: self.assertEqual(err.args, (42,)) else: - self.fail_("e[42] didn't raise RuntimeError") + self.fail("e[42] didn't raise RuntimeError") class F(dict): def __init__(self): # An instance variable __missing__ should have no effect @@ -433,7 +441,7 @@ except KeyError, err: self.assertEqual(err.args, (42,)) else: - self.fail_("f[42] didn't raise KeyError") + self.fail("f[42] didn't raise KeyError") class G(dict): pass g = G() @@ -442,7 +450,7 @@ except KeyError, err: self.assertEqual(err.args, (42,)) else: - self.fail_("g[42] didn't raise KeyError") + self.fail("g[42] didn't raise KeyError") def test_tuple_keyerror(self): # SF #1576657 @@ -454,6 +462,77 @@ else: self.fail("missing KeyError") + def test_bad_key(self): + # Dictionary lookups should fail if __cmp__() raises an exception. + class CustomException(Exception): + pass + + class BadDictKey: + def __hash__(self): + return hash(self.__class__) + + def __cmp__(self, other): + if isinstance(other, self.__class__): + raise CustomException + return other + + d = {} + x1 = BadDictKey() + x2 = BadDictKey() + d[x1] = 1 + for stmt in ['d[x2] = 2', + 'z = d[x2]', + 'x2 in d', + 'd.has_key(x2)', + 'd.get(x2)', + 'd.setdefault(x2, 42)', + 'd.pop(x2)', + 'd.update({x2: 2})']: + try: + exec stmt in locals() + except CustomException: + pass + else: + self.fail("Statement didn't raise exception") + + def test_resize1(self): + # Dict resizing bug, found by Jack Jansen in 2.2 CVS development. + # This version got an assert failure in debug build, infinite loop in + # release build. Unfortunately, provoking this kind of stuff requires + # a mix of inserts and deletes hitting exactly the right hash codes in + # exactly the right order, and I can't think of a randomized approach + # that would be *likely* to hit a failing case in reasonable time. + + d = {} + for i in range(5): + d[i] = i + for i in range(5): + del d[i] + for i in range(5, 9): # i==8 was the problem + d[i] = i + + def test_resize2(self): + # Another dict resizing bug (SF bug #1456209). + # This caused Segmentation faults or Illegal instructions. + + class X(object): + def __hash__(self): + return 5 + def __eq__(self, other): + if resizing: + d.clear() + return False + d = {} + resizing = False + d[X()] = 1 + d[X()] = 2 + d[X()] = 3 + d[X()] = 4 + d[X()] = 5 + # now trigger a resize + resizing = True + d[9] = 6 + from test import mapping_tests Modified: python/branches/bcannon-objcap/Lib/test/test_dis.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_dis.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_dis.py Fri May 25 22:13:08 2007 @@ -1,11 +1,11 @@ -from test.test_support import verify, verbose, TestFailed, run_unittest +# Minimal tests for dis module + +from test.test_support import verbose, run_unittest +import unittest import sys import dis import StringIO -# Minimal tests for dis module - -import unittest def _f(a): print a Modified: python/branches/bcannon-objcap/Lib/test/test_email.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_email.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_email.py Fri May 25 22:13:08 2007 @@ -4,10 +4,10 @@ import unittest # The specific tests now live in Lib/email/test from email.test.test_email import suite -from test.test_support import run_suite +from test import test_support def test_main(): - run_suite(suite()) + test_support.run_unittest(suite()) if __name__ == '__main__': test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_email_codecs.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_email_codecs.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_email_codecs.py Fri May 25 22:13:08 2007 @@ -9,7 +9,7 @@ def test_main(): suite = test_email_codecs.suite() suite.addTest(test_email_codecs_renamed.suite()) - test_support.run_suite(suite) + test_support.run_unittest(suite) if __name__ == '__main__': test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_email_renamed.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_email_renamed.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_email_renamed.py Fri May 25 22:13:08 2007 @@ -4,10 +4,10 @@ import unittest # The specific tests now live in Lib/email/test from email.test.test_email_renamed import suite -from test.test_support import run_suite +from test import test_support def test_main(): - run_suite(suite()) + test_support.run_unittest(suite()) if __name__ == '__main__': test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_exceptions.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_exceptions.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_exceptions.py Fri May 25 22:13:08 2007 @@ -5,7 +5,9 @@ import unittest import pickle, cPickle -from test.test_support import TESTFN, unlink, run_unittest +from test.test_support import (TESTFN, unlink, run_unittest, + guard_warnings_filter) +from test.test_pep352 import ignore_message_warning # XXX This is not really enough, each *operation* should be tested! @@ -225,6 +227,9 @@ (EnvironmentError, (1, 'strErrorStr', 'filenameStr'), {'message' : '', 'args' : (1, 'strErrorStr'), 'errno' : 1, 'strerror' : 'strErrorStr', 'filename' : 'filenameStr'}), + (SyntaxError, (), {'message' : '', 'msg' : None, 'text' : None, + 'filename' : None, 'lineno' : None, 'offset' : None, + 'print_file_and_line' : None}), (SyntaxError, ('msgStr',), {'message' : 'msgStr', 'args' : ('msgStr',), 'text' : None, 'print_file_and_line' : None, 'msg' : 'msgStr', @@ -269,32 +274,34 @@ except NameError: pass - for exc, args, expected in exceptionList: - try: - raise exc(*args) - except BaseException, e: - if type(e) is not exc: - raise - # Verify module name - self.assertEquals(type(e).__module__, 'exceptions') - # Verify no ref leaks in Exc_str() - s = str(e) - for checkArgName in expected: - self.assertEquals(repr(getattr(e, checkArgName)), - repr(expected[checkArgName]), - 'exception "%s", attribute "%s"' % - (repr(e), checkArgName)) - - # test for pickling support - for p in pickle, cPickle: - for protocol in range(p.HIGHEST_PROTOCOL + 1): - new = p.loads(p.dumps(e, protocol)) - for checkArgName in expected: - got = repr(getattr(new, checkArgName)) - want = repr(expected[checkArgName]) - self.assertEquals(got, want, - 'pickled "%r", attribute "%s' % - (e, checkArgName)) + with guard_warnings_filter(): + ignore_message_warning() + for exc, args, expected in exceptionList: + try: + raise exc(*args) + except BaseException, e: + if type(e) is not exc: + raise + # Verify module name + self.assertEquals(type(e).__module__, 'exceptions') + # Verify no ref leaks in Exc_str() + s = str(e) + for checkArgName in expected: + self.assertEquals(repr(getattr(e, checkArgName)), + repr(expected[checkArgName]), + 'exception "%s", attribute "%s"' % + (repr(e), checkArgName)) + + # test for pickling support + for p in pickle, cPickle: + for protocol in range(p.HIGHEST_PROTOCOL + 1): + new = p.loads(p.dumps(e, protocol)) + for checkArgName in expected: + got = repr(getattr(new, checkArgName)) + want = repr(expected[checkArgName]) + self.assertEquals(got, want, + 'pickled "%r", attribute "%s' % + (e, checkArgName)) def testSlicing(self): # Test that you can slice an exception directly instead of requiring Modified: python/branches/bcannon-objcap/Lib/test/test_extcall.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_extcall.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_extcall.py Fri May 25 22:13:08 2007 @@ -1,5 +1,6 @@ from test.test_support import verify, verbose, TestFailed, sortdict from UserList import UserList +from UserDict import UserDict def e(a, b): print a, b @@ -25,6 +26,12 @@ f(1, 2, 3, *(4, 5), **{'a':6, 'b':7}) f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b':9}) + +f(1, 2, 3, **UserDict(a=4, b=5)) +f(1, 2, 3, *(4, 5), **UserDict(a=6, b=7)) +f(1, 2, 3, x=4, y=5, *(6, 7), **UserDict(a=8, b=9)) + + # Verify clearing of SF bug #733667 try: e(c=3) Modified: python/branches/bcannon-objcap/Lib/test/test_fileinput.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_fileinput.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_fileinput.py Fri May 25 22:13:08 2007 @@ -3,7 +3,9 @@ Nick Mathewson ''' -from test.test_support import verify, verbose, TESTFN, TestFailed +import unittest +from test.test_support import verbose, TESTFN, run_unittest +from test.test_support import unlink as safe_unlink import sys, os, re from StringIO import StringIO from fileinput import FileInput, hook_encoded @@ -22,206 +24,202 @@ f.close() return name -pat = re.compile(r'LINE (\d+) OF FILE (\d+)') - def remove_tempfiles(*names): for name in names: - try: - os.unlink(name) - except: - pass + safe_unlink(name) -def runTests(t1, t2, t3, t4, bs=0, round=0): - start = 1 + round*6 - if verbose: - print '%s. Simple iteration (bs=%s)' % (start+0, bs) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - lines = list(fi) - fi.close() - verify(len(lines) == 31) - verify(lines[4] == 'Line 5 of file 1\n') - verify(lines[30] == 'Line 1 of file 4\n') - verify(fi.lineno() == 31) - verify(fi.filename() == t4) - - if verbose: - print '%s. Status variables (bs=%s)' % (start+1, bs) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - s = "x" - while s and s != 'Line 6 of file 2\n': - s = fi.readline() - verify(fi.filename() == t2) - verify(fi.lineno() == 21) - verify(fi.filelineno() == 6) - verify(not fi.isfirstline()) - verify(not fi.isstdin()) - - if verbose: - print '%s. Nextfile (bs=%s)' % (start+2, bs) - fi.nextfile() - verify(fi.readline() == 'Line 1 of file 3\n') - verify(fi.lineno() == 22) - fi.close() - - if verbose: - print '%s. Stdin (bs=%s)' % (start+3, bs) - fi = FileInput(files=(t1, t2, t3, t4, '-'), bufsize=bs) - savestdin = sys.stdin - try: - sys.stdin = StringIO("Line 1 of stdin\nLine 2 of stdin\n") +class BufferSizesTests(unittest.TestCase): + def test_buffer_sizes(self): + # First, run the tests with default and teeny buffer size. + for round, bs in (0, 0), (1, 30): + try: + t1 = writeTmp(1, ["Line %s of file 1\n" % (i+1) for i in range(15)]) + t2 = writeTmp(2, ["Line %s of file 2\n" % (i+1) for i in range(10)]) + t3 = writeTmp(3, ["Line %s of file 3\n" % (i+1) for i in range(5)]) + t4 = writeTmp(4, ["Line %s of file 4\n" % (i+1) for i in range(1)]) + self.buffer_size_test(t1, t2, t3, t4, bs, round) + finally: + remove_tempfiles(t1, t2, t3, t4) + + def buffer_size_test(self, t1, t2, t3, t4, bs=0, round=0): + pat = re.compile(r'LINE (\d+) OF FILE (\d+)') + + start = 1 + round*6 + if verbose: + print '%s. Simple iteration (bs=%s)' % (start+0, bs) + fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) lines = list(fi) - verify(len(lines) == 33) - verify(lines[32] == 'Line 2 of stdin\n') - verify(fi.filename() == '') + fi.close() + self.assertEqual(len(lines), 31) + self.assertEqual(lines[4], 'Line 5 of file 1\n') + self.assertEqual(lines[30], 'Line 1 of file 4\n') + self.assertEqual(fi.lineno(), 31) + self.assertEqual(fi.filename(), t4) + + if verbose: + print '%s. Status variables (bs=%s)' % (start+1, bs) + fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) + s = "x" + while s and s != 'Line 6 of file 2\n': + s = fi.readline() + self.assertEqual(fi.filename(), t2) + self.assertEqual(fi.lineno(), 21) + self.assertEqual(fi.filelineno(), 6) + self.failIf(fi.isfirstline()) + self.failIf(fi.isstdin()) + + if verbose: + print '%s. Nextfile (bs=%s)' % (start+2, bs) fi.nextfile() - finally: - sys.stdin = savestdin + self.assertEqual(fi.readline(), 'Line 1 of file 3\n') + self.assertEqual(fi.lineno(), 22) + fi.close() - if verbose: - print '%s. Boundary conditions (bs=%s)' % (start+4, bs) - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - verify(fi.lineno() == 0) - verify(fi.filename() == None) - fi.nextfile() - verify(fi.lineno() == 0) - verify(fi.filename() == None) - - if verbose: - print '%s. Inplace (bs=%s)' % (start+5, bs) - savestdout = sys.stdout - try: - fi = FileInput(files=(t1, t2, t3, t4), inplace=1, bufsize=bs) + if verbose: + print '%s. Stdin (bs=%s)' % (start+3, bs) + fi = FileInput(files=(t1, t2, t3, t4, '-'), bufsize=bs) + savestdin = sys.stdin + try: + sys.stdin = StringIO("Line 1 of stdin\nLine 2 of stdin\n") + lines = list(fi) + self.assertEqual(len(lines), 33) + self.assertEqual(lines[32], 'Line 2 of stdin\n') + self.assertEqual(fi.filename(), '') + fi.nextfile() + finally: + sys.stdin = savestdin + + if verbose: + print '%s. Boundary conditions (bs=%s)' % (start+4, bs) + fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) + self.assertEqual(fi.lineno(), 0) + self.assertEqual(fi.filename(), None) + fi.nextfile() + self.assertEqual(fi.lineno(), 0) + self.assertEqual(fi.filename(), None) + + if verbose: + print '%s. Inplace (bs=%s)' % (start+5, bs) + savestdout = sys.stdout + try: + fi = FileInput(files=(t1, t2, t3, t4), inplace=1, bufsize=bs) + for line in fi: + line = line[:-1].upper() + print line + fi.close() + finally: + sys.stdout = savestdout + + fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) for line in fi: - line = line[:-1].upper() - print line + self.assertEqual(line[-1], '\n') + m = pat.match(line[:-1]) + self.assertNotEqual(m, None) + self.assertEqual(int(m.group(1)), fi.filelineno()) fi.close() - finally: - sys.stdout = savestdout - fi = FileInput(files=(t1, t2, t3, t4), bufsize=bs) - for line in fi: - verify(line[-1] == '\n') - m = pat.match(line[:-1]) - verify(m != None) - verify(int(m.group(1)) == fi.filelineno()) - fi.close() - - -def writeFiles(): - global t1, t2, t3, t4 - t1 = writeTmp(1, ["Line %s of file 1\n" % (i+1) for i in range(15)]) - t2 = writeTmp(2, ["Line %s of file 2\n" % (i+1) for i in range(10)]) - t3 = writeTmp(3, ["Line %s of file 3\n" % (i+1) for i in range(5)]) - t4 = writeTmp(4, ["Line %s of file 4\n" % (i+1) for i in range(1)]) - -# First, run the tests with default and teeny buffer size. -for round, bs in (0, 0), (1, 30): - try: - writeFiles() - runTests(t1, t2, t3, t4, bs, round) - finally: - remove_tempfiles(t1, t2, t3, t4) - -# Next, check for proper behavior with 0-byte files. -if verbose: - print "13. 0-byte files" -try: - t1 = writeTmp(1, [""]) - t2 = writeTmp(2, [""]) - t3 = writeTmp(3, ["The only line there is.\n"]) - t4 = writeTmp(4, [""]) - fi = FileInput(files=(t1, t2, t3, t4)) - line = fi.readline() - verify(line == 'The only line there is.\n') - verify(fi.lineno() == 1) - verify(fi.filelineno() == 1) - verify(fi.filename() == t3) - line = fi.readline() - verify(not line) - verify(fi.lineno() == 1) - verify(fi.filelineno() == 0) - verify(fi.filename() == t4) - fi.close() -finally: - remove_tempfiles(t1, t2, t3, t4) - -if verbose: - print "14. Files that don't end with newline" -try: - t1 = writeTmp(1, ["A\nB\nC"]) - t2 = writeTmp(2, ["D\nE\nF"]) - fi = FileInput(files=(t1, t2)) - lines = list(fi) - verify(lines == ["A\n", "B\n", "C", "D\n", "E\n", "F"]) - verify(fi.filelineno() == 3) - verify(fi.lineno() == 6) -finally: - remove_tempfiles(t1, t2) - -if verbose: - print "15. Unicode filenames" -try: - t1 = writeTmp(1, ["A\nB"]) - encoding = sys.getfilesystemencoding() - if encoding is None: - encoding = 'ascii' - fi = FileInput(files=unicode(t1, encoding)) - lines = list(fi) - verify(lines == ["A\n", "B"]) -finally: - remove_tempfiles(t1) - -if verbose: - print "16. fileno()" -try: - t1 = writeTmp(1, ["A\nB"]) - t2 = writeTmp(2, ["C\nD"]) - fi = FileInput(files=(t1, t2)) - verify(fi.fileno() == -1) - line = fi.next() - verify(fi.fileno() != -1) - fi.nextfile() - verify(fi.fileno() == -1) - line = list(fi) - verify(fi.fileno() == -1) -finally: - remove_tempfiles(t1, t2) - -if verbose: - print "17. Specify opening mode" -try: - # invalid mode, should raise ValueError - fi = FileInput(mode="w") - raise TestFailed("FileInput should reject invalid mode argument") -except ValueError: - pass -try: - # try opening in universal newline mode - t1 = writeTmp(1, ["A\nB\r\nC\rD"], mode="wb") - fi = FileInput(files=t1, mode="U") - lines = list(fi) - verify(lines == ["A\n", "B\n", "C\n", "D"]) -finally: - remove_tempfiles(t1) - -if verbose: - print "18. Test file opening hook" -try: - # cannot use openhook and inplace mode - fi = FileInput(inplace=1, openhook=lambda f,m: None) - raise TestFailed("FileInput should raise if both inplace " - "and openhook arguments are given") -except ValueError: - pass -try: - fi = FileInput(openhook=1) - raise TestFailed("FileInput should check openhook for being callable") -except ValueError: - pass -try: - t1 = writeTmp(1, ["A\nB"], mode="wb") - fi = FileInput(files=t1, openhook=hook_encoded("rot13")) - lines = list(fi) - verify(lines == ["N\n", "O"]) -finally: - remove_tempfiles(t1) +class FileInputTests(unittest.TestCase): + def test_zero_byte_files(self): + try: + t1 = writeTmp(1, [""]) + t2 = writeTmp(2, [""]) + t3 = writeTmp(3, ["The only line there is.\n"]) + t4 = writeTmp(4, [""]) + fi = FileInput(files=(t1, t2, t3, t4)) + + line = fi.readline() + self.assertEqual(line, 'The only line there is.\n') + self.assertEqual(fi.lineno(), 1) + self.assertEqual(fi.filelineno(), 1) + self.assertEqual(fi.filename(), t3) + + line = fi.readline() + self.failIf(line) + self.assertEqual(fi.lineno(), 1) + self.assertEqual(fi.filelineno(), 0) + self.assertEqual(fi.filename(), t4) + fi.close() + finally: + remove_tempfiles(t1, t2, t3, t4) + + def test_files_that_dont_end_with_newline(self): + try: + t1 = writeTmp(1, ["A\nB\nC"]) + t2 = writeTmp(2, ["D\nE\nF"]) + fi = FileInput(files=(t1, t2)) + lines = list(fi) + self.assertEqual(lines, ["A\n", "B\n", "C", "D\n", "E\n", "F"]) + self.assertEqual(fi.filelineno(), 3) + self.assertEqual(fi.lineno(), 6) + finally: + remove_tempfiles(t1, t2) + + def test_unicode_filenames(self): + try: + t1 = writeTmp(1, ["A\nB"]) + encoding = sys.getfilesystemencoding() + if encoding is None: + encoding = 'ascii' + fi = FileInput(files=unicode(t1, encoding)) + lines = list(fi) + self.assertEqual(lines, ["A\n", "B"]) + finally: + remove_tempfiles(t1) + + def test_fileno(self): + try: + t1 = writeTmp(1, ["A\nB"]) + t2 = writeTmp(2, ["C\nD"]) + fi = FileInput(files=(t1, t2)) + self.assertEqual(fi.fileno(), -1) + line = fi.next() + self.assertNotEqual(fi.fileno(), -1) + fi.nextfile() + self.assertEqual(fi.fileno(), -1) + line = list(fi) + self.assertEqual(fi.fileno(), -1) + finally: + remove_tempfiles(t1, t2) + + def test_opening_mode(self): + try: + # invalid mode, should raise ValueError + fi = FileInput(mode="w") + self.fail("FileInput should reject invalid mode argument") + except ValueError: + pass + try: + # try opening in universal newline mode + t1 = writeTmp(1, ["A\nB\r\nC\rD"], mode="wb") + fi = FileInput(files=t1, mode="U") + lines = list(fi) + self.assertEqual(lines, ["A\n", "B\n", "C\n", "D"]) + finally: + remove_tempfiles(t1) + + def test_file_opening_hook(self): + try: + # cannot use openhook and inplace mode + fi = FileInput(inplace=1, openhook=lambda f,m: None) + self.fail("FileInput should raise if both inplace " + "and openhook arguments are given") + except ValueError: + pass + try: + fi = FileInput(openhook=1) + self.fail("FileInput should check openhook for being callable") + except ValueError: + pass + try: + t1 = writeTmp(1, ["A\nB"], mode="wb") + fi = FileInput(files=t1, openhook=hook_encoded("rot13")) + lines = list(fi) + self.assertEqual(lines, ["N\n", "O"]) + finally: + remove_tempfiles(t1) + +def test_main(): + run_unittest(BufferSizesTests, FileInputTests) + +if __name__ == "__main__": + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_format.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_format.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_format.py Fri May 25 22:13:08 2007 @@ -1,5 +1,7 @@ from test.test_support import verbose, have_unicode, TestFailed import sys +from test.test_support import MAX_Py_ssize_t +maxsize = MAX_Py_ssize_t # test string formatting operator (I am not sure if this is being tested # elsewhere but, surely, some of the given cases are *not* tested because @@ -238,11 +240,11 @@ test_exc('%o', Foobar(), TypeError, "expected string or Unicode object, long found") -if sys.maxint == 2**31-1: +if maxsize == 2**31-1: # crashes 2.2.1 and earlier: try: - "%*d"%(sys.maxint, -127) + "%*d"%(maxsize, -127) except MemoryError: pass else: - raise TestFailed, '"%*d"%(sys.maxint, -127) should fail' + raise TestFailed, '"%*d"%(maxsize, -127) should fail' Modified: python/branches/bcannon-objcap/Lib/test/test_gc.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_gc.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_gc.py Fri May 25 22:13:08 2007 @@ -1,390 +1,11 @@ -from test.test_support import verify, verbose, TestFailed, vereq +import unittest +from test.test_support import verbose, run_unittest import sys import gc import weakref -def expect(actual, expected, name): - if actual != expected: - raise TestFailed, "test_%s: actual %r, expected %r" % ( - name, actual, expected) - -def expect_nonzero(actual, name): - if actual == 0: - raise TestFailed, "test_%s: unexpected zero" % name - -def run_test(name, thunk): - if verbose: - print "testing %s..." % name, - thunk() - if verbose: - print "ok" - -def test_list(): - l = [] - l.append(l) - gc.collect() - del l - expect(gc.collect(), 1, "list") - -def test_dict(): - d = {} - d[1] = d - gc.collect() - del d - expect(gc.collect(), 1, "dict") - -def test_tuple(): - # since tuples are immutable we close the loop with a list - l = [] - t = (l,) - l.append(t) - gc.collect() - del t - del l - expect(gc.collect(), 2, "tuple") - -def test_class(): - class A: - pass - A.a = A - gc.collect() - del A - expect_nonzero(gc.collect(), "class") - -def test_newstyleclass(): - class A(object): - pass - gc.collect() - del A - expect_nonzero(gc.collect(), "staticclass") - -def test_instance(): - class A: - pass - a = A() - a.a = a - gc.collect() - del a - expect_nonzero(gc.collect(), "instance") - -def test_newinstance(): - class A(object): - pass - a = A() - a.a = a - gc.collect() - del a - expect_nonzero(gc.collect(), "newinstance") - class B(list): - pass - class C(B, A): - pass - a = C() - a.a = a - gc.collect() - del a - expect_nonzero(gc.collect(), "newinstance(2)") - del B, C - expect_nonzero(gc.collect(), "newinstance(3)") - A.a = A() - del A - expect_nonzero(gc.collect(), "newinstance(4)") - expect(gc.collect(), 0, "newinstance(5)") - -def test_method(): - # Tricky: self.__init__ is a bound method, it references the instance. - class A: - def __init__(self): - self.init = self.__init__ - a = A() - gc.collect() - del a - expect_nonzero(gc.collect(), "method") - -def test_finalizer(): - # A() is uncollectable if it is part of a cycle, make sure it shows up - # in gc.garbage. - class A: - def __del__(self): pass - class B: - pass - a = A() - a.a = a - id_a = id(a) - b = B() - b.b = b - gc.collect() - del a - del b - expect_nonzero(gc.collect(), "finalizer") - for obj in gc.garbage: - if id(obj) == id_a: - del obj.a - break - else: - raise TestFailed, "didn't find obj in garbage (finalizer)" - gc.garbage.remove(obj) - -def test_finalizer_newclass(): - # A() is uncollectable if it is part of a cycle, make sure it shows up - # in gc.garbage. - class A(object): - def __del__(self): pass - class B(object): - pass - a = A() - a.a = a - id_a = id(a) - b = B() - b.b = b - gc.collect() - del a - del b - expect_nonzero(gc.collect(), "finalizer") - for obj in gc.garbage: - if id(obj) == id_a: - del obj.a - break - else: - raise TestFailed, "didn't find obj in garbage (finalizer)" - gc.garbage.remove(obj) - -def test_function(): - # Tricky: f -> d -> f, code should call d.clear() after the exec to - # break the cycle. - d = {} - exec("def f(): pass\n") in d - gc.collect() - del d - expect(gc.collect(), 2, "function") - -def test_frame(): - def f(): - frame = sys._getframe() - gc.collect() - f() - expect(gc.collect(), 1, "frame") - - -def test_saveall(): - # Verify that cyclic garbage like lists show up in gc.garbage if the - # SAVEALL option is enabled. - - # First make sure we don't save away other stuff that just happens to - # be waiting for collection. - gc.collect() - vereq(gc.garbage, []) # if this fails, someone else created immortal trash - - L = [] - L.append(L) - id_L = id(L) - - debug = gc.get_debug() - gc.set_debug(debug | gc.DEBUG_SAVEALL) - del L - gc.collect() - gc.set_debug(debug) - - vereq(len(gc.garbage), 1) - obj = gc.garbage.pop() - vereq(id(obj), id_L) - -def test_del(): - # __del__ methods can trigger collection, make this to happen - thresholds = gc.get_threshold() - gc.enable() - gc.set_threshold(1) - - class A: - def __del__(self): - dir(self) - a = A() - del a - - gc.disable() - gc.set_threshold(*thresholds) - -def test_del_newclass(): - # __del__ methods can trigger collection, make this to happen - thresholds = gc.get_threshold() - gc.enable() - gc.set_threshold(1) - - class A(object): - def __del__(self): - dir(self) - a = A() - del a - - gc.disable() - gc.set_threshold(*thresholds) - -def test_get_count(): - gc.collect() - expect(gc.get_count(), (0, 0, 0), "get_count()") - a = dict() - expect(gc.get_count(), (1, 0, 0), "get_count()") - -def test_collect_generations(): - gc.collect() - a = dict() - gc.collect(0) - expect(gc.get_count(), (0, 1, 0), "collect(0)") - gc.collect(1) - expect(gc.get_count(), (0, 0, 1), "collect(1)") - gc.collect(2) - expect(gc.get_count(), (0, 0, 0), "collect(1)") - -class Ouch: - n = 0 - def __del__(self): - Ouch.n = Ouch.n + 1 - if Ouch.n % 17 == 0: - gc.collect() - -def test_trashcan(): - # "trashcan" is a hack to prevent stack overflow when deallocating - # very deeply nested tuples etc. It works in part by abusing the - # type pointer and refcount fields, and that can yield horrible - # problems when gc tries to traverse the structures. - # If this test fails (as it does in 2.0, 2.1 and 2.2), it will - # most likely die via segfault. - - # Note: In 2.3 the possibility for compiling without cyclic gc was - # removed, and that in turn allows the trashcan mechanism to work - # via much simpler means (e.g., it never abuses the type pointer or - # refcount fields anymore). Since it's much less likely to cause a - # problem now, the various constants in this expensive (we force a lot - # of full collections) test are cut back from the 2.2 version. - gc.enable() - N = 150 - for count in range(2): - t = [] - for i in range(N): - t = [t, Ouch()] - u = [] - for i in range(N): - u = [u, Ouch()] - v = {} - for i in range(N): - v = {1: v, 2: Ouch()} - gc.disable() - -class Boom: - def __getattr__(self, someattribute): - del self.attr - raise AttributeError - -def test_boom(): - a = Boom() - b = Boom() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - # a<->b are in a trash cycle now. Collection will invoke Boom.__getattr__ - # (to see whether a and b have __del__ methods), and __getattr__ deletes - # the internal "attr" attributes as a side effect. That causes the - # trash cycle to get reclaimed via refcounts falling to 0, thus mutating - # the trash graph as a side effect of merely asking whether __del__ - # exists. This used to (before 2.3b1) crash Python. Now __getattr__ - # isn't called. - expect(gc.collect(), 4, "boom") - expect(len(gc.garbage), garbagelen, "boom") - -class Boom2: - def __init__(self): - self.x = 0 - - def __getattr__(self, someattribute): - self.x += 1 - if self.x > 1: - del self.attr - raise AttributeError - -def test_boom2(): - a = Boom2() - b = Boom2() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - # Much like test_boom(), except that __getattr__ doesn't break the - # cycle until the second time gc checks for __del__. As of 2.3b1, - # there isn't a second time, so this simply cleans up the trash cycle. - # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get reclaimed - # this way. - expect(gc.collect(), 4, "boom2") - expect(len(gc.garbage), garbagelen, "boom2") - -# boom__new and boom2_new are exactly like boom and boom2, except use -# new-style classes. - -class Boom_New(object): - def __getattr__(self, someattribute): - del self.attr - raise AttributeError - -def test_boom_new(): - a = Boom_New() - b = Boom_New() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - expect(gc.collect(), 4, "boom_new") - expect(len(gc.garbage), garbagelen, "boom_new") - -class Boom2_New(object): - def __init__(self): - self.x = 0 - - def __getattr__(self, someattribute): - self.x += 1 - if self.x > 1: - del self.attr - raise AttributeError - -def test_boom2_new(): - a = Boom2_New() - b = Boom2_New() - a.attr = b - b.attr = a - - gc.collect() - garbagelen = len(gc.garbage) - del a, b - expect(gc.collect(), 4, "boom2_new") - expect(len(gc.garbage), garbagelen, "boom2_new") - -def test_get_referents(): - alist = [1, 3, 5] - got = gc.get_referents(alist) - got.sort() - expect(got, alist, "get_referents") - - atuple = tuple(alist) - got = gc.get_referents(atuple) - got.sort() - expect(got, alist, "get_referents") - - adict = {1: 3, 5: 7} - expected = [1, 3, 5, 7] - got = gc.get_referents(adict) - got.sort() - expect(got, expected, "get_referents") - - got = gc.get_referents([1, 2], {3: 4}, (0, 0, 0)) - got.sort() - expect(got, [0, 0] + range(5), "get_referents") - - expect(gc.get_referents(1, 'a', 4j), [], "get_referents") +### Support code +############################################################################### # Bug 1055820 has several tests of longstanding bugs involving weakrefs and # cyclic gc. @@ -410,217 +31,556 @@ # gc collects it. self.wr = weakref.ref(C1055820(666), it_happened) -def test_bug1055820b(): - # Corresponds to temp2b.py in the bug report. - ouch = [] - def callback(ignored): - ouch[:] = [wr() for wr in WRs] - - Cs = [C1055820(i) for i in range(2)] - WRs = [weakref.ref(c, callback) for c in Cs] - c = None - - gc.collect() - expect(len(ouch), 0, "bug1055820b") - # Make the two instances trash, and collect again. The bug was that - # the callback materialized a strong reference to an instance, but gc - # cleared the instance's dict anyway. - Cs = None - gc.collect() - expect(len(ouch), 2, "bug1055820b") # else the callbacks didn't run - for x in ouch: - # If the callback resurrected one of these guys, the instance - # would be damaged, with an empty __dict__. - expect(x, None, "bug1055820b") - -def test_bug1055820c(): - # Corresponds to temp2c.py in the bug report. This is pretty elaborate. - - c0 = C1055820(0) - # Move c0 into generation 2. - gc.collect() - - c1 = C1055820(1) - c1.keep_c0_alive = c0 - del c0.loop # now only c1 keeps c0 alive - - c2 = C1055820(2) - c2wr = weakref.ref(c2) # no callback! - - ouch = [] - def callback(ignored): - ouch[:] = [c2wr()] - - # The callback gets associated with a wr on an object in generation 2. - c0wr = weakref.ref(c0, callback) - - c0 = c1 = c2 = None - - # What we've set up: c0, c1, and c2 are all trash now. c0 is in - # generation 2. The only thing keeping it alive is that c1 points to it. - # c1 and c2 are in generation 0, and are in self-loops. There's a global - # weakref to c2 (c2wr), but that weakref has no callback. There's also - # a global weakref to c0 (c0wr), and that does have a callback, and that - # callback references c2 via c2wr(). - # - # c0 has a wr with callback, which references c2wr - # ^ - # | - # | Generation 2 above dots - #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . - # | Generation 0 below dots - # | - # | - # ^->c1 ^->c2 has a wr but no callback - # | | | | - # <--v <--v - # - # So this is the nightmare: when generation 0 gets collected, we see that - # c2 has a callback-free weakref, and c1 doesn't even have a weakref. - # Collecting generation 0 doesn't see c0 at all, and c0 is the only object - # that has a weakref with a callback. gc clears c1 and c2. Clearing c1 - # has the side effect of dropping the refcount on c0 to 0, so c0 goes - # away (despite that it's in an older generation) and c0's wr callback - # triggers. That in turn materializes a reference to c2 via c2wr(), but - # c2 gets cleared anyway by gc. - - # We want to let gc happen "naturally", to preserve the distinction - # between generations. - junk = [] - i = 0 - detector = GC_Detector() - while not detector.gc_happened: - i += 1 - if i > 10000: - raise TestFailed("gc didn't happen after 10000 iterations") - expect(len(ouch), 0, "bug1055820c") - junk.append([]) # this will eventually trigger gc - - expect(len(ouch), 1, "bug1055820c") # else the callback wasn't invoked - for x in ouch: - # If the callback resurrected c2, the instance would be damaged, - # with an empty __dict__. - expect(x, None, "bug1055820c") - -def test_bug1055820d(): - # Corresponds to temp2d.py in the bug report. This is very much like - # test_bug1055820c, but uses a __del__ method instead of a weakref - # callback to sneak in a resurrection of cyclic trash. - - ouch = [] - class D(C1055820): - def __del__(self): - ouch[:] = [c2wr()] +### Tests +############################################################################### - d0 = D(0) - # Move all the above into generation 2. - gc.collect() - - c1 = C1055820(1) - c1.keep_d0_alive = d0 - del d0.loop # now only c1 keeps d0 alive - - c2 = C1055820(2) - c2wr = weakref.ref(c2) # no callback! - - d0 = c1 = c2 = None - - # What we've set up: d0, c1, and c2 are all trash now. d0 is in - # generation 2. The only thing keeping it alive is that c1 points to it. - # c1 and c2 are in generation 0, and are in self-loops. There's a global - # weakref to c2 (c2wr), but that weakref has no callback. There are no - # other weakrefs. - # - # d0 has a __del__ method that references c2wr - # ^ - # | - # | Generation 2 above dots - #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . - # | Generation 0 below dots - # | - # | - # ^->c1 ^->c2 has a wr but no callback - # | | | | - # <--v <--v - # - # So this is the nightmare: when generation 0 gets collected, we see that - # c2 has a callback-free weakref, and c1 doesn't even have a weakref. - # Collecting generation 0 doesn't see d0 at all. gc clears c1 and c2. - # Clearing c1 has the side effect of dropping the refcount on d0 to 0, so - # d0 goes away (despite that it's in an older generation) and d0's __del__ - # triggers. That in turn materializes a reference to c2 via c2wr(), but - # c2 gets cleared anyway by gc. - - # We want to let gc happen "naturally", to preserve the distinction - # between generations. - detector = GC_Detector() - junk = [] - i = 0 - while not detector.gc_happened: - i += 1 - if i > 10000: - raise TestFailed("gc didn't happen after 10000 iterations") - expect(len(ouch), 0, "bug1055820d") - junk.append([]) # this will eventually trigger gc - - expect(len(ouch), 1, "bug1055820d") # else __del__ wasn't invoked - for x in ouch: - # If __del__ resurrected c2, the instance would be damaged, with an - # empty __dict__. - expect(x, None, "bug1055820d") - - -def test_all(): - gc.collect() # Delete 2nd generation garbage - run_test("lists", test_list) - run_test("dicts", test_dict) - run_test("tuples", test_tuple) - run_test("classes", test_class) - run_test("new style classes", test_newstyleclass) - run_test("instances", test_instance) - run_test("new instances", test_newinstance) - run_test("methods", test_method) - run_test("functions", test_function) - run_test("frames", test_frame) - run_test("finalizers", test_finalizer) - run_test("finalizers (new class)", test_finalizer_newclass) - run_test("__del__", test_del) - run_test("__del__ (new class)", test_del_newclass) - run_test("get_count()", test_get_count) - run_test("collect(n)", test_collect_generations) - run_test("saveall", test_saveall) - run_test("trashcan", test_trashcan) - run_test("boom", test_boom) - run_test("boom2", test_boom2) - run_test("boom_new", test_boom_new) - run_test("boom2_new", test_boom2_new) - run_test("get_referents", test_get_referents) - run_test("bug1055820b", test_bug1055820b) +class GCTests(unittest.TestCase): + def test_list(self): + l = [] + l.append(l) + gc.collect() + del l + self.assertEqual(gc.collect(), 1) + + def test_dict(self): + d = {} + d[1] = d + gc.collect() + del d + self.assertEqual(gc.collect(), 1) + + def test_tuple(self): + # since tuples are immutable we close the loop with a list + l = [] + t = (l,) + l.append(t) + gc.collect() + del t + del l + self.assertEqual(gc.collect(), 2) + + def test_class(self): + class A: + pass + A.a = A + gc.collect() + del A + self.assertNotEqual(gc.collect(), 0) + + def test_newstyleclass(self): + class A(object): + pass + gc.collect() + del A + self.assertNotEqual(gc.collect(), 0) + + def test_instance(self): + class A: + pass + a = A() + a.a = a + gc.collect() + del a + self.assertNotEqual(gc.collect(), 0) + + def test_newinstance(self): + class A(object): + pass + a = A() + a.a = a + gc.collect() + del a + self.assertNotEqual(gc.collect(), 0) + class B(list): + pass + class C(B, A): + pass + a = C() + a.a = a + gc.collect() + del a + self.assertNotEqual(gc.collect(), 0) + del B, C + self.assertNotEqual(gc.collect(), 0) + A.a = A() + del A + self.assertNotEqual(gc.collect(), 0) + self.assertEqual(gc.collect(), 0) + + def test_method(self): + # Tricky: self.__init__ is a bound method, it references the instance. + class A: + def __init__(self): + self.init = self.__init__ + a = A() + gc.collect() + del a + self.assertNotEqual(gc.collect(), 0) + + def test_finalizer(self): + # A() is uncollectable if it is part of a cycle, make sure it shows up + # in gc.garbage. + class A: + def __del__(self): pass + class B: + pass + a = A() + a.a = a + id_a = id(a) + b = B() + b.b = b + gc.collect() + del a + del b + self.assertNotEqual(gc.collect(), 0) + for obj in gc.garbage: + if id(obj) == id_a: + del obj.a + break + else: + self.fail("didn't find obj in garbage (finalizer)") + gc.garbage.remove(obj) + + def test_finalizer_newclass(self): + # A() is uncollectable if it is part of a cycle, make sure it shows up + # in gc.garbage. + class A(object): + def __del__(self): pass + class B(object): + pass + a = A() + a.a = a + id_a = id(a) + b = B() + b.b = b + gc.collect() + del a + del b + self.assertNotEqual(gc.collect(), 0) + for obj in gc.garbage: + if id(obj) == id_a: + del obj.a + break + else: + self.fail("didn't find obj in garbage (finalizer)") + gc.garbage.remove(obj) + + def test_function(self): + # Tricky: f -> d -> f, code should call d.clear() after the exec to + # break the cycle. + d = {} + exec("def f(): pass\n") in d + gc.collect() + del d + self.assertEqual(gc.collect(), 2) + + def test_frame(self): + def f(): + frame = sys._getframe() + gc.collect() + f() + self.assertEqual(gc.collect(), 1) + + def test_saveall(self): + # Verify that cyclic garbage like lists show up in gc.garbage if the + # SAVEALL option is enabled. + + # First make sure we don't save away other stuff that just happens to + # be waiting for collection. + gc.collect() + # if this fails, someone else created immortal trash + self.assertEqual(gc.garbage, []) + + L = [] + L.append(L) + id_L = id(L) + + debug = gc.get_debug() + gc.set_debug(debug | gc.DEBUG_SAVEALL) + del L + gc.collect() + gc.set_debug(debug) + + self.assertEqual(len(gc.garbage), 1) + obj = gc.garbage.pop() + self.assertEqual(id(obj), id_L) + + def test_del(self): + # __del__ methods can trigger collection, make this to happen + thresholds = gc.get_threshold() + gc.enable() + gc.set_threshold(1) + + class A: + def __del__(self): + dir(self) + a = A() + del a - gc.enable() - try: - run_test("bug1055820c", test_bug1055820c) - finally: gc.disable() + gc.set_threshold(*thresholds) - gc.enable() - try: - run_test("bug1055820d", test_bug1055820d) - finally: + def test_del_newclass(self): + # __del__ methods can trigger collection, make this to happen + thresholds = gc.get_threshold() + gc.enable() + gc.set_threshold(1) + + class A(object): + def __del__(self): + dir(self) + a = A() + del a + + gc.disable() + gc.set_threshold(*thresholds) + + def test_get_count(self): + gc.collect() + self.assertEqual(gc.get_count(), (0, 0, 0)) + a = dict() + self.assertEqual(gc.get_count(), (1, 0, 0)) + + def test_collect_generations(self): + gc.collect() + a = dict() + gc.collect(0) + self.assertEqual(gc.get_count(), (0, 1, 0)) + gc.collect(1) + self.assertEqual(gc.get_count(), (0, 0, 1)) + gc.collect(2) + self.assertEqual(gc.get_count(), (0, 0, 0)) + + def test_trashcan(self): + class Ouch: + n = 0 + def __del__(self): + Ouch.n = Ouch.n + 1 + if Ouch.n % 17 == 0: + gc.collect() + + # "trashcan" is a hack to prevent stack overflow when deallocating + # very deeply nested tuples etc. It works in part by abusing the + # type pointer and refcount fields, and that can yield horrible + # problems when gc tries to traverse the structures. + # If this test fails (as it does in 2.0, 2.1 and 2.2), it will + # most likely die via segfault. + + # Note: In 2.3 the possibility for compiling without cyclic gc was + # removed, and that in turn allows the trashcan mechanism to work + # via much simpler means (e.g., it never abuses the type pointer or + # refcount fields anymore). Since it's much less likely to cause a + # problem now, the various constants in this expensive (we force a lot + # of full collections) test are cut back from the 2.2 version. + gc.enable() + N = 150 + for count in range(2): + t = [] + for i in range(N): + t = [t, Ouch()] + u = [] + for i in range(N): + u = [u, Ouch()] + v = {} + for i in range(N): + v = {1: v, 2: Ouch()} + gc.disable() + + def test_boom(self): + class Boom: + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + a = Boom() + b = Boom() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # a<->b are in a trash cycle now. Collection will invoke + # Boom.__getattr__ (to see whether a and b have __del__ methods), and + # __getattr__ deletes the internal "attr" attributes as a side effect. + # That causes the trash cycle to get reclaimed via refcounts falling to + # 0, thus mutating the trash graph as a side effect of merely asking + # whether __del__ exists. This used to (before 2.3b1) crash Python. + # Now __getattr__ isn't called. + self.assertEqual(gc.collect(), 4) + self.assertEqual(len(gc.garbage), garbagelen) + + def test_boom2(self): + class Boom2: + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + a = Boom2() + b = Boom2() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + # Much like test_boom(), except that __getattr__ doesn't break the + # cycle until the second time gc checks for __del__. As of 2.3b1, + # there isn't a second time, so this simply cleans up the trash cycle. + # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get + # reclaimed this way. + self.assertEqual(gc.collect(), 4) + self.assertEqual(len(gc.garbage), garbagelen) + + def test_boom_new(self): + # boom__new and boom2_new are exactly like boom and boom2, except use + # new-style classes. + + class Boom_New(object): + def __getattr__(self, someattribute): + del self.attr + raise AttributeError + + a = Boom_New() + b = Boom_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + self.assertEqual(gc.collect(), 4) + self.assertEqual(len(gc.garbage), garbagelen) + + def test_boom2_new(self): + class Boom2_New(object): + def __init__(self): + self.x = 0 + + def __getattr__(self, someattribute): + self.x += 1 + if self.x > 1: + del self.attr + raise AttributeError + + a = Boom2_New() + b = Boom2_New() + a.attr = b + b.attr = a + + gc.collect() + garbagelen = len(gc.garbage) + del a, b + self.assertEqual(gc.collect(), 4) + self.assertEqual(len(gc.garbage), garbagelen) + + def test_get_referents(self): + alist = [1, 3, 5] + got = gc.get_referents(alist) + got.sort() + self.assertEqual(got, alist) + + atuple = tuple(alist) + got = gc.get_referents(atuple) + got.sort() + self.assertEqual(got, alist) + + adict = {1: 3, 5: 7} + expected = [1, 3, 5, 7] + got = gc.get_referents(adict) + got.sort() + self.assertEqual(got, expected) + + got = gc.get_referents([1, 2], {3: 4}, (0, 0, 0)) + got.sort() + self.assertEqual(got, [0, 0] + range(5)) + + self.assertEqual(gc.get_referents(1, 'a', 4j), []) + + def test_bug1055820b(self): + # Corresponds to temp2b.py in the bug report. + + ouch = [] + def callback(ignored): + ouch[:] = [wr() for wr in WRs] + + Cs = [C1055820(i) for i in range(2)] + WRs = [weakref.ref(c, callback) for c in Cs] + c = None + + gc.collect() + self.assertEqual(len(ouch), 0) + # Make the two instances trash, and collect again. The bug was that + # the callback materialized a strong reference to an instance, but gc + # cleared the instance's dict anyway. + Cs = None + gc.collect() + self.assertEqual(len(ouch), 2) # else the callbacks didn't run + for x in ouch: + # If the callback resurrected one of these guys, the instance + # would be damaged, with an empty __dict__. + self.assertEqual(x, None) + +class GCTogglingTests(unittest.TestCase): + def setUp(self): + gc.enable() + + def tearDown(self): gc.disable() -def test(): - if verbose: - print "disabling automatic collection" + def test_bug1055820c(self): + # Corresponds to temp2c.py in the bug report. This is pretty + # elaborate. + + c0 = C1055820(0) + # Move c0 into generation 2. + gc.collect() + + c1 = C1055820(1) + c1.keep_c0_alive = c0 + del c0.loop # now only c1 keeps c0 alive + + c2 = C1055820(2) + c2wr = weakref.ref(c2) # no callback! + + ouch = [] + def callback(ignored): + ouch[:] = [c2wr()] + + # The callback gets associated with a wr on an object in generation 2. + c0wr = weakref.ref(c0, callback) + + c0 = c1 = c2 = None + + # What we've set up: c0, c1, and c2 are all trash now. c0 is in + # generation 2. The only thing keeping it alive is that c1 points to + # it. c1 and c2 are in generation 0, and are in self-loops. There's a + # global weakref to c2 (c2wr), but that weakref has no callback. + # There's also a global weakref to c0 (c0wr), and that does have a + # callback, and that callback references c2 via c2wr(). + # + # c0 has a wr with callback, which references c2wr + # ^ + # | + # | Generation 2 above dots + #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . + # | Generation 0 below dots + # | + # | + # ^->c1 ^->c2 has a wr but no callback + # | | | | + # <--v <--v + # + # So this is the nightmare: when generation 0 gets collected, we see + # that c2 has a callback-free weakref, and c1 doesn't even have a + # weakref. Collecting generation 0 doesn't see c0 at all, and c0 is + # the only object that has a weakref with a callback. gc clears c1 + # and c2. Clearing c1 has the side effect of dropping the refcount on + # c0 to 0, so c0 goes away (despite that it's in an older generation) + # and c0's wr callback triggers. That in turn materializes a reference + # to c2 via c2wr(), but c2 gets cleared anyway by gc. + + # We want to let gc happen "naturally", to preserve the distinction + # between generations. + junk = [] + i = 0 + detector = GC_Detector() + while not detector.gc_happened: + i += 1 + if i > 10000: + self.fail("gc didn't happen after 10000 iterations") + self.assertEqual(len(ouch), 0) + junk.append([]) # this will eventually trigger gc + + self.assertEqual(len(ouch), 1) # else the callback wasn't invoked + for x in ouch: + # If the callback resurrected c2, the instance would be damaged, + # with an empty __dict__. + self.assertEqual(x, None) + + def test_bug1055820d(self): + # Corresponds to temp2d.py in the bug report. This is very much like + # test_bug1055820c, but uses a __del__ method instead of a weakref + # callback to sneak in a resurrection of cyclic trash. + + ouch = [] + class D(C1055820): + def __del__(self): + ouch[:] = [c2wr()] + + d0 = D(0) + # Move all the above into generation 2. + gc.collect() + + c1 = C1055820(1) + c1.keep_d0_alive = d0 + del d0.loop # now only c1 keeps d0 alive + + c2 = C1055820(2) + c2wr = weakref.ref(c2) # no callback! + + d0 = c1 = c2 = None + + # What we've set up: d0, c1, and c2 are all trash now. d0 is in + # generation 2. The only thing keeping it alive is that c1 points to + # it. c1 and c2 are in generation 0, and are in self-loops. There's + # a global weakref to c2 (c2wr), but that weakref has no callback. + # There are no other weakrefs. + # + # d0 has a __del__ method that references c2wr + # ^ + # | + # | Generation 2 above dots + #. . . . . . . .|. . . . . . . . . . . . . . . . . . . . . . . . + # | Generation 0 below dots + # | + # | + # ^->c1 ^->c2 has a wr but no callback + # | | | | + # <--v <--v + # + # So this is the nightmare: when generation 0 gets collected, we see + # that c2 has a callback-free weakref, and c1 doesn't even have a + # weakref. Collecting generation 0 doesn't see d0 at all. gc clears + # c1 and c2. Clearing c1 has the side effect of dropping the refcount + # on d0 to 0, so d0 goes away (despite that it's in an older + # generation) and d0's __del__ triggers. That in turn materializes + # a reference to c2 via c2wr(), but c2 gets cleared anyway by gc. + + # We want to let gc happen "naturally", to preserve the distinction + # between generations. + detector = GC_Detector() + junk = [] + i = 0 + while not detector.gc_happened: + i += 1 + if i > 10000: + self.fail("gc didn't happen after 10000 iterations") + self.assertEqual(len(ouch), 0) + junk.append([]) # this will eventually trigger gc + + self.assertEqual(len(ouch), 1) # else __del__ wasn't invoked + for x in ouch: + # If __del__ resurrected c2, the instance would be damaged, with an + # empty __dict__. + self.assertEqual(x, None) + +def test_main(): enabled = gc.isenabled() gc.disable() - verify(not gc.isenabled()) + assert not gc.isenabled() debug = gc.get_debug() gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak try: - test_all() + gc.collect() # Delete 2nd generation garbage + run_unittest(GCTests, GCTogglingTests) finally: gc.set_debug(debug) # test gc.enable() even if GC is disabled by default @@ -628,9 +588,9 @@ print "restoring automatic collection" # make sure to always test gc.enable() gc.enable() - verify(gc.isenabled()) + assert gc.isenabled() if not enabled: gc.disable() - -test() +if __name__ == "__main__": + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_gdbm.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_gdbm.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_gdbm.py Fri May 25 22:13:08 2007 @@ -5,9 +5,9 @@ import gdbm from gdbm import error -from test.test_support import verbose, verify, TestFailed +from test.test_support import verbose, verify, TestFailed, TESTFN -filename= '/tmp/delete_me' +filename = TESTFN g = gdbm.open(filename, 'c') verify(g.keys() == []) Modified: python/branches/bcannon-objcap/Lib/test/test_generators.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_generators.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_generators.py Fri May 25 22:13:08 2007 @@ -1681,7 +1681,7 @@ >>> g.next() >>> del g >>> sys.stderr.getvalue().startswith( -... "Exception exceptions.RuntimeError: 'generator ignored GeneratorExit' in " +... "Exception RuntimeError: 'generator ignored GeneratorExit' in " ... ) True >>> sys.stderr = old @@ -1798,7 +1798,7 @@ ... del l ... err = sys.stderr.getvalue().strip() ... err.startswith( -... "Exception exceptions.RuntimeError: RuntimeError() in <" +... "Exception RuntimeError: RuntimeError() in <" ... ) ... err.endswith("> ignored") ... len(err.splitlines()) Modified: python/branches/bcannon-objcap/Lib/test/test_getopt.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_getopt.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_getopt.py Fri May 25 22:13:08 2007 @@ -1,180 +1,179 @@ # test_getopt.py # David Goodger 2000-08-19 +from test.test_support import verbose, run_doctest, run_unittest +import unittest + import getopt -from getopt import GetoptError -from test.test_support import verify, verbose, run_doctest import os -def expectException(teststr, expected, failure=AssertionError): - """Executes a statement passed in teststr, and raises an exception - (failure) if the expected exception is *not* raised.""" - try: - exec teststr - except expected: - pass - else: - raise failure - -old_posixly_correct = os.environ.get("POSIXLY_CORRECT") -if old_posixly_correct is not None: - del os.environ["POSIXLY_CORRECT"] - -if verbose: - print 'Running tests on getopt.short_has_arg' -verify(getopt.short_has_arg('a', 'a:')) -verify(not getopt.short_has_arg('a', 'a')) -expectException("tmp = getopt.short_has_arg('a', 'b')", GetoptError) -expectException("tmp = getopt.short_has_arg('a', '')", GetoptError) - -if verbose: - print 'Running tests on getopt.long_has_args' -has_arg, option = getopt.long_has_args('abc', ['abc=']) -verify(has_arg) -verify(option == 'abc') -has_arg, option = getopt.long_has_args('abc', ['abc']) -verify(not has_arg) -verify(option == 'abc') -has_arg, option = getopt.long_has_args('abc', ['abcd']) -verify(not has_arg) -verify(option == 'abcd') -expectException("has_arg, option = getopt.long_has_args('abc', ['def'])", - GetoptError) -expectException("has_arg, option = getopt.long_has_args('abc', [])", - GetoptError) -expectException("has_arg, option = " + \ - "getopt.long_has_args('abc', ['abcd','abcde'])", - GetoptError) - -if verbose: - print 'Running tests on getopt.do_shorts' -opts, args = getopt.do_shorts([], 'a', 'a', []) -verify(opts == [('-a', '')]) -verify(args == []) -opts, args = getopt.do_shorts([], 'a1', 'a:', []) -verify(opts == [('-a', '1')]) -verify(args == []) -#opts, args = getopt.do_shorts([], 'a=1', 'a:', []) -#verify(opts == [('-a', '1')]) -#verify(args == []) -opts, args = getopt.do_shorts([], 'a', 'a:', ['1']) -verify(opts == [('-a', '1')]) -verify(args == []) -opts, args = getopt.do_shorts([], 'a', 'a:', ['1', '2']) -verify(opts == [('-a', '1')]) -verify(args == ['2']) -expectException("opts, args = getopt.do_shorts([], 'a1', 'a', [])", - GetoptError) -expectException("opts, args = getopt.do_shorts([], 'a', 'a:', [])", - GetoptError) - -if verbose: - print 'Running tests on getopt.do_longs' -opts, args = getopt.do_longs([], 'abc', ['abc'], []) -verify(opts == [('--abc', '')]) -verify(args == []) -opts, args = getopt.do_longs([], 'abc=1', ['abc='], []) -verify(opts == [('--abc', '1')]) -verify(args == []) -opts, args = getopt.do_longs([], 'abc=1', ['abcd='], []) -verify(opts == [('--abcd', '1')]) -verify(args == []) -opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], []) -verify(opts == [('--abc', '')]) -verify(args == []) -# Much like the preceding, except with a non-alpha character ("-") in -# option name that precedes "="; failed in -# http://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470 -opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], []) -verify(opts == [('--foo', '42')]) -verify(args == []) -expectException("opts, args = getopt.do_longs([], 'abc=1', ['abc'], [])", - GetoptError) -expectException("opts, args = getopt.do_longs([], 'abc', ['abc='], [])", - GetoptError) - -# note: the empty string between '-a' and '--beta' is significant: -# it simulates an empty string option argument ('-a ""') on the command line. -cmdline = ['-a', '1', '-b', '--alpha=2', '--beta', '-a', '3', '-a', '', - '--beta', 'arg1', 'arg2'] - -if verbose: - print 'Running tests on getopt.getopt' -opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta']) -verify(opts == [('-a', '1'), ('-b', ''), ('--alpha', '2'), ('--beta', ''), - ('-a', '3'), ('-a', ''), ('--beta', '')] ) -# Note ambiguity of ('-b', '') and ('-a', '') above. This must be -# accounted for in the code that calls getopt(). -verify(args == ['arg1', 'arg2']) - -expectException( - "opts, args = getopt.getopt(cmdline, 'a:b', ['alpha', 'beta'])", - GetoptError) - -# Test handling of GNU style scanning mode. -if verbose: - print 'Running tests on getopt.gnu_getopt' -cmdline = ['-a', 'arg1', '-b', '1', '--alpha', '--beta=2'] -# GNU style -opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) -verify(opts == [('-a', ''), ('-b', '1'), ('--alpha', ''), ('--beta', '2')]) -verify(args == ['arg1']) -# Posix style via + -opts, args = getopt.gnu_getopt(cmdline, '+ab:', ['alpha', 'beta=']) -verify(opts == [('-a', '')]) -verify(args == ['arg1', '-b', '1', '--alpha', '--beta=2']) -# Posix style via POSIXLY_CORRECT -os.environ["POSIXLY_CORRECT"] = "1" -opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) -verify(opts == [('-a', '')]) -verify(args == ['arg1', '-b', '1', '--alpha', '--beta=2']) - - -if old_posixly_correct is None: - del os.environ["POSIXLY_CORRECT"] -else: - os.environ["POSIXLY_CORRECT"] = old_posixly_correct - -#------------------------------------------------------------------------------ - -libreftest = """ -Examples from the Library Reference: Doc/lib/libgetopt.tex - -An example using only Unix style options: - - ->>> import getopt ->>> args = '-a -b -cfoo -d bar a1 a2'.split() ->>> args -['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2'] ->>> optlist, args = getopt.getopt(args, 'abc:d:') ->>> optlist -[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')] ->>> args -['a1', 'a2'] - -Using long option names is equally easy: - - ->>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' ->>> args = s.split() ->>> args -['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2'] ->>> optlist, args = getopt.getopt(args, 'x', [ -... 'condition=', 'output-file=', 'testing']) ->>> optlist -[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')] ->>> args -['a1', 'a2'] - -""" - -__test__ = {'libreftest' : libreftest} +sentinel = object() + +class GetoptTests(unittest.TestCase): + def setUp(self): + self.old_posixly_correct = os.environ.get("POSIXLY_CORRECT", sentinel) + if self.old_posixly_correct is not sentinel: + del os.environ["POSIXLY_CORRECT"] + + def tearDown(self): + if self.old_posixly_correct is sentinel: + os.environ.pop("POSIXLY_CORRECT", None) + else: + os.environ["POSIXLY_CORRECT"] = self.old_posixly_correct + + def assertError(self, *args, **kwargs): + self.assertRaises(getopt.GetoptError, *args, **kwargs) + + def test_short_has_arg(self): + self.failUnless(getopt.short_has_arg('a', 'a:')) + self.failIf(getopt.short_has_arg('a', 'a')) + self.assertError(getopt.short_has_arg, 'a', 'b') + + def test_long_has_args(self): + has_arg, option = getopt.long_has_args('abc', ['abc=']) + self.failUnless(has_arg) + self.assertEqual(option, 'abc') + + has_arg, option = getopt.long_has_args('abc', ['abc']) + self.failIf(has_arg) + self.assertEqual(option, 'abc') + + has_arg, option = getopt.long_has_args('abc', ['abcd']) + self.failIf(has_arg) + self.assertEqual(option, 'abcd') + + self.assertError(getopt.long_has_args, 'abc', ['def']) + self.assertError(getopt.long_has_args, 'abc', []) + self.assertError(getopt.long_has_args, 'abc', ['abcd','abcde']) + + def test_do_shorts(self): + opts, args = getopt.do_shorts([], 'a', 'a', []) + self.assertEqual(opts, [('-a', '')]) + self.assertEqual(args, []) + + opts, args = getopt.do_shorts([], 'a1', 'a:', []) + self.assertEqual(opts, [('-a', '1')]) + self.assertEqual(args, []) + + #opts, args = getopt.do_shorts([], 'a=1', 'a:', []) + #self.assertEqual(opts, [('-a', '1')]) + #self.assertEqual(args, []) + + opts, args = getopt.do_shorts([], 'a', 'a:', ['1']) + self.assertEqual(opts, [('-a', '1')]) + self.assertEqual(args, []) + + opts, args = getopt.do_shorts([], 'a', 'a:', ['1', '2']) + self.assertEqual(opts, [('-a', '1')]) + self.assertEqual(args, ['2']) + + self.assertError(getopt.do_shorts, [], 'a1', 'a', []) + self.assertError(getopt.do_shorts, [], 'a', 'a:', []) + + def test_do_longs(self): + opts, args = getopt.do_longs([], 'abc', ['abc'], []) + self.assertEqual(opts, [('--abc', '')]) + self.assertEqual(args, []) + + opts, args = getopt.do_longs([], 'abc=1', ['abc='], []) + self.assertEqual(opts, [('--abc', '1')]) + self.assertEqual(args, []) + + opts, args = getopt.do_longs([], 'abc=1', ['abcd='], []) + self.assertEqual(opts, [('--abcd', '1')]) + self.assertEqual(args, []) + + opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], []) + self.assertEqual(opts, [('--abc', '')]) + self.assertEqual(args, []) + + # Much like the preceding, except with a non-alpha character ("-") in + # option name that precedes "="; failed in + # http://python.org/sf/126863 + opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], []) + self.assertEqual(opts, [('--foo', '42')]) + self.assertEqual(args, []) + + self.assertError(getopt.do_longs, [], 'abc=1', ['abc'], []) + self.assertError(getopt.do_longs, [], 'abc', ['abc='], []) + + def test_getopt(self): + # note: the empty string between '-a' and '--beta' is significant: + # it simulates an empty string option argument ('-a ""') on the + # command line. + cmdline = ['-a', '1', '-b', '--alpha=2', '--beta', '-a', '3', '-a', + '', '--beta', 'arg1', 'arg2'] + + opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta']) + self.assertEqual(opts, [('-a', '1'), ('-b', ''), + ('--alpha', '2'), ('--beta', ''), + ('-a', '3'), ('-a', ''), ('--beta', '')]) + # Note ambiguity of ('-b', '') and ('-a', '') above. This must be + # accounted for in the code that calls getopt(). + self.assertEqual(args, ['arg1', 'arg2']) + + self.assertError(getopt.getopt, cmdline, 'a:b', ['alpha', 'beta']) + + def test_gnu_getopt(self): + # Test handling of GNU style scanning mode. + cmdline = ['-a', 'arg1', '-b', '1', '--alpha', '--beta=2'] + + # GNU style + opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) + self.assertEqual(args, ['arg1']) + self.assertEqual(opts, [('-a', ''), ('-b', '1'), + ('--alpha', ''), ('--beta', '2')]) + + # Posix style via + + opts, args = getopt.gnu_getopt(cmdline, '+ab:', ['alpha', 'beta=']) + self.assertEqual(opts, [('-a', '')]) + self.assertEqual(args, ['arg1', '-b', '1', '--alpha', '--beta=2']) + + # Posix style via POSIXLY_CORRECT + os.environ["POSIXLY_CORRECT"] = "1" + opts, args = getopt.gnu_getopt(cmdline, 'ab:', ['alpha', 'beta=']) + self.assertEqual(opts, [('-a', '')]) + self.assertEqual(args, ['arg1', '-b', '1', '--alpha', '--beta=2']) + + def test_libref_examples(self): + s = """ + Examples from the Library Reference: Doc/lib/libgetopt.tex + + An example using only Unix style options: + + + >>> import getopt + >>> args = '-a -b -cfoo -d bar a1 a2'.split() + >>> args + ['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2'] + >>> optlist, args = getopt.getopt(args, 'abc:d:') + >>> optlist + [('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')] + >>> args + ['a1', 'a2'] + + Using long option names is equally easy: + + + >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' + >>> args = s.split() + >>> args + ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2'] + >>> optlist, args = getopt.getopt(args, 'x', [ + ... 'condition=', 'output-file=', 'testing']) + >>> optlist + [('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')] + >>> args + ['a1', 'a2'] + """ + + import new + m = new.module("libreftest", s) + run_doctest(m, verbose) -import sys -run_doctest(sys.modules[__name__], verbose) -#------------------------------------------------------------------------------ +def test_main(): + run_unittest(GetoptTests) -if verbose: - print "Module getopt: tests completed successfully." +if __name__ == "__main__": + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_gettext.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_gettext.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_gettext.py Fri May 25 22:13:08 2007 @@ -4,7 +4,7 @@ import gettext import unittest -from test.test_support import run_suite +from test import test_support # TODO: @@ -336,19 +336,8 @@ 'John Doe \nJane Foobar ') -def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(GettextTestCase1)) - suite.addTest(unittest.makeSuite(GettextTestCase2)) - suite.addTest(unittest.makeSuite(PluralFormsTestCase)) - suite.addTest(unittest.makeSuite(UnicodeTranslationsTest)) - suite.addTest(unittest.makeSuite(WeirdMetadataTest)) - return suite - - def test_main(): - run_suite(suite()) - + test_support.run_unittest(__name__) if __name__ == '__main__': test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_glob.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_glob.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_glob.py Fri May 25 22:13:08 2007 @@ -52,6 +52,16 @@ eq(self.glob('aab'), [self.norm('aab')]) eq(self.glob('zymurgy'), []) + # test return types are unicode, but only if os.listdir + # returns unicode filenames + uniset = set([unicode]) + tmp = os.listdir(u'.') + if set(type(x) for x in tmp) == uniset: + u1 = glob.glob(u'*') + u2 = glob.glob(u'./*') + self.assertEquals(set(type(r) for r in u1), uniset) + self.assertEquals(set(type(r) for r in u2), uniset) + def test_glob_one_directory(self): eq = self.assertSequencesEqual_noorder eq(self.glob('a*'), map(self.norm, ['a', 'aab', 'aaa'])) Modified: python/branches/bcannon-objcap/Lib/test/test_grammar.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_grammar.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_grammar.py Fri May 25 22:13:08 2007 @@ -600,7 +600,7 @@ def testTry(self): ### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] ### | 'try' ':' suite 'finally' ':' suite - ### except_clause: 'except' [expr [',' expr]] + ### except_clause: 'except' [expr [('as' | ',') expr]] try: 1/0 except ZeroDivisionError: @@ -609,7 +609,7 @@ pass try: 1/0 except EOFError: pass - except TypeError, msg: pass + except TypeError as msg: pass except RuntimeError, msg: pass except: pass else: pass Modified: python/branches/bcannon-objcap/Lib/test/test_gzip.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_gzip.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_gzip.py Fri May 25 22:13:08 2007 @@ -153,6 +153,13 @@ self.assertEqual(f.myfileobj.mode, 'rb') f.close() + def test_1647484(self): + for mode in ('wb', 'rb'): + f = gzip.GzipFile(self.filename, mode) + self.assert_(hasattr(f, "name")) + self.assertEqual(f.name, self.filename) + f.close() + def test_main(verbose=None): test_support.run_unittest(TestGzip) Modified: python/branches/bcannon-objcap/Lib/test/test_heapq.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_heapq.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_heapq.py Fri May 25 22:13:08 2007 @@ -1,6 +1,6 @@ """Unittests for heapq.""" -from heapq import heappush, heappop, heapify, heapreplace, nlargest, nsmallest +from heapq import heappush, heappop, heapify, heapreplace, merge, nlargest, nsmallest import random import unittest from test import test_support @@ -103,6 +103,29 @@ heap_sorted = [heappop(heap) for i in range(size)] self.assertEqual(heap_sorted, sorted(data)) + def test_merge(self): + inputs = [] + for i in xrange(random.randrange(5)): + row = sorted(random.randrange(1000) for j in range(random.randrange(10))) + inputs.append(row) + self.assertEqual(sorted(chain(*inputs)), list(merge(*inputs))) + self.assertEqual(list(merge()), []) + + def test_merge_stability(self): + class Int(int): + pass + inputs = [[], [], [], []] + for i in range(20000): + stream = random.randrange(4) + x = random.randrange(500) + obj = Int(x) + obj.pair = (x, stream) + inputs[stream].append(obj) + for stream in inputs: + stream.sort() + result = [i.pair for i in merge(*inputs)] + self.assertEqual(result, sorted(result)) + def test_nsmallest(self): data = [(random.randrange(2000), i) for i in range(1000)] for f in (None, lambda x: x[0] * 547 % 2000): Modified: python/branches/bcannon-objcap/Lib/test/test_htmlparser.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_htmlparser.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_htmlparser.py Fri May 25 22:13:08 2007 @@ -309,6 +309,11 @@ ("endtag", "script"), ]) + def test_entityrefs_in_attributes(self): + self._run_check("", [ + ("starttag", "html", [("foo", u"\u20AC&aa&unsupported;")]) + ]) + def test_main(): test_support.run_unittest(HTMLParserTestCase) Modified: python/branches/bcannon-objcap/Lib/test/test_httplib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_httplib.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_httplib.py Fri May 25 22:13:08 2007 @@ -1,6 +1,7 @@ import httplib import StringIO import sys +import socket from unittest import TestCase @@ -149,8 +150,60 @@ def test_responses(self): self.assertEquals(httplib.responses[httplib.NOT_FOUND], "Not Found") +PORT = 50003 +HOST = "localhost" + +class TimeoutTest(TestCase): + + def setUp(self): + self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + global PORT + PORT = test_support.bind_port(self.serv, HOST, PORT) + self.serv.listen(5) + + def tearDown(self): + self.serv.close() + self.serv = None + + def testTimeoutAttribute(self): + '''This will prove that the timeout gets through + HTTPConnection and into the socket. + ''' + # default + httpConn = httplib.HTTPConnection(HOST, PORT) + httpConn.connect() + self.assertTrue(httpConn.sock.gettimeout() is None) + httpConn.close() + + # a value + httpConn = httplib.HTTPConnection(HOST, PORT, timeout=30) + httpConn.connect() + self.assertEqual(httpConn.sock.gettimeout(), 30) + httpConn.close() + + # None, having other default + previous = socket.getdefaulttimeout() + socket.setdefaulttimeout(30) + try: + httpConn = httplib.HTTPConnection(HOST, PORT, timeout=None) + httpConn.connect() + finally: + socket.setdefaulttimeout(previous) + self.assertEqual(httpConn.sock.gettimeout(), 30) + httpConn.close() + + +class HTTPSTimeoutTest(TestCase): +# XXX Here should be tests for HTTPS, there isn't any right now! + + def test_attributes(self): + # simple test to check it's storing it + h = httplib.HTTPSConnection(HOST, PORT, timeout=30) + self.assertEqual(h.timeout, 30) + def test_main(verbose=None): - test_support.run_unittest(HeaderTests, OfflineTest, BasicTest) + test_support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest, HTTPSTimeoutTest) if __name__ == '__main__': test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_imageop.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_imageop.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_imageop.py Fri May 25 22:13:08 2007 @@ -7,23 +7,16 @@ from test.test_support import verbose, unlink -import imageop, uu, os +import imageop, uu, os, imgfile import warnings -warnings.filterwarnings("ignore", - "the rgbimg module is deprecated", - DeprecationWarning, - ".*test_imageop") -def main(use_rgbimg=1): +def main(): # Create binary test files uu.decode(get_qualified_path('testrgb'+os.extsep+'uue'), 'test'+os.extsep+'rgb') - if use_rgbimg: - image, width, height = getrgbimage('test'+os.extsep+'rgb') - else: - image, width, height = getimage('test'+os.extsep+'rgb') + image, width, height = getimage('test'+os.extsep+'rgb') # Return the selected part of image, which should by width by height # in size and consist of pixels of psize bytes. @@ -122,30 +115,10 @@ # Cleanup unlink('test'+os.extsep+'rgb') -def getrgbimage(name): - """return a tuple consisting of image (in 'imgfile' format but - using rgbimg instead) width and height""" - - import rgbimg - - try: - sizes = rgbimg.sizeofimage(name) - except rgbimg.error: - name = get_qualified_path(name) - sizes = rgbimg.sizeofimage(name) - if verbose: - print 'rgbimg opening test image: %s, sizes: %s' % (name, str(sizes)) - - image = rgbimg.longimagedata(name) - return (image, sizes[0], sizes[1]) - def getimage(name): """return a tuple consisting of image (in 'imgfile' format) width and height """ - - import imgfile - try: sizes = imgfile.getsizes(name) except imgfile.error: @@ -172,6 +145,4 @@ return fullname return name -# rgbimg (unlike imgfile) is portable to platforms other than SGI. -# So we prefer to use it. -main(use_rgbimg=1) +main() Modified: python/branches/bcannon-objcap/Lib/test/test_import.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_import.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_import.py Fri May 25 22:13:08 2007 @@ -193,6 +193,16 @@ if TESTFN in sys.modules: del sys.modules[TESTFN] + def test_infinite_reload(self): + # Bug #742342 reports that Python segfaults (infinite recursion in C) + # when faced with self-recursive reload()ing. + + sys.path.insert(0, os.path.dirname(__file__)) + try: + import infinite_reload + finally: + sys.path.pop(0) + def test_import_name_binding(self): # import x.y.z binds x in the current namespace import test as x Modified: python/branches/bcannon-objcap/Lib/test/test_index.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_index.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_index.py Fri May 25 22:13:08 2007 @@ -1,7 +1,10 @@ import unittest from test import test_support import operator +import sys from sys import maxint +maxsize = test_support.MAX_Py_ssize_t +minsize = -maxsize-1 class oldstyle: def __index__(self): @@ -185,7 +188,7 @@ def _getitem_helper(self, base): class GetItem(base): def __len__(self): - return maxint + return maxint #cannot return long here def __getitem__(self, key): return key def __getslice__(self, i, j): @@ -193,8 +196,8 @@ x = GetItem() self.assertEqual(x[self.pos], self.pos) self.assertEqual(x[self.neg], self.neg) - self.assertEqual(x[self.neg:self.pos], (-1, maxint)) - self.assertEqual(x[self.neg:self.pos:1].indices(maxint), (0, maxint, 1)) + self.assertEqual(x[self.neg:self.pos], (maxint+minsize, maxsize)) + self.assertEqual(x[self.neg:self.pos:1].indices(maxsize), (0, maxsize, 1)) def test_getitem(self): self._getitem_helper(object) Modified: python/branches/bcannon-objcap/Lib/test/test_itertools.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_itertools.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_itertools.py Fri May 25 22:13:08 2007 @@ -5,6 +5,8 @@ import sys import operator import random +maxsize = test_support.MAX_Py_ssize_t +minsize = -maxsize-1 def onearg(x): 'Test function of one argument' @@ -52,8 +54,7 @@ self.assertEqual(take(2, zip('abc',count(3))), [('a', 3), ('b', 4)]) self.assertRaises(TypeError, count, 2, 3) self.assertRaises(TypeError, count, 'a') - c = count(sys.maxint-2) # verify that rollover doesn't crash - c.next(); c.next(); c.next(); c.next(); c.next() + self.assertRaises(OverflowError, list, islice(count(maxsize-5), 10)) c = count(3) self.assertEqual(repr(c), 'count(3)') c.next() @@ -199,6 +200,51 @@ ids = map(id, list(izip('abc', 'def'))) self.assertEqual(len(dict.fromkeys(ids)), len(ids)) + def test_iziplongest(self): + for args in [ + ['abc', range(6)], + [range(6), 'abc'], + [range(1000), range(2000,2100), range(3000,3050)], + [range(1000), range(0), range(3000,3050), range(1200), range(1500)], + [range(1000), range(0), range(3000,3050), range(1200), range(1500), range(0)], + ]: + target = map(None, *args) + self.assertEqual(list(izip_longest(*args)), target) + self.assertEqual(list(izip_longest(*args, **{})), target) + target = [tuple((e is None and 'X' or e) for e in t) for t in target] # Replace None fills with 'X' + self.assertEqual(list(izip_longest(*args, **dict(fillvalue='X'))), target) + + self.assertEqual(take(3,izip_longest('abcdef', count())), zip('abcdef', range(3))) # take 3 from infinite input + + self.assertEqual(list(izip_longest()), zip()) + self.assertEqual(list(izip_longest([])), zip([])) + self.assertEqual(list(izip_longest('abcdef')), zip('abcdef')) + + self.assertEqual(list(izip_longest('abc', 'defg', **{})), map(None, 'abc', 'defg')) # empty keyword dict + self.assertRaises(TypeError, izip_longest, 3) + self.assertRaises(TypeError, izip_longest, range(3), 3) + + for stmt in [ + "izip_longest('abc', fv=1)", + "izip_longest('abc', fillvalue=1, bogus_keyword=None)", + ]: + try: + eval(stmt, globals(), locals()) + except TypeError: + pass + else: + self.fail('Did not raise Type in: ' + stmt) + + # Check tuple re-use (implementation detail) + self.assertEqual([tuple(list(pair)) for pair in izip_longest('abc', 'def')], + zip('abc', 'def')) + self.assertEqual([pair for pair in izip_longest('abc', 'def')], + zip('abc', 'def')) + ids = map(id, izip_longest('abc', 'def')) + self.assertEqual(min(ids), max(ids)) + ids = map(id, list(izip_longest('abc', 'def'))) + self.assertEqual(len(dict.fromkeys(ids)), len(ids)) + def test_repeat(self): self.assertEqual(zip(xrange(3),repeat('a')), [(0, 'a'), (1, 'a'), (2, 'a')]) @@ -286,7 +332,7 @@ self.assertRaises(ValueError, islice, xrange(10), 1, 'a') self.assertRaises(ValueError, islice, xrange(10), 'a', 1, 1) self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1) - self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1) + self.assertEqual(len(list(islice(count(), 1, 10, maxsize))), 1) def test_takewhile(self): data = [1, 3, 5, 20, 2, 4, 6, 8] @@ -612,6 +658,15 @@ self.assertRaises(TypeError, list, izip(N(s))) self.assertRaises(ZeroDivisionError, list, izip(E(s))) + def test_iziplongest(self): + for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): + for g in (G, I, Ig, S, L, R): + self.assertEqual(list(izip_longest(g(s))), zip(g(s))) + self.assertEqual(list(izip_longest(g(s), g(s))), zip(g(s), g(s))) + self.assertRaises(TypeError, izip_longest, X(s)) + self.assertRaises(TypeError, list, izip_longest(N(s))) + self.assertRaises(ZeroDivisionError, list, izip_longest(E(s))) + def test_imap(self): for s in (range(10), range(0), range(100), (7,11), xrange(20,50,5)): for g in (G, I, Ig, S, L, R): Modified: python/branches/bcannon-objcap/Lib/test/test_locale.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_locale.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_locale.py Fri May 25 22:13:08 2007 @@ -7,7 +7,7 @@ oldlocale = locale.setlocale(locale.LC_NUMERIC) if sys.platform.startswith("win"): - tlocs = ("en",) + tlocs = ("En", "English") else: tlocs = ("en_US.UTF-8", "en_US.US-ASCII", "en_US") Modified: python/branches/bcannon-objcap/Lib/test/test_logging.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_logging.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_logging.py Fri May 25 22:13:08 2007 @@ -555,6 +555,8 @@ except KeyError: logging.exception("just testing") os.remove(fn) + hdlr = logging.getLogger().handlers[0] + logging.getLogger().handlers.remove(hdlr) finally: logging._acquireLock() try: Modified: python/branches/bcannon-objcap/Lib/test/test_long_future.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_long_future.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_long_future.py Fri May 25 22:13:08 2007 @@ -3,53 +3,53 @@ # test_long.py instead. In the meantime, it's too obscure to try to # trick just part of test_long into using future division. -from test.test_support import TestFailed, verify, verbose +import unittest +from test.test_support import run_unittest -def test_true_division(): - if verbose: - print "long true division" - huge = 1L << 40000 - mhuge = -huge - verify(huge / huge == 1.0) - verify(mhuge / mhuge == 1.0) - verify(huge / mhuge == -1.0) - verify(mhuge / huge == -1.0) - verify(1 / huge == 0.0) - verify(1L / huge == 0.0) - verify(1 / mhuge == 0.0) - verify(1L / mhuge == 0.0) - verify((666 * huge + (huge >> 1)) / huge == 666.5) - verify((666 * mhuge + (mhuge >> 1)) / mhuge == 666.5) - verify((666 * huge + (huge >> 1)) / mhuge == -666.5) - verify((666 * mhuge + (mhuge >> 1)) / huge == -666.5) - verify(huge / (huge << 1) == 0.5) - verify((1000000 * huge) / huge == 1000000) - - namespace = {'huge': huge, 'mhuge': mhuge} - - for overflow in ["float(huge)", "float(mhuge)", - "huge / 1", "huge / 2L", "huge / -1", "huge / -2L", - "mhuge / 100", "mhuge / 100L"]: - try: - eval(overflow, namespace) - except OverflowError: - pass - else: - raise TestFailed("expected OverflowError from %r" % overflow) - - for underflow in ["1 / huge", "2L / huge", "-1 / huge", "-2L / huge", - "100 / mhuge", "100L / mhuge"]: - result = eval(underflow, namespace) - if result != 0.0: - raise TestFailed("expected underflow to 0 from %r" % underflow) - - for zero in ["huge / 0", "huge / 0L", - "mhuge / 0", "mhuge / 0L"]: - try: - eval(zero, namespace) - except ZeroDivisionError: - pass - else: - raise TestFailed("expected ZeroDivisionError from %r" % zero) +class TrueDivisionTests(unittest.TestCase): + def test(self): + huge = 1L << 40000 + mhuge = -huge + self.assertEqual(huge / huge, 1.0) + self.assertEqual(mhuge / mhuge, 1.0) + self.assertEqual(huge / mhuge, -1.0) + self.assertEqual(mhuge / huge, -1.0) + self.assertEqual(1 / huge, 0.0) + self.assertEqual(1L / huge, 0.0) + self.assertEqual(1 / mhuge, 0.0) + self.assertEqual(1L / mhuge, 0.0) + self.assertEqual((666 * huge + (huge >> 1)) / huge, 666.5) + self.assertEqual((666 * mhuge + (mhuge >> 1)) / mhuge, 666.5) + self.assertEqual((666 * huge + (huge >> 1)) / mhuge, -666.5) + self.assertEqual((666 * mhuge + (mhuge >> 1)) / huge, -666.5) + self.assertEqual(huge / (huge << 1), 0.5) + self.assertEqual((1000000 * huge) / huge, 1000000) + + namespace = {'huge': huge, 'mhuge': mhuge} + + for overflow in ["float(huge)", "float(mhuge)", + "huge / 1", "huge / 2L", "huge / -1", "huge / -2L", + "mhuge / 100", "mhuge / 100L"]: + # XXX(cwinter) this test doesn't pass when converted to + # use assertRaises. + try: + eval(overflow, namespace) + self.fail("expected OverflowError from %r" % overflow) + except OverflowError: + pass + + for underflow in ["1 / huge", "2L / huge", "-1 / huge", "-2L / huge", + "100 / mhuge", "100L / mhuge"]: + result = eval(underflow, namespace) + self.assertEqual(result, 0.0, + "expected underflow to 0 from %r" % underflow) + + for zero in ["huge / 0", "huge / 0L", "mhuge / 0", "mhuge / 0L"]: + self.assertRaises(ZeroDivisionError, eval, zero, namespace) -test_true_division() + +def test_main(): + run_unittest(TrueDivisionTests) + +if __name__ == "__main__": + test_main() Deleted: /python/branches/bcannon-objcap/Lib/test/test_macfs.py ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/test_macfs.py Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,78 +0,0 @@ -# Copyright (C) 2003 Python Software Foundation - -import unittest -import warnings -warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) -import macfs -import os -import sys -import tempfile -from test import test_support - -class TestMacfs(unittest.TestCase): - - def setUp(self): - fp = open(test_support.TESTFN, 'w') - fp.write('hello world\n') - fp.close() - - def tearDown(self): - try: - os.unlink(test_support.TESTFN) - except: - pass - - def test_fsspec(self): - fss = macfs.FSSpec(test_support.TESTFN) - self.assertEqual(os.path.realpath(test_support.TESTFN), fss.as_pathname()) - - def test_fsref(self): - fsr = macfs.FSRef(test_support.TESTFN) - self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) - - def test_fsref_unicode(self): - if sys.getfilesystemencoding(): - testfn_unicode = unicode(test_support.TESTFN) - fsr = macfs.FSRef(testfn_unicode) - self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) - - def test_coercion(self): - fss = macfs.FSSpec(test_support.TESTFN) - fsr = macfs.FSRef(test_support.TESTFN) - fss2 = fsr.as_fsspec() - fsr2 = fss.as_fsref() - self.assertEqual(fss.as_pathname(), fss2.as_pathname()) - self.assertEqual(fsr.as_pathname(), fsr2.as_pathname()) - - def test_dates(self): - import time - fss = macfs.FSSpec(test_support.TESTFN) - now = int(time.time()) - fss.SetDates(now, now+1, now+2) - dates = fss.GetDates() - self.assertEqual(dates, (now, now+1, now+2)) - - def test_ctor_type(self): - fss = macfs.FSSpec(test_support.TESTFN) - fss.SetCreatorType('Pyth', 'TEXT') - filecr, filetp = fss.GetCreatorType() - self.assertEqual((filecr, filetp), ('Pyth', 'TEXT')) - - def test_alias(self): - fss = macfs.FSSpec(test_support.TESTFN) - alias = fss.NewAlias() - fss2, changed = alias.Resolve() - self.assertEqual(changed, 0) - self.assertEqual(fss.as_pathname(), fss2.as_pathname()) - - - def test_fss_alias(self): - fss = macfs.FSSpec(test_support.TESTFN) - - -def test_main(): - test_support.run_unittest(TestMacfs) - - -if __name__ == '__main__': - test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_macostools.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_macostools.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_macostools.py Fri May 25 22:13:08 2007 @@ -51,7 +51,11 @@ def test_touched(self): # This really only tests that nothing unforeseen happens. - macostools.touched(test_support.TESTFN) + import warnings + with test_support.guard_warnings_filter(): + warnings.filterwarnings('ignore', 'macostools.touched*', + DeprecationWarning) + macostools.touched(test_support.TESTFN) def test_copy(self): try: Modified: python/branches/bcannon-objcap/Lib/test/test_macpath.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_macpath.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_macpath.py Fri May 25 22:13:08 2007 @@ -48,7 +48,7 @@ splitext = macpath.splitext self.assertEquals(splitext(":foo.ext"), (':foo', '.ext')) self.assertEquals(splitext("foo:foo.ext"), ('foo:foo', '.ext')) - self.assertEquals(splitext(".ext"), ('', '.ext')) + self.assertEquals(splitext(".ext"), ('.ext', '')) self.assertEquals(splitext("foo.ext:foo"), ('foo.ext:foo', '')) self.assertEquals(splitext(":foo.ext:"), (':foo.ext:', '')) self.assertEquals(splitext(""), ('', '')) Modified: python/branches/bcannon-objcap/Lib/test/test_mailbox.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_mailbox.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_mailbox.py Fri May 25 22:13:08 2007 @@ -54,6 +54,7 @@ def setUp(self): self._path = test_support.TESTFN + self._delete_recursively(self._path) self._box = self._factory(self._path) def tearDown(self): @@ -693,7 +694,7 @@ self._box.close() self._delete_recursively(self._path) for lock_remnant in glob.glob(self._path + '.*'): - os.remove(lock_remnant) + test_support.unlink(lock_remnant) def test_add_from_string(self): # Add a string starting with 'From ' to the mailbox @@ -914,7 +915,7 @@ self._box.close() self._delete_recursively(self._path) for lock_remnant in glob.glob(self._path + '.*'): - os.remove(lock_remnant) + test_support.unlink(lock_remnant) def test_labels(self): # Get labels from the mailbox Modified: python/branches/bcannon-objcap/Lib/test/test_marshal.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_marshal.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_marshal.py Fri May 25 22:13:08 2007 @@ -220,6 +220,30 @@ except Exception: pass + def test_loads_recursion(self): + s = 'c' + ('X' * 4*4) + '{' * 2**20 + self.assertRaises(ValueError, marshal.loads, s) + + def test_recursion_limit(self): + # Create a deeply nested structure. + head = last = [] + # The max stack depth should match the value in Python/marshal.c. + MAX_MARSHAL_STACK_DEPTH = 2000 + for i in range(MAX_MARSHAL_STACK_DEPTH - 2): + last.append([0]) + last = last[-1] + + # Verify we don't blow out the stack with dumps/load. + data = marshal.dumps(head) + new_head = marshal.loads(data) + # Don't use == to compare objects, it can exceed the recursion limit. + self.assertEqual(len(new_head), len(head)) + self.assertEqual(len(new_head[0]), len(head[0])) + self.assertEqual(len(new_head[-1]), len(head[-1])) + + last.append([0]) + self.assertRaises(ValueError, marshal.dumps, head) + def test_main(): test_support.run_unittest(IntTestCase, FloatTestCase, Modified: python/branches/bcannon-objcap/Lib/test/test_minidom.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_minidom.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_minidom.py Fri May 25 22:13:08 2007 @@ -5,7 +5,8 @@ import pickle import traceback from StringIO import StringIO -from test.test_support import verbose +from test.test_support import verbose, run_unittest, TestSkipped +import unittest import xml.dom import xml.dom.minidom @@ -22,682 +23,9 @@ tstfile = os.path.join(os.path.dirname(base), "test"+os.extsep+"xml") del base -def confirm(test, testname = "Test"): - if not test: - print "Failed " + testname - raise Exception - -def testParseFromFile(): - dom = parse(StringIO(open(tstfile).read())) - dom.unlink() - confirm(isinstance(dom,Document)) - -def testGetElementsByTagName(): - dom = parse(tstfile) - confirm(dom.getElementsByTagName("LI") == \ - dom.documentElement.getElementsByTagName("LI")) - dom.unlink() - -def testInsertBefore(): - dom = parseString("") - root = dom.documentElement - elem = root.childNodes[0] - nelem = dom.createElement("element") - root.insertBefore(nelem, elem) - confirm(len(root.childNodes) == 2 - and root.childNodes.length == 2 - and root.childNodes[0] is nelem - and root.childNodes.item(0) is nelem - and root.childNodes[1] is elem - and root.childNodes.item(1) is elem - and root.firstChild is nelem - and root.lastChild is elem - and root.toxml() == "" - , "testInsertBefore -- node properly placed in tree") - nelem = dom.createElement("element") - root.insertBefore(nelem, None) - confirm(len(root.childNodes) == 3 - and root.childNodes.length == 3 - and root.childNodes[1] is elem - and root.childNodes.item(1) is elem - and root.childNodes[2] is nelem - and root.childNodes.item(2) is nelem - and root.lastChild is nelem - and nelem.previousSibling is elem - and root.toxml() == "" - , "testInsertBefore -- node properly placed in tree") - nelem2 = dom.createElement("bar") - root.insertBefore(nelem2, nelem) - confirm(len(root.childNodes) == 4 - and root.childNodes.length == 4 - and root.childNodes[2] is nelem2 - and root.childNodes.item(2) is nelem2 - and root.childNodes[3] is nelem - and root.childNodes.item(3) is nelem - and nelem2.nextSibling is nelem - and nelem.previousSibling is nelem2 - and root.toxml() == "" - , "testInsertBefore -- node properly placed in tree") - dom.unlink() - -def _create_fragment_test_nodes(): - dom = parseString("") - orig = dom.createTextNode("original") - c1 = dom.createTextNode("foo") - c2 = dom.createTextNode("bar") - c3 = dom.createTextNode("bat") - dom.documentElement.appendChild(orig) - frag = dom.createDocumentFragment() - frag.appendChild(c1) - frag.appendChild(c2) - frag.appendChild(c3) - return dom, orig, c1, c2, c3, frag - -def testInsertBeforeFragment(): - dom, orig, c1, c2, c3, frag = _create_fragment_test_nodes() - dom.documentElement.insertBefore(frag, None) - confirm(tuple(dom.documentElement.childNodes) == (orig, c1, c2, c3), - "insertBefore(, None)") - frag.unlink() - dom.unlink() - # - dom, orig, c1, c2, c3, frag = _create_fragment_test_nodes() - dom.documentElement.insertBefore(frag, orig) - confirm(tuple(dom.documentElement.childNodes) == (c1, c2, c3, orig), - "insertBefore(, orig)") - frag.unlink() - dom.unlink() - -def testAppendChild(): - dom = parse(tstfile) - dom.documentElement.appendChild(dom.createComment(u"Hello")) - confirm(dom.documentElement.childNodes[-1].nodeName == "#comment") - confirm(dom.documentElement.childNodes[-1].data == "Hello") - dom.unlink() - -def testAppendChildFragment(): - dom, orig, c1, c2, c3, frag = _create_fragment_test_nodes() - dom.documentElement.appendChild(frag) - confirm(tuple(dom.documentElement.childNodes) == (orig, c1, c2, c3), - "appendChild()") - frag.unlink() - dom.unlink() - -def testReplaceChildFragment(): - dom, orig, c1, c2, c3, frag = _create_fragment_test_nodes() - dom.documentElement.replaceChild(frag, orig) - orig.unlink() - confirm(tuple(dom.documentElement.childNodes) == (c1, c2, c3), - "replaceChild()") - frag.unlink() - dom.unlink() - -def testLegalChildren(): - dom = Document() - elem = dom.createElement('element') - text = dom.createTextNode('text') - - try: dom.appendChild(text) - except xml.dom.HierarchyRequestErr: pass - else: - print "dom.appendChild didn't raise HierarchyRequestErr" - - dom.appendChild(elem) - try: dom.insertBefore(text, elem) - except xml.dom.HierarchyRequestErr: pass - else: - print "dom.appendChild didn't raise HierarchyRequestErr" - - try: dom.replaceChild(text, elem) - except xml.dom.HierarchyRequestErr: pass - else: - print "dom.appendChild didn't raise HierarchyRequestErr" - - nodemap = elem.attributes - try: nodemap.setNamedItem(text) - except xml.dom.HierarchyRequestErr: pass - else: - print "NamedNodeMap.setNamedItem didn't raise HierarchyRequestErr" - - try: nodemap.setNamedItemNS(text) - except xml.dom.HierarchyRequestErr: pass - else: - print "NamedNodeMap.setNamedItemNS didn't raise HierarchyRequestErr" - - elem.appendChild(text) - dom.unlink() - -def testNamedNodeMapSetItem(): - dom = Document() - elem = dom.createElement('element') - attrs = elem.attributes - attrs["foo"] = "bar" - a = attrs.item(0) - confirm(a.ownerDocument is dom, - "NamedNodeMap.__setitem__() sets ownerDocument") - confirm(a.ownerElement is elem, - "NamedNodeMap.__setitem__() sets ownerElement") - confirm(a.value == "bar", - "NamedNodeMap.__setitem__() sets value") - confirm(a.nodeValue == "bar", - "NamedNodeMap.__setitem__() sets nodeValue") - elem.unlink() - dom.unlink() - -def testNonZero(): - dom = parse(tstfile) - confirm(dom)# should not be zero - dom.appendChild(dom.createComment("foo")) - confirm(not dom.childNodes[-1].childNodes) - dom.unlink() - -def testUnlink(): - dom = parse(tstfile) - dom.unlink() - -def testElement(): - dom = Document() - dom.appendChild(dom.createElement("abc")) - confirm(dom.documentElement) - dom.unlink() - -def testAAA(): - dom = parseString("") - el = dom.documentElement - el.setAttribute("spam", "jam2") - confirm(el.toxml() == '', "testAAA") - a = el.getAttributeNode("spam") - confirm(a.ownerDocument is dom, - "setAttribute() sets ownerDocument") - confirm(a.ownerElement is dom.documentElement, - "setAttribute() sets ownerElement") - dom.unlink() - -def testAAB(): - dom = parseString("") - el = dom.documentElement - el.setAttribute("spam", "jam") - el.setAttribute("spam", "jam2") - confirm(el.toxml() == '', "testAAB") - dom.unlink() - -def testAddAttr(): - dom = Document() - child = dom.appendChild(dom.createElement("abc")) - - child.setAttribute("def", "ghi") - confirm(child.getAttribute("def") == "ghi") - confirm(child.attributes["def"].value == "ghi") - - child.setAttribute("jkl", "mno") - confirm(child.getAttribute("jkl") == "mno") - confirm(child.attributes["jkl"].value == "mno") - - confirm(len(child.attributes) == 2) - - child.setAttribute("def", "newval") - confirm(child.getAttribute("def") == "newval") - confirm(child.attributes["def"].value == "newval") - - confirm(len(child.attributes) == 2) - dom.unlink() - -def testDeleteAttr(): - dom = Document() - child = dom.appendChild(dom.createElement("abc")) - - confirm(len(child.attributes) == 0) - child.setAttribute("def", "ghi") - confirm(len(child.attributes) == 1) - del child.attributes["def"] - confirm(len(child.attributes) == 0) - dom.unlink() - -def testRemoveAttr(): - dom = Document() - child = dom.appendChild(dom.createElement("abc")) - - child.setAttribute("def", "ghi") - confirm(len(child.attributes) == 1) - child.removeAttribute("def") - confirm(len(child.attributes) == 0) - - dom.unlink() - -def testRemoveAttrNS(): - dom = Document() - child = dom.appendChild( - dom.createElementNS("http://www.python.org", "python:abc")) - child.setAttributeNS("http://www.w3.org", "xmlns:python", - "http://www.python.org") - child.setAttributeNS("http://www.python.org", "python:abcattr", "foo") - confirm(len(child.attributes) == 2) - child.removeAttributeNS("http://www.python.org", "abcattr") - confirm(len(child.attributes) == 1) - - dom.unlink() - -def testRemoveAttributeNode(): - dom = Document() - child = dom.appendChild(dom.createElement("foo")) - child.setAttribute("spam", "jam") - confirm(len(child.attributes) == 1) - node = child.getAttributeNode("spam") - child.removeAttributeNode(node) - confirm(len(child.attributes) == 0 - and child.getAttributeNode("spam") is None) - - dom.unlink() - -def testChangeAttr(): - dom = parseString("") - el = dom.documentElement - el.setAttribute("spam", "jam") - confirm(len(el.attributes) == 1) - el.setAttribute("spam", "bam") - # Set this attribute to be an ID and make sure that doesn't change - # when changing the value: - el.setIdAttribute("spam") - confirm(len(el.attributes) == 1 - and el.attributes["spam"].value == "bam" - and el.attributes["spam"].nodeValue == "bam" - and el.getAttribute("spam") == "bam" - and el.getAttributeNode("spam").isId) - el.attributes["spam"] = "ham" - confirm(len(el.attributes) == 1 - and el.attributes["spam"].value == "ham" - and el.attributes["spam"].nodeValue == "ham" - and el.getAttribute("spam") == "ham" - and el.attributes["spam"].isId) - el.setAttribute("spam2", "bam") - confirm(len(el.attributes) == 2 - and el.attributes["spam"].value == "ham" - and el.attributes["spam"].nodeValue == "ham" - and el.getAttribute("spam") == "ham" - and el.attributes["spam2"].value == "bam" - and el.attributes["spam2"].nodeValue == "bam" - and el.getAttribute("spam2") == "bam") - el.attributes["spam2"] = "bam2" - confirm(len(el.attributes) == 2 - and el.attributes["spam"].value == "ham" - and el.attributes["spam"].nodeValue == "ham" - and el.getAttribute("spam") == "ham" - and el.attributes["spam2"].value == "bam2" - and el.attributes["spam2"].nodeValue == "bam2" - and el.getAttribute("spam2") == "bam2") - dom.unlink() - -def testGetAttrList(): - pass - -def testGetAttrValues(): pass - -def testGetAttrLength(): pass - -def testGetAttribute(): pass - -def testGetAttributeNS(): pass - -def testGetAttributeNode(): pass - -def testGetElementsByTagNameNS(): - d=""" - - """ - dom = parseString(d) - elems = dom.getElementsByTagNameNS("http://pyxml.sf.net/minidom", "myelem") - confirm(len(elems) == 1 - and elems[0].namespaceURI == "http://pyxml.sf.net/minidom" - and elems[0].localName == "myelem" - and elems[0].prefix == "minidom" - and elems[0].tagName == "minidom:myelem" - and elems[0].nodeName == "minidom:myelem") - dom.unlink() - -def get_empty_nodelist_from_elements_by_tagName_ns_helper(doc, nsuri, lname): - nodelist = doc.getElementsByTagNameNS(nsuri, lname) - confirm(len(nodelist) == 0) - -def testGetEmptyNodeListFromElementsByTagNameNS(): - doc = parseString('') - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, 'http://xml.python.org/namespaces/a', 'localname') - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, '*', 'splat') - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, 'http://xml.python.org/namespaces/a', '*') - - doc = parseString('') - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, "http://xml.python.org/splat", "not-there") - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, "*", "not-there") - get_empty_nodelist_from_elements_by_tagName_ns_helper( - doc, "http://somewhere.else.net/not-there", "e") - -def testElementReprAndStr(): - dom = Document() - el = dom.appendChild(dom.createElement("abc")) - string1 = repr(el) - string2 = str(el) - confirm(string1 == string2) - dom.unlink() - -# commented out until Fredrick's fix is checked in -def _testElementReprAndStrUnicode(): - dom = Document() - el = dom.appendChild(dom.createElement(u"abc")) - string1 = repr(el) - string2 = str(el) - confirm(string1 == string2) - dom.unlink() - -# commented out until Fredrick's fix is checked in -def _testElementReprAndStrUnicodeNS(): - dom = Document() - el = dom.appendChild( - dom.createElementNS(u"http://www.slashdot.org", u"slash:abc")) - string1 = repr(el) - string2 = str(el) - confirm(string1 == string2) - confirm(string1.find("slash:abc") != -1) - dom.unlink() - -def testAttributeRepr(): - dom = Document() - el = dom.appendChild(dom.createElement(u"abc")) - node = el.setAttribute("abc", "def") - confirm(str(node) == repr(node)) - dom.unlink() - -def testTextNodeRepr(): pass - -def testWriteXML(): - str = '' - dom = parseString(str) - domstr = dom.toxml() - dom.unlink() - confirm(str == domstr) - -def testAltNewline(): - str = '\n\n' - dom = parseString(str) - domstr = dom.toprettyxml(newl="\r\n") - dom.unlink() - confirm(domstr == str.replace("\n", "\r\n")) - -def testProcessingInstruction(): - dom = parseString('') - pi = dom.documentElement.firstChild - confirm(pi.target == "mypi" - and pi.data == "data \t\n " - and pi.nodeName == "mypi" - and pi.nodeType == Node.PROCESSING_INSTRUCTION_NODE - and pi.attributes is None - and not pi.hasChildNodes() - and len(pi.childNodes) == 0 - and pi.firstChild is None - and pi.lastChild is None - and pi.localName is None - and pi.namespaceURI == xml.dom.EMPTY_NAMESPACE) - -def testProcessingInstructionRepr(): pass - -def testTextRepr(): pass - -def testWriteText(): pass - -def testDocumentElement(): pass - -def testTooManyDocumentElements(): - doc = parseString("") - elem = doc.createElement("extra") - try: - doc.appendChild(elem) - except xml.dom.HierarchyRequestErr: - pass - else: - print "Failed to catch expected exception when" \ - " adding extra document element." - elem.unlink() - doc.unlink() - -def testCreateElementNS(): pass - -def testCreateAttributeNS(): pass - -def testParse(): pass - -def testParseString(): pass - -def testComment(): pass - -def testAttrListItem(): pass - -def testAttrListItems(): pass - -def testAttrListItemNS(): pass - -def testAttrListKeys(): pass - -def testAttrListKeysNS(): pass - -def testRemoveNamedItem(): - doc = parseString("") - e = doc.documentElement - attrs = e.attributes - a1 = e.getAttributeNode("a") - a2 = attrs.removeNamedItem("a") - confirm(a1.isSameNode(a2)) - try: - attrs.removeNamedItem("a") - except xml.dom.NotFoundErr: - pass - -def testRemoveNamedItemNS(): - doc = parseString("") - e = doc.documentElement - attrs = e.attributes - a1 = e.getAttributeNodeNS("http://xml.python.org/", "b") - a2 = attrs.removeNamedItemNS("http://xml.python.org/", "b") - confirm(a1.isSameNode(a2)) - try: - attrs.removeNamedItemNS("http://xml.python.org/", "b") - except xml.dom.NotFoundErr: - pass - -def testAttrListValues(): pass - -def testAttrListLength(): pass - -def testAttrList__getitem__(): pass - -def testAttrList__setitem__(): pass - -def testSetAttrValueandNodeValue(): pass - -def testParseElement(): pass - -def testParseAttributes(): pass - -def testParseElementNamespaces(): pass - -def testParseAttributeNamespaces(): pass - -def testParseProcessingInstructions(): pass - -def testChildNodes(): pass - -def testFirstChild(): pass - -def testHasChildNodes(): pass - -def testCloneElementShallow(): - dom, clone = _setupCloneElement(0) - confirm(len(clone.childNodes) == 0 - and clone.childNodes.length == 0 - and clone.parentNode is None - and clone.toxml() == '' - , "testCloneElementShallow") - dom.unlink() - -def testCloneElementDeep(): - dom, clone = _setupCloneElement(1) - confirm(len(clone.childNodes) == 1 - and clone.childNodes.length == 1 - and clone.parentNode is None - and clone.toxml() == '' - , "testCloneElementDeep") - dom.unlink() - -def _setupCloneElement(deep): - dom = parseString("") - root = dom.documentElement - clone = root.cloneNode(deep) - _testCloneElementCopiesAttributes( - root, clone, "testCloneElement" + (deep and "Deep" or "Shallow")) - # mutilate the original so shared data is detected - root.tagName = root.nodeName = "MODIFIED" - root.setAttribute("attr", "NEW VALUE") - root.setAttribute("added", "VALUE") - return dom, clone - -def _testCloneElementCopiesAttributes(e1, e2, test): - attrs1 = e1.attributes - attrs2 = e2.attributes - keys1 = attrs1.keys() - keys2 = attrs2.keys() - keys1.sort() - keys2.sort() - confirm(keys1 == keys2, "clone of element has same attribute keys") - for i in range(len(keys1)): - a1 = attrs1.item(i) - a2 = attrs2.item(i) - confirm(a1 is not a2 - and a1.value == a2.value - and a1.nodeValue == a2.nodeValue - and a1.namespaceURI == a2.namespaceURI - and a1.localName == a2.localName - , "clone of attribute node has proper attribute values") - confirm(a2.ownerElement is e2, - "clone of attribute node correctly owned") - -def testCloneDocumentShallow(): - doc = parseString("\n" - "" - "\n" - "]>\n" - "") - doc2 = doc.cloneNode(0) - confirm(doc2 is None, - "testCloneDocumentShallow:" - " shallow cloning of documents makes no sense!") - -def testCloneDocumentDeep(): - doc = parseString("\n" - "" - "\n" - "]>\n" - "") - doc2 = doc.cloneNode(1) - confirm(not (doc.isSameNode(doc2) or doc2.isSameNode(doc)), - "testCloneDocumentDeep: document objects not distinct") - confirm(len(doc.childNodes) == len(doc2.childNodes), - "testCloneDocumentDeep: wrong number of Document children") - confirm(doc2.documentElement.nodeType == Node.ELEMENT_NODE, - "testCloneDocumentDeep: documentElement not an ELEMENT_NODE") - confirm(doc2.documentElement.ownerDocument.isSameNode(doc2), - "testCloneDocumentDeep: documentElement owner is not new document") - confirm(not doc.documentElement.isSameNode(doc2.documentElement), - "testCloneDocumentDeep: documentElement should not be shared") - if doc.doctype is not None: - # check the doctype iff the original DOM maintained it - confirm(doc2.doctype.nodeType == Node.DOCUMENT_TYPE_NODE, - "testCloneDocumentDeep: doctype not a DOCUMENT_TYPE_NODE") - confirm(doc2.doctype.ownerDocument.isSameNode(doc2)) - confirm(not doc.doctype.isSameNode(doc2.doctype)) - -def testCloneDocumentTypeDeepOk(): - doctype = create_nonempty_doctype() - clone = doctype.cloneNode(1) - confirm(clone is not None - and clone.nodeName == doctype.nodeName - and clone.name == doctype.name - and clone.publicId == doctype.publicId - and clone.systemId == doctype.systemId - and len(clone.entities) == len(doctype.entities) - and clone.entities.item(len(clone.entities)) is None - and len(clone.notations) == len(doctype.notations) - and clone.notations.item(len(clone.notations)) is None - and len(clone.childNodes) == 0) - for i in range(len(doctype.entities)): - se = doctype.entities.item(i) - ce = clone.entities.item(i) - confirm((not se.isSameNode(ce)) - and (not ce.isSameNode(se)) - and ce.nodeName == se.nodeName - and ce.notationName == se.notationName - and ce.publicId == se.publicId - and ce.systemId == se.systemId - and ce.encoding == se.encoding - and ce.actualEncoding == se.actualEncoding - and ce.version == se.version) - for i in range(len(doctype.notations)): - sn = doctype.notations.item(i) - cn = clone.notations.item(i) - confirm((not sn.isSameNode(cn)) - and (not cn.isSameNode(sn)) - and cn.nodeName == sn.nodeName - and cn.publicId == sn.publicId - and cn.systemId == sn.systemId) - -def testCloneDocumentTypeDeepNotOk(): - doc = create_doc_with_doctype() - clone = doc.doctype.cloneNode(1) - confirm(clone is None, "testCloneDocumentTypeDeepNotOk") - -def testCloneDocumentTypeShallowOk(): - doctype = create_nonempty_doctype() - clone = doctype.cloneNode(0) - confirm(clone is not None - and clone.nodeName == doctype.nodeName - and clone.name == doctype.name - and clone.publicId == doctype.publicId - and clone.systemId == doctype.systemId - and len(clone.entities) == 0 - and clone.entities.item(0) is None - and len(clone.notations) == 0 - and clone.notations.item(0) is None - and len(clone.childNodes) == 0) - -def testCloneDocumentTypeShallowNotOk(): - doc = create_doc_with_doctype() - clone = doc.doctype.cloneNode(0) - confirm(clone is None, "testCloneDocumentTypeShallowNotOk") - -def check_import_document(deep, testName): - doc1 = parseString("") - doc2 = parseString("") - try: - doc1.importNode(doc2, deep) - except xml.dom.NotSupportedErr: - pass - else: - raise Exception(testName + - ": expected NotSupportedErr when importing a document") - -def testImportDocumentShallow(): - check_import_document(0, "testImportDocumentShallow") - -def testImportDocumentDeep(): - check_import_document(1, "testImportDocumentDeep") - # The tests of DocumentType importing use these helpers to construct # the documents to work with, since not all DOM builders actually # create the DocumentType nodes. - def create_doc_without_doctype(doctype=None): return getDOMImplementation().createDocument(None, "doc", doctype) @@ -724,674 +52,1263 @@ doctype.notations.item(0).ownerDocument = doc return doc -def testImportDocumentTypeShallow(): - src = create_doc_with_doctype() - target = create_doc_without_doctype() - try: - imported = target.importNode(src.doctype, 0) - except xml.dom.NotSupportedErr: - pass - else: - raise Exception( - "testImportDocumentTypeShallow: expected NotSupportedErr") - -def testImportDocumentTypeDeep(): - src = create_doc_with_doctype() - target = create_doc_without_doctype() - try: - imported = target.importNode(src.doctype, 1) - except xml.dom.NotSupportedErr: - pass - else: - raise Exception( - "testImportDocumentTypeDeep: expected NotSupportedErr") - -# Testing attribute clones uses a helper, and should always be deep, -# even if the argument to cloneNode is false. -def check_clone_attribute(deep, testName): - doc = parseString("") - attr = doc.documentElement.getAttributeNode("attr") - assert attr is not None - clone = attr.cloneNode(deep) - confirm(not clone.isSameNode(attr)) - confirm(not attr.isSameNode(clone)) - confirm(clone.ownerElement is None, - testName + ": ownerElement should be None") - confirm(clone.ownerDocument.isSameNode(attr.ownerDocument), - testName + ": ownerDocument does not match") - confirm(clone.specified, - testName + ": cloned attribute must have specified == True") - -def testCloneAttributeShallow(): - check_clone_attribute(0, "testCloneAttributeShallow") - -def testCloneAttributeDeep(): - check_clone_attribute(1, "testCloneAttributeDeep") - -def check_clone_pi(deep, testName): - doc = parseString("") - pi = doc.firstChild - assert pi.nodeType == Node.PROCESSING_INSTRUCTION_NODE - clone = pi.cloneNode(deep) - confirm(clone.target == pi.target - and clone.data == pi.data) - -def testClonePIShallow(): - check_clone_pi(0, "testClonePIShallow") - -def testClonePIDeep(): - check_clone_pi(1, "testClonePIDeep") - -def testNormalize(): - doc = parseString("") - root = doc.documentElement - root.appendChild(doc.createTextNode("first")) - root.appendChild(doc.createTextNode("second")) - confirm(len(root.childNodes) == 2 - and root.childNodes.length == 2, "testNormalize -- preparation") - doc.normalize() - confirm(len(root.childNodes) == 1 - and root.childNodes.length == 1 - and root.firstChild is root.lastChild - and root.firstChild.data == "firstsecond" - , "testNormalize -- result") - doc.unlink() - - doc = parseString("") - root = doc.documentElement - root.appendChild(doc.createTextNode("")) - doc.normalize() - confirm(len(root.childNodes) == 0 - and root.childNodes.length == 0, - "testNormalize -- single empty node removed") - doc.unlink() - -def testSiblings(): - doc = parseString("text?") - root = doc.documentElement - (pi, text, elm) = root.childNodes - - confirm(pi.nextSibling is text and - pi.previousSibling is None and - text.nextSibling is elm and - text.previousSibling is pi and - elm.nextSibling is None and - elm.previousSibling is text, "testSiblings") - - doc.unlink() - -def testParents(): - doc = parseString("") - root = doc.documentElement - elm1 = root.childNodes[0] - (elm2a, elm2b) = elm1.childNodes - elm3 = elm2b.childNodes[0] - - confirm(root.parentNode is doc and - elm1.parentNode is root and - elm2a.parentNode is elm1 and - elm2b.parentNode is elm1 and - elm3.parentNode is elm2b, "testParents") - - doc.unlink() - -def testNodeListItem(): - doc = parseString("") - children = doc.childNodes - docelem = children[0] - confirm(children[0] is children.item(0) - and children.item(1) is None - and docelem.childNodes.item(0) is docelem.childNodes[0] - and docelem.childNodes.item(1) is docelem.childNodes[1] - and docelem.childNodes.item(0).childNodes.item(0) is None, - "test NodeList.item()") - doc.unlink() - -def testSAX2DOM(): - from xml.dom import pulldom - - sax2dom = pulldom.SAX2DOM() - sax2dom.startDocument() - sax2dom.startElement("doc", {}) - sax2dom.characters("text") - sax2dom.startElement("subelm", {}) - sax2dom.characters("text") - sax2dom.endElement("subelm") - sax2dom.characters("text") - sax2dom.endElement("doc") - sax2dom.endDocument() - - doc = sax2dom.document - root = doc.documentElement - (text1, elm1, text2) = root.childNodes - text3 = elm1.childNodes[0] - - confirm(text1.previousSibling is None and - text1.nextSibling is elm1 and - elm1.previousSibling is text1 and - elm1.nextSibling is text2 and - text2.previousSibling is elm1 and - text2.nextSibling is None and - text3.previousSibling is None and - text3.nextSibling is None, "testSAX2DOM - siblings") - - confirm(root.parentNode is doc and - text1.parentNode is root and - elm1.parentNode is root and - text2.parentNode is root and - text3.parentNode is elm1, "testSAX2DOM - parents") - - doc.unlink() - -def testEncodings(): - doc = parseString('') - confirm(doc.toxml() == u'\u20ac' - and doc.toxml('utf-8') == '\xe2\x82\xac' - and doc.toxml('iso-8859-15') == '\xa4', - "testEncodings - encoding EURO SIGN") - - # Verify that character decoding errors throw exceptions instead of crashing - try: - doc = parseString('Comment \xe7a va ? Tr\xe8s bien ?') - except UnicodeDecodeError: - pass - else: - print 'parsing with bad encoding should raise a UnicodeDecodeError' +class MinidomTest(unittest.TestCase): + def tearDown(self): + try: + Node.allnodes + except AttributeError: + # We don't actually have the minidom from the standard library, + # but are picking up the PyXML version from site-packages. + pass + else: + self.confirm(len(Node.allnodes) == 0, + "assertion: len(Node.allnodes) == 0") + if len(Node.allnodes): + print "Garbage left over:" + if verbose: + print Node.allnodes.items()[0:10] + else: + # Don't print specific nodes if repeatable results + # are needed + print len(Node.allnodes) + Node.allnodes = {} + + def confirm(self, test, testname = "Test"): + self.assertTrue(test, testname) - doc.unlink() + def checkWholeText(self, node, s): + t = node.wholeText + self.confirm(t == s, "looking for %s, found %s" % (repr(s), repr(t))) + + def testParseFromFile(self): + dom = parse(StringIO(open(tstfile).read())) + dom.unlink() + self.confirm(isinstance(dom,Document)) + + def testGetElementsByTagName(self): + dom = parse(tstfile) + self.confirm(dom.getElementsByTagName("LI") == \ + dom.documentElement.getElementsByTagName("LI")) + dom.unlink() + + def testInsertBefore(self): + dom = parseString("") + root = dom.documentElement + elem = root.childNodes[0] + nelem = dom.createElement("element") + root.insertBefore(nelem, elem) + self.confirm(len(root.childNodes) == 2 + and root.childNodes.length == 2 + and root.childNodes[0] is nelem + and root.childNodes.item(0) is nelem + and root.childNodes[1] is elem + and root.childNodes.item(1) is elem + and root.firstChild is nelem + and root.lastChild is elem + and root.toxml() == "" + , "testInsertBefore -- node properly placed in tree") + nelem = dom.createElement("element") + root.insertBefore(nelem, None) + self.confirm(len(root.childNodes) == 3 + and root.childNodes.length == 3 + and root.childNodes[1] is elem + and root.childNodes.item(1) is elem + and root.childNodes[2] is nelem + and root.childNodes.item(2) is nelem + and root.lastChild is nelem + and nelem.previousSibling is elem + and root.toxml() == "" + , "testInsertBefore -- node properly placed in tree") + nelem2 = dom.createElement("bar") + root.insertBefore(nelem2, nelem) + self.confirm(len(root.childNodes) == 4 + and root.childNodes.length == 4 + and root.childNodes[2] is nelem2 + and root.childNodes.item(2) is nelem2 + and root.childNodes[3] is nelem + and root.childNodes.item(3) is nelem + and nelem2.nextSibling is nelem + and nelem.previousSibling is nelem2 + and root.toxml() == + "" + , "testInsertBefore -- node properly placed in tree") + dom.unlink() + + def _create_fragment_test_nodes(self): + dom = parseString("") + orig = dom.createTextNode("original") + c1 = dom.createTextNode("foo") + c2 = dom.createTextNode("bar") + c3 = dom.createTextNode("bat") + dom.documentElement.appendChild(orig) + frag = dom.createDocumentFragment() + frag.appendChild(c1) + frag.appendChild(c2) + frag.appendChild(c3) + return dom, orig, c1, c2, c3, frag + + def testInsertBeforeFragment(self): + dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes() + dom.documentElement.insertBefore(frag, None) + self.confirm(tuple(dom.documentElement.childNodes) == + (orig, c1, c2, c3), + "insertBefore(, None)") + frag.unlink() + dom.unlink() + + dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes() + dom.documentElement.insertBefore(frag, orig) + self.confirm(tuple(dom.documentElement.childNodes) == + (c1, c2, c3, orig), + "insertBefore(, orig)") + frag.unlink() + dom.unlink() + + def testAppendChild(self): + dom = parse(tstfile) + dom.documentElement.appendChild(dom.createComment(u"Hello")) + self.confirm(dom.documentElement.childNodes[-1].nodeName == "#comment") + self.confirm(dom.documentElement.childNodes[-1].data == "Hello") + dom.unlink() + + def testAppendChildFragment(self): + dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes() + dom.documentElement.appendChild(frag) + self.confirm(tuple(dom.documentElement.childNodes) == + (orig, c1, c2, c3), + "appendChild()") + frag.unlink() + dom.unlink() + + def testReplaceChildFragment(self): + dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes() + dom.documentElement.replaceChild(frag, orig) + orig.unlink() + self.confirm(tuple(dom.documentElement.childNodes) == (c1, c2, c3), + "replaceChild()") + frag.unlink() + dom.unlink() + + def testLegalChildren(self): + dom = Document() + elem = dom.createElement('element') + text = dom.createTextNode('text') + self.assertRaises(xml.dom.HierarchyRequestErr, dom.appendChild, text) + + dom.appendChild(elem) + self.assertRaises(xml.dom.HierarchyRequestErr, dom.insertBefore, text, + elem) + self.assertRaises(xml.dom.HierarchyRequestErr, dom.replaceChild, text, + elem) + + nodemap = elem.attributes + self.assertRaises(xml.dom.HierarchyRequestErr, nodemap.setNamedItem, + text) + self.assertRaises(xml.dom.HierarchyRequestErr, nodemap.setNamedItemNS, + text) + + elem.appendChild(text) + dom.unlink() + + def testNamedNodeMapSetItem(self): + dom = Document() + elem = dom.createElement('element') + attrs = elem.attributes + attrs["foo"] = "bar" + a = attrs.item(0) + self.confirm(a.ownerDocument is dom, + "NamedNodeMap.__setitem__() sets ownerDocument") + self.confirm(a.ownerElement is elem, + "NamedNodeMap.__setitem__() sets ownerElement") + self.confirm(a.value == "bar", + "NamedNodeMap.__setitem__() sets value") + self.confirm(a.nodeValue == "bar", + "NamedNodeMap.__setitem__() sets nodeValue") + elem.unlink() + dom.unlink() + + def testNonZero(self): + dom = parse(tstfile) + self.confirm(dom)# should not be zero + dom.appendChild(dom.createComment("foo")) + self.confirm(not dom.childNodes[-1].childNodes) + dom.unlink() + + def testUnlink(self): + dom = parse(tstfile) + dom.unlink() + + def testElement(self): + dom = Document() + dom.appendChild(dom.createElement("abc")) + self.confirm(dom.documentElement) + dom.unlink() + + def testAAA(self): + dom = parseString("") + el = dom.documentElement + el.setAttribute("spam", "jam2") + self.confirm(el.toxml() == '', "testAAA") + a = el.getAttributeNode("spam") + self.confirm(a.ownerDocument is dom, + "setAttribute() sets ownerDocument") + self.confirm(a.ownerElement is dom.documentElement, + "setAttribute() sets ownerElement") + dom.unlink() + + def testAAB(self): + dom = parseString("") + el = dom.documentElement + el.setAttribute("spam", "jam") + el.setAttribute("spam", "jam2") + self.confirm(el.toxml() == '', "testAAB") + dom.unlink() + + def testAddAttr(self): + dom = Document() + child = dom.appendChild(dom.createElement("abc")) + + child.setAttribute("def", "ghi") + self.confirm(child.getAttribute("def") == "ghi") + self.confirm(child.attributes["def"].value == "ghi") + + child.setAttribute("jkl", "mno") + self.confirm(child.getAttribute("jkl") == "mno") + self.confirm(child.attributes["jkl"].value == "mno") + + self.confirm(len(child.attributes) == 2) + + child.setAttribute("def", "newval") + self.confirm(child.getAttribute("def") == "newval") + self.confirm(child.attributes["def"].value == "newval") + + self.confirm(len(child.attributes) == 2) + dom.unlink() + + def testDeleteAttr(self): + dom = Document() + child = dom.appendChild(dom.createElement("abc")) + + self.confirm(len(child.attributes) == 0) + child.setAttribute("def", "ghi") + self.confirm(len(child.attributes) == 1) + del child.attributes["def"] + self.confirm(len(child.attributes) == 0) + dom.unlink() + + def testRemoveAttr(self): + dom = Document() + child = dom.appendChild(dom.createElement("abc")) + + child.setAttribute("def", "ghi") + self.confirm(len(child.attributes) == 1) + child.removeAttribute("def") + self.confirm(len(child.attributes) == 0) + dom.unlink() + + def testRemoveAttrNS(self): + dom = Document() + child = dom.appendChild( + dom.createElementNS("http://www.python.org", "python:abc")) + child.setAttributeNS("http://www.w3.org", "xmlns:python", + "http://www.python.org") + child.setAttributeNS("http://www.python.org", "python:abcattr", "foo") + self.confirm(len(child.attributes) == 2) + child.removeAttributeNS("http://www.python.org", "abcattr") + self.confirm(len(child.attributes) == 1) + dom.unlink() + + def testRemoveAttributeNode(self): + dom = Document() + child = dom.appendChild(dom.createElement("foo")) + child.setAttribute("spam", "jam") + self.confirm(len(child.attributes) == 1) + node = child.getAttributeNode("spam") + child.removeAttributeNode(node) + self.confirm(len(child.attributes) == 0 + and child.getAttributeNode("spam") is None) + dom.unlink() + + def testChangeAttr(self): + dom = parseString("") + el = dom.documentElement + el.setAttribute("spam", "jam") + self.confirm(len(el.attributes) == 1) + el.setAttribute("spam", "bam") + # Set this attribute to be an ID and make sure that doesn't change + # when changing the value: + el.setIdAttribute("spam") + self.confirm(len(el.attributes) == 1 + and el.attributes["spam"].value == "bam" + and el.attributes["spam"].nodeValue == "bam" + and el.getAttribute("spam") == "bam" + and el.getAttributeNode("spam").isId) + el.attributes["spam"] = "ham" + self.confirm(len(el.attributes) == 1 + and el.attributes["spam"].value == "ham" + and el.attributes["spam"].nodeValue == "ham" + and el.getAttribute("spam") == "ham" + and el.attributes["spam"].isId) + el.setAttribute("spam2", "bam") + self.confirm(len(el.attributes) == 2 + and el.attributes["spam"].value == "ham" + and el.attributes["spam"].nodeValue == "ham" + and el.getAttribute("spam") == "ham" + and el.attributes["spam2"].value == "bam" + and el.attributes["spam2"].nodeValue == "bam" + and el.getAttribute("spam2") == "bam") + el.attributes["spam2"] = "bam2" + self.confirm(len(el.attributes) == 2 + and el.attributes["spam"].value == "ham" + and el.attributes["spam"].nodeValue == "ham" + and el.getAttribute("spam") == "ham" + and el.attributes["spam2"].value == "bam2" + and el.attributes["spam2"].nodeValue == "bam2" + and el.getAttribute("spam2") == "bam2") + dom.unlink() -class UserDataHandler: - called = 0 - def handle(self, operation, key, data, src, dst): - dst.setUserData(key, data + 1, self) - src.setUserData(key, None, None) - self.called = 1 - -def testUserData(): - dom = Document() - n = dom.createElement('e') - confirm(n.getUserData("foo") is None) - n.setUserData("foo", None, None) - confirm(n.getUserData("foo") is None) - n.setUserData("foo", 12, 12) - n.setUserData("bar", 13, 13) - confirm(n.getUserData("foo") == 12) - confirm(n.getUserData("bar") == 13) - n.setUserData("foo", None, None) - confirm(n.getUserData("foo") is None) - confirm(n.getUserData("bar") == 13) - - handler = UserDataHandler() - n.setUserData("bar", 12, handler) - c = n.cloneNode(1) - confirm(handler.called - and n.getUserData("bar") is None - and c.getUserData("bar") == 13) - n.unlink() - c.unlink() - dom.unlink() - -def testRenameAttribute(): - doc = parseString("") - elem = doc.documentElement - attrmap = elem.attributes - attr = elem.attributes['a'] - - # Simple renaming - attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b") - confirm(attr.name == "b" - and attr.nodeName == "b" - and attr.localName is None - and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE - and attr.prefix is None - and attr.value == "v" - and elem.getAttributeNode("a") is None - and elem.getAttributeNode("b").isSameNode(attr) - and attrmap["b"].isSameNode(attr) - and attr.ownerDocument.isSameNode(doc) - and attr.ownerElement.isSameNode(elem)) - - # Rename to have a namespace, no prefix - attr = doc.renameNode(attr, "http://xml.python.org/ns", "c") - confirm(attr.name == "c" - and attr.nodeName == "c" - and attr.localName == "c" - and attr.namespaceURI == "http://xml.python.org/ns" - and attr.prefix is None - and attr.value == "v" - and elem.getAttributeNode("a") is None - and elem.getAttributeNode("b") is None - and elem.getAttributeNode("c").isSameNode(attr) - and elem.getAttributeNodeNS( - "http://xml.python.org/ns", "c").isSameNode(attr) - and attrmap["c"].isSameNode(attr) - and attrmap[("http://xml.python.org/ns", "c")].isSameNode(attr)) - - # Rename to have a namespace, with prefix - attr = doc.renameNode(attr, "http://xml.python.org/ns2", "p:d") - confirm(attr.name == "p:d" - and attr.nodeName == "p:d" - and attr.localName == "d" - and attr.namespaceURI == "http://xml.python.org/ns2" - and attr.prefix == "p" - and attr.value == "v" - and elem.getAttributeNode("a") is None - and elem.getAttributeNode("b") is None - and elem.getAttributeNode("c") is None - and elem.getAttributeNodeNS( - "http://xml.python.org/ns", "c") is None - and elem.getAttributeNode("p:d").isSameNode(attr) - and elem.getAttributeNodeNS( - "http://xml.python.org/ns2", "d").isSameNode(attr) - and attrmap["p:d"].isSameNode(attr) - and attrmap[("http://xml.python.org/ns2", "d")].isSameNode(attr)) - - # Rename back to a simple non-NS node - attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e") - confirm(attr.name == "e" - and attr.nodeName == "e" - and attr.localName is None - and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE - and attr.prefix is None - and attr.value == "v" - and elem.getAttributeNode("a") is None - and elem.getAttributeNode("b") is None - and elem.getAttributeNode("c") is None - and elem.getAttributeNode("p:d") is None - and elem.getAttributeNodeNS( - "http://xml.python.org/ns", "c") is None - and elem.getAttributeNode("e").isSameNode(attr) - and attrmap["e"].isSameNode(attr)) - - try: - doc.renameNode(attr, "http://xml.python.org/ns", "xmlns") - except xml.dom.NamespaceErr: + def testGetAttrList(self): pass - else: - print "expected NamespaceErr" - checkRenameNodeSharedConstraints(doc, attr) - doc.unlink() + def testGetAttrValues(self): pass -def testRenameElement(): - doc = parseString("") - elem = doc.documentElement - - # Simple renaming - elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a") - confirm(elem.tagName == "a" - and elem.nodeName == "a" - and elem.localName is None - and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE - and elem.prefix is None - and elem.ownerDocument.isSameNode(doc)) - - # Rename to have a namespace, no prefix - elem = doc.renameNode(elem, "http://xml.python.org/ns", "b") - confirm(elem.tagName == "b" - and elem.nodeName == "b" - and elem.localName == "b" - and elem.namespaceURI == "http://xml.python.org/ns" - and elem.prefix is None - and elem.ownerDocument.isSameNode(doc)) - - # Rename to have a namespace, with prefix - elem = doc.renameNode(elem, "http://xml.python.org/ns2", "p:c") - confirm(elem.tagName == "p:c" - and elem.nodeName == "p:c" - and elem.localName == "c" - and elem.namespaceURI == "http://xml.python.org/ns2" - and elem.prefix == "p" - and elem.ownerDocument.isSameNode(doc)) - - # Rename back to a simple non-NS node - elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d") - confirm(elem.tagName == "d" - and elem.nodeName == "d" - and elem.localName is None - and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE - and elem.prefix is None - and elem.ownerDocument.isSameNode(doc)) - - checkRenameNodeSharedConstraints(doc, elem) - doc.unlink() - -def checkRenameNodeSharedConstraints(doc, node): - # Make sure illegal NS usage is detected: - try: - doc.renameNode(node, "http://xml.python.org/ns", "xmlns:foo") - except xml.dom.NamespaceErr: - pass - else: - print "expected NamespaceErr" + def testGetAttrLength(self): pass - doc2 = parseString("") - try: - doc2.renameNode(node, xml.dom.EMPTY_NAMESPACE, "foo") - except xml.dom.WrongDocumentErr: - pass - else: - print "expected WrongDocumentErr" + def testGetAttribute(self): pass -def testRenameOther(): - # We have to create a comment node explicitly since not all DOM - # builders used with minidom add comments to the DOM. - doc = xml.dom.minidom.getDOMImplementation().createDocument( - xml.dom.EMPTY_NAMESPACE, "e", None) - node = doc.createComment("comment") - try: - doc.renameNode(node, xml.dom.EMPTY_NAMESPACE, "foo") - except xml.dom.NotSupportedErr: - pass - else: - print "expected NotSupportedErr when renaming comment node" - doc.unlink() - -def checkWholeText(node, s): - t = node.wholeText - confirm(t == s, "looking for %s, found %s" % (repr(s), repr(t))) - -def testWholeText(): - doc = parseString("a") - elem = doc.documentElement - text = elem.childNodes[0] - assert text.nodeType == Node.TEXT_NODE - - checkWholeText(text, "a") - elem.appendChild(doc.createTextNode("b")) - checkWholeText(text, "ab") - elem.insertBefore(doc.createCDATASection("c"), text) - checkWholeText(text, "cab") - - # make sure we don't cross other nodes - splitter = doc.createComment("comment") - elem.appendChild(splitter) - text2 = doc.createTextNode("d") - elem.appendChild(text2) - checkWholeText(text, "cab") - checkWholeText(text2, "d") - - x = doc.createElement("x") - elem.replaceChild(x, splitter) - splitter = x - checkWholeText(text, "cab") - checkWholeText(text2, "d") - - x = doc.createProcessingInstruction("y", "z") - elem.replaceChild(x, splitter) - splitter = x - checkWholeText(text, "cab") - checkWholeText(text2, "d") - - elem.removeChild(splitter) - checkWholeText(text, "cabd") - checkWholeText(text2, "cabd") - -def testPatch1094164 (): - doc = parseString("") - elem = doc.documentElement - e = elem.firstChild - confirm(e.parentNode is elem, "Before replaceChild()") - # Check that replacing a child with itself leaves the tree unchanged - elem.replaceChild(e, e) - confirm(e.parentNode is elem, "After replaceChild()") + def testGetAttributeNS(self): pass + def testGetAttributeNode(self): pass + + def testGetElementsByTagNameNS(self): + d=""" + + """ + dom = parseString(d) + elems = dom.getElementsByTagNameNS("http://pyxml.sf.net/minidom", + "myelem") + self.confirm(len(elems) == 1 + and elems[0].namespaceURI == "http://pyxml.sf.net/minidom" + and elems[0].localName == "myelem" + and elems[0].prefix == "minidom" + and elems[0].tagName == "minidom:myelem" + and elems[0].nodeName == "minidom:myelem") + dom.unlink() + + def get_empty_nodelist_from_elements_by_tagName_ns_helper(self, doc, nsuri, + lname): + nodelist = doc.getElementsByTagNameNS(nsuri, lname) + self.confirm(len(nodelist) == 0) + + def testGetEmptyNodeListFromElementsByTagNameNS(self): + doc = parseString('') + self.get_empty_nodelist_from_elements_by_tagName_ns_helper( + doc, 'http://xml.python.org/namespaces/a', 'localname') + self.get_empty_nodelist_from_elements_by_tagName_ns_helper( + doc, '*', 'splat') + self.get_empty_nodelist_from_elements_by_tagName_ns_helper( + doc, 'http://xml.python.org/namespaces/a', '*') + + doc = parseString('') + self.get_empty_nodelist_from_elements_by_tagName_ns_helper( + doc, "http://xml.python.org/splat", "not-there") + self.get_empty_nodelist_from_elements_by_tagName_ns_helper( + doc, "*", "not-there") + self.get_empty_nodelist_from_elements_by_tagName_ns_helper( + doc, "http://somewhere.else.net/not-there", "e") + + def testElementReprAndStr(self): + dom = Document() + el = dom.appendChild(dom.createElement("abc")) + string1 = repr(el) + string2 = str(el) + self.confirm(string1 == string2) + dom.unlink() + + def testElementReprAndStrUnicode(self): + dom = Document() + el = dom.appendChild(dom.createElement(u"abc")) + string1 = repr(el) + string2 = str(el) + self.confirm(string1 == string2) + dom.unlink() + + def testElementReprAndStrUnicodeNS(self): + dom = Document() + el = dom.appendChild( + dom.createElementNS(u"http://www.slashdot.org", u"slash:abc")) + string1 = repr(el) + string2 = str(el) + self.confirm(string1 == string2) + self.confirm(string1.find("slash:abc") != -1) + dom.unlink() + + def testAttributeRepr(self): + dom = Document() + el = dom.appendChild(dom.createElement(u"abc")) + node = el.setAttribute("abc", "def") + self.confirm(str(node) == repr(node)) + dom.unlink() + + def testTextNodeRepr(self): pass + + def testWriteXML(self): + str = '' + dom = parseString(str) + domstr = dom.toxml() + dom.unlink() + self.confirm(str == domstr) + + def testAltNewline(self): + str = '\n\n' + dom = parseString(str) + domstr = dom.toprettyxml(newl="\r\n") + dom.unlink() + self.confirm(domstr == str.replace("\n", "\r\n")) + + def testProcessingInstruction(self): + dom = parseString('') + pi = dom.documentElement.firstChild + self.confirm(pi.target == "mypi" + and pi.data == "data \t\n " + and pi.nodeName == "mypi" + and pi.nodeType == Node.PROCESSING_INSTRUCTION_NODE + and pi.attributes is None + and not pi.hasChildNodes() + and len(pi.childNodes) == 0 + and pi.firstChild is None + and pi.lastChild is None + and pi.localName is None + and pi.namespaceURI == xml.dom.EMPTY_NAMESPACE) + + def testProcessingInstructionRepr(self): pass + + def testTextRepr(self): pass + + def testWriteText(self): pass + + def testDocumentElement(self): pass + + def testTooManyDocumentElements(self): + doc = parseString("") + elem = doc.createElement("extra") + # Should raise an exception when adding an extra document element. + self.assertRaises(xml.dom.HierarchyRequestErr, doc.appendChild, elem) + elem.unlink() + doc.unlink() + + def testCreateElementNS(self): pass + + def testCreateAttributeNS(self): pass + + def testParse(self): pass + + def testParseString(self): pass + + def testComment(self): pass + + def testAttrListItem(self): pass + + def testAttrListItems(self): pass + + def testAttrListItemNS(self): pass + + def testAttrListKeys(self): pass + + def testAttrListKeysNS(self): pass + + def testRemoveNamedItem(self): + doc = parseString("") + e = doc.documentElement + attrs = e.attributes + a1 = e.getAttributeNode("a") + a2 = attrs.removeNamedItem("a") + self.confirm(a1.isSameNode(a2)) + self.assertRaises(xml.dom.NotFoundErr, attrs.removeNamedItem, "a") + + def testRemoveNamedItemNS(self): + doc = parseString("") + e = doc.documentElement + attrs = e.attributes + a1 = e.getAttributeNodeNS("http://xml.python.org/", "b") + a2 = attrs.removeNamedItemNS("http://xml.python.org/", "b") + self.confirm(a1.isSameNode(a2)) + self.assertRaises(xml.dom.NotFoundErr, attrs.removeNamedItemNS, + "http://xml.python.org/", "b") + + def testAttrListValues(self): pass + + def testAttrListLength(self): pass + + def testAttrList__getitem__(self): pass + + def testAttrList__setitem__(self): pass + + def testSetAttrValueandNodeValue(self): pass + + def testParseElement(self): pass + + def testParseAttributes(self): pass + + def testParseElementNamespaces(self): pass + + def testParseAttributeNamespaces(self): pass + + def testParseProcessingInstructions(self): pass + + def testChildNodes(self): pass + + def testFirstChild(self): pass + + def testHasChildNodes(self): pass + + def _testCloneElementCopiesAttributes(self, e1, e2, test): + attrs1 = e1.attributes + attrs2 = e2.attributes + keys1 = attrs1.keys() + keys2 = attrs2.keys() + keys1.sort() + keys2.sort() + self.confirm(keys1 == keys2, "clone of element has same attribute keys") + for i in range(len(keys1)): + a1 = attrs1.item(i) + a2 = attrs2.item(i) + self.confirm(a1 is not a2 + and a1.value == a2.value + and a1.nodeValue == a2.nodeValue + and a1.namespaceURI == a2.namespaceURI + and a1.localName == a2.localName + , "clone of attribute node has proper attribute values") + self.confirm(a2.ownerElement is e2, + "clone of attribute node correctly owned") + + def _setupCloneElement(self, deep): + dom = parseString("") + root = dom.documentElement + clone = root.cloneNode(deep) + self._testCloneElementCopiesAttributes( + root, clone, "testCloneElement" + (deep and "Deep" or "Shallow")) + # mutilate the original so shared data is detected + root.tagName = root.nodeName = "MODIFIED" + root.setAttribute("attr", "NEW VALUE") + root.setAttribute("added", "VALUE") + return dom, clone + + def testCloneElementShallow(self): + dom, clone = self._setupCloneElement(0) + self.confirm(len(clone.childNodes) == 0 + and clone.childNodes.length == 0 + and clone.parentNode is None + and clone.toxml() == '' + , "testCloneElementShallow") + dom.unlink() + + def testCloneElementDeep(self): + dom, clone = self._setupCloneElement(1) + self.confirm(len(clone.childNodes) == 1 + and clone.childNodes.length == 1 + and clone.parentNode is None + and clone.toxml() == '' + , "testCloneElementDeep") + dom.unlink() + + def testCloneDocumentShallow(self): + doc = parseString("\n" + "" + "\n" + "]>\n" + "") + doc2 = doc.cloneNode(0) + self.confirm(doc2 is None, + "testCloneDocumentShallow:" + " shallow cloning of documents makes no sense!") + + def testCloneDocumentDeep(self): + doc = parseString("\n" + "" + "\n" + "]>\n" + "") + doc2 = doc.cloneNode(1) + self.confirm(not (doc.isSameNode(doc2) or doc2.isSameNode(doc)), + "testCloneDocumentDeep: document objects not distinct") + self.confirm(len(doc.childNodes) == len(doc2.childNodes), + "testCloneDocumentDeep: wrong number of Document children") + self.confirm(doc2.documentElement.nodeType == Node.ELEMENT_NODE, + "testCloneDocumentDeep: documentElement not an ELEMENT_NODE") + self.confirm(doc2.documentElement.ownerDocument.isSameNode(doc2), + "testCloneDocumentDeep: documentElement owner is not new document") + self.confirm(not doc.documentElement.isSameNode(doc2.documentElement), + "testCloneDocumentDeep: documentElement should not be shared") + if doc.doctype is not None: + # check the doctype iff the original DOM maintained it + self.confirm(doc2.doctype.nodeType == Node.DOCUMENT_TYPE_NODE, + "testCloneDocumentDeep: doctype not a DOCUMENT_TYPE_NODE") + self.confirm(doc2.doctype.ownerDocument.isSameNode(doc2)) + self.confirm(not doc.doctype.isSameNode(doc2.doctype)) + + def testCloneDocumentTypeDeepOk(self): + doctype = create_nonempty_doctype() + clone = doctype.cloneNode(1) + self.confirm(clone is not None + and clone.nodeName == doctype.nodeName + and clone.name == doctype.name + and clone.publicId == doctype.publicId + and clone.systemId == doctype.systemId + and len(clone.entities) == len(doctype.entities) + and clone.entities.item(len(clone.entities)) is None + and len(clone.notations) == len(doctype.notations) + and clone.notations.item(len(clone.notations)) is None + and len(clone.childNodes) == 0) + for i in range(len(doctype.entities)): + se = doctype.entities.item(i) + ce = clone.entities.item(i) + self.confirm((not se.isSameNode(ce)) + and (not ce.isSameNode(se)) + and ce.nodeName == se.nodeName + and ce.notationName == se.notationName + and ce.publicId == se.publicId + and ce.systemId == se.systemId + and ce.encoding == se.encoding + and ce.actualEncoding == se.actualEncoding + and ce.version == se.version) + for i in range(len(doctype.notations)): + sn = doctype.notations.item(i) + cn = clone.notations.item(i) + self.confirm((not sn.isSameNode(cn)) + and (not cn.isSameNode(sn)) + and cn.nodeName == sn.nodeName + and cn.publicId == sn.publicId + and cn.systemId == sn.systemId) + + def testCloneDocumentTypeDeepNotOk(self): + doc = create_doc_with_doctype() + clone = doc.doctype.cloneNode(1) + self.confirm(clone is None, "testCloneDocumentTypeDeepNotOk") + + def testCloneDocumentTypeShallowOk(self): + doctype = create_nonempty_doctype() + clone = doctype.cloneNode(0) + self.confirm(clone is not None + and clone.nodeName == doctype.nodeName + and clone.name == doctype.name + and clone.publicId == doctype.publicId + and clone.systemId == doctype.systemId + and len(clone.entities) == 0 + and clone.entities.item(0) is None + and len(clone.notations) == 0 + and clone.notations.item(0) is None + and len(clone.childNodes) == 0) + + def testCloneDocumentTypeShallowNotOk(self): + doc = create_doc_with_doctype() + clone = doc.doctype.cloneNode(0) + self.confirm(clone is None, "testCloneDocumentTypeShallowNotOk") + + def check_import_document(self, deep, testName): + doc1 = parseString("") + doc2 = parseString("") + self.assertRaises(xml.dom.NotSupportedErr, doc1.importNode, doc2, deep) + + def testImportDocumentShallow(self): + self.check_import_document(0, "testImportDocumentShallow") + + def testImportDocumentDeep(self): + self.check_import_document(1, "testImportDocumentDeep") + + def testImportDocumentTypeShallow(self): + src = create_doc_with_doctype() + target = create_doc_without_doctype() + self.assertRaises(xml.dom.NotSupportedErr, target.importNode, + src.doctype, 0) + + def testImportDocumentTypeDeep(self): + src = create_doc_with_doctype() + target = create_doc_without_doctype() + self.assertRaises(xml.dom.NotSupportedErr, target.importNode, + src.doctype, 1) + + # Testing attribute clones uses a helper, and should always be deep, + # even if the argument to cloneNode is false. + def check_clone_attribute(self, deep, testName): + doc = parseString("") + attr = doc.documentElement.getAttributeNode("attr") + self.failIfEqual(attr, None) + clone = attr.cloneNode(deep) + self.confirm(not clone.isSameNode(attr)) + self.confirm(not attr.isSameNode(clone)) + self.confirm(clone.ownerElement is None, + testName + ": ownerElement should be None") + self.confirm(clone.ownerDocument.isSameNode(attr.ownerDocument), + testName + ": ownerDocument does not match") + self.confirm(clone.specified, + testName + ": cloned attribute must have specified == True") + + def testCloneAttributeShallow(self): + self.check_clone_attribute(0, "testCloneAttributeShallow") + + def testCloneAttributeDeep(self): + self.check_clone_attribute(1, "testCloneAttributeDeep") + + def check_clone_pi(self, deep, testName): + doc = parseString("") + pi = doc.firstChild + self.assertEquals(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE) + clone = pi.cloneNode(deep) + self.confirm(clone.target == pi.target + and clone.data == pi.data) + + def testClonePIShallow(self): + self.check_clone_pi(0, "testClonePIShallow") + + def testClonePIDeep(self): + self.check_clone_pi(1, "testClonePIDeep") + + def testNormalize(self): + doc = parseString("") + root = doc.documentElement + root.appendChild(doc.createTextNode("first")) + root.appendChild(doc.createTextNode("second")) + self.confirm(len(root.childNodes) == 2 + and root.childNodes.length == 2, + "testNormalize -- preparation") + doc.normalize() + self.confirm(len(root.childNodes) == 1 + and root.childNodes.length == 1 + and root.firstChild is root.lastChild + and root.firstChild.data == "firstsecond" + , "testNormalize -- result") + doc.unlink() + + doc = parseString("") + root = doc.documentElement + root.appendChild(doc.createTextNode("")) + doc.normalize() + self.confirm(len(root.childNodes) == 0 + and root.childNodes.length == 0, + "testNormalize -- single empty node removed") + doc.unlink() + + def testSiblings(self): + doc = parseString("text?") + root = doc.documentElement + (pi, text, elm) = root.childNodes + + self.confirm(pi.nextSibling is text and + pi.previousSibling is None and + text.nextSibling is elm and + text.previousSibling is pi and + elm.nextSibling is None and + elm.previousSibling is text, "testSiblings") + + doc.unlink() + + def testParents(self): + doc = parseString( + "") + root = doc.documentElement + elm1 = root.childNodes[0] + (elm2a, elm2b) = elm1.childNodes + elm3 = elm2b.childNodes[0] + + self.confirm(root.parentNode is doc and + elm1.parentNode is root and + elm2a.parentNode is elm1 and + elm2b.parentNode is elm1 and + elm3.parentNode is elm2b, "testParents") + doc.unlink() + + def testNodeListItem(self): + doc = parseString("") + children = doc.childNodes + docelem = children[0] + self.confirm(children[0] is children.item(0) + and children.item(1) is None + and docelem.childNodes.item(0) is docelem.childNodes[0] + and docelem.childNodes.item(1) is docelem.childNodes[1] + and docelem.childNodes.item(0).childNodes.item(0) is None, + "test NodeList.item()") + doc.unlink() + + def testSAX2DOM(self): + from xml.dom import pulldom + + sax2dom = pulldom.SAX2DOM() + sax2dom.startDocument() + sax2dom.startElement("doc", {}) + sax2dom.characters("text") + sax2dom.startElement("subelm", {}) + sax2dom.characters("text") + sax2dom.endElement("subelm") + sax2dom.characters("text") + sax2dom.endElement("doc") + sax2dom.endDocument() + + doc = sax2dom.document + root = doc.documentElement + (text1, elm1, text2) = root.childNodes + text3 = elm1.childNodes[0] + + self.confirm(text1.previousSibling is None and + text1.nextSibling is elm1 and + elm1.previousSibling is text1 and + elm1.nextSibling is text2 and + text2.previousSibling is elm1 and + text2.nextSibling is None and + text3.previousSibling is None and + text3.nextSibling is None, "testSAX2DOM - siblings") + + self.confirm(root.parentNode is doc and + text1.parentNode is root and + elm1.parentNode is root and + text2.parentNode is root and + text3.parentNode is elm1, "testSAX2DOM - parents") + doc.unlink() + + def testEncodings(self): + doc = parseString('') + self.confirm(doc.toxml() == u'\u20ac' + and doc.toxml('utf-8') == + '\xe2\x82\xac' + and doc.toxml('iso-8859-15') == + '\xa4', + "testEncodings - encoding EURO SIGN") + + # Verify that character decoding errors throw exceptions instead + # of crashing + self.assertRaises(UnicodeDecodeError, parseString, + 'Comment \xe7a va ? Tr\xe8s bien ?') + + doc.unlink() + + class UserDataHandler: + called = 0 + def handle(self, operation, key, data, src, dst): + dst.setUserData(key, data + 1, self) + src.setUserData(key, None, None) + self.called = 1 + + def testUserData(self): + dom = Document() + n = dom.createElement('e') + self.confirm(n.getUserData("foo") is None) + n.setUserData("foo", None, None) + self.confirm(n.getUserData("foo") is None) + n.setUserData("foo", 12, 12) + n.setUserData("bar", 13, 13) + self.confirm(n.getUserData("foo") == 12) + self.confirm(n.getUserData("bar") == 13) + n.setUserData("foo", None, None) + self.confirm(n.getUserData("foo") is None) + self.confirm(n.getUserData("bar") == 13) + + handler = self.UserDataHandler() + n.setUserData("bar", 12, handler) + c = n.cloneNode(1) + self.confirm(handler.called + and n.getUserData("bar") is None + and c.getUserData("bar") == 13) + n.unlink() + c.unlink() + dom.unlink() + + def checkRenameNodeSharedConstraints(self, doc, node): + # Make sure illegal NS usage is detected: + self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, node, + "http://xml.python.org/ns", "xmlns:foo") + doc2 = parseString("") + self.assertRaises(xml.dom.WrongDocumentErr, doc2.renameNode, node, + xml.dom.EMPTY_NAMESPACE, "foo") + def testRenameAttribute(self): + doc = parseString("") + elem = doc.documentElement + attrmap = elem.attributes + attr = elem.attributes['a'] -def testReplaceWholeText(): - def setup(): - doc = parseString("ad") + # Simple renaming + attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b") + self.confirm(attr.name == "b" + and attr.nodeName == "b" + and attr.localName is None + and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE + and attr.prefix is None + and attr.value == "v" + and elem.getAttributeNode("a") is None + and elem.getAttributeNode("b").isSameNode(attr) + and attrmap["b"].isSameNode(attr) + and attr.ownerDocument.isSameNode(doc) + and attr.ownerElement.isSameNode(elem)) + + # Rename to have a namespace, no prefix + attr = doc.renameNode(attr, "http://xml.python.org/ns", "c") + self.confirm(attr.name == "c" + and attr.nodeName == "c" + and attr.localName == "c" + and attr.namespaceURI == "http://xml.python.org/ns" + and attr.prefix is None + and attr.value == "v" + and elem.getAttributeNode("a") is None + and elem.getAttributeNode("b") is None + and elem.getAttributeNode("c").isSameNode(attr) + and elem.getAttributeNodeNS( + "http://xml.python.org/ns", "c").isSameNode(attr) + and attrmap["c"].isSameNode(attr) + and attrmap[("http://xml.python.org/ns", "c")].isSameNode(attr)) + + # Rename to have a namespace, with prefix + attr = doc.renameNode(attr, "http://xml.python.org/ns2", "p:d") + self.confirm(attr.name == "p:d" + and attr.nodeName == "p:d" + and attr.localName == "d" + and attr.namespaceURI == "http://xml.python.org/ns2" + and attr.prefix == "p" + and attr.value == "v" + and elem.getAttributeNode("a") is None + and elem.getAttributeNode("b") is None + and elem.getAttributeNode("c") is None + and elem.getAttributeNodeNS( + "http://xml.python.org/ns", "c") is None + and elem.getAttributeNode("p:d").isSameNode(attr) + and elem.getAttributeNodeNS( + "http://xml.python.org/ns2", "d").isSameNode(attr) + and attrmap["p:d"].isSameNode(attr) + and attrmap[("http://xml.python.org/ns2", "d")].isSameNode(attr)) + + # Rename back to a simple non-NS node + attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e") + self.confirm(attr.name == "e" + and attr.nodeName == "e" + and attr.localName is None + and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE + and attr.prefix is None + and attr.value == "v" + and elem.getAttributeNode("a") is None + and elem.getAttributeNode("b") is None + and elem.getAttributeNode("c") is None + and elem.getAttributeNode("p:d") is None + and elem.getAttributeNodeNS( + "http://xml.python.org/ns", "c") is None + and elem.getAttributeNode("e").isSameNode(attr) + and attrmap["e"].isSameNode(attr)) + + self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, attr, + "http://xml.python.org/ns", "xmlns") + self.checkRenameNodeSharedConstraints(doc, attr) + doc.unlink() + + def testRenameElement(self): + doc = parseString("") + elem = doc.documentElement + + # Simple renaming + elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a") + self.confirm(elem.tagName == "a" + and elem.nodeName == "a" + and elem.localName is None + and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE + and elem.prefix is None + and elem.ownerDocument.isSameNode(doc)) + + # Rename to have a namespace, no prefix + elem = doc.renameNode(elem, "http://xml.python.org/ns", "b") + self.confirm(elem.tagName == "b" + and elem.nodeName == "b" + and elem.localName == "b" + and elem.namespaceURI == "http://xml.python.org/ns" + and elem.prefix is None + and elem.ownerDocument.isSameNode(doc)) + + # Rename to have a namespace, with prefix + elem = doc.renameNode(elem, "http://xml.python.org/ns2", "p:c") + self.confirm(elem.tagName == "p:c" + and elem.nodeName == "p:c" + and elem.localName == "c" + and elem.namespaceURI == "http://xml.python.org/ns2" + and elem.prefix == "p" + and elem.ownerDocument.isSameNode(doc)) + + # Rename back to a simple non-NS node + elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d") + self.confirm(elem.tagName == "d" + and elem.nodeName == "d" + and elem.localName is None + and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE + and elem.prefix is None + and elem.ownerDocument.isSameNode(doc)) + + self.checkRenameNodeSharedConstraints(doc, elem) + doc.unlink() + + def testRenameOther(self): + # We have to create a comment node explicitly since not all DOM + # builders used with minidom add comments to the DOM. + doc = xml.dom.minidom.getDOMImplementation().createDocument( + xml.dom.EMPTY_NAMESPACE, "e", None) + node = doc.createComment("comment") + self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node, + xml.dom.EMPTY_NAMESPACE, "foo") + doc.unlink() + + def testWholeText(self): + doc = parseString("a") + elem = doc.documentElement + text = elem.childNodes[0] + self.assertEquals(text.nodeType, Node.TEXT_NODE) + + self.checkWholeText(text, "a") + elem.appendChild(doc.createTextNode("b")) + self.checkWholeText(text, "ab") + elem.insertBefore(doc.createCDATASection("c"), text) + self.checkWholeText(text, "cab") + + # make sure we don't cross other nodes + splitter = doc.createComment("comment") + elem.appendChild(splitter) + text2 = doc.createTextNode("d") + elem.appendChild(text2) + self.checkWholeText(text, "cab") + self.checkWholeText(text2, "d") + + x = doc.createElement("x") + elem.replaceChild(x, splitter) + splitter = x + self.checkWholeText(text, "cab") + self.checkWholeText(text2, "d") + + x = doc.createProcessingInstruction("y", "z") + elem.replaceChild(x, splitter) + splitter = x + self.checkWholeText(text, "cab") + self.checkWholeText(text2, "d") + + elem.removeChild(splitter) + self.checkWholeText(text, "cabd") + self.checkWholeText(text2, "cabd") + + def testPatch1094164(self): + doc = parseString("") elem = doc.documentElement - text1 = elem.firstChild - text2 = elem.lastChild - splitter = text1.nextSibling - elem.insertBefore(doc.createTextNode("b"), splitter) - elem.insertBefore(doc.createCDATASection("c"), text1) - return doc, elem, text1, splitter, text2 - - doc, elem, text1, splitter, text2 = setup() - text = text1.replaceWholeText("new content") - checkWholeText(text, "new content") - checkWholeText(text2, "d") - confirm(len(elem.childNodes) == 3) - - doc, elem, text1, splitter, text2 = setup() - text = text2.replaceWholeText("new content") - checkWholeText(text, "new content") - checkWholeText(text1, "cab") - confirm(len(elem.childNodes) == 5) - - doc, elem, text1, splitter, text2 = setup() - text = text1.replaceWholeText("") - checkWholeText(text2, "d") - confirm(text is None - and len(elem.childNodes) == 2) - -def testSchemaType(): - doc = parseString( - "\n" - " \n" - " \n" - "]>") - elem = doc.documentElement - # We don't want to rely on any specific loader at this point, so - # just make sure we can get to all the names, and that the - # DTD-based namespace is right. The names can vary by loader - # since each supports a different level of DTD information. - t = elem.schemaType - confirm(t.name is None - and t.namespace == xml.dom.EMPTY_NAMESPACE) - names = "id notid text enum ref refs ent ents nm nms".split() - for name in names: - a = elem.getAttributeNode(name) - t = a.schemaType - confirm(hasattr(t, "name") + e = elem.firstChild + self.confirm(e.parentNode is elem, "Before replaceChild()") + # Check that replacing a child with itself leaves the tree unchanged + elem.replaceChild(e, e) + self.confirm(e.parentNode is elem, "After replaceChild()") + + def testReplaceWholeText(self): + def setup(): + doc = parseString("ad") + elem = doc.documentElement + text1 = elem.firstChild + text2 = elem.lastChild + splitter = text1.nextSibling + elem.insertBefore(doc.createTextNode("b"), splitter) + elem.insertBefore(doc.createCDATASection("c"), text1) + return doc, elem, text1, splitter, text2 + + doc, elem, text1, splitter, text2 = setup() + text = text1.replaceWholeText("new content") + self.checkWholeText(text, "new content") + self.checkWholeText(text2, "d") + self.confirm(len(elem.childNodes) == 3) + + doc, elem, text1, splitter, text2 = setup() + text = text2.replaceWholeText("new content") + self.checkWholeText(text, "new content") + self.checkWholeText(text1, "cab") + self.confirm(len(elem.childNodes) == 5) + + doc, elem, text1, splitter, text2 = setup() + text = text1.replaceWholeText("") + self.checkWholeText(text2, "d") + self.confirm(text is None + and len(elem.childNodes) == 2) + + def testSchemaType(self): + doc = parseString( + "\n" + " \n" + " \n" + "]>") + elem = doc.documentElement + # We don't want to rely on any specific loader at this point, so + # just make sure we can get to all the names, and that the + # DTD-based namespace is right. The names can vary by loader + # since each supports a different level of DTD information. + t = elem.schemaType + self.confirm(t.name is None and t.namespace == xml.dom.EMPTY_NAMESPACE) + names = "id notid text enum ref refs ent ents nm nms".split() + for name in names: + a = elem.getAttributeNode(name) + t = a.schemaType + self.confirm(hasattr(t, "name") + and t.namespace == xml.dom.EMPTY_NAMESPACE) + + def testSetIdAttribute(self): + doc = parseString("") + e = doc.documentElement + a1 = e.getAttributeNode("a1") + a2 = e.getAttributeNode("a2") + self.confirm(doc.getElementById("v") is None + and not a1.isId + and not a2.isId) + e.setIdAttribute("a1") + self.confirm(e.isSameNode(doc.getElementById("v")) + and a1.isId + and not a2.isId) + e.setIdAttribute("a2") + self.confirm(e.isSameNode(doc.getElementById("v")) + and e.isSameNode(doc.getElementById("w")) + and a1.isId + and a2.isId) + # replace the a1 node; the new node should *not* be an ID + a3 = doc.createAttribute("a1") + a3.value = "v" + e.setAttributeNode(a3) + self.confirm(doc.getElementById("v") is None + and e.isSameNode(doc.getElementById("w")) + and not a1.isId + and a2.isId + and not a3.isId) + # renaming an attribute should not affect its ID-ness: + doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") + self.confirm(e.isSameNode(doc.getElementById("w")) + and a2.isId) + + def testSetIdAttributeNS(self): + NS1 = "http://xml.python.org/ns1" + NS2 = "http://xml.python.org/ns2" + doc = parseString("") + e = doc.documentElement + a1 = e.getAttributeNodeNS(NS1, "a1") + a2 = e.getAttributeNodeNS(NS2, "a2") + self.confirm(doc.getElementById("v") is None + and not a1.isId + and not a2.isId) + e.setIdAttributeNS(NS1, "a1") + self.confirm(e.isSameNode(doc.getElementById("v")) + and a1.isId + and not a2.isId) + e.setIdAttributeNS(NS2, "a2") + self.confirm(e.isSameNode(doc.getElementById("v")) + and e.isSameNode(doc.getElementById("w")) + and a1.isId + and a2.isId) + # replace the a1 node; the new node should *not* be an ID + a3 = doc.createAttributeNS(NS1, "a1") + a3.value = "v" + e.setAttributeNode(a3) + self.confirm(e.isSameNode(doc.getElementById("w"))) + self.confirm(not a1.isId) + self.confirm(a2.isId) + self.confirm(not a3.isId) + self.confirm(doc.getElementById("v") is None) + # renaming an attribute should not affect its ID-ness: + doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") + self.confirm(e.isSameNode(doc.getElementById("w")) + and a2.isId) + + def testSetIdAttributeNode(self): + NS1 = "http://xml.python.org/ns1" + NS2 = "http://xml.python.org/ns2" + doc = parseString("") + e = doc.documentElement + a1 = e.getAttributeNodeNS(NS1, "a1") + a2 = e.getAttributeNodeNS(NS2, "a2") + self.confirm(doc.getElementById("v") is None + and not a1.isId + and not a2.isId) + e.setIdAttributeNode(a1) + self.confirm(e.isSameNode(doc.getElementById("v")) + and a1.isId + and not a2.isId) + e.setIdAttributeNode(a2) + self.confirm(e.isSameNode(doc.getElementById("v")) + and e.isSameNode(doc.getElementById("w")) + and a1.isId + and a2.isId) + # replace the a1 node; the new node should *not* be an ID + a3 = doc.createAttributeNS(NS1, "a1") + a3.value = "v" + e.setAttributeNode(a3) + self.confirm(e.isSameNode(doc.getElementById("w"))) + self.confirm(not a1.isId) + self.confirm(a2.isId) + self.confirm(not a3.isId) + self.confirm(doc.getElementById("v") is None) + # renaming an attribute should not affect its ID-ness: + doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") + self.confirm(e.isSameNode(doc.getElementById("w")) + and a2.isId) + + def testPickledDocument(self): + doc = parseString("\n" + "\n" + " \n" + "]> text\n" + " ") + s = pickle.dumps(doc) + doc2 = pickle.loads(s) + stack = [(doc, doc2)] + while stack: + n1, n2 = stack.pop() + self.confirm(n1.nodeType == n2.nodeType + and len(n1.childNodes) == len(n2.childNodes) + and n1.nodeName == n2.nodeName + and not n1.isSameNode(n2) + and not n2.isSameNode(n1)) + if n1.nodeType == Node.DOCUMENT_TYPE_NODE: + len(n1.entities) + len(n2.entities) + len(n1.notations) + len(n2.notations) + self.confirm(len(n1.entities) == len(n2.entities) + and len(n1.notations) == len(n2.notations)) + for i in range(len(n1.notations)): + no1 = n1.notations.item(i) + no2 = n1.notations.item(i) + self.confirm(no1.name == no2.name + and no1.publicId == no2.publicId + and no1.systemId == no2.systemId) + statck.append((no1, no2)) + for i in range(len(n1.entities)): + e1 = n1.entities.item(i) + e2 = n2.entities.item(i) + self.confirm(e1.notationName == e2.notationName + and e1.publicId == e2.publicId + and e1.systemId == e2.systemId) + stack.append((e1, e2)) + if n1.nodeType != Node.DOCUMENT_NODE: + self.confirm(n1.ownerDocument.isSameNode(doc) + and n2.ownerDocument.isSameNode(doc2)) + for i in range(len(n1.childNodes)): + stack.append((n1.childNodes[i], n2.childNodes[i])) -def testSetIdAttribute(): - doc = parseString("") - e = doc.documentElement - a1 = e.getAttributeNode("a1") - a2 = e.getAttributeNode("a2") - confirm(doc.getElementById("v") is None - and not a1.isId - and not a2.isId) - e.setIdAttribute("a1") - confirm(e.isSameNode(doc.getElementById("v")) - and a1.isId - and not a2.isId) - e.setIdAttribute("a2") - confirm(e.isSameNode(doc.getElementById("v")) - and e.isSameNode(doc.getElementById("w")) - and a1.isId - and a2.isId) - # replace the a1 node; the new node should *not* be an ID - a3 = doc.createAttribute("a1") - a3.value = "v" - e.setAttributeNode(a3) - confirm(doc.getElementById("v") is None - and e.isSameNode(doc.getElementById("w")) - and not a1.isId - and a2.isId - and not a3.isId) - # renaming an attribute should not affect its ID-ness: - doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") - confirm(e.isSameNode(doc.getElementById("w")) - and a2.isId) - -def testSetIdAttributeNS(): - NS1 = "http://xml.python.org/ns1" - NS2 = "http://xml.python.org/ns2" - doc = parseString("") - e = doc.documentElement - a1 = e.getAttributeNodeNS(NS1, "a1") - a2 = e.getAttributeNodeNS(NS2, "a2") - confirm(doc.getElementById("v") is None - and not a1.isId - and not a2.isId) - e.setIdAttributeNS(NS1, "a1") - confirm(e.isSameNode(doc.getElementById("v")) - and a1.isId - and not a2.isId) - e.setIdAttributeNS(NS2, "a2") - confirm(e.isSameNode(doc.getElementById("v")) - and e.isSameNode(doc.getElementById("w")) - and a1.isId - and a2.isId) - # replace the a1 node; the new node should *not* be an ID - a3 = doc.createAttributeNS(NS1, "a1") - a3.value = "v" - e.setAttributeNode(a3) - confirm(e.isSameNode(doc.getElementById("w"))) - confirm(not a1.isId) - confirm(a2.isId) - confirm(not a3.isId) - confirm(doc.getElementById("v") is None) - # renaming an attribute should not affect its ID-ness: - doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") - confirm(e.isSameNode(doc.getElementById("w")) - and a2.isId) - -def testSetIdAttributeNode(): - NS1 = "http://xml.python.org/ns1" - NS2 = "http://xml.python.org/ns2" - doc = parseString("") - e = doc.documentElement - a1 = e.getAttributeNodeNS(NS1, "a1") - a2 = e.getAttributeNodeNS(NS2, "a2") - confirm(doc.getElementById("v") is None - and not a1.isId - and not a2.isId) - e.setIdAttributeNode(a1) - confirm(e.isSameNode(doc.getElementById("v")) - and a1.isId - and not a2.isId) - e.setIdAttributeNode(a2) - confirm(e.isSameNode(doc.getElementById("v")) - and e.isSameNode(doc.getElementById("w")) - and a1.isId - and a2.isId) - # replace the a1 node; the new node should *not* be an ID - a3 = doc.createAttributeNS(NS1, "a1") - a3.value = "v" - e.setAttributeNode(a3) - confirm(e.isSameNode(doc.getElementById("w"))) - confirm(not a1.isId) - confirm(a2.isId) - confirm(not a3.isId) - confirm(doc.getElementById("v") is None) - # renaming an attribute should not affect its ID-ness: - doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an") - confirm(e.isSameNode(doc.getElementById("w")) - and a2.isId) - -def testPickledDocument(): - doc = parseString("\n" - "\n" - " \n" - "]> text\n" - " ") - s = pickle.dumps(doc) - doc2 = pickle.loads(s) - stack = [(doc, doc2)] - while stack: - n1, n2 = stack.pop() - confirm(n1.nodeType == n2.nodeType - and len(n1.childNodes) == len(n2.childNodes) - and n1.nodeName == n2.nodeName - and not n1.isSameNode(n2) - and not n2.isSameNode(n1)) - if n1.nodeType == Node.DOCUMENT_TYPE_NODE: - len(n1.entities) - len(n2.entities) - len(n1.notations) - len(n2.notations) - confirm(len(n1.entities) == len(n2.entities) - and len(n1.notations) == len(n2.notations)) - for i in range(len(n1.notations)): - no1 = n1.notations.item(i) - no2 = n1.notations.item(i) - confirm(no1.name == no2.name - and no1.publicId == no2.publicId - and no1.systemId == no2.systemId) - statck.append((no1, no2)) - for i in range(len(n1.entities)): - e1 = n1.entities.item(i) - e2 = n2.entities.item(i) - confirm(e1.notationName == e2.notationName - and e1.publicId == e2.publicId - and e1.systemId == e2.systemId) - stack.append((e1, e2)) - if n1.nodeType != Node.DOCUMENT_NODE: - confirm(n1.ownerDocument.isSameNode(doc) - and n2.ownerDocument.isSameNode(doc2)) - for i in range(len(n1.childNodes)): - stack.append((n1.childNodes[i], n2.childNodes[i])) - - -# --- MAIN PROGRAM - -names = globals().keys() -names.sort() - -failed = [] - -try: - Node.allnodes -except AttributeError: - # We don't actually have the minidom from the standard library, - # but are picking up the PyXML version from site-packages. - def check_allnodes(): - pass -else: - def check_allnodes(): - confirm(len(Node.allnodes) == 0, - "assertion: len(Node.allnodes) == 0") - if len(Node.allnodes): - print "Garbage left over:" - if verbose: - print Node.allnodes.items()[0:10] - else: - # Don't print specific nodes if repeatable results - # are needed - print len(Node.allnodes) - Node.allnodes = {} - -for name in names: - if name.startswith("test"): - func = globals()[name] - try: - func() - check_allnodes() - except: - failed.append(name) - print "Test Failed: ", name - sys.stdout.flush() - traceback.print_exception(*sys.exc_info()) - print repr(sys.exc_info()[1]) - Node.allnodes = {} +def test_main(): + run_unittest(MinidomTest) -if failed: - print "\n\n\n**** Check for failures in these tests:" - for name in failed: - print " " + name +if __name__ == "__main__": + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_module.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_module.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_module.py Fri May 25 22:13:08 2007 @@ -1,48 +1,61 @@ # Test the module type - -from test.test_support import verify, vereq, verbose, TestFailed +import unittest +from test.test_support import verbose, run_unittest import sys -module = type(sys) +ModuleType = type(sys) + +class ModuleTests(unittest.TestCase): + def test_uninitialized(self): + # An uninitialized module has no __dict__ or __name__, + # and __doc__ is None + foo = ModuleType.__new__(ModuleType) + self.failUnless(foo.__dict__ is None) + try: + s = foo.__name__ + self.fail("__name__ = %s" % repr(s)) + except AttributeError: + pass + self.assertEqual(foo.__doc__, ModuleType.__doc__) + + def test_no_docstring(self): + # Regularly initialized module, no docstring + foo = ModuleType("foo") + self.assertEqual(foo.__name__, "foo") + self.assertEqual(foo.__doc__, None) + self.assertEqual(foo.__dict__, {"__name__": "foo", "__doc__": None}) + + def test_ascii_docstring(self): + # ASCII docstring + foo = ModuleType("foo", "foodoc") + self.assertEqual(foo.__name__, "foo") + self.assertEqual(foo.__doc__, "foodoc") + self.assertEqual(foo.__dict__, + {"__name__": "foo", "__doc__": "foodoc"}) + + def test_unicode_docstring(self): + # Unicode docstring + foo = ModuleType("foo", u"foodoc\u1234") + self.assertEqual(foo.__name__, "foo") + self.assertEqual(foo.__doc__, u"foodoc\u1234") + self.assertEqual(foo.__dict__, + {"__name__": "foo", "__doc__": u"foodoc\u1234"}) + + def test_reinit(self): + # Reinitialization should not replace the __dict__ + foo = ModuleType("foo", u"foodoc\u1234") + foo.bar = 42 + d = foo.__dict__ + foo.__init__("foo", "foodoc") + self.assertEqual(foo.__name__, "foo") + self.assertEqual(foo.__doc__, "foodoc") + self.assertEqual(foo.bar, 42) + self.assertEqual(foo.__dict__, + {"__name__": "foo", "__doc__": "foodoc", "bar": 42}) + self.failUnless(foo.__dict__ is d) -# An uninitialized module has no __dict__ or __name__, and __doc__ is None -foo = module.__new__(module) -verify(foo.__dict__ is None) -try: - s = foo.__name__ -except AttributeError: - pass -else: - raise TestFailed, "__name__ = %s" % repr(s) -vereq(foo.__doc__, module.__doc__) - -# Regularly initialized module, no docstring -foo = module("foo") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, None) -vereq(foo.__dict__, {"__name__": "foo", "__doc__": None}) - -# ASCII docstring -foo = module("foo", "foodoc") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, "foodoc") -vereq(foo.__dict__, {"__name__": "foo", "__doc__": "foodoc"}) - -# Unicode docstring -foo = module("foo", u"foodoc\u1234") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, u"foodoc\u1234") -vereq(foo.__dict__, {"__name__": "foo", "__doc__": u"foodoc\u1234"}) - -# Reinitialization should not replace the __dict__ -foo.bar = 42 -d = foo.__dict__ -foo.__init__("foo", "foodoc") -vereq(foo.__name__, "foo") -vereq(foo.__doc__, "foodoc") -vereq(foo.bar, 42) -vereq(foo.__dict__, {"__name__": "foo", "__doc__": "foodoc", "bar": 42}) -verify(foo.__dict__ is d) +def test_main(): + run_unittest(ModuleTests) -if verbose: - print "All OK" +if __name__ == '__main__': + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_multibytecodec.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_multibytecodec.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_multibytecodec.py Fri May 25 22:13:08 2007 @@ -219,13 +219,7 @@ myunichr(x).encode('iso_2022_jp', 'ignore') def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(Test_MultibyteCodec)) - suite.addTest(unittest.makeSuite(Test_IncrementalEncoder)) - suite.addTest(unittest.makeSuite(Test_IncrementalDecoder)) - suite.addTest(unittest.makeSuite(Test_StreamWriter)) - suite.addTest(unittest.makeSuite(Test_ISO2022)) - test_support.run_suite(suite) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_normalization.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_normalization.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_normalization.py Fri May 25 22:13:08 2007 @@ -1,5 +1,6 @@ -from test.test_support import (verbose, TestFailed, TestSkipped, verify, - open_urlresource) +from test.test_support import run_unittest, open_urlresource +import unittest + import sys import os from unicodedata import normalize @@ -29,60 +30,67 @@ raise RangeError return u"".join([unichr(x) for x in data]) -def test_main(): - part1_data = {} - for line in open_urlresource(TESTDATAURL): - if '#' in line: - line = line.split('#')[0] - line = line.strip() - if not line: - continue - if line.startswith("@Part"): - part = line.split()[0] - continue - if part == "@Part3": - # XXX we don't support PRI #29 yet, so skip these tests for now - continue - try: - c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]] - except RangeError: - # Skip unsupported characters; - # try atleast adding c1 if we are in part1 +class NormalizationTest(unittest.TestCase): + def test_main(self): + part1_data = {} + for line in open_urlresource(TESTDATAURL): + if '#' in line: + line = line.split('#')[0] + line = line.strip() + if not line: + continue + if line.startswith("@Part"): + part = line.split()[0] + continue + if part == "@Part3": + # XXX we don't support PRI #29 yet, so skip these tests for now + continue + try: + c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]] + except RangeError: + # Skip unsupported characters; + # try atleast adding c1 if we are in part1 + if part == "@Part1": + try: + c1 = unistr(line.split(';')[0]) + except RangeError: + pass + else: + part1_data[c1] = 1 + continue + + # Perform tests + self.failUnless(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) + self.failUnless(c4 == NFC(c4) == NFC(c5), line) + self.failUnless(c3 == NFD(c1) == NFD(c2) == NFD(c3), line) + self.failUnless(c5 == NFD(c4) == NFD(c5), line) + self.failUnless(c4 == NFKC(c1) == NFKC(c2) == \ + NFKC(c3) == NFKC(c4) == NFKC(c5), + line) + self.failUnless(c5 == NFKD(c1) == NFKD(c2) == \ + NFKD(c3) == NFKD(c4) == NFKD(c5), + line) + + # Record part 1 data if part == "@Part1": - try: - c1=unistr(line.split(';')[0]) - except RangeError: - pass - else: - part1_data[c1] = 1 - continue - - if verbose: - print line - - # Perform tests - verify(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) - verify(c4 == NFC(c4) == NFC(c5), line) - verify(c3 == NFD(c1) == NFD(c2) == NFD(c3), line) - verify(c5 == NFD(c4) == NFD(c5), line) - verify(c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5), - line) - verify(c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5), - line) - - # Record part 1 data - if part == "@Part1": - part1_data[c1] = 1 - - # Perform tests for all other data - for c in range(sys.maxunicode+1): - X = unichr(c) - if X in part1_data: - continue - assert X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c + part1_data[c1] = 1 - # Check for bug 834676 - normalize('NFC',u'\ud55c\uae00') + # Perform tests for all other data + for c in range(sys.maxunicode+1): + X = unichr(c) + if X in part1_data: + continue + self.failUnless(X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c) + + def test_bug_834676(self): + # Check for bug 834676 + normalize('NFC', u'\ud55c\uae00') + + +def test_main(): + # Hit the exception early + open_urlresource(TESTDATAURL) + run_unittest(NormalizationTest) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_ntpath.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_ntpath.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_ntpath.py Fri May 25 22:13:08 2007 @@ -18,13 +18,14 @@ tester('ntpath.splitext("foo.ext")', ('foo', '.ext')) tester('ntpath.splitext("/foo/foo.ext")', ('/foo/foo', '.ext')) -tester('ntpath.splitext(".ext")', ('', '.ext')) +tester('ntpath.splitext(".ext")', ('.ext', '')) tester('ntpath.splitext("\\foo.ext\\foo")', ('\\foo.ext\\foo', '')) tester('ntpath.splitext("foo.ext\\")', ('foo.ext\\', '')) tester('ntpath.splitext("")', ('', '')) tester('ntpath.splitext("foo.bar.ext")', ('foo.bar', '.ext')) tester('ntpath.splitext("xx/foo.bar.ext")', ('xx/foo.bar', '.ext')) tester('ntpath.splitext("xx\\foo.bar.ext")', ('xx\\foo.bar', '.ext')) +tester('ntpath.splitext("c:a/b\\c.d")', ('c:a/b\\c', '.d')) tester('ntpath.splitdrive("c:\\foo\\bar")', ('c:', '\\foo\\bar')) @@ -133,6 +134,13 @@ tester('ntpath.expandvars("${{foo}}")', "baz1}") tester('ntpath.expandvars("$foo$foo")', "barbar") tester('ntpath.expandvars("$bar$bar")', "$bar$bar") + tester('ntpath.expandvars("%foo% bar")', "bar bar") + tester('ntpath.expandvars("%foo%bar")', "barbar") + tester('ntpath.expandvars("%foo%%foo%")', "barbar") + tester('ntpath.expandvars("%%foo%%foo%foo%")', "%foo%foobar") + tester('ntpath.expandvars("%?bar%")', "%?bar%") + tester('ntpath.expandvars("%foo%%bar")', "bar%bar") + tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar") finally: os.environ.clear() os.environ.update(oldenv) @@ -149,6 +157,16 @@ else: tester('ntpath.abspath("C:\\")', "C:\\") +currentdir = os.path.split(os.getcwd())[-1] +tester('ntpath.relpath("a")', 'a') +tester('ntpath.relpath(os.path.abspath("a"))', 'a') +tester('ntpath.relpath("a/b")', 'a\\b') +tester('ntpath.relpath("../a/b")', '..\\a\\b') +tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') +tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') +tester('ntpath.relpath("a", "b/c")', '..\\..\\a') +tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') + if errors: raise TestFailed(str(errors) + " errors.") elif verbose: Deleted: /python/branches/bcannon-objcap/Lib/test/test_operations.py ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/test_operations.py Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,78 +0,0 @@ -# Python test set -- part 3, built-in operations. - - -print '3. Operations' -print 'XXX Mostly not yet implemented' - - -print '3.1 Dictionary lookups fail if __cmp__() raises an exception' - -class BadDictKey: - - def __hash__(self): - return hash(self.__class__) - - def __cmp__(self, other): - if isinstance(other, self.__class__): - print "raising error" - raise RuntimeError, "gotcha" - return other - -d = {} -x1 = BadDictKey() -x2 = BadDictKey() -d[x1] = 1 -for stmt in ['d[x2] = 2', - 'z = d[x2]', - 'x2 in d', - 'd.has_key(x2)', - 'd.get(x2)', - 'd.setdefault(x2, 42)', - 'd.pop(x2)', - 'd.update({x2: 2})']: - try: - exec stmt - except RuntimeError: - print "%s: caught the RuntimeError outside" % (stmt,) - else: - print "%s: No exception passed through!" # old CPython behavior - - -# Dict resizing bug, found by Jack Jansen in 2.2 CVS development. -# This version got an assert failure in debug build, infinite loop in -# release build. Unfortunately, provoking this kind of stuff requires -# a mix of inserts and deletes hitting exactly the right hash codes in -# exactly the right order, and I can't think of a randomized approach -# that would be *likely* to hit a failing case in reasonable time. - -d = {} -for i in range(5): - d[i] = i -for i in range(5): - del d[i] -for i in range(5, 9): # i==8 was the problem - d[i] = i - - -# Another dict resizing bug (SF bug #1456209). -# This caused Segmentation faults or Illegal instructions. - -class X(object): - def __hash__(self): - return 5 - def __eq__(self, other): - if resizing: - d.clear() - return False -d = {} -resizing = False -d[X()] = 1 -d[X()] = 2 -d[X()] = 3 -d[X()] = 4 -d[X()] = 5 -# now trigger a resize -resizing = True -d[9] = 6 - -print 'resize bugs not triggered.' Modified: python/branches/bcannon-objcap/Lib/test/test_operator.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_operator.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_operator.py Fri May 25 22:13:08 2007 @@ -143,6 +143,8 @@ self.failUnlessRaises(TypeError, operator.delslice, a, None, None) self.failUnless(operator.delslice(a, 2, 8) is None) self.assert_(a == [0, 1, 8, 9]) + operator.delslice(a, 0, test_support.MAX_Py_ssize_t) + self.assert_(a == []) def test_div(self): self.failUnlessRaises(TypeError, operator.div, 5) @@ -170,6 +172,8 @@ self.failUnlessRaises(TypeError, operator.getslice) self.failUnlessRaises(TypeError, operator.getslice, a, None, None) self.failUnless(operator.getslice(a, 4, 6) == [4, 5]) + b = operator.getslice(a, 0, test_support.MAX_Py_ssize_t) + self.assert_(b == a) def test_indexOf(self): self.failUnlessRaises(TypeError, operator.indexOf) @@ -215,6 +219,8 @@ self.failUnless(operator.isSequenceType(xrange(10))) self.failUnless(operator.isSequenceType('yeahbuddy')) self.failIf(operator.isSequenceType(3)) + class Dict(dict): pass + self.failIf(operator.isSequenceType(Dict())) def test_lshift(self): self.failUnlessRaises(TypeError, operator.lshift) @@ -316,6 +322,8 @@ self.failUnlessRaises(TypeError, operator.setslice, a, None, None, None) self.failUnless(operator.setslice(a, 1, 3, [2, 1]) is None) self.assert_(a == [0, 2, 1, 3]) + operator.setslice(a, 0, test_support.MAX_Py_ssize_t, []) + self.assert_(a == []) def test_sub(self): self.failUnlessRaises(TypeError, operator.sub) Modified: python/branches/bcannon-objcap/Lib/test/test_optparse.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_optparse.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_optparse.py Fri May 25 22:13:08 2007 @@ -1631,18 +1631,8 @@ "option -l: invalid long integer value: '0x12x'") -def _testclasses(): - mod = sys.modules[__name__] - return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] - -def suite(): - suite = unittest.TestSuite() - for testclass in _testclasses(): - suite.addTest(unittest.makeSuite(testclass)) - return suite - def test_main(): - test_support.run_suite(suite()) + test_support.run_unittest(__name__) if __name__ == '__main__': - unittest.main() + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_os.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_os.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_os.py Fri May 25 22:13:08 2007 @@ -240,6 +240,15 @@ os.utime(self.fname, (t1, t1)) self.assertEquals(os.stat(self.fname).st_mtime, t1) + def test_1686475(self): + # Verify that an open file can be stat'ed + try: + os.stat(r"c:\pagefile.sys") + except WindowsError, e: + if e == 2: # file does not exist; cannot run test + return + self.fail("Could not stat pagefile.sys") + from test import mapping_tests class EnvironTests(mapping_tests.BasicTestMappingProtocol): @@ -272,75 +281,104 @@ from os.path import join # Build: - # TESTFN/ a file kid and two directory kids + # TESTFN/ + # TEST1/ a file kid and two directory kids # tmp1 # SUB1/ a file kid and a directory kid - # tmp2 - # SUB11/ no kids - # SUB2/ just a file kid - # tmp3 - sub1_path = join(test_support.TESTFN, "SUB1") + # tmp2 + # SUB11/ no kids + # SUB2/ a file kid and a dirsymlink kid + # tmp3 + # link/ a symlink to TESTFN.2 + # TEST2/ + # tmp4 a lone file + walk_path = join(test_support.TESTFN, "TEST1") + sub1_path = join(walk_path, "SUB1") sub11_path = join(sub1_path, "SUB11") - sub2_path = join(test_support.TESTFN, "SUB2") - tmp1_path = join(test_support.TESTFN, "tmp1") + sub2_path = join(walk_path, "SUB2") + tmp1_path = join(walk_path, "tmp1") tmp2_path = join(sub1_path, "tmp2") tmp3_path = join(sub2_path, "tmp3") + link_path = join(sub2_path, "link") + t2_path = join(test_support.TESTFN, "TEST2") + tmp4_path = join(test_support.TESTFN, "TEST2", "tmp4") # Create stuff. os.makedirs(sub11_path) os.makedirs(sub2_path) - for path in tmp1_path, tmp2_path, tmp3_path: + os.makedirs(t2_path) + for path in tmp1_path, tmp2_path, tmp3_path, tmp4_path: f = open(path, "w") f.write("I'm " + path + " and proud of it. Blame test_os.\n") f.close() + if hasattr(os, "symlink"): + os.symlink(os.path.abspath(t2_path), link_path) + sub2_tree = (sub2_path, ["link"], ["tmp3"]) + else: + sub2_tree = (sub2_path, [], ["tmp3"]) # Walk top-down. - all = list(os.walk(test_support.TESTFN)) + all = list(os.walk(walk_path)) self.assertEqual(len(all), 4) # We can't know which order SUB1 and SUB2 will appear in. # Not flipped: TESTFN, SUB1, SUB11, SUB2 # flipped: TESTFN, SUB2, SUB1, SUB11 flipped = all[0][1][0] != "SUB1" all[0][1].sort() - self.assertEqual(all[0], (test_support.TESTFN, ["SUB1", "SUB2"], ["tmp1"])) + self.assertEqual(all[0], (walk_path, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[1 + flipped], (sub1_path, ["SUB11"], ["tmp2"])) self.assertEqual(all[2 + flipped], (sub11_path, [], [])) - self.assertEqual(all[3 - 2 * flipped], (sub2_path, [], ["tmp3"])) + self.assertEqual(all[3 - 2 * flipped], sub2_tree) # Prune the search. all = [] - for root, dirs, files in os.walk(test_support.TESTFN): + for root, dirs, files in os.walk(walk_path): all.append((root, dirs, files)) # Don't descend into SUB1. if 'SUB1' in dirs: # Note that this also mutates the dirs we appended to all! dirs.remove('SUB1') self.assertEqual(len(all), 2) - self.assertEqual(all[0], (test_support.TESTFN, ["SUB2"], ["tmp1"])) - self.assertEqual(all[1], (sub2_path, [], ["tmp3"])) + self.assertEqual(all[0], (walk_path, ["SUB2"], ["tmp1"])) + self.assertEqual(all[1], sub2_tree) # Walk bottom-up. - all = list(os.walk(test_support.TESTFN, topdown=False)) + all = list(os.walk(walk_path, topdown=False)) self.assertEqual(len(all), 4) # We can't know which order SUB1 and SUB2 will appear in. # Not flipped: SUB11, SUB1, SUB2, TESTFN # flipped: SUB2, SUB11, SUB1, TESTFN flipped = all[3][1][0] != "SUB1" all[3][1].sort() - self.assertEqual(all[3], (test_support.TESTFN, ["SUB1", "SUB2"], ["tmp1"])) + self.assertEqual(all[3], (walk_path, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[flipped], (sub11_path, [], [])) self.assertEqual(all[flipped + 1], (sub1_path, ["SUB11"], ["tmp2"])) - self.assertEqual(all[2 - 2 * flipped], (sub2_path, [], ["tmp3"])) + self.assertEqual(all[2 - 2 * flipped], sub2_tree) + + if hasattr(os, "symlink"): + # Walk, following symlinks. + for root, dirs, files in os.walk(walk_path, followlinks=True): + if root == link_path: + self.assertEqual(dirs, []) + self.assertEqual(files, ["tmp4"]) + break + else: + self.fail("Didn't follow symlink with followlinks=True") + def tearDown(self): # Tear everything down. This is a decent use for bottom-up on # Windows, which doesn't have a recursive delete command. The # (not so) subtlety is that rmdir will fail unless the dir's # kids are removed first, so bottom up is essential. for root, dirs, files in os.walk(test_support.TESTFN, topdown=False): for name in files: - os.remove(join(root, name)) + os.remove(os.path.join(root, name)) for name in dirs: - os.rmdir(join(root, name)) + dirname = os.path.join(root, name) + if not os.path.islink(dirname): + os.rmdir(dirname) + else: + os.remove(dirname) os.rmdir(test_support.TESTFN) class MakedirTests (unittest.TestCase): Modified: python/branches/bcannon-objcap/Lib/test/test_ossaudiodev.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_ossaudiodev.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_ossaudiodev.py Fri May 25 22:13:08 2007 @@ -1,7 +1,7 @@ from test import test_support test_support.requires('audio') -from test.test_support import verbose, findfile, TestFailed, TestSkipped +from test.test_support import verbose, findfile, TestSkipped import errno import fcntl @@ -12,6 +12,7 @@ import sunaudio import time import audioop +import unittest # Arggh, AFMT_S16_NE not defined on all platforms -- seems to be a # fairly recent addition to OSS. @@ -33,131 +34,141 @@ fp.close() if enc != SND_FORMAT_MULAW_8: - print "Expect .au file with 8-bit mu-law samples" - return + raise RuntimeError("Expect .au file with 8-bit mu-law samples") # Convert the data to 16-bit signed. data = audioop.ulaw2lin(data, 2) return (data, rate, 16, nchannels) -# version of assert that still works with -O -def _assert(expr, message=None): - if not expr: - raise AssertionError(message or "assertion failed") +class OSSAudioDevTests(unittest.TestCase): -def play_sound_file(data, rate, ssize, nchannels): - try: - dsp = ossaudiodev.open('w') - except IOError, msg: - if msg[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY): - raise TestSkipped, msg - raise TestFailed, msg - - # at least check that these methods can be invoked - dsp.bufsize() - dsp.obufcount() - dsp.obuffree() - dsp.getptr() - dsp.fileno() - - # Make sure the read-only attributes work. - _assert(dsp.closed is False, "dsp.closed is not False") - _assert(dsp.name == "/dev/dsp") - _assert(dsp.mode == 'w', "bad dsp.mode: %r" % dsp.mode) - - # And make sure they're really read-only. - for attr in ('closed', 'name', 'mode'): + def play_sound_file(self, data, rate, ssize, nchannels): try: - setattr(dsp, attr, 42) - raise RuntimeError("dsp.%s not read-only" % attr) - except TypeError: - pass - - # Compute expected running time of sound sample (in seconds). - expected_time = float(len(data)) / (ssize/8) / nchannels / rate - - # set parameters based on .au file headers - dsp.setparameters(AFMT_S16_NE, nchannels, rate) - print ("playing test sound file (expected running time: %.2f sec)" - % expected_time) - t1 = time.time() - dsp.write(data) - dsp.close() - t2 = time.time() - elapsed_time = t2 - t1 - - percent_diff = (abs(elapsed_time - expected_time) / expected_time) * 100 - _assert(percent_diff <= 10.0, \ - ("elapsed time (%.2f sec) > 10%% off of expected time (%.2f sec)" - % (elapsed_time, expected_time))) - -def test_setparameters(dsp): - # Two configurations for testing: - # config1 (8-bit, mono, 8 kHz) should work on even the most - # ancient and crufty sound card, but maybe not on special- - # purpose high-end hardware - # config2 (16-bit, stereo, 44.1kHz) should work on all but the - # most ancient and crufty hardware - config1 = (ossaudiodev.AFMT_U8, 1, 8000) - config2 = (AFMT_S16_NE, 2, 44100) - - for config in [config1, config2]: - (fmt, channels, rate) = config - if (dsp.setfmt(fmt) == fmt and - dsp.channels(channels) == channels and - dsp.speed(rate) == rate): - break - else: - raise RuntimeError("unable to set audio sampling parameters: " - "you must have really weird audio hardware") + dsp = ossaudiodev.open('w') + except IOError, msg: + if msg[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY): + raise TestSkipped(msg) + raise + + # at least check that these methods can be invoked + dsp.bufsize() + dsp.obufcount() + dsp.obuffree() + dsp.getptr() + dsp.fileno() + + # Make sure the read-only attributes work. + self.failUnless(dsp.close) + self.assertEqual(dsp.name, "/dev/dsp") + self.assertEqual(dsp.mode, "w", "bad dsp.mode: %r" % dsp.mode) + + # And make sure they're really read-only. + for attr in ('closed', 'name', 'mode'): + try: + setattr(dsp, attr, 42) + except TypeError: + pass + else: + self.fail("dsp.%s not read-only" % attr) + + # Compute expected running time of sound sample (in seconds). + expected_time = float(len(data)) / (ssize/8) / nchannels / rate + + # set parameters based on .au file headers + dsp.setparameters(AFMT_S16_NE, nchannels, rate) + print ("playing test sound file (expected running time: %.2f sec)" + % expected_time) + t1 = time.time() + dsp.write(data) + dsp.close() + t2 = time.time() + elapsed_time = t2 - t1 + + percent_diff = (abs(elapsed_time - expected_time) / expected_time) * 100 + self.failUnless(percent_diff <= 10.0, + "elapsed time > 10% off of expected time") + + def set_parameters(self, dsp): + # Two configurations for testing: + # config1 (8-bit, mono, 8 kHz) should work on even the most + # ancient and crufty sound card, but maybe not on special- + # purpose high-end hardware + # config2 (16-bit, stereo, 44.1kHz) should work on all but the + # most ancient and crufty hardware + config1 = (ossaudiodev.AFMT_U8, 1, 8000) + config2 = (AFMT_S16_NE, 2, 44100) + + for config in [config1, config2]: + (fmt, channels, rate) = config + if (dsp.setfmt(fmt) == fmt and + dsp.channels(channels) == channels and + dsp.speed(rate) == rate): + break + else: + raise RuntimeError("unable to set audio sampling parameters: " + "you must have really weird audio hardware") - # setparameters() should be able to set this configuration in - # either strict or non-strict mode. - result = dsp.setparameters(fmt, channels, rate, False) - _assert(result == (fmt, channels, rate), - "setparameters%r: returned %r" % (config, result)) - result = dsp.setparameters(fmt, channels, rate, True) - _assert(result == (fmt, channels, rate), - "setparameters%r: returned %r" % (config, result)) - -def test_bad_setparameters(dsp): - - # Now try some configurations that are presumably bogus: eg. 300 - # channels currently exceeds even Hollywood's ambitions, and - # negative sampling rate is utter nonsense. setparameters() should - # accept these in non-strict mode, returning something other than - # was requested, but should barf in strict mode. - fmt = AFMT_S16_NE - rate = 44100 - channels = 2 - for config in [(fmt, 300, rate), # ridiculous nchannels - (fmt, -5, rate), # impossible nchannels - (fmt, channels, -50), # impossible rate - ]: - (fmt, channels, rate) = config + # setparameters() should be able to set this configuration in + # either strict or non-strict mode. result = dsp.setparameters(fmt, channels, rate, False) - _assert(result != config, - "setparameters: unexpectedly got requested configuration") + self.assertEqual(result, (fmt, channels, rate), + "setparameters%r: returned %r" % (config, result)) + result = dsp.setparameters(fmt, channels, rate, True) + self.assertEqual(result, (fmt, channels, rate), + "setparameters%r: returned %r" % (config, result)) + + def set_bad_parameters(self, dsp): + + # Now try some configurations that are presumably bogus: eg. 300 + # channels currently exceeds even Hollywood's ambitions, and + # negative sampling rate is utter nonsense. setparameters() should + # accept these in non-strict mode, returning something other than + # was requested, but should barf in strict mode. + fmt = AFMT_S16_NE + rate = 44100 + channels = 2 + for config in [(fmt, 300, rate), # ridiculous nchannels + (fmt, -5, rate), # impossible nchannels + (fmt, channels, -50), # impossible rate + ]: + (fmt, channels, rate) = config + result = dsp.setparameters(fmt, channels, rate, False) + self.failIfEqual(result, config, + "unexpectedly got requested configuration") + + try: + result = dsp.setparameters(fmt, channels, rate, True) + except ossaudiodev.OSSAudioError, err: + pass + else: + self.fail("expected OSSAudioError") + + def test_playback(self): + sound_info = read_sound_file(findfile('audiotest.au')) + self.play_sound_file(*sound_info) + + def test_set_parameters(self): + dsp = ossaudiodev.open("w") try: - result = dsp.setparameters(fmt, channels, rate, True) - raise AssertionError("setparameters: expected OSSAudioError") - except ossaudiodev.OSSAudioError, err: - print "setparameters: got OSSAudioError as expected" - -def test(): - (data, rate, ssize, nchannels) = read_sound_file(findfile('audiotest.au')) - play_sound_file(data, rate, ssize, nchannels) + self.set_parameters(dsp) - dsp = ossaudiodev.open("w") - try: - test_setparameters(dsp) + # Disabled because it fails under Linux 2.6 with ALSA's OSS + # emulation layer. + #self.set_bad_parameters(dsp) + finally: + dsp.close() + self.failUnless(dsp.closed) - # Disabled because it fails under Linux 2.6 with ALSA's OSS - # emulation layer. - #test_bad_setparameters(dsp) - finally: - dsp.close() - _assert(dsp.closed is True, "dsp.closed is not True") -test() +def test_main(): + try: + dsp = ossaudiodev.open('w') + except IOError, msg: + if msg[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY): + raise TestSkipped(msg) + raise + test_support.run_unittest(__name__) + +if __name__ == "__main__": + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_peepholer.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_peepholer.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_peepholer.py Fri May 25 22:13:08 2007 @@ -49,6 +49,11 @@ self.assert_(elem not in asm) for elem in ('LOAD_CONST', '(None)'): self.assert_(elem in asm) + def f(): + 'Adding a docstring made this test fail in Py2.5.0' + return None + self.assert_('LOAD_CONST' in disassemble(f)) + self.assert_('LOAD_GLOBAL' not in disassemble(f)) def test_while_one(self): # Skip over: LOAD_CONST trueconst JUMP_IF_FALSE xx POP_TOP Modified: python/branches/bcannon-objcap/Lib/test/test_pep352.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_pep352.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_pep352.py Fri May 25 22:13:08 2007 @@ -6,6 +6,13 @@ import os from platform import system as platform_system +def ignore_message_warning(): + """Ignore the DeprecationWarning for BaseException.message.""" + warnings.resetwarnings() + warnings.filterwarnings("ignore", "BaseException.message", + DeprecationWarning) + + class ExceptionClassTests(unittest.TestCase): """Tests for anything relating to exception objects themselves (e.g., @@ -15,9 +22,13 @@ self.failUnless(issubclass(Exception, object)) def verify_instance_interface(self, ins): - for attr in ("args", "message", "__str__", "__repr__", "__getitem__"): - self.failUnless(hasattr(ins, attr), "%s missing %s attribute" % - (ins.__class__.__name__, attr)) + with guard_warnings_filter(): + ignore_message_warning() + for attr in ("args", "message", "__str__", "__repr__", + "__getitem__"): + self.failUnless(hasattr(ins, attr), + "%s missing %s attribute" % + (ins.__class__.__name__, attr)) def test_inheritance(self): # Make sure the inheritance hierarchy matches the documentation @@ -84,35 +95,97 @@ # Make sure interface works properly when given a single argument arg = "spam" exc = Exception(arg) - results = ([len(exc.args), 1], [exc.args[0], arg], [exc.message, arg], - [str(exc), str(arg)], [unicode(exc), unicode(arg)], - [repr(exc), exc.__class__.__name__ + repr(exc.args)], [exc[0], arg]) - self.interface_test_driver(results) + with guard_warnings_filter(): + ignore_message_warning() + results = ([len(exc.args), 1], [exc.args[0], arg], + [exc.message, arg], + [str(exc), str(arg)], [unicode(exc), unicode(arg)], + [repr(exc), exc.__class__.__name__ + repr(exc.args)], [exc[0], + arg]) + self.interface_test_driver(results) def test_interface_multi_arg(self): # Make sure interface correct when multiple arguments given arg_count = 3 args = tuple(range(arg_count)) exc = Exception(*args) - results = ([len(exc.args), arg_count], [exc.args, args], - [exc.message, ''], [str(exc), str(args)], - [unicode(exc), unicode(args)], - [repr(exc), exc.__class__.__name__ + repr(exc.args)], - [exc[-1], args[-1]]) - self.interface_test_driver(results) + with guard_warnings_filter(): + ignore_message_warning() + results = ([len(exc.args), arg_count], [exc.args, args], + [exc.message, ''], [str(exc), str(args)], + [unicode(exc), unicode(args)], + [repr(exc), exc.__class__.__name__ + repr(exc.args)], + [exc[-1], args[-1]]) + self.interface_test_driver(results) def test_interface_no_arg(self): # Make sure that with no args that interface is correct exc = Exception() - results = ([len(exc.args), 0], [exc.args, tuple()], [exc.message, ''], - [str(exc), ''], [unicode(exc), u''], - [repr(exc), exc.__class__.__name__ + '()'], [True, True]) - self.interface_test_driver(results) + with guard_warnings_filter(): + ignore_message_warning() + results = ([len(exc.args), 0], [exc.args, tuple()], + [exc.message, ''], + [str(exc), ''], [unicode(exc), u''], + [repr(exc), exc.__class__.__name__ + '()'], [True, True]) + self.interface_test_driver(results) + + + def test_message_deprecation(self): + # As of Python 2.6, BaseException.message is deprecated. + with guard_warnings_filter(): + warnings.resetwarnings() + warnings.filterwarnings('error') + + try: + BaseException().message + except DeprecationWarning: + pass + else: + self.fail("BaseException.message not deprecated") + + exc = BaseException() + try: + exc.message = '' + except DeprecationWarning: + pass + else: + self.fail("BaseException.message assignment not deprecated") class UsageTests(unittest.TestCase): """Test usage of exceptions""" + def raise_fails(self, object_): + """Make sure that raising 'object_' triggers a TypeError.""" + try: + raise object_ + except TypeError: + return # What is expected. + self.fail("TypeError expected for raising %s" % type(object_)) + + def catch_fails(self, object_): + """Catching 'object_' should raise a TypeError.""" + try: + try: + raise StandardError + except object_: + pass + except TypeError: + pass + except StandardError: + self.fail("TypeError expected when catching %s" % type(object_)) + + try: + try: + raise StandardError + except (object_,): + pass + except TypeError: + return + except StandardError: + self.fail("TypeError expected when catching %s as specified in a " + "tuple" % type(object_)) + def test_raise_classic(self): # Raising a classic class is okay (for now). class ClassicClass: @@ -137,27 +210,12 @@ # inherit from it. class NewStyleClass(object): pass - try: - raise NewStyleClass - except TypeError: - pass - except: - self.fail("able to raise new-style class") - try: - raise NewStyleClass() - except TypeError: - pass - except: - self.fail("able to raise new-style class instance") + self.raise_fails(NewStyleClass) + self.raise_fails(NewStyleClass()) def test_raise_string(self): # Raising a string raises TypeError. - try: - raise "spam" - except TypeError: - pass - except: - self.fail("was able to raise a string exception") + self.raise_fails("spam") def test_catch_string(self): # Catching a string should trigger a DeprecationWarning. Modified: python/branches/bcannon-objcap/Lib/test/test_popen2.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_popen2.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_popen2.py Fri May 25 22:13:08 2007 @@ -1,78 +1,98 @@ #! /usr/bin/env python -"""Test script for popen2.py - Christian Tismer -""" +"""Test script for popen2.py""" + +import warnings +warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*", + DeprecationWarning) +warnings.filterwarnings("ignore", "os\.popen. is deprecated.*", + DeprecationWarning) import os import sys -from test.test_support import TestSkipped, reap_children +import unittest +import popen2 -# popen2 contains its own testing routine -# which is especially useful to see if open files -# like stdin can be read successfully by a forked -# subprocess. - -def main(): - print "Test popen2 module:" - if (sys.platform[:4] == 'beos' or sys.platform[:6] == 'atheos') \ - and __name__ != '__main__': - # Locks get messed up or something. Generally we're supposed - # to avoid mixing "posix" fork & exec with native threads, and - # they may be right about that after all. - raise TestSkipped, "popen2() doesn't work during import on " + sys.platform - try: - from os import popen - except ImportError: - # if we don't have os.popen, check that - # we have os.fork. if not, skip the test - # (by raising an ImportError) - from os import fork - import popen2 - popen2._test() - - -def _test(): - # same test as popen2._test(), but using the os.popen*() API - print "Testing os module:" - import popen2 - # When the test runs, there shouldn't be any open pipes - popen2._cleanup() - assert not popen2._active, "Active pipes when test starts " + repr([c.cmd for c in popen2._active]) - cmd = "cat" - teststr = "ab cd\n" +from test.test_support import TestSkipped, run_unittest, reap_children + +if sys.platform[:4] == 'beos' or sys.platform[:6] == 'atheos': + # Locks get messed up or something. Generally we're supposed + # to avoid mixing "posix" fork & exec with native threads, and + # they may be right about that after all. + raise TestSkipped("popen2() doesn't work on " + sys.platform) + +# if we don't have os.popen, check that +# we have os.fork. if not, skip the test +# (by raising an ImportError) +try: + from os import popen + del popen +except ImportError: + from os import fork + del fork + +class Popen2Test(unittest.TestCase): + cmd = "cat" if os.name == "nt": cmd = "more" + teststr = "ab cd\n" # "more" doesn't act the same way across Windows flavors, # sometimes adding an extra newline at the start or the # end. So we strip whitespace off both ends for comparison. expected = teststr.strip() - print "testing popen2..." - w, r = os.popen2(cmd) - w.write(teststr) - w.close() - got = r.read() - if got.strip() != expected: - raise ValueError("wrote %r read %r" % (teststr, got)) - print "testing popen3..." - try: - w, r, e = os.popen3([cmd]) - except: - w, r, e = os.popen3(cmd) - w.write(teststr) - w.close() - got = r.read() - if got.strip() != expected: - raise ValueError("wrote %r read %r" % (teststr, got)) - got = e.read() - if got: - raise ValueError("unexpected %r on stderr" % (got,)) - for inst in popen2._active[:]: - inst.wait() - popen2._cleanup() - if popen2._active: - raise ValueError("_active not empty") - print "All OK" - -main() -_test() -reap_children() + + def setUp(self): + popen2._cleanup() + # When the test runs, there shouldn't be any open pipes + self.assertFalse(popen2._active, "Active pipes when test starts" + + repr([c.cmd for c in popen2._active])) + + def tearDown(self): + for inst in popen2._active: + inst.wait() + popen2._cleanup() + self.assertFalse(popen2._active, "_active not empty") + reap_children() + + def validate_output(self, teststr, expected_out, r, w, e=None): + w.write(teststr) + w.close() + got = r.read() + self.assertEquals(expected_out, got.strip(), "wrote %r read %r" % + (teststr, got)) + + if e is not None: + got = e.read() + self.assertFalse(got, "unexpected %r on stderr" % got) + + def test_popen2(self): + r, w = popen2.popen2(self.cmd) + self.validate_output(self.teststr, self.expected, r, w) + + def test_popen3(self): + if os.name == 'posix': + r, w, e = popen2.popen3([self.cmd]) + self.validate_output(self.teststr, self.expected, r, w, e) + + r, w, e = popen2.popen3(self.cmd) + self.validate_output(self.teststr, self.expected, r, w, e) + + def test_os_popen2(self): + # same test as test_popen2(), but using the os.popen*() API + w, r = os.popen2(self.cmd) + self.validate_output(self.teststr, self.expected, r, w) + + def test_os_popen3(self): + # same test as test_popen3(), but using the os.popen*() API + if os.name == 'posix': + w, r, e = os.popen3([self.cmd]) + self.validate_output(self.teststr, self.expected, r, w, e) + + w, r, e = os.popen3(self.cmd) + self.validate_output(self.teststr, self.expected, r, w, e) + + +def test_main(): + run_unittest(Popen2Test) + +if __name__ == "__main__": + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_posix.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_posix.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_posix.py Fri May 25 22:13:08 2007 @@ -192,6 +192,18 @@ posix.utime(test_support.TESTFN, (int(now), int(now))) posix.utime(test_support.TESTFN, (now, now)) + def test_chflags(self): + if hasattr(posix, 'chflags'): + st = os.stat(test_support.TESTFN) + if hasattr(st, 'st_flags'): + posix.chflags(test_support.TESTFN, st.st_flags) + + def test_lchflags(self): + if hasattr(posix, 'lchflags'): + st = os.stat(test_support.TESTFN) + if hasattr(st, 'st_flags'): + posix.lchflags(test_support.TESTFN, st.st_flags) + def test_main(): test_support.run_unittest(PosixTester) Modified: python/branches/bcannon-objcap/Lib/test/test_posixpath.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_posixpath.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_posixpath.py Fri May 25 22:13:08 2007 @@ -2,15 +2,29 @@ from test import test_support import posixpath, os -from posixpath import realpath, abspath, join, dirname, basename +from posixpath import realpath, abspath, join, dirname, basename, relpath # An absolute path to a temporary filename for testing. We can't rely on TESTFN # being an absolute path, so we need this. ABSTFN = abspath(test_support.TESTFN) +def safe_rmdir(dirname): + try: + os.rmdir(dirname) + except OSError: + pass + class PosixPathTest(unittest.TestCase): + def setUp(self): + self.tearDown() + + def tearDown(self): + for suffix in ["", "1", "2"]: + test_support.unlink(test_support.TESTFN + suffix) + safe_rmdir(test_support.TESTFN + suffix) + def assertIs(self, a, b): self.assert_(a is b) @@ -43,15 +57,27 @@ self.assertRaises(TypeError, posixpath.split) - def test_splitext(self): - self.assertEqual(posixpath.splitext("foo.ext"), ("foo", ".ext")) - self.assertEqual(posixpath.splitext("/foo/foo.ext"), ("/foo/foo", ".ext")) - self.assertEqual(posixpath.splitext(".ext"), ("", ".ext")) - self.assertEqual(posixpath.splitext("/foo.ext/foo"), ("/foo.ext/foo", "")) - self.assertEqual(posixpath.splitext("foo.ext/"), ("foo.ext/", "")) - self.assertEqual(posixpath.splitext(""), ("", "")) - self.assertEqual(posixpath.splitext("foo.bar.ext"), ("foo.bar", ".ext")) + def splitextTest(self, path, filename, ext): + self.assertEqual(posixpath.splitext(path), (filename, ext)) + self.assertEqual(posixpath.splitext("/" + path), ("/" + filename, ext)) + self.assertEqual(posixpath.splitext("abc/" + path), ("abc/" + filename, ext)) + self.assertEqual(posixpath.splitext("abc.def/" + path), ("abc.def/" + filename, ext)) + self.assertEqual(posixpath.splitext("/abc.def/" + path), ("/abc.def/" + filename, ext)) + self.assertEqual(posixpath.splitext(path + "/"), (filename + ext + "/", "")) + def test_splitext(self): + self.splitextTest("foo.bar", "foo", ".bar") + self.splitextTest("foo.boo.bar", "foo.boo", ".bar") + self.splitextTest("foo.boo.biff.bar", "foo.boo.biff", ".bar") + self.splitextTest(".csh.rc", ".csh", ".rc") + self.splitextTest("nodots", "nodots", "") + self.splitextTest(".cshrc", ".cshrc", "") + self.splitextTest("...manydots", "...manydots", "") + self.splitextTest("...manydots.ext", "...manydots", ".ext") + self.splitextTest(".", ".", "") + self.splitextTest("..", "..", "") + self.splitextTest("........", "........", "") + self.splitextTest("", "", "") self.assertRaises(TypeError, posixpath.splitext) def test_isabs(self): @@ -104,6 +130,16 @@ "/home/swen/spam" ) + testlist = ['', 'abc', 'Xbcd', 'Xb', 'XY', 'abcd', 'aXc', 'abd', 'ab', 'aX', 'abcX'] + for s1 in testlist: + for s2 in testlist: + p = posixpath.commonprefix([s1, s2]) + self.assert_(s1.startswith(p)) + self.assert_(s2.startswith(p)) + if s1 != s2: + n = len(p) + self.assertNotEqual(s1[n:n+1], s2[n:n+1]) + def test_getsize(self): f = open(test_support.TESTFN, "wb") try: @@ -113,7 +149,6 @@ finally: if not f.closed: f.close() - os.remove(test_support.TESTFN) def test_time(self): f = open(test_support.TESTFN, "wb") @@ -135,7 +170,6 @@ finally: if not f.closed: f.close() - os.remove(test_support.TESTFN) def test_islink(self): self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) @@ -154,14 +188,6 @@ finally: if not f.close(): f.close() - try: - os.remove(test_support.TESTFN + "1") - except os.error: - pass - try: - os.remove(test_support.TESTFN + "2") - except os.error: - pass self.assertRaises(TypeError, posixpath.islink) @@ -176,10 +202,6 @@ finally: if not f.close(): f.close() - try: - os.remove(test_support.TESTFN) - except os.error: - pass self.assertRaises(TypeError, posixpath.exists) @@ -197,14 +219,6 @@ finally: if not f.close(): f.close() - try: - os.remove(test_support.TESTFN) - except os.error: - pass - try: - os.rmdir(test_support.TESTFN) - except os.error: - pass self.assertRaises(TypeError, posixpath.isdir) @@ -222,67 +236,51 @@ finally: if not f.close(): f.close() - try: - os.remove(test_support.TESTFN) - except os.error: - pass - try: - os.rmdir(test_support.TESTFN) - except os.error: - pass self.assertRaises(TypeError, posixpath.isdir) - def test_samefile(self): - f = open(test_support.TESTFN + "1", "wb") - try: - f.write("foo") - f.close() + def test_samefile(self): + f = open(test_support.TESTFN + "1", "wb") + try: + f.write("foo") + f.close() + self.assertIs( + posixpath.samefile( + test_support.TESTFN + "1", + test_support.TESTFN + "1" + ), + True + ) + # If we don't have links, assume that os.stat doesn't return resonable + # inode information and thus, that samefile() doesn't work + if hasattr(os, "symlink"): + os.symlink( + test_support.TESTFN + "1", + test_support.TESTFN + "2" + ) self.assertIs( posixpath.samefile( test_support.TESTFN + "1", - test_support.TESTFN + "1" + test_support.TESTFN + "2" ), True ) - # If we don't have links, assume that os.stat doesn't return resonable - # inode information and thus, that samefile() doesn't work - if hasattr(os, "symlink"): - os.symlink( + os.remove(test_support.TESTFN + "2") + f = open(test_support.TESTFN + "2", "wb") + f.write("bar") + f.close() + self.assertIs( + posixpath.samefile( test_support.TESTFN + "1", test_support.TESTFN + "2" - ) - self.assertIs( - posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" - ), - True - ) - os.remove(test_support.TESTFN + "2") - f = open(test_support.TESTFN + "2", "wb") - f.write("bar") - f.close() - self.assertIs( - posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" - ), - False - ) - finally: - if not f.close(): - f.close() - try: - os.remove(test_support.TESTFN + "1") - except os.error: - pass - try: - os.remove(test_support.TESTFN + "2") - except os.error: - pass + ), + False + ) + finally: + if not f.close(): + f.close() - self.assertRaises(TypeError, posixpath.samefile) + self.assertRaises(TypeError, posixpath.samefile) def test_samestat(self): f = open(test_support.TESTFN + "1", "wb") @@ -322,14 +320,6 @@ finally: if not f.close(): f.close() - try: - os.remove(test_support.TESTFN + "1") - except os.error: - pass - try: - os.remove(test_support.TESTFN + "2") - except os.error: - pass self.assertRaises(TypeError, posixpath.samestat) @@ -409,7 +399,7 @@ os.symlink(ABSTFN+"1", ABSTFN) self.assertEqual(realpath(ABSTFN), ABSTFN+"1") finally: - self.safe_remove(ABSTFN) + test_support.unlink(ABSTFN) def test_realpath_symlink_loops(self): # Bug #930024, return the path unchanged if we get into an infinite @@ -429,9 +419,9 @@ self.assertEqual(realpath(basename(ABSTFN)), ABSTFN) finally: os.chdir(old_path) - self.safe_remove(ABSTFN) - self.safe_remove(ABSTFN+"1") - self.safe_remove(ABSTFN+"2") + test_support.unlink(ABSTFN) + test_support.unlink(ABSTFN+"1") + test_support.unlink(ABSTFN+"2") def test_realpath_resolve_parents(self): # We also need to resolve any symlinks in the parents of a relative @@ -448,9 +438,9 @@ self.assertEqual(realpath("a"), ABSTFN + "/y/a") finally: os.chdir(old_path) - self.safe_remove(ABSTFN + "/k") - self.safe_rmdir(ABSTFN + "/y") - self.safe_rmdir(ABSTFN) + test_support.unlink(ABSTFN + "/k") + safe_rmdir(ABSTFN + "/y") + safe_rmdir(ABSTFN) def test_realpath_resolve_before_normalizing(self): # Bug #990669: Symbolic links should be resolved before we @@ -474,10 +464,10 @@ self.assertEqual(realpath(basename(ABSTFN) + "/link-y/.."), ABSTFN + "/k") finally: os.chdir(old_path) - self.safe_remove(ABSTFN + "/link-y") - self.safe_rmdir(ABSTFN + "/k/y") - self.safe_rmdir(ABSTFN + "/k") - self.safe_rmdir(ABSTFN) + test_support.unlink(ABSTFN + "/link-y") + safe_rmdir(ABSTFN + "/k/y") + safe_rmdir(ABSTFN + "/k") + safe_rmdir(ABSTFN) def test_realpath_resolve_first(self): # Bug #1213894: The first component of the path, if not absolute, @@ -495,20 +485,24 @@ self.assertEqual(realpath(base + "link/k"), ABSTFN + "/k") finally: os.chdir(old_path) - self.safe_remove(ABSTFN + "link") - self.safe_rmdir(ABSTFN + "/k") - self.safe_rmdir(ABSTFN) - - # Convenience functions for removing temporary files. - def pass_os_error(self, func, filename): - try: func(filename) - except OSError: pass + test_support.unlink(ABSTFN + "link") + safe_rmdir(ABSTFN + "/k") + safe_rmdir(ABSTFN) - def safe_remove(self, filename): - self.pass_os_error(os.remove, filename) - - def safe_rmdir(self, dirname): - self.pass_os_error(os.rmdir, dirname) + def test_relpath(self): + (real_getcwd, os.getcwd) = (os.getcwd, lambda: r"/home/user/bar") + try: + curdir = os.path.split(os.getcwd())[-1] + self.assertRaises(ValueError, posixpath.relpath, "") + self.assertEqual(posixpath.relpath("a"), "a") + self.assertEqual(posixpath.relpath(posixpath.abspath("a")), "a") + self.assertEqual(posixpath.relpath("a/b"), "a/b") + self.assertEqual(posixpath.relpath("../a/b"), "../a/b") + self.assertEqual(posixpath.relpath("a", "../b"), "../"+curdir+"/a") + self.assertEqual(posixpath.relpath("a/b", "../c"), "../"+curdir+"/a/b") + self.assertEqual(posixpath.relpath("a", "b/c"), "../../a") + finally: + os.getcwd = real_getcwd def test_main(): test_support.run_unittest(PosixPathTest) Modified: python/branches/bcannon-objcap/Lib/test/test_pty.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_pty.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_pty.py Fri May 25 22:13:08 2007 @@ -1,5 +1,11 @@ -import pty, os, sys, signal -from test.test_support import verbose, TestFailed, TestSkipped +import errno +import fcntl +import pty +import os +import sys +import signal +from test.test_support import verbose, TestSkipped, run_unittest +import unittest TEST_STRING_1 = "I wish to buy a fish license.\n" TEST_STRING_2 = "For my pet fish, Eric.\n" @@ -11,6 +17,7 @@ def debug(msg): pass + def normalize_output(data): # Some operating systems do conversions on newline. We could possibly # fix that by doing the appropriate termios.tcsetattr()s. I couldn't @@ -32,116 +39,158 @@ return data + # Marginal testing of pty suite. Cannot do extensive 'do or fail' testing # because pty code is not too portable. +# XXX(nnorwitz): these tests leak fds when there is an error. +class PtyTest(unittest.TestCase): + def setUp(self): + # isatty() and close() can hang on some platforms. Set an alarm + # before running the test to make sure we don't hang forever. + self.old_alarm = signal.signal(signal.SIGALRM, self.handle_sig) + signal.alarm(10) + + def tearDown(self): + # remove alarm, restore old alarm handler + signal.alarm(0) + signal.signal(signal.SIGALRM, self.old_alarm) + + def handle_sig(self, sig, frame): + self.fail("isatty hung") + + def test_basic(self): + try: + debug("Calling master_open()") + master_fd, slave_name = pty.master_open() + debug("Got master_fd '%d', slave_name '%s'" % + (master_fd, slave_name)) + debug("Calling slave_open(%r)" % (slave_name,)) + slave_fd = pty.slave_open(slave_name) + debug("Got slave_fd '%d'" % slave_fd) + except OSError: + # " An optional feature could not be imported " ... ? + raise TestSkipped, "Pseudo-terminals (seemingly) not functional." + + self.assertTrue(os.isatty(slave_fd), 'slave_fd is not a tty') + + # Solaris requires reading the fd before anything is returned. + # My guess is that since we open and close the slave fd + # in master_open(), we need to read the EOF. + + # Ensure the fd is non-blocking in case there's nothing to read. + orig_flags = fcntl.fcntl(master_fd, fcntl.F_GETFL) + fcntl.fcntl(master_fd, fcntl.F_SETFL, orig_flags | os.O_NONBLOCK) + try: + s1 = os.read(master_fd, 1024) + self.assertEquals('', s1) + except OSError, e: + if e.errno != errno.EAGAIN: + raise + # Restore the original flags. + fcntl.fcntl(master_fd, fcntl.F_SETFL, orig_flags) + + debug("Writing to slave_fd") + os.write(slave_fd, TEST_STRING_1) + s1 = os.read(master_fd, 1024) + self.assertEquals('I wish to buy a fish license.\n', + normalize_output(s1)) + + debug("Writing chunked output") + os.write(slave_fd, TEST_STRING_2[:5]) + os.write(slave_fd, TEST_STRING_2[5:]) + s2 = os.read(master_fd, 1024) + self.assertEquals('For my pet fish, Eric.\n', normalize_output(s2)) + + os.close(slave_fd) + os.close(master_fd) + + + def test_fork(self): + debug("calling pty.fork()") + pid, master_fd = pty.fork() + if pid == pty.CHILD: + # stdout should be connected to a tty. + if not os.isatty(1): + debug("Child's fd 1 is not a tty?!") + os._exit(3) + + # After pty.fork(), the child should already be a session leader. + # (on those systems that have that concept.) + debug("In child, calling os.setsid()") + try: + os.setsid() + except OSError: + # Good, we already were session leader + debug("Good: OSError was raised.") + pass + except AttributeError: + # Have pty, but not setsid()? + debug("No setsid() available?") + pass + except: + # We don't want this error to propagate, escaping the call to + # os._exit() and causing very peculiar behavior in the calling + # regrtest.py ! + # Note: could add traceback printing here. + debug("An unexpected error was raised.") + os._exit(1) + else: + debug("os.setsid() succeeded! (bad!)") + os._exit(2) + os._exit(4) + else: + debug("Waiting for child (%d) to finish." % pid) + # In verbose mode, we have to consume the debug output from the + # child or the child will block, causing this test to hang in the + # parent's waitpid() call. The child blocks after a + # platform-dependent amount of data is written to its fd. On + # Linux 2.6, it's 4000 bytes and the child won't block, but on OS + # X even the small writes in the child above will block it. Also + # on Linux, the read() will throw an OSError (input/output error) + # when it tries to read past the end of the buffer but the child's + # already exited, so catch and discard those exceptions. It's not + # worth checking for EIO. + while True: + try: + data = os.read(master_fd, 80) + except OSError: + break + if not data: + break + sys.stdout.write(data.replace('\r\n', '\n')) + + ##line = os.read(master_fd, 80) + ##lines = line.replace('\r\n', '\n').split('\n') + ##if False and lines != ['In child, calling os.setsid()', + ## 'Good: OSError was raised.', '']: + ## raise TestFailed("Unexpected output from child: %r" % line) + + (pid, status) = os.waitpid(pid, 0) + res = status >> 8 + debug("Child (%d) exited with status %d (%d)." % (pid, res, status)) + if res == 1: + self.fail("Child raised an unexpected exception in os.setsid()") + elif res == 2: + self.fail("pty.fork() failed to make child a session leader.") + elif res == 3: + self.fail("Child spawned by pty.fork() did not have a tty as stdout") + elif res != 4: + self.fail("pty.fork() failed for unknown reasons.") + + ##debug("Reading from master_fd now that the child has exited") + ##try: + ## s1 = os.read(master_fd, 1024) + ##except os.error: + ## pass + ##else: + ## raise TestFailed("Read from master_fd did not raise exception") + + os.close(master_fd) -def test_basic_pty(): - try: - debug("Calling master_open()") - master_fd, slave_name = pty.master_open() - debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) - debug("Calling slave_open(%r)"%(slave_name,)) - slave_fd = pty.slave_open(slave_name) - debug("Got slave_fd '%d'"%slave_fd) - except OSError: - # " An optional feature could not be imported " ... ? - raise TestSkipped, "Pseudo-terminals (seemingly) not functional." - - if not os.isatty(slave_fd): - raise TestFailed, "slave_fd is not a tty" - - debug("Writing to slave_fd") - os.write(slave_fd, TEST_STRING_1) - s1 = os.read(master_fd, 1024) - sys.stdout.write(normalize_output(s1)) - - debug("Writing chunked output") - os.write(slave_fd, TEST_STRING_2[:5]) - os.write(slave_fd, TEST_STRING_2[5:]) - s2 = os.read(master_fd, 1024) - sys.stdout.write(normalize_output(s2)) - - os.close(slave_fd) - os.close(master_fd) - -def handle_sig(sig, frame): - raise TestFailed, "isatty hung" - -# isatty() and close() can hang on some platforms -# set an alarm before running the test to make sure we don't hang forever -old_alarm = signal.signal(signal.SIGALRM, handle_sig) -signal.alarm(10) - -try: - test_basic_pty() -finally: - # remove alarm, restore old alarm handler - signal.alarm(0) - signal.signal(signal.SIGALRM, old_alarm) - -# basic pty passed. - -debug("calling pty.fork()") -pid, master_fd = pty.fork() -if pid == pty.CHILD: - # stdout should be connected to a tty. - if not os.isatty(1): - debug("Child's fd 1 is not a tty?!") - os._exit(3) - - # After pty.fork(), the child should already be a session leader. - # (on those systems that have that concept.) - debug("In child, calling os.setsid()") - try: - os.setsid() - except OSError: - # Good, we already were session leader - debug("Good: OSError was raised.") - pass - except AttributeError: - # Have pty, but not setsid() ? - debug("No setsid() available ?") - pass - except: - # We don't want this error to propagate, escaping the call to - # os._exit() and causing very peculiar behavior in the calling - # regrtest.py ! - # Note: could add traceback printing here. - debug("An unexpected error was raised.") - os._exit(1) - else: - debug("os.setsid() succeeded! (bad!)") - os._exit(2) - os._exit(4) -else: - debug("Waiting for child (%d) to finish."%pid) - ##line = os.read(master_fd, 80) - ##lines = line.replace('\r\n', '\n').split('\n') - ##if False and lines != ['In child, calling os.setsid()', - ## 'Good: OSError was raised.', '']: - ## raise TestFailed("Unexpected output from child: %r" % line) - - (pid, status) = os.waitpid(pid, 0) - res = status >> 8 - debug("Child (%d) exited with status %d (%d)."%(pid, res, status)) - if res == 1: - raise TestFailed, "Child raised an unexpected exception in os.setsid()" - elif res == 2: - raise TestFailed, "pty.fork() failed to make child a session leader." - elif res == 3: - raise TestFailed, "Child spawned by pty.fork() did not have a tty as stdout" - elif res != 4: - raise TestFailed, "pty.fork() failed for unknown reasons." - - ##debug("Reading from master_fd now that the child has exited") - ##try: - ## s1 = os.read(master_fd, 1024) - ##except os.error: - ## pass - ##else: - ## raise TestFailed("Read from master_fd did not raise exception") - + # pty.fork() passed. -os.close(master_fd) +def test_main(verbose=None): + run_unittest(PtyTest) -# pty.fork() passed. +if __name__ == "__main__": + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_pyexpat.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_pyexpat.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_pyexpat.py Fri May 25 22:13:08 2007 @@ -1,108 +1,40 @@ -# Very simple test - Parse a file and print what happens - # XXX TypeErrors on calling handlers, or on bad return values from a # handler, are obscure and unhelpful. +import StringIO +import unittest + import pyexpat from xml.parsers import expat -from test.test_support import sortdict, TestFailed +from test.test_support import sortdict, run_unittest -class Outputter: - def StartElementHandler(self, name, attrs): - print 'Start element:\n\t', repr(name), sortdict(attrs) - def EndElementHandler(self, name): - print 'End element:\n\t', repr(name) +class SetAttributeTest(unittest.TestCase): + def setUp(self): + self.parser = expat.ParserCreate(namespace_separator='!') + self.set_get_pairs = [ + [0, 0], + [1, 1], + [2, 1], + [0, 0], + ] + + def test_returns_unicode(self): + for x, y in self.set_get_pairs: + self.parser.returns_unicode = x + self.assertEquals(self.parser.returns_unicode, y) + + def test_ordered_attributes(self): + for x, y in self.set_get_pairs: + self.parser.ordered_attributes = x + self.assertEquals(self.parser.ordered_attributes, y) + + def test_specified_attributes(self): + for x, y in self.set_get_pairs: + self.parser.specified_attributes = x + self.assertEquals(self.parser.specified_attributes, y) - def CharacterDataHandler(self, data): - data = data.strip() - if data: - print 'Character data:' - print '\t', repr(data) - - def ProcessingInstructionHandler(self, target, data): - print 'PI:\n\t', repr(target), repr(data) - - def StartNamespaceDeclHandler(self, prefix, uri): - print 'NS decl:\n\t', repr(prefix), repr(uri) - - def EndNamespaceDeclHandler(self, prefix): - print 'End of NS decl:\n\t', repr(prefix) - - def StartCdataSectionHandler(self): - print 'Start of CDATA section' - - def EndCdataSectionHandler(self): - print 'End of CDATA section' - - def CommentHandler(self, text): - print 'Comment:\n\t', repr(text) - - def NotationDeclHandler(self, *args): - name, base, sysid, pubid = args - print 'Notation declared:', args - - def UnparsedEntityDeclHandler(self, *args): - entityName, base, systemId, publicId, notationName = args - print 'Unparsed entity decl:\n\t', args - - def NotStandaloneHandler(self, userData): - print 'Not standalone' - return 1 - - def ExternalEntityRefHandler(self, *args): - context, base, sysId, pubId = args - print 'External entity ref:', args[1:] - return 1 - - def DefaultHandler(self, userData): - pass - - def DefaultHandlerExpand(self, userData): - pass - - -def confirm(ok): - if ok: - print "OK." - else: - print "Not OK." - -out = Outputter() -parser = expat.ParserCreate(namespace_separator='!') - -# Test getting/setting returns_unicode -parser.returns_unicode = 0; confirm(parser.returns_unicode == 0) -parser.returns_unicode = 1; confirm(parser.returns_unicode == 1) -parser.returns_unicode = 2; confirm(parser.returns_unicode == 1) -parser.returns_unicode = 0; confirm(parser.returns_unicode == 0) - -# Test getting/setting ordered_attributes -parser.ordered_attributes = 0; confirm(parser.ordered_attributes == 0) -parser.ordered_attributes = 1; confirm(parser.ordered_attributes == 1) -parser.ordered_attributes = 2; confirm(parser.ordered_attributes == 1) -parser.ordered_attributes = 0; confirm(parser.ordered_attributes == 0) - -# Test getting/setting specified_attributes -parser.specified_attributes = 0; confirm(parser.specified_attributes == 0) -parser.specified_attributes = 1; confirm(parser.specified_attributes == 1) -parser.specified_attributes = 2; confirm(parser.specified_attributes == 1) -parser.specified_attributes = 0; confirm(parser.specified_attributes == 0) - -HANDLER_NAMES = [ - 'StartElementHandler', 'EndElementHandler', - 'CharacterDataHandler', 'ProcessingInstructionHandler', - 'UnparsedEntityDeclHandler', 'NotationDeclHandler', - 'StartNamespaceDeclHandler', 'EndNamespaceDeclHandler', - 'CommentHandler', 'StartCdataSectionHandler', - 'EndCdataSectionHandler', - 'DefaultHandler', 'DefaultHandlerExpand', - #'NotStandaloneHandler', - 'ExternalEntityRefHandler' - ] -for name in HANDLER_NAMES: - setattr(parser, name, getattr(out, name)) data = '''\ @@ -126,108 +58,228 @@ ''' -# Produce UTF-8 output -parser.returns_unicode = 0 -try: - parser.Parse(data, 1) -except expat.error: - print '** Error', parser.ErrorCode, expat.ErrorString(parser.ErrorCode) - print '** Line', parser.ErrorLineNumber - print '** Column', parser.ErrorColumnNumber - print '** Byte', parser.ErrorByteIndex - -# Try the parse again, this time producing Unicode output -parser = expat.ParserCreate(namespace_separator='!') -parser.returns_unicode = 1 - -for name in HANDLER_NAMES: - setattr(parser, name, getattr(out, name)) -try: - parser.Parse(data, 1) -except expat.error: - print '** Error', parser.ErrorCode, expat.ErrorString(parser.ErrorCode) - print '** Line', parser.ErrorLineNumber - print '** Column', parser.ErrorColumnNumber - print '** Byte', parser.ErrorByteIndex - -# Try parsing a file -parser = expat.ParserCreate(namespace_separator='!') -parser.returns_unicode = 1 -for name in HANDLER_NAMES: - setattr(parser, name, getattr(out, name)) -import StringIO -file = StringIO.StringIO(data) -try: - parser.ParseFile(file) -except expat.error: - print '** Error', parser.ErrorCode, expat.ErrorString(parser.ErrorCode) - print '** Line', parser.ErrorLineNumber - print '** Column', parser.ErrorColumnNumber - print '** Byte', parser.ErrorByteIndex - - -# Tests that make sure we get errors when the namespace_separator value -# is illegal, and that we don't for good values: -print -print "Testing constructor for proper handling of namespace_separator values:" -expat.ParserCreate() -expat.ParserCreate(namespace_separator=None) -expat.ParserCreate(namespace_separator=' ') -print "Legal values tested o.k." -try: - expat.ParserCreate(namespace_separator=42) -except TypeError, e: - print "Caught expected TypeError:" - print e -else: - print "Failed to catch expected TypeError." - -try: - expat.ParserCreate(namespace_separator='too long') -except ValueError, e: - print "Caught expected ValueError:" - print e -else: - print "Failed to catch expected ValueError." - -# ParserCreate() needs to accept a namespace_separator of zero length -# to satisfy the requirements of RDF applications that are required -# to simply glue together the namespace URI and the localname. Though -# considered a wart of the RDF specifications, it needs to be supported. -# -# See XML-SIG mailing list thread starting with -# http://mail.python.org/pipermail/xml-sig/2001-April/005202.html -# -expat.ParserCreate(namespace_separator='') # too short - -# Test the interning machinery. -p = expat.ParserCreate() -L = [] -def collector(name, *args): - L.append(name) -p.StartElementHandler = collector -p.EndElementHandler = collector -p.Parse(" ", 1) -tag = L[0] -if len(L) != 6: - print "L should only contain 6 entries; found", len(L) -for entry in L: - if tag is not entry: - print "expected L to contain many references to the same string", - print "(it didn't)" - print "L =", repr(L) - break +# Produce UTF-8 output +class ParseTest(unittest.TestCase): + class Outputter: + def __init__(self): + self.out = [] + + def StartElementHandler(self, name, attrs): + self.out.append('Start element: ' + repr(name) + ' ' + + sortdict(attrs)) + + def EndElementHandler(self, name): + self.out.append('End element: ' + repr(name)) + + def CharacterDataHandler(self, data): + data = data.strip() + if data: + self.out.append('Character data: ' + repr(data)) + + def ProcessingInstructionHandler(self, target, data): + self.out.append('PI: ' + repr(target) + ' ' + repr(data)) + + def StartNamespaceDeclHandler(self, prefix, uri): + self.out.append('NS decl: ' + repr(prefix) + ' ' + repr(uri)) + + def EndNamespaceDeclHandler(self, prefix): + self.out.append('End of NS decl: ' + repr(prefix)) + + def StartCdataSectionHandler(self): + self.out.append('Start of CDATA section') + + def EndCdataSectionHandler(self): + self.out.append('End of CDATA section') + + def CommentHandler(self, text): + self.out.append('Comment: ' + repr(text)) + + def NotationDeclHandler(self, *args): + name, base, sysid, pubid = args + self.out.append('Notation declared: %s' %(args,)) + + def UnparsedEntityDeclHandler(self, *args): + entityName, base, systemId, publicId, notationName = args + self.out.append('Unparsed entity decl: %s' %(args,)) + + def NotStandaloneHandler(self, userData): + self.out.append('Not standalone') + return 1 + + def ExternalEntityRefHandler(self, *args): + context, base, sysId, pubId = args + self.out.append('External entity ref: %s' %(args[1:],)) + return 1 + + def DefaultHandler(self, userData): + pass + + def DefaultHandlerExpand(self, userData): + pass + + handler_names = [ + 'StartElementHandler', 'EndElementHandler', + 'CharacterDataHandler', 'ProcessingInstructionHandler', + 'UnparsedEntityDeclHandler', 'NotationDeclHandler', + 'StartNamespaceDeclHandler', 'EndNamespaceDeclHandler', + 'CommentHandler', 'StartCdataSectionHandler', + 'EndCdataSectionHandler', + 'DefaultHandler', 'DefaultHandlerExpand', + #'NotStandaloneHandler', + 'ExternalEntityRefHandler' + ] + + def test_utf8(self): + + out = self.Outputter() + parser = expat.ParserCreate(namespace_separator='!') + for name in self.handler_names: + setattr(parser, name, getattr(out, name)) + parser.returns_unicode = 0 + parser.Parse(data, 1) + + # Verify output + op = out.out + self.assertEquals(op[0], 'PI: \'xml-stylesheet\' \'href="stylesheet.css"\'') + self.assertEquals(op[1], "Comment: ' comment data '") + self.assertEquals(op[2], "Notation declared: ('notation', None, 'notation.jpeg', None)") + self.assertEquals(op[3], "Unparsed entity decl: ('unparsed_entity', None, 'entity.file', None, 'notation')") + self.assertEquals(op[4], "Start element: 'root' {'attr1': 'value1', 'attr2': 'value2\\xe1\\xbd\\x80'}") + self.assertEquals(op[5], "NS decl: 'myns' 'http://www.python.org/namespace'") + self.assertEquals(op[6], "Start element: 'http://www.python.org/namespace!subelement' {}") + self.assertEquals(op[7], "Character data: 'Contents of subelements'") + self.assertEquals(op[8], "End element: 'http://www.python.org/namespace!subelement'") + self.assertEquals(op[9], "End of NS decl: 'myns'") + self.assertEquals(op[10], "Start element: 'sub2' {}") + self.assertEquals(op[11], 'Start of CDATA section') + self.assertEquals(op[12], "Character data: 'contents of CDATA section'") + self.assertEquals(op[13], 'End of CDATA section') + self.assertEquals(op[14], "End element: 'sub2'") + self.assertEquals(op[15], "External entity ref: (None, 'entity.file', None)") + self.assertEquals(op[16], "End element: 'root'") + + def test_unicode(self): + # Try the parse again, this time producing Unicode output + out = self.Outputter() + parser = expat.ParserCreate(namespace_separator='!') + parser.returns_unicode = 1 + for name in self.handler_names: + setattr(parser, name, getattr(out, name)) + + parser.Parse(data, 1) + + op = out.out + self.assertEquals(op[0], 'PI: u\'xml-stylesheet\' u\'href="stylesheet.css"\'') + self.assertEquals(op[1], "Comment: u' comment data '") + self.assertEquals(op[2], "Notation declared: (u'notation', None, u'notation.jpeg', None)") + self.assertEquals(op[3], "Unparsed entity decl: (u'unparsed_entity', None, u'entity.file', None, u'notation')") + self.assertEquals(op[4], "Start element: u'root' {u'attr1': u'value1', u'attr2': u'value2\\u1f40'}") + self.assertEquals(op[5], "NS decl: u'myns' u'http://www.python.org/namespace'") + self.assertEquals(op[6], "Start element: u'http://www.python.org/namespace!subelement' {}") + self.assertEquals(op[7], "Character data: u'Contents of subelements'") + self.assertEquals(op[8], "End element: u'http://www.python.org/namespace!subelement'") + self.assertEquals(op[9], "End of NS decl: u'myns'") + self.assertEquals(op[10], "Start element: u'sub2' {}") + self.assertEquals(op[11], 'Start of CDATA section') + self.assertEquals(op[12], "Character data: u'contents of CDATA section'") + self.assertEquals(op[13], 'End of CDATA section') + self.assertEquals(op[14], "End element: u'sub2'") + self.assertEquals(op[15], "External entity ref: (None, u'entity.file', None)") + self.assertEquals(op[16], "End element: u'root'") + + def test_parse_file(self): + # Try parsing a file + out = self.Outputter() + parser = expat.ParserCreate(namespace_separator='!') + parser.returns_unicode = 1 + for name in self.handler_names: + setattr(parser, name, getattr(out, name)) + file = StringIO.StringIO(data) + + parser.ParseFile(file) + + op = out.out + self.assertEquals(op[0], 'PI: u\'xml-stylesheet\' u\'href="stylesheet.css"\'') + self.assertEquals(op[1], "Comment: u' comment data '") + self.assertEquals(op[2], "Notation declared: (u'notation', None, u'notation.jpeg', None)") + self.assertEquals(op[3], "Unparsed entity decl: (u'unparsed_entity', None, u'entity.file', None, u'notation')") + self.assertEquals(op[4], "Start element: u'root' {u'attr1': u'value1', u'attr2': u'value2\\u1f40'}") + self.assertEquals(op[5], "NS decl: u'myns' u'http://www.python.org/namespace'") + self.assertEquals(op[6], "Start element: u'http://www.python.org/namespace!subelement' {}") + self.assertEquals(op[7], "Character data: u'Contents of subelements'") + self.assertEquals(op[8], "End element: u'http://www.python.org/namespace!subelement'") + self.assertEquals(op[9], "End of NS decl: u'myns'") + self.assertEquals(op[10], "Start element: u'sub2' {}") + self.assertEquals(op[11], 'Start of CDATA section') + self.assertEquals(op[12], "Character data: u'contents of CDATA section'") + self.assertEquals(op[13], 'End of CDATA section') + self.assertEquals(op[14], "End element: u'sub2'") + self.assertEquals(op[15], "External entity ref: (None, u'entity.file', None)") + self.assertEquals(op[16], "End element: u'root'") + + +class NamespaceSeparatorTest(unittest.TestCase): + def test_legal(self): + # Tests that make sure we get errors when the namespace_separator value + # is illegal, and that we don't for good values: + expat.ParserCreate() + expat.ParserCreate(namespace_separator=None) + expat.ParserCreate(namespace_separator=' ') + + def test_illegal(self): + try: + expat.ParserCreate(namespace_separator=42) + self.fail() + except TypeError, e: + self.assertEquals(str(e), + 'ParserCreate() argument 2 must be string or None, not int') + + try: + expat.ParserCreate(namespace_separator='too long') + self.fail() + except ValueError, e: + self.assertEquals(str(e), + 'namespace_separator must be at most one character, omitted, or None') + + def test_zero_length(self): + # ParserCreate() needs to accept a namespace_separator of zero length + # to satisfy the requirements of RDF applications that are required + # to simply glue together the namespace URI and the localname. Though + # considered a wart of the RDF specifications, it needs to be supported. + # + # See XML-SIG mailing list thread starting with + # http://mail.python.org/pipermail/xml-sig/2001-April/005202.html + # + expat.ParserCreate(namespace_separator='') # too short + + +class InterningTest(unittest.TestCase): + def test(self): + # Test the interning machinery. + p = expat.ParserCreate() + L = [] + def collector(name, *args): + L.append(name) + p.StartElementHandler = collector + p.EndElementHandler = collector + p.Parse(" ", 1) + tag = L[0] + self.assertEquals(len(L), 6) + for entry in L: + # L should have the same string repeated over and over. + self.assertTrue(tag is entry) -# Tests of the buffer_text attribute. -import sys -class TextCollector: - def __init__(self, parser): +class BufferTextTest(unittest.TestCase): + def setUp(self): self.stuff = [] + self.parser = expat.ParserCreate() + self.parser.buffer_text = 1 + self.parser.CharacterDataHandler = self.CharacterDataHandler def check(self, expected, label): - require(self.stuff == expected, + self.assertEquals(self.stuff, expected, "%s\nstuff = %r\nexpected = %r" % (label, self.stuff, map(unicode, expected))) @@ -238,9 +290,9 @@ self.stuff.append("<%s>" % name) bt = attrs.get("buffer-text") if bt == "yes": - parser.buffer_text = 1 + self.parser.buffer_text = 1 elif bt == "no": - parser.buffer_text = 0 + self.parser.buffer_text = 0 def EndElementHandler(self, name): self.stuff.append("" % name) @@ -248,95 +300,91 @@ def CommentHandler(self, data): self.stuff.append("" % data) -def require(cond, label): - # similar to confirm(), but no extraneous output - if not cond: - raise TestFailed(label) - -def setup(handlers=[]): - parser = expat.ParserCreate() - require(not parser.buffer_text, - "buffer_text not disabled by default") - parser.buffer_text = 1 - handler = TextCollector(parser) - parser.CharacterDataHandler = handler.CharacterDataHandler - for name in handlers: - setattr(parser, name, getattr(handler, name)) - return parser, handler - -parser, handler = setup() -require(parser.buffer_text, - "text buffering either not acknowledged or not enabled") -parser.Parse("123", 1) -handler.check(["123"], - "buffered text not properly collapsed") - -# XXX This test exposes more detail of Expat's text chunking than we -# XXX like, but it tests what we need to concisely. -parser, handler = setup(["StartElementHandler"]) -parser.Parse("12\n34\n5", 1) -handler.check(["", "1", "", "2", "\n", "3", "", "4\n5"], - "buffering control not reacting as expected") - -parser, handler = setup() -parser.Parse("1<2> \n 3", 1) -handler.check(["1<2> \n 3"], - "buffered text not properly collapsed") - -parser, handler = setup(["StartElementHandler"]) -parser.Parse("123", 1) -handler.check(["", "1", "", "2", "", "3"], - "buffered text not properly split") - -parser, handler = setup(["StartElementHandler", "EndElementHandler"]) -parser.CharacterDataHandler = None -parser.Parse("123", 1) -handler.check(["", "", "", "", "", ""], - "huh?") - -parser, handler = setup(["StartElementHandler", "EndElementHandler"]) -parser.Parse("123", 1) -handler.check(["", "1", "", "", "2", "", "", "3", ""], - "huh?") - -parser, handler = setup(["CommentHandler", "EndElementHandler", - "StartElementHandler"]) -parser.Parse("12345 ", 1) -handler.check(["", "1", "", "", "2", "", "", "345", ""], - "buffered text not properly split") - -parser, handler = setup(["CommentHandler", "EndElementHandler", - "StartElementHandler"]) -parser.Parse("12345 ", 1) -handler.check(["", "1", "", "", "2", "", "", "3", - "", "4", "", "5", ""], - "buffered text not properly split") + def setHandlers(self, handlers=[]): + for name in handlers: + setattr(self.parser, name, getattr(self, name)) + + def test_default_to_disabled(self): + parser = expat.ParserCreate() + self.assertFalse(parser.buffer_text) + + def test_buffering_enabled(self): + # Make sure buffering is turned on + self.assertTrue(self.parser.buffer_text) + self.parser.Parse("123", 1) + self.assertEquals(self.stuff, ['123'], + "buffered text not properly collapsed") + + def test1(self): + # XXX This test exposes more detail of Expat's text chunking than we + # XXX like, but it tests what we need to concisely. + self.setHandlers(["StartElementHandler"]) + self.parser.Parse("12\n34\n5", 1) + self.assertEquals(self.stuff, + ["", "1", "", "2", "\n", "3", "", "4\n5"], + "buffering control not reacting as expected") + + def test2(self): + self.parser.Parse("1<2> \n 3", 1) + self.assertEquals(self.stuff, ["1<2> \n 3"], + "buffered text not properly collapsed") + + def test3(self): + self.setHandlers(["StartElementHandler"]) + self.parser.Parse("123", 1) + self.assertEquals(self.stuff, ["", "1", "", "2", "", "3"], + "buffered text not properly split") + + def test4(self): + self.setHandlers(["StartElementHandler", "EndElementHandler"]) + self.parser.CharacterDataHandler = None + self.parser.Parse("123", 1) + self.assertEquals(self.stuff, + ["", "", "", "", "", ""]) + + def test5(self): + self.setHandlers(["StartElementHandler", "EndElementHandler"]) + self.parser.Parse("123", 1) + self.assertEquals(self.stuff, + ["", "1", "", "", "2", "", "", "3", ""]) + + def test6(self): + self.setHandlers(["CommentHandler", "EndElementHandler", + "StartElementHandler"]) + self.parser.Parse("12345 ", 1) + self.assertEquals(self.stuff, + ["", "1", "", "", "2", "", "", "345", ""], + "buffered text not properly split") + + def test7(self): + self.setHandlers(["CommentHandler", "EndElementHandler", + "StartElementHandler"]) + self.parser.Parse("12345 ", 1) + self.assertEquals(self.stuff, + ["", "1", "", "", "2", "", "", "3", + "", "4", "", "5", ""], + "buffered text not properly split") + # Test handling of exception from callback: -def StartElementHandler(name, attrs): - raise RuntimeError(name) +class HandlerExceptionTest(unittest.TestCase): + def StartElementHandler(self, name, attrs): + raise RuntimeError(name) -parser = expat.ParserCreate() -parser.StartElementHandler = StartElementHandler + def test(self): + parser = expat.ParserCreate() + parser.StartElementHandler = self.StartElementHandler + try: + parser.Parse("", 1) + self.fail() + except RuntimeError, e: + self.assertEquals(e.args[0], 'a', + "Expected RuntimeError for element 'a', but" + \ + " found %r" % e.args[0]) -try: - parser.Parse("", 1) -except RuntimeError, e: - if e.args[0] != "a": - print "Expected RuntimeError for element 'a'; found %r" % e.args[0] -else: - print "Expected RuntimeError for 'a'" # Test Current* members: -class PositionTest: - - def __init__(self, expected_list, parser): - self.parser = parser - self.parser.StartElementHandler = self.StartElementHandler - self.parser.EndElementHandler = self.EndElementHandler - self.expected_list = expected_list - self.upto = 0 - +class PositionTest(unittest.TestCase): def StartElementHandler(self, name, attrs): self.check_pos('s') @@ -348,41 +396,54 @@ self.parser.CurrentByteIndex, self.parser.CurrentLineNumber, self.parser.CurrentColumnNumber) - require(self.upto < len(self.expected_list), - 'too many parser events') + self.assertTrue(self.upto < len(self.expected_list), + 'too many parser events') expected = self.expected_list[self.upto] - require(pos == expected, - 'expected position %s, got %s' % (expected, pos)) + self.assertEquals(pos, expected, + 'Expected position %s, got position %s' %(pos, expected)) self.upto += 1 + def test(self): + self.parser = expat.ParserCreate() + self.parser.StartElementHandler = self.StartElementHandler + self.parser.EndElementHandler = self.EndElementHandler + self.upto = 0 + self.expected_list = [('s', 0, 1, 0), ('s', 5, 2, 1), ('s', 11, 3, 2), + ('e', 15, 3, 6), ('e', 17, 4, 1), ('e', 22, 5, 0)] + + xml = '\n \n \n \n' + self.parser.Parse(xml, 1) + + +class sf1296433Test(unittest.TestCase): + def test_parse_only_xml_data(self): + # http://python.org/sf/1296433 + # + xml = "%s" % ('a' * 1025) + # this one doesn't crash + #xml = "%s" % ('a' * 10000) + + class SpecificException(Exception): + pass + + def handler(text): + raise SpecificException + + parser = expat.ParserCreate() + parser.CharacterDataHandler = handler + + self.assertRaises(Exception, parser.Parse, xml) + -parser = expat.ParserCreate() -handler = PositionTest([('s', 0, 1, 0), ('s', 5, 2, 1), ('s', 11, 3, 2), - ('e', 15, 3, 6), ('e', 17, 4, 1), ('e', 22, 5, 0)], - parser) -parser.Parse(''' - - - -''', 1) - - -def test_parse_only_xml_data(): - # http://python.org/sf/1296433 - # - xml = "%s" % ('a' * 1025) - # this one doesn't crash - #xml = "%s" % ('a' * 10000) - - def handler(text): - raise Exception - - parser = expat.ParserCreate() - parser.CharacterDataHandler = handler - - try: - parser.Parse(xml) - except: - pass +def test_main(): + run_unittest(SetAttributeTest, + ParseTest, + NamespaceSeparatorTest, + InterningTest, + BufferTextTest, + HandlerExceptionTest, + PositionTest, + sf1296433Test) -test_parse_only_xml_data() +if __name__ == "__main__": + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_re.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_re.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_re.py Fri May 25 22:13:08 2007 @@ -1,7 +1,7 @@ import sys sys.path = ['.'] + sys.path -from test.test_support import verbose, run_unittest +from test.test_support import verbose, run_unittest, guard_warnings_filter import re from re import Scanner import sys, os, traceback @@ -414,6 +414,12 @@ self.pickle_test(pickle) import cPickle self.pickle_test(cPickle) + # old pickles expect the _compile() reconstructor in sre module + import warnings + with guard_warnings_filter(): + warnings.filterwarnings("ignore", "The sre module is deprecated", + DeprecationWarning) + from sre import _compile def pickle_test(self, pickle): oldpat = re.compile('a(?:b|(c|e){1,2}?|d)+?(.)') @@ -595,6 +601,13 @@ self.assertEqual(iter.next().span(), (4, 4)) self.assertRaises(StopIteration, iter.next) + def test_empty_array(self): + # SF buf 1647541 + import array + for typecode in 'cbBuhHiIlLfd': + a = array.array(typecode) + self.assertEqual(re.compile("bla").match(a), None) + self.assertEqual(re.compile("").match(a).groups(), ()) def run_re_tests(): from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR Deleted: /python/branches/bcannon-objcap/Lib/test/test_rgbimg.py ============================================================================== --- /python/branches/bcannon-objcap/Lib/test/test_rgbimg.py Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,70 +0,0 @@ -# Testing rgbimg module - -import warnings -warnings.filterwarnings("ignore", - "the rgbimg module is deprecated", - DeprecationWarning, - ".*test_rgbimg$") -import rgbimg - -import os, uu - -from test.test_support import verbose, unlink, findfile - -class error(Exception): - pass - -print 'RGBimg test suite:' - -def testimg(rgb_file, raw_file): - rgb_file = findfile(rgb_file) - raw_file = findfile(raw_file) - width, height = rgbimg.sizeofimage(rgb_file) - rgb = rgbimg.longimagedata(rgb_file) - if len(rgb) != width * height * 4: - raise error, 'bad image length' - raw = open(raw_file, 'rb').read() - if rgb != raw: - raise error, \ - 'images don\'t match for '+rgb_file+' and '+raw_file - for depth in [1, 3, 4]: - rgbimg.longstoimage(rgb, width, height, depth, '@.rgb') - os.unlink('@.rgb') - -table = [ - ('testrgb'+os.extsep+'uue', 'test'+os.extsep+'rgb'), - ('testimg'+os.extsep+'uue', 'test'+os.extsep+'rawimg'), - ('testimgr'+os.extsep+'uue', 'test'+os.extsep+'rawimg'+os.extsep+'rev'), - ] -for source, target in table: - source = findfile(source) - target = findfile(target) - if verbose: - print "uudecoding", source, "->", target, "..." - uu.decode(source, target) - -if verbose: - print "testing..." - -ttob = rgbimg.ttob(0) -if ttob != 0: - raise error, 'ttob should start out as zero' - -testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg') - -ttob = rgbimg.ttob(1) -if ttob != 0: - raise error, 'ttob should be zero' - -testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg'+os.extsep+'rev') - -ttob = rgbimg.ttob(0) -if ttob != 1: - raise error, 'ttob should be one' - -ttob = rgbimg.ttob(0) -if ttob != 0: - raise error, 'ttob should be zero' - -for source, target in table: - unlink(findfile(target)) Modified: python/branches/bcannon-objcap/Lib/test/test_robotparser.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_robotparser.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_robotparser.py Fri May 25 22:13:08 2007 @@ -135,8 +135,8 @@ RobotTest(7, doc, good, bad) def test_main(): - test_support.run_suite(tests) + test_support.run_unittest(tests) if __name__=='__main__': test_support.Verbose = 1 - test_support.run_suite(tests) + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_sax.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_sax.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_sax.py Fri May 25 22:13:08 2007 @@ -13,26 +13,66 @@ from xml.sax.expatreader import create_parser from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl from cStringIO import StringIO -from test.test_support import verify, verbose, TestFailed, findfile +from test.test_support import findfile, run_unittest +import unittest import os -# ===== Utilities - -tests = 0 -failures = [] - -def confirm(outcome, name): - global tests +ns_uri = "http://www.python.org/xml-ns/saxtest/" - tests = tests + 1 - if outcome: - if verbose: - print "Passed", name - else: - failures.append(name) +class XmlTestBase(unittest.TestCase): + def verify_empty_attrs(self, attrs): + self.assertRaises(KeyError, attrs.getValue, "attr") + self.assertRaises(KeyError, attrs.getValueByQName, "attr") + self.assertRaises(KeyError, attrs.getNameByQName, "attr") + self.assertRaises(KeyError, attrs.getQNameByName, "attr") + self.assertRaises(KeyError, attrs.__getitem__, "attr") + self.assertEquals(attrs.getLength(), 0) + self.assertEquals(attrs.getNames(), []) + self.assertEquals(attrs.getQNames(), []) + self.assertEquals(len(attrs), 0) + self.assertFalse(attrs.has_key("attr")) + self.assertEquals(attrs.keys(), []) + self.assertEquals(attrs.get("attrs"), None) + self.assertEquals(attrs.get("attrs", 25), 25) + self.assertEquals(attrs.items(), []) + self.assertEquals(attrs.values(), []) + + def verify_empty_nsattrs(self, attrs): + self.assertRaises(KeyError, attrs.getValue, (ns_uri, "attr")) + self.assertRaises(KeyError, attrs.getValueByQName, "ns:attr") + self.assertRaises(KeyError, attrs.getNameByQName, "ns:attr") + self.assertRaises(KeyError, attrs.getQNameByName, (ns_uri, "attr")) + self.assertRaises(KeyError, attrs.__getitem__, (ns_uri, "attr")) + self.assertEquals(attrs.getLength(), 0) + self.assertEquals(attrs.getNames(), []) + self.assertEquals(attrs.getQNames(), []) + self.assertEquals(len(attrs), 0) + self.assertFalse(attrs.has_key((ns_uri, "attr"))) + self.assertEquals(attrs.keys(), []) + self.assertEquals(attrs.get((ns_uri, "attr")), None) + self.assertEquals(attrs.get((ns_uri, "attr"), 25), 25) + self.assertEquals(attrs.items(), []) + self.assertEquals(attrs.values(), []) + + def verify_attrs_wattr(self, attrs): + self.assertEquals(attrs.getLength(), 1) + self.assertEquals(attrs.getNames(), ["attr"]) + self.assertEquals(attrs.getQNames(), ["attr"]) + self.assertEquals(len(attrs), 1) + self.assertTrue(attrs.has_key("attr")) + self.assertEquals(attrs.keys(), ["attr"]) + self.assertEquals(attrs.get("attr"), "val") + self.assertEquals(attrs.get("attr", 25), "val") + self.assertEquals(attrs.items(), [("attr", "val")]) + self.assertEquals(attrs.values(), ["val"]) + self.assertEquals(attrs.getValue("attr"), "val") + self.assertEquals(attrs.getValueByQName("attr"), "val") + self.assertEquals(attrs.getNameByQName("attr"), "attr") + self.assertEquals(attrs["attr"], "val") + self.assertEquals(attrs.getQNameByName("attr"), "attr") -def test_make_parser2(): - try: +class MakeParserTest(unittest.TestCase): + def test_make_parser2(self): # Creating parsers several times in a row should succeed. # Testing this because there have been failures of this kind # before. @@ -48,10 +88,6 @@ p = make_parser() from xml.sax import make_parser p = make_parser() - except: - return 0 - else: - return p # =========================================================================== @@ -60,178 +96,214 @@ # # =========================================================================== -# ===== escape - -def test_escape_basic(): - return escape("Donald Duck & Co") == "Donald Duck & Co" - -def test_escape_all(): - return escape("") == "<Donald Duck & Co>" - -def test_escape_extra(): - return escape("Hei p? deg", {"?" : "å"}) == "Hei på deg" - -# ===== unescape - -def test_unescape_basic(): - return unescape("Donald Duck & Co") == "Donald Duck & Co" - -def test_unescape_all(): - return unescape("<Donald Duck & Co>") == "" - -def test_unescape_extra(): - return unescape("Hei p? deg", {"?" : "å"}) == "Hei på deg" - -def test_unescape_amp_extra(): - return unescape("&foo;", {"&foo;": "splat"}) == "&foo;" - -# ===== quoteattr +class SaxutilsTest(unittest.TestCase): + # ===== escape + def test_escape_basic(self): + self.assertEquals(escape("Donald Duck & Co"), "Donald Duck & Co") + + def test_escape_all(self): + self.assertEquals(escape(""), + "<Donald Duck & Co>") + + def test_escape_extra(self): + self.assertEquals(escape("Hei p? deg", {"?" : "å"}), + "Hei på deg") + + # ===== unescape + def test_unescape_basic(self): + self.assertEquals(unescape("Donald Duck & Co"), "Donald Duck & Co") + + def test_unescape_all(self): + self.assertEquals(unescape("<Donald Duck & Co>"), + "") + + def test_unescape_extra(self): + self.assertEquals(unescape("Hei p? deg", {"?" : "å"}), + "Hei på deg") + + def test_unescape_amp_extra(self): + self.assertEquals(unescape("&foo;", {"&foo;": "splat"}), "&foo;") + + # ===== quoteattr + def test_quoteattr_basic(self): + self.assertEquals(quoteattr("Donald Duck & Co"), + '"Donald Duck & Co"') + + def test_single_quoteattr(self): + self.assertEquals(quoteattr('Includes "double" quotes'), + '\'Includes "double" quotes\'') + + def test_double_quoteattr(self): + self.assertEquals(quoteattr("Includes 'single' quotes"), + "\"Includes 'single' quotes\"") + + def test_single_double_quoteattr(self): + self.assertEquals(quoteattr("Includes 'single' and \"double\" quotes"), + "\"Includes 'single' and "double" quotes\"") -def test_quoteattr_basic(): - return quoteattr("Donald Duck & Co") == '"Donald Duck & Co"' - -def test_single_quoteattr(): - return (quoteattr('Includes "double" quotes') - == '\'Includes "double" quotes\'') - -def test_double_quoteattr(): - return (quoteattr("Includes 'single' quotes") - == "\"Includes 'single' quotes\"") - -def test_single_double_quoteattr(): - return (quoteattr("Includes 'single' and \"double\" quotes") - == "\"Includes 'single' and "double" quotes\"") - -# ===== make_parser - -def test_make_parser(): - try: + # ===== make_parser + def test_make_parser(self): # Creating a parser should succeed - it should fall back # to the expatreader p = make_parser(['xml.parsers.no_such_parser']) - except: - return 0 - else: - return p # ===== XMLGenerator start = '\n' -def test_xmlgen_basic(): - result = StringIO() - gen = XMLGenerator(result) - gen.startDocument() - gen.startElement("doc", {}) - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + "" - -def test_xmlgen_content(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startElement("doc", {}) - gen.characters("huhei") - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + "huhei" - -def test_xmlgen_pi(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.processingInstruction("test", "data") - gen.startElement("doc", {}) - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + "" - -def test_xmlgen_content_escape(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startElement("doc", {}) - gen.characters("<huhei&" - -def test_xmlgen_attr_escape(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startElement("doc", {"a": '"'}) - gen.startElement("e", {"a": "'"}) - gen.endElement("e") - gen.startElement("e", {"a": "'\""}) - gen.endElement("e") - gen.startElement("e", {"a": "\n\r\t"}) - gen.endElement("e") - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + ("" - "" - "") - -def test_xmlgen_ignorable(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startElement("doc", {}) - gen.ignorableWhitespace(" ") - gen.endElement("doc") - gen.endDocument() - - return result.getvalue() == start + " " +class XmlgenTest(unittest.TestCase): + def test_xmlgen_basic(self): + result = StringIO() + gen = XMLGenerator(result) + gen.startDocument() + gen.startElement("doc", {}) + gen.endElement("doc") + gen.endDocument() + + self.assertEquals(result.getvalue(), start + "") + + def test_xmlgen_content(self): + result = StringIO() + gen = XMLGenerator(result) + + gen.startDocument() + gen.startElement("doc", {}) + gen.characters("huhei") + gen.endElement("doc") + gen.endDocument() + + self.assertEquals(result.getvalue(), start + "huhei") + + def test_xmlgen_pi(self): + result = StringIO() + gen = XMLGenerator(result) + + gen.startDocument() + gen.processingInstruction("test", "data") + gen.startElement("doc", {}) + gen.endElement("doc") + gen.endDocument() + + self.assertEquals(result.getvalue(), start + "") + + def test_xmlgen_content_escape(self): + result = StringIO() + gen = XMLGenerator(result) + + gen.startDocument() + gen.startElement("doc", {}) + gen.characters("<huhei&") + + def test_xmlgen_attr_escape(self): + result = StringIO() + gen = XMLGenerator(result) + + gen.startDocument() + gen.startElement("doc", {"a": '"'}) + gen.startElement("e", {"a": "'"}) + gen.endElement("e") + gen.startElement("e", {"a": "'\""}) + gen.endElement("e") + gen.startElement("e", {"a": "\n\r\t"}) + gen.endElement("e") + gen.endElement("doc") + gen.endDocument() + + self.assertEquals(result.getvalue(), start + + ("" + "" + "")) + + def test_xmlgen_ignorable(self): + result = StringIO() + gen = XMLGenerator(result) + + gen.startDocument() + gen.startElement("doc", {}) + gen.ignorableWhitespace(" ") + gen.endElement("doc") + gen.endDocument() + + self.assertEquals(result.getvalue(), start + " ") + + def test_xmlgen_ns(self): + result = StringIO() + gen = XMLGenerator(result) + + gen.startDocument() + gen.startPrefixMapping("ns1", ns_uri) + gen.startElementNS((ns_uri, "doc"), "ns1:doc", {}) + # add an unqualified name + gen.startElementNS((None, "udoc"), None, {}) + gen.endElementNS((None, "udoc"), None) + gen.endElementNS((ns_uri, "doc"), "ns1:doc") + gen.endPrefixMapping("ns1") + gen.endDocument() -ns_uri = "http://www.python.org/xml-ns/saxtest/" - -def test_xmlgen_ns(): - result = StringIO() - gen = XMLGenerator(result) - - gen.startDocument() - gen.startPrefixMapping("ns1", ns_uri) - gen.startElementNS((ns_uri, "doc"), "ns1:doc", {}) - # add an unqualified name - gen.startElementNS((None, "udoc"), None, {}) - gen.endElementNS((None, "udoc"), None) - gen.endElementNS((ns_uri, "doc"), "ns1:doc") - gen.endPrefixMapping("ns1") - gen.endDocument() - - return result.getvalue() == start + \ + self.assertEquals(result.getvalue(), start + \ ('' % - ns_uri) + ns_uri)) -# ===== XMLFilterBase + def test_1463026_1(self): + result = StringIO() + gen = XMLGenerator(result) + + gen.startDocument() + gen.startElementNS((None, 'a'), 'a', {(None, 'b'):'c'}) + gen.endElementNS((None, 'a'), 'a') + gen.endDocument() + + self.assertEquals(result.getvalue(), start+'') + + def test_1463026_2(self): + result = StringIO() + gen = XMLGenerator(result) + + gen.startDocument() + gen.startPrefixMapping(None, 'qux') + gen.startElementNS(('qux', 'a'), 'a', {}) + gen.endElementNS(('qux', 'a'), 'a') + gen.endPrefixMapping(None) + gen.endDocument() + + self.assertEquals(result.getvalue(), start+'') + + def test_1463026_3(self): + result = StringIO() + gen = XMLGenerator(result) + + gen.startDocument() + gen.startPrefixMapping('my', 'qux') + gen.startElementNS(('qux', 'a'), 'a', {(None, 'b'):'c'}) + gen.endElementNS(('qux', 'a'), 'a') + gen.endPrefixMapping('my') + gen.endDocument() + + self.assertEquals(result.getvalue(), + start+'') + + +class XMLFilterBaseTest(unittest.TestCase): + def test_filter_basic(self): + result = StringIO() + gen = XMLGenerator(result) + filter = XMLFilterBase() + filter.setContentHandler(gen) + + filter.startDocument() + filter.startElement("doc", {}) + filter.characters("content") + filter.ignorableWhitespace(" ") + filter.endElement("doc") + filter.endDocument() -def test_filter_basic(): - result = StringIO() - gen = XMLGenerator(result) - filter = XMLFilterBase() - filter.setContentHandler(gen) - - filter.startDocument() - filter.startElement("doc", {}) - filter.characters("content") - filter.ignorableWhitespace(" ") - filter.endElement("doc") - filter.endDocument() - - return result.getvalue() == start + "content " + self.assertEquals(result.getvalue(), start + "content ") # =========================================================================== # @@ -239,229 +311,233 @@ # # =========================================================================== -# ===== XMLReader support +xml_test_out = open(findfile("test"+os.extsep+"xml"+os.extsep+"out")).read() -def test_expat_file(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) +class ExpatReaderTest(XmlTestBase): - parser.setContentHandler(xmlgen) - parser.parse(open(findfile("test"+os.extsep+"xml"))) + # ===== XMLReader support - return result.getvalue() == xml_test_out + def test_expat_file(self): + parser = create_parser() + result = StringIO() + xmlgen = XMLGenerator(result) -# ===== DTDHandler support + parser.setContentHandler(xmlgen) + parser.parse(open(findfile("test"+os.extsep+"xml"))) -class TestDTDHandler: + self.assertEquals(result.getvalue(), xml_test_out) - def __init__(self): - self._notations = [] - self._entities = [] + # ===== DTDHandler support - def notationDecl(self, name, publicId, systemId): - self._notations.append((name, publicId, systemId)) + class TestDTDHandler: - def unparsedEntityDecl(self, name, publicId, systemId, ndata): - self._entities.append((name, publicId, systemId, ndata)) + def __init__(self): + self._notations = [] + self._entities = [] -def test_expat_dtdhandler(): - parser = create_parser() - handler = TestDTDHandler() - parser.setDTDHandler(handler) + def notationDecl(self, name, publicId, systemId): + self._notations.append((name, publicId, systemId)) - parser.feed('\n') - parser.feed(' \n') - parser.feed(']>\n') - parser.feed('') - parser.close() + def unparsedEntityDecl(self, name, publicId, systemId, ndata): + self._entities.append((name, publicId, systemId, ndata)) - return handler._notations == [("GIF", "-//CompuServe//NOTATION Graphics Interchange Format 89a//EN", None)] and \ - handler._entities == [("img", None, "expat.gif", "GIF")] + def test_expat_dtdhandler(self): + parser = create_parser() + handler = self.TestDTDHandler() + parser.setDTDHandler(handler) -# ===== EntityResolver support + parser.feed('\n') + parser.feed(' \n') + parser.feed(']>\n') + parser.feed('') + parser.close() -class TestEntityResolver: + self.assertEquals(handler._notations, + [("GIF", "-//CompuServe//NOTATION Graphics Interchange Format 89a//EN", None)]) + self.assertEquals(handler._entities, [("img", None, "expat.gif", "GIF")]) - def resolveEntity(self, publicId, systemId): - inpsrc = InputSource() - inpsrc.setByteStream(StringIO("")) - return inpsrc + # ===== EntityResolver support -def test_expat_entityresolver(): - parser = create_parser() - parser.setEntityResolver(TestEntityResolver()) - result = StringIO() - parser.setContentHandler(XMLGenerator(result)) + class TestEntityResolver: - parser.feed('\n') - parser.feed(']>\n') - parser.feed('&test;') - parser.close() + def resolveEntity(self, publicId, systemId): + inpsrc = InputSource() + inpsrc.setByteStream(StringIO("")) + return inpsrc - return result.getvalue() == start + "" + def test_expat_entityresolver(self): + parser = create_parser() + parser.setEntityResolver(self.TestEntityResolver()) + result = StringIO() + parser.setContentHandler(XMLGenerator(result)) -# ===== Attributes support + parser.feed('\n') + parser.feed(']>\n') + parser.feed('&test;') + parser.close() -class AttrGatherer(ContentHandler): + self.assertEquals(result.getvalue(), start + + "") - def startElement(self, name, attrs): - self._attrs = attrs + # ===== Attributes support - def startElementNS(self, name, qname, attrs): - self._attrs = attrs + class AttrGatherer(ContentHandler): -def test_expat_attrs_empty(): - parser = create_parser() - gather = AttrGatherer() - parser.setContentHandler(gather) + def startElement(self, name, attrs): + self._attrs = attrs - parser.feed("") - parser.close() + def startElementNS(self, name, qname, attrs): + self._attrs = attrs - return verify_empty_attrs(gather._attrs) + def test_expat_attrs_empty(self): + parser = create_parser() + gather = self.AttrGatherer() + parser.setContentHandler(gather) -def test_expat_attrs_wattr(): - parser = create_parser() - gather = AttrGatherer() - parser.setContentHandler(gather) + parser.feed("") + parser.close() - parser.feed("") - parser.close() + self.verify_empty_attrs(gather._attrs) - return verify_attrs_wattr(gather._attrs) + def test_expat_attrs_wattr(self): + parser = create_parser() + gather = self.AttrGatherer() + parser.setContentHandler(gather) -def test_expat_nsattrs_empty(): - parser = create_parser(1) - gather = AttrGatherer() - parser.setContentHandler(gather) + parser.feed("") + parser.close() - parser.feed("") - parser.close() + self.verify_attrs_wattr(gather._attrs) - return verify_empty_nsattrs(gather._attrs) + def test_expat_nsattrs_empty(self): + parser = create_parser(1) + gather = self.AttrGatherer() + parser.setContentHandler(gather) -def test_expat_nsattrs_wattr(): - parser = create_parser(1) - gather = AttrGatherer() - parser.setContentHandler(gather) + parser.feed("") + parser.close() - parser.feed("" % ns_uri) - parser.close() + self.verify_empty_nsattrs(gather._attrs) - attrs = gather._attrs + def test_expat_nsattrs_wattr(self): + parser = create_parser(1) + gather = self.AttrGatherer() + parser.setContentHandler(gather) - return attrs.getLength() == 1 and \ - attrs.getNames() == [(ns_uri, "attr")] and \ - (attrs.getQNames() == [] or attrs.getQNames() == ["ns:attr"]) and \ - len(attrs) == 1 and \ - attrs.has_key((ns_uri, "attr")) and \ - attrs.keys() == [(ns_uri, "attr")] and \ - attrs.get((ns_uri, "attr")) == "val" and \ - attrs.get((ns_uri, "attr"), 25) == "val" and \ - attrs.items() == [((ns_uri, "attr"), "val")] and \ - attrs.values() == ["val"] and \ - attrs.getValue((ns_uri, "attr")) == "val" and \ - attrs[(ns_uri, "attr")] == "val" + parser.feed("" % ns_uri) + parser.close() -# ===== InputSource support + attrs = gather._attrs -xml_test_out = open(findfile("test"+os.extsep+"xml"+os.extsep+"out")).read() + self.assertEquals(attrs.getLength(), 1) + self.assertEquals(attrs.getNames(), [(ns_uri, "attr")]) + self.assertTrue((attrs.getQNames() == [] or + attrs.getQNames() == ["ns:attr"])) + self.assertEquals(len(attrs), 1) + self.assertTrue(attrs.has_key((ns_uri, "attr"))) + self.assertEquals(attrs.get((ns_uri, "attr")), "val") + self.assertEquals(attrs.get((ns_uri, "attr"), 25), "val") + self.assertEquals(attrs.items(), [((ns_uri, "attr"), "val")]) + self.assertEquals(attrs.values(), ["val"]) + self.assertEquals(attrs.getValue((ns_uri, "attr")), "val") + self.assertEquals(attrs[(ns_uri, "attr")], "val") + + # ===== InputSource support + + def test_expat_inpsource_filename(self): + parser = create_parser() + result = StringIO() + xmlgen = XMLGenerator(result) + + parser.setContentHandler(xmlgen) + parser.parse(findfile("test"+os.extsep+"xml")) + + self.assertEquals(result.getvalue(), xml_test_out) + + def test_expat_inpsource_sysid(self): + parser = create_parser() + result = StringIO() + xmlgen = XMLGenerator(result) + + parser.setContentHandler(xmlgen) + parser.parse(InputSource(findfile("test"+os.extsep+"xml"))) + + self.assertEquals(result.getvalue(), xml_test_out) + + def test_expat_inpsource_stream(self): + parser = create_parser() + result = StringIO() + xmlgen = XMLGenerator(result) + + parser.setContentHandler(xmlgen) + inpsrc = InputSource() + inpsrc.setByteStream(open(findfile("test"+os.extsep+"xml"))) + parser.parse(inpsrc) + + self.assertEquals(result.getvalue(), xml_test_out) + + # ===== IncrementalParser support -def test_expat_inpsource_filename(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) - - parser.setContentHandler(xmlgen) - parser.parse(findfile("test"+os.extsep+"xml")) - - return result.getvalue() == xml_test_out - -def test_expat_inpsource_sysid(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) - - parser.setContentHandler(xmlgen) - parser.parse(InputSource(findfile("test"+os.extsep+"xml"))) - - return result.getvalue() == xml_test_out - -def test_expat_inpsource_stream(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) - - parser.setContentHandler(xmlgen) - inpsrc = InputSource() - inpsrc.setByteStream(open(findfile("test"+os.extsep+"xml"))) - parser.parse(inpsrc) - - return result.getvalue() == xml_test_out - -# ===== IncrementalParser support - -def test_expat_incremental(): - result = StringIO() - xmlgen = XMLGenerator(result) - parser = create_parser() - parser.setContentHandler(xmlgen) - - parser.feed("") - parser.feed("") - parser.close() - - return result.getvalue() == start + "" - -def test_expat_incremental_reset(): - result = StringIO() - xmlgen = XMLGenerator(result) - parser = create_parser() - parser.setContentHandler(xmlgen) - - parser.feed("") - parser.feed("text") - - result = StringIO() - xmlgen = XMLGenerator(result) - parser.setContentHandler(xmlgen) - parser.reset() - - parser.feed("") - parser.feed("text") - parser.feed("") - parser.close() - - return result.getvalue() == start + "text" - -# ===== Locator support - -def test_expat_locator_noinfo(): - result = StringIO() - xmlgen = XMLGenerator(result) - parser = create_parser() - parser.setContentHandler(xmlgen) - - parser.feed("") - parser.feed("") - parser.close() - - return parser.getSystemId() is None and \ - parser.getPublicId() is None and \ - parser.getLineNumber() == 1 - -def test_expat_locator_withinfo(): - result = StringIO() - xmlgen = XMLGenerator(result) - parser = create_parser() - parser.setContentHandler(xmlgen) - parser.parse(findfile("test.xml")) + def test_expat_incremental(self): + result = StringIO() + xmlgen = XMLGenerator(result) + parser = create_parser() + parser.setContentHandler(xmlgen) + + parser.feed("") + parser.feed("") + parser.close() + + self.assertEquals(result.getvalue(), start + "") + + def test_expat_incremental_reset(self): + result = StringIO() + xmlgen = XMLGenerator(result) + parser = create_parser() + parser.setContentHandler(xmlgen) + + parser.feed("") + parser.feed("text") + + result = StringIO() + xmlgen = XMLGenerator(result) + parser.setContentHandler(xmlgen) + parser.reset() + + parser.feed("") + parser.feed("text") + parser.feed("") + parser.close() + + self.assertEquals(result.getvalue(), start + "text") + + # ===== Locator support + + def test_expat_locator_noinfo(self): + result = StringIO() + xmlgen = XMLGenerator(result) + parser = create_parser() + parser.setContentHandler(xmlgen) + + parser.feed("") + parser.feed("") + parser.close() + + self.assertEquals(parser.getSystemId(), None) + self.assertEquals(parser.getPublicId(), None) + self.assertEquals(parser.getLineNumber(), 1) + + def test_expat_locator_withinfo(self): + result = StringIO() + xmlgen = XMLGenerator(result) + parser = create_parser() + parser.setContentHandler(xmlgen) + parser.parse(findfile("test.xml")) - return parser.getSystemId() == findfile("test.xml") and \ - parser.getPublicId() is None + self.assertEquals(parser.getSystemId(), findfile("test.xml")) + self.assertEquals(parser.getPublicId(), None) # =========================================================================== @@ -470,63 +546,59 @@ # # =========================================================================== -def test_expat_inpsource_location(): - parser = create_parser() - parser.setContentHandler(ContentHandler()) # do nothing - source = InputSource() - source.setByteStream(StringIO("")) #ill-formed - name = "a file name" - source.setSystemId(name) - try: - parser.parse(source) - except SAXException, e: - return e.getSystemId() == name - -def test_expat_incomplete(): - parser = create_parser() - parser.setContentHandler(ContentHandler()) # do nothing - try: - parser.parse(StringIO("")) - except SAXParseException: - return 1 # ok, error found - else: - return 0 - -def test_sax_parse_exception_str(): - # pass various values from a locator to the SAXParseException to - # make sure that the __str__() doesn't fall apart when None is - # passed instead of an integer line and column number - # - # use "normal" values for the locator: - str(SAXParseException("message", None, - DummyLocator(1, 1))) - # use None for the line number: - str(SAXParseException("message", None, - DummyLocator(None, 1))) - # use None for the column number: - str(SAXParseException("message", None, - DummyLocator(1, None))) - # use None for both: - str(SAXParseException("message", None, - DummyLocator(None, None))) - return 1 - -class DummyLocator: - def __init__(self, lineno, colno): - self._lineno = lineno - self._colno = colno - - def getPublicId(self): - return "pubid" +class ErrorReportingTest(unittest.TestCase): + def test_expat_inpsource_location(self): + parser = create_parser() + parser.setContentHandler(ContentHandler()) # do nothing + source = InputSource() + source.setByteStream(StringIO("")) #ill-formed + name = "a file name" + source.setSystemId(name) + try: + parser.parse(source) + self.fail() + except SAXException, e: + self.assertEquals(e.getSystemId(), name) + + def test_expat_incomplete(self): + parser = create_parser() + parser.setContentHandler(ContentHandler()) # do nothing + self.assertRaises(SAXParseException, parser.parse, StringIO("")) + + def test_sax_parse_exception_str(self): + # pass various values from a locator to the SAXParseException to + # make sure that the __str__() doesn't fall apart when None is + # passed instead of an integer line and column number + # + # use "normal" values for the locator: + str(SAXParseException("message", None, + self.DummyLocator(1, 1))) + # use None for the line number: + str(SAXParseException("message", None, + self.DummyLocator(None, 1))) + # use None for the column number: + str(SAXParseException("message", None, + self.DummyLocator(1, None))) + # use None for both: + str(SAXParseException("message", None, + self.DummyLocator(None, None))) + + class DummyLocator: + def __init__(self, lineno, colno): + self._lineno = lineno + self._colno = colno + + def getPublicId(self): + return "pubid" - def getSystemId(self): - return "sysid" + def getSystemId(self): + return "sysid" - def getLineNumber(self): - return self._lineno + def getLineNumber(self): + return self._lineno - def getColumnNumber(self): - return self._colno + def getColumnNumber(self): + return self._colno # =========================================================================== # @@ -534,218 +606,91 @@ # # =========================================================================== -# ===== AttributesImpl +class XmlReaderTest(XmlTestBase): -def verify_empty_attrs(attrs): - try: - attrs.getValue("attr") - gvk = 0 - except KeyError: - gvk = 1 - - try: - attrs.getValueByQName("attr") - gvqk = 0 - except KeyError: - gvqk = 1 - - try: - attrs.getNameByQName("attr") - gnqk = 0 - except KeyError: - gnqk = 1 - - try: - attrs.getQNameByName("attr") - gqnk = 0 - except KeyError: - gqnk = 1 - - try: - attrs["attr"] - gik = 0 - except KeyError: - gik = 1 - - return attrs.getLength() == 0 and \ - attrs.getNames() == [] and \ - attrs.getQNames() == [] and \ - len(attrs) == 0 and \ - not attrs.has_key("attr") and \ - attrs.keys() == [] and \ - attrs.get("attrs") is None and \ - attrs.get("attrs", 25) == 25 and \ - attrs.items() == [] and \ - attrs.values() == [] and \ - gvk and gvqk and gnqk and gik and gqnk - -def verify_attrs_wattr(attrs): - return attrs.getLength() == 1 and \ - attrs.getNames() == ["attr"] and \ - attrs.getQNames() == ["attr"] and \ - len(attrs) == 1 and \ - attrs.has_key("attr") and \ - attrs.keys() == ["attr"] and \ - attrs.get("attr") == "val" and \ - attrs.get("attr", 25) == "val" and \ - attrs.items() == [("attr", "val")] and \ - attrs.values() == ["val"] and \ - attrs.getValue("attr") == "val" and \ - attrs.getValueByQName("attr") == "val" and \ - attrs.getNameByQName("attr") == "attr" and \ - attrs["attr"] == "val" and \ - attrs.getQNameByName("attr") == "attr" - -def test_attrs_empty(): - return verify_empty_attrs(AttributesImpl({})) - -def test_attrs_wattr(): - return verify_attrs_wattr(AttributesImpl({"attr" : "val"})) - -# ===== AttributesImpl - -def verify_empty_nsattrs(attrs): - try: - attrs.getValue((ns_uri, "attr")) - gvk = 0 - except KeyError: - gvk = 1 - - try: - attrs.getValueByQName("ns:attr") - gvqk = 0 - except KeyError: - gvqk = 1 - - try: - attrs.getNameByQName("ns:attr") - gnqk = 0 - except KeyError: - gnqk = 1 - - try: - attrs.getQNameByName((ns_uri, "attr")) - gqnk = 0 - except KeyError: - gqnk = 1 - - try: - attrs[(ns_uri, "attr")] - gik = 0 - except KeyError: - gik = 1 - - return attrs.getLength() == 0 and \ - attrs.getNames() == [] and \ - attrs.getQNames() == [] and \ - len(attrs) == 0 and \ - not attrs.has_key((ns_uri, "attr")) and \ - attrs.keys() == [] and \ - attrs.get((ns_uri, "attr")) is None and \ - attrs.get((ns_uri, "attr"), 25) == 25 and \ - attrs.items() == [] and \ - attrs.values() == [] and \ - gvk and gvqk and gnqk and gik and gqnk - -def test_nsattrs_empty(): - return verify_empty_nsattrs(AttributesNSImpl({}, {})) - -def test_nsattrs_wattr(): - attrs = AttributesNSImpl({(ns_uri, "attr") : "val"}, - {(ns_uri, "attr") : "ns:attr"}) - - return attrs.getLength() == 1 and \ - attrs.getNames() == [(ns_uri, "attr")] and \ - attrs.getQNames() == ["ns:attr"] and \ - len(attrs) == 1 and \ - attrs.has_key((ns_uri, "attr")) and \ - attrs.keys() == [(ns_uri, "attr")] and \ - attrs.get((ns_uri, "attr")) == "val" and \ - attrs.get((ns_uri, "attr"), 25) == "val" and \ - attrs.items() == [((ns_uri, "attr"), "val")] and \ - attrs.values() == ["val"] and \ - attrs.getValue((ns_uri, "attr")) == "val" and \ - attrs.getValueByQName("ns:attr") == "val" and \ - attrs.getNameByQName("ns:attr") == (ns_uri, "attr") and \ - attrs[(ns_uri, "attr")] == "val" and \ - attrs.getQNameByName((ns_uri, "attr")) == "ns:attr" - - -# During the development of Python 2.5, an attempt to move the "xml" -# package implementation to a new package ("xmlcore") proved painful. -# The goal of this change was to allow applications to be able to -# obtain and rely on behavior in the standard library implementation -# of the XML support without needing to be concerned about the -# availability of the PyXML implementation. -# -# While the existing import hackery in Lib/xml/__init__.py can cause -# PyXML's _xmlpus package to supplant the "xml" package, that only -# works because either implementation uses the "xml" package name for -# imports. -# -# The move resulted in a number of problems related to the fact that -# the import machinery's "package context" is based on the name that's -# being imported rather than the __name__ of the actual package -# containment; it wasn't possible for the "xml" package to be replaced -# by a simple module that indirected imports to the "xmlcore" package. -# -# The following two tests exercised bugs that were introduced in that -# attempt. Keeping these tests around will help detect problems with -# other attempts to provide reliable access to the standard library's -# implementation of the XML support. - -def test_sf_1511497(): - # Bug report: http://www.python.org/sf/1511497 - import sys - old_modules = sys.modules.copy() - for modname in sys.modules.keys(): - if modname.startswith("xml."): - del sys.modules[modname] - try: - import xml.sax.expatreader - module = xml.sax.expatreader - return module.__name__ == "xml.sax.expatreader" - finally: - sys.modules.update(old_modules) - -def test_sf_1513611(): - # Bug report: http://www.python.org/sf/1513611 - sio = StringIO("invalid") - parser = make_parser() - from xml.sax import SAXParseException - try: - parser.parse(sio) - except SAXParseException: - return True - else: - return False - -# ===== Main program - -def make_test_output(): - parser = create_parser() - result = StringIO() - xmlgen = XMLGenerator(result) - - parser.setContentHandler(xmlgen) - parser.parse(findfile("test"+os.extsep+"xml")) - - outf = open(findfile("test"+os.extsep+"xml"+os.extsep+"out"), "w") - outf.write(result.getvalue()) - outf.close() - -items = locals().items() -items.sort() -for (name, value) in items: - if name[ : 5] == "test_": - confirm(value(), name) -# We delete the items variable so that the assignment to items above -# doesn't pick up the old value of items (which messes with attempts -# to find reference leaks). -del items - -if verbose: - print "%d tests, %d failures" % (tests, len(failures)) -if failures: - raise TestFailed("%d of %d tests failed: %s" - % (len(failures), tests, ", ".join(failures))) + # ===== AttributesImpl + def test_attrs_empty(self): + self.verify_empty_attrs(AttributesImpl({})) + + def test_attrs_wattr(self): + self.verify_attrs_wattr(AttributesImpl({"attr" : "val"})) + + def test_nsattrs_empty(self): + self.verify_empty_nsattrs(AttributesNSImpl({}, {})) + + def test_nsattrs_wattr(self): + attrs = AttributesNSImpl({(ns_uri, "attr") : "val"}, + {(ns_uri, "attr") : "ns:attr"}) + + self.assertEquals(attrs.getLength(), 1) + self.assertEquals(attrs.getNames(), [(ns_uri, "attr")]) + self.assertEquals(attrs.getQNames(), ["ns:attr"]) + self.assertEquals(len(attrs), 1) + self.assertTrue(attrs.has_key((ns_uri, "attr"))) + self.assertEquals(attrs.keys(), [(ns_uri, "attr")]) + self.assertEquals(attrs.get((ns_uri, "attr")), "val") + self.assertEquals(attrs.get((ns_uri, "attr"), 25), "val") + self.assertEquals(attrs.items(), [((ns_uri, "attr"), "val")]) + self.assertEquals(attrs.values(), ["val"]) + self.assertEquals(attrs.getValue((ns_uri, "attr")), "val") + self.assertEquals(attrs.getValueByQName("ns:attr"), "val") + self.assertEquals(attrs.getNameByQName("ns:attr"), (ns_uri, "attr")) + self.assertEquals(attrs[(ns_uri, "attr")], "val") + self.assertEquals(attrs.getQNameByName((ns_uri, "attr")), "ns:attr") + + + # During the development of Python 2.5, an attempt to move the "xml" + # package implementation to a new package ("xmlcore") proved painful. + # The goal of this change was to allow applications to be able to + # obtain and rely on behavior in the standard library implementation + # of the XML support without needing to be concerned about the + # availability of the PyXML implementation. + # + # While the existing import hackery in Lib/xml/__init__.py can cause + # PyXML's _xmlpus package to supplant the "xml" package, that only + # works because either implementation uses the "xml" package name for + # imports. + # + # The move resulted in a number of problems related to the fact that + # the import machinery's "package context" is based on the name that's + # being imported rather than the __name__ of the actual package + # containment; it wasn't possible for the "xml" package to be replaced + # by a simple module that indirected imports to the "xmlcore" package. + # + # The following two tests exercised bugs that were introduced in that + # attempt. Keeping these tests around will help detect problems with + # other attempts to provide reliable access to the standard library's + # implementation of the XML support. + + def test_sf_1511497(self): + # Bug report: http://www.python.org/sf/1511497 + import sys + old_modules = sys.modules.copy() + for modname in sys.modules.keys(): + if modname.startswith("xml."): + del sys.modules[modname] + try: + import xml.sax.expatreader + module = xml.sax.expatreader + self.assertEquals(module.__name__, "xml.sax.expatreader") + finally: + sys.modules.update(old_modules) + + def test_sf_1513611(self): + # Bug report: http://www.python.org/sf/1513611 + sio = StringIO("invalid") + parser = make_parser() + from xml.sax import SAXParseException + self.assertRaises(SAXParseException, parser.parse, sio) + + +def unittest_main(): + run_unittest(MakeParserTest, + SaxutilsTest, + XmlgenTest, + ExpatReaderTest, + ErrorReportingTest, + XmlReaderTest) + +if __name__ == "__main__": + unittest_main() Modified: python/branches/bcannon-objcap/Lib/test/test_scope.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_scope.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_scope.py Fri May 25 22:13:08 2007 @@ -486,6 +486,39 @@ del d['h'] self.assertEqual(d, {'x': 2, 'y': 7, 'w': 6}) + def testLocalsClass(self): + # This test verifies that calling locals() does not pollute + # the local namespace of the class with free variables. Old + # versions of Python had a bug, where a free variable being + # passed through a class namespace would be inserted into + # locals() by locals() or exec or a trace function. + # + # The real bug lies in frame code that copies variables + # between fast locals and the locals dict, e.g. when executing + # a trace function. + + def f(x): + class C: + x = 12 + def m(self): + return x + locals() + return C + + self.assertEqual(f(1).x, 12) + + def f(x): + class C: + y = x + def m(self): + return x + z = list(locals()) + return C + + varnames = f(1).z + self.assert_("x" not in varnames) + self.assert_("y" in varnames) + def testBoundAndFree(self): # var is bound and free in class Modified: python/branches/bcannon-objcap/Lib/test/test_set.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_set.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_set.py Fri May 25 22:13:08 2007 @@ -26,6 +26,14 @@ def __repr__(self): return repr(self.value) +class HashCountingInt(int): + 'int-like object that counts the number of times __hash__ is called' + def __init__(self, *args): + self.hash_count = 0 + def __hash__(self): + self.hash_count += 1 + return int.__hash__(self) + class TestJointOps(unittest.TestCase): # Tests common to both set and frozenset @@ -270,6 +278,25 @@ fo.close() os.remove(test_support.TESTFN) + def test_do_not_rehash_dict_keys(self): + n = 10 + d = dict.fromkeys(map(HashCountingInt, xrange(n))) + self.assertEqual(sum(elem.hash_count for elem in d), n) + s = self.thetype(d) + self.assertEqual(sum(elem.hash_count for elem in d), n) + s.difference(d) + self.assertEqual(sum(elem.hash_count for elem in d), n) + if hasattr(s, 'symmetric_difference_update'): + s.symmetric_difference_update(d) + self.assertEqual(sum(elem.hash_count for elem in d), n) + d2 = dict.fromkeys(set(d)) + self.assertEqual(sum(elem.hash_count for elem in d), n) + d3 = dict.fromkeys(frozenset(d)) + self.assertEqual(sum(elem.hash_count for elem in d), n) + d3 = dict.fromkeys(frozenset(d), 123) + self.assertEqual(sum(elem.hash_count for elem in d), n) + self.assertEqual(d3, dict.fromkeys(d, 123)) + class TestSet(TestJointOps): thetype = set Modified: python/branches/bcannon-objcap/Lib/test/test_slice.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_slice.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_slice.py Fri May 25 22:13:08 2007 @@ -2,6 +2,7 @@ import unittest from test import test_support +from cPickle import loads, dumps import sys @@ -92,6 +93,24 @@ self.assertRaises(OverflowError, slice(None).indices, 1L<<100) + def test_setslice_without_getslice(self): + tmp = [] + class X(object): + def __setslice__(self, i, j, k): + tmp.append((i, j, k)) + + x = X() + x[1:2] = 42 + self.assertEquals(tmp, [(1, 2, 42)]) + + def test_pickle(self): + s = slice(10, 20, 3) + for protocol in (0,1,2): + t = loads(dumps(s, protocol)) + self.assertEqual(s, t) + self.assertEqual(s.indices(15), t.indices(15)) + self.assertNotEqual(id(s), id(t)) + def test_main(): test_support.run_unittest(SliceTest) Modified: python/branches/bcannon-objcap/Lib/test/test_socket.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_socket.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_socket.py Fri May 25 22:13:08 2007 @@ -75,7 +75,7 @@ Note, the server setup function cannot call any blocking functions that rely on the client thread during setup, - unless serverExplicityReady() is called just before + unless serverExplicitReady() is called just before the blocking call (such as in setting up a client/server connection and performing the accept() in setUp(). """ @@ -597,6 +597,13 @@ def _testRecvFrom(self): self.cli.sendto(MSG, 0, (HOST, PORT)) + def testRecvFromNegative(self): + # Negative lengths passed to recvfrom should give ValueError. + self.assertRaises(ValueError, self.serv.recvfrom, -1) + + def _testRecvFromNegative(self): + self.cli.sendto(MSG, 0, (HOST, PORT)) + class TCPCloserTest(ThreadedTCPSocketTest): def testClose(self): @@ -810,6 +817,98 @@ bufsize = 2 # Exercise the buffering code +class NetworkConnectionTest(object): + """Prove network connection.""" + def clientSetUp(self): + self.cli = socket.create_connection((HOST, PORT)) + self.serv_conn = self.cli + +class BasicTCPTest2(NetworkConnectionTest, BasicTCPTest): + """Tests that NetworkConnection does not break existing TCP functionality. + """ + +class NetworkConnectionNoServer(unittest.TestCase): + def testWithoutServer(self): + self.failUnlessRaises(socket.error, lambda: socket.create_connection((HOST, PORT))) + +class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest): + + def __init__(self, methodName='runTest'): + SocketTCPTest.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def clientSetUp(self): + pass + + def clientTearDown(self): + self.cli.close() + self.cli = None + ThreadableTest.clientTearDown(self) + + def _justAccept(self): + conn, addr = self.serv.accept() + + testFamily = _justAccept + def _testFamily(self): + self.cli = socket.create_connection((HOST, PORT), timeout=30) + self.assertEqual(self.cli.family, 2) + + testTimeoutDefault = _justAccept + def _testTimeoutDefault(self): + self.cli = socket.create_connection((HOST, PORT)) + self.assertTrue(self.cli.gettimeout() is None) + + testTimeoutValueNamed = _justAccept + def _testTimeoutValueNamed(self): + self.cli = socket.create_connection((HOST, PORT), timeout=30) + self.assertEqual(self.cli.gettimeout(), 30) + + testTimeoutValueNonamed = _justAccept + def _testTimeoutValueNonamed(self): + self.cli = socket.create_connection((HOST, PORT), 30) + self.assertEqual(self.cli.gettimeout(), 30) + + testTimeoutNone = _justAccept + def _testTimeoutNone(self): + previous = socket.getdefaulttimeout() + socket.setdefaulttimeout(30) + try: + self.cli = socket.create_connection((HOST, PORT), timeout=None) + finally: + socket.setdefaulttimeout(previous) + self.assertEqual(self.cli.gettimeout(), 30) + + +class NetworkConnectionBehaviourTest(SocketTCPTest, ThreadableTest): + + def __init__(self, methodName='runTest'): + SocketTCPTest.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def clientSetUp(self): + pass + + def clientTearDown(self): + self.cli.close() + self.cli = None + ThreadableTest.clientTearDown(self) + + def testInsideTimeout(self): + conn, addr = self.serv.accept() + time.sleep(3) + conn.send("done!") + testOutsideTimeout = testInsideTimeout + + def _testInsideTimeout(self): + self.cli = sock = socket.create_connection((HOST, PORT)) + data = sock.recv(5) + self.assertEqual(data, "done!") + + def _testOutsideTimeout(self): + self.cli = sock = socket.create_connection((HOST, PORT), timeout=1) + self.failUnlessRaises(socket.timeout, lambda: sock.recv(5)) + + class Urllib2FileobjectTest(unittest.TestCase): # urllib2.HTTPHandler has "borrowed" socket._fileobject, and requires that @@ -977,7 +1076,7 @@ def test_main(): tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest, - TestExceptions, BufferIOTest] + TestExceptions, BufferIOTest, BasicTCPTest2] if sys.platform != 'mac': tests.extend([ BasicUDPTest, UDPTimeoutTest ]) @@ -988,6 +1087,9 @@ LineBufferedFileObjectClassTestCase, SmallBufferedFileObjectClassTestCase, Urllib2FileobjectTest, + NetworkConnectionNoServer, + NetworkConnectionAttributesTest, + NetworkConnectionBehaviourTest, ]) if hasattr(socket, "socketpair"): tests.append(BasicSocketPairTest) Modified: python/branches/bcannon-objcap/Lib/test/test_socket_ssl.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_socket_ssl.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_socket_ssl.py Fri May 25 22:13:08 2007 @@ -1,128 +1,221 @@ # Test just the SSL support in the socket module, in a moderately bogus way. import sys +import unittest from test import test_support import socket import errno +import threading +import subprocess +import time +import os +import urllib -# Optionally test SSL support. This requires the 'network' resource as given -# on the regrtest command line. -skip_expected = not (test_support.is_resource_enabled('network') and - hasattr(socket, "ssl")) +# Optionally test SSL support, if we have it in the tested platform +skip_expected = not hasattr(socket, "ssl") -def test_basic(): - test_support.requires('network') +class ConnectedTests(unittest.TestCase): - import urllib - - if test_support.verbose: - print "test_basic ..." - - socket.RAND_status() - try: - socket.RAND_egd(1) - except TypeError: - pass - else: - print "didn't raise TypeError" - socket.RAND_add("this is a random string", 75.0) + def testBasic(self): + socket.RAND_status() + try: + socket.RAND_egd(1) + except TypeError: + pass + else: + print "didn't raise TypeError" + socket.RAND_add("this is a random string", 75.0) - f = urllib.urlopen('https://sf.net') - buf = f.read() - f.close() - -def test_timeout(): - test_support.requires('network') - - def error_msg(extra_msg): - print >> sys.stderr, """\ - WARNING: an attempt to connect to %r %s, in - test_timeout. That may be legitimate, but is not the outcome we hoped - for. If this message is seen often, test_timeout should be changed to - use a more reliable address.""" % (ADDR, extra_msg) - - if test_support.verbose: - print "test_timeout ..." - - # A service which issues a welcome banner (without need to write - # anything). - # XXX ("gmail.org", 995) has been unreliable so far, from time to time - # XXX non-responsive for hours on end (& across all buildbot slaves, - # XXX so that's not just a local thing). - ADDR = "gmail.org", 995 + with test_support.transient_internet(): + f = urllib.urlopen('https://sf.net') + buf = f.read() + f.close() + + def testTimeout(self): + def error_msg(extra_msg): + print >> sys.stderr, """\ + WARNING: an attempt to connect to %r %s, in + test_timeout. That may be legitimate, but is not the outcome we + hoped for. If this message is seen often, test_timeout should be + changed to use a more reliable address.""" % (ADDR, extra_msg) + + # A service which issues a welcome banner (without need to write + # anything). + # XXX ("gmail.org", 995) has been unreliable so far, from time to + # XXX time non-responsive for hours on end (& across all buildbot + # XXX slaves, so that's not just a local thing). + ADDR = "gmail.org", 995 - s = socket.socket() - s.settimeout(30.0) - try: - s.connect(ADDR) - except socket.timeout: - error_msg('timed out') - return - except socket.error, exc: # In case connection is refused. - if exc.args[0] == errno.ECONNREFUSED: - error_msg('was refused') + s = socket.socket() + s.settimeout(30.0) + try: + s.connect(ADDR) + except socket.timeout: + error_msg('timed out') return - else: - raise + except socket.error, exc: # In case connection is refused. + if exc.args[0] == errno.ECONNREFUSED: + error_msg('was refused') + return + else: + raise + + ss = socket.ssl(s) + # Read part of return welcome banner twice. + ss.read(1) + ss.read(1) + s.close() + +class BasicTests(unittest.TestCase): + + def testRudeShutdown(self): + # Some random port to connect to. + PORT = [9934] + + listener_ready = threading.Event() + listener_gone = threading.Event() + + # `listener` runs in a thread. It opens a socket listening on + # PORT, and sits in an accept() until the main thread connects. + # Then it rudely closes the socket, and sets Event `listener_gone` + # to let the main thread know the socket is gone. + def listener(): + s = socket.socket() + PORT[0] = test_support.bind_port(s, '', PORT[0]) + s.listen(5) + listener_ready.set() + s.accept() + s = None # reclaim the socket object, which also closes it + listener_gone.set() + + def connector(): + listener_ready.wait() + s = socket.socket() + s.connect(('localhost', PORT[0])) + listener_gone.wait() + try: + ssl_sock = socket.ssl(s) + except socket.sslerror: + pass + else: + raise test_support.TestFailed( + 'connecting to closed SSL socket should have failed') - ss = socket.ssl(s) - # Read part of return welcome banner twice. - ss.read(1) - ss.read(1) - s.close() - -def test_rude_shutdown(): - if test_support.verbose: - print "test_rude_shutdown ..." + t = threading.Thread(target=listener) + t.start() + connector() + t.join() - try: - import threading - except ImportError: - return - - # Some random port to connect to. - PORT = [9934] - - listener_ready = threading.Event() - listener_gone = threading.Event() - - # `listener` runs in a thread. It opens a socket listening on PORT, and - # sits in an accept() until the main thread connects. Then it rudely - # closes the socket, and sets Event `listener_gone` to let the main thread - # know the socket is gone. - def listener(): +class OpenSSLTests(unittest.TestCase): + + def testBasic(self): s = socket.socket() - PORT[0] = test_support.bind_port(s, '', PORT[0]) - s.listen(5) - listener_ready.set() - s.accept() - s = None # reclaim the socket object, which also closes it - listener_gone.set() + s.connect(("localhost", 4433)) + ss = socket.ssl(s) + ss.write("Foo\n") + i = ss.read(4) + self.assertEqual(i, "Foo\n") + s.close() + + def testMethods(self): + # read & write is already tried in the Basic test + # now we'll try to get the server info about certificates + # this came from the certificate I used, one I found in /usr/share/openssl + info = "/C=PT/ST=Queensland/L=Lisboa/O=Neuronio, Lda./OU=Desenvolvimento/CN=brutus.neuronio.pt/emailAddress=sampo at iki.fi" - def connector(): - listener_ready.wait() s = socket.socket() - s.connect(('localhost', PORT[0])) - listener_gone.wait() + s.connect(("localhost", 4433)) + ss = socket.ssl(s) + cert = ss.server() + self.assertEqual(cert, info) + cert = ss.issuer() + self.assertEqual(cert, info) + s.close() + + +class OpenSSLServer(threading.Thread): + def __init__(self): + self.s = None + self.keepServing = True + self._external() + if self.haveServer: + threading.Thread.__init__(self) + + def _external(self): + # let's find the .pem files + curdir = os.path.dirname(__file__) or os.curdir + cert_file = os.path.join(curdir, "ssl_cert.pem") + if not os.access(cert_file, os.F_OK): + raise ValueError("No cert file found! (tried %r)" % cert_file) + key_file = os.path.join(curdir, "ssl_key.pem") + if not os.access(key_file, os.F_OK): + raise ValueError("No key file found! (tried %r)" % key_file) + try: - ssl_sock = socket.ssl(s) - except socket.sslerror: - pass + cmd = "openssl s_server -cert %s -key %s -quiet" % (cert_file, key_file) + self.s = subprocess.Popen(cmd.split(), stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + time.sleep(1) + except: + self.haveServer = False else: - raise test_support.TestFailed( - 'connecting to closed SSL socket should have failed') - - t = threading.Thread(target=listener) - t.start() - connector() - t.join() + # let's try if it is actually up + try: + s = socket.socket() + s.connect(("localhost", 4433)) + s.close() + if self.s.stdout.readline() != "ERROR\n": + raise ValueError + except: + self.haveServer = False + else: + self.haveServer = True + + def run(self): + while self.keepServing: + time.sleep(.5) + l = self.s.stdout.readline() + self.s.stdin.write(l) + + def shutdown(self): + self.keepServing = False + if not self.s: + return + if sys.platform == "win32": + subprocess.TerminateProcess(int(self.s._handle), -1) + else: + os.kill(self.s.pid, 15) def test_main(): if not hasattr(socket, "ssl"): raise test_support.TestSkipped("socket module has no ssl support") - test_rude_shutdown() - test_basic() - test_timeout() + + tests = [BasicTests] + + if test_support.is_resource_enabled('network'): + tests.append(ConnectedTests) + + # in these platforms we can kill the openssl process + if sys.platform in ("sunos5", "darwin", "linux1", + "linux2", "win32", "hp-ux11"): + + server = OpenSSLServer() + if server.haveServer: + tests.append(OpenSSLTests) + server.start() + else: + server = None + + thread_info = test_support.threading_setup() + + try: + test_support.run_unittest(*tests) + finally: + if server is not None and server.haveServer: + server.shutdown() + + test_support.threading_cleanup(*thread_info) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_socketserver.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_socketserver.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_socketserver.py Fri May 25 22:13:08 2007 @@ -74,6 +74,7 @@ self.__addr = addr self.__svrcls = svrcls self.__hdlrcls = hdlrcls + self.ready = threading.Event() def run(self): class svrcls(MyMixinServer, self.__svrcls): pass @@ -81,9 +82,13 @@ svr = svrcls(self.__addr, self.__hdlrcls) # pull the address out of the server in case it changed # this can happen if another process is using the port - addr = getattr(svr, 'server_address') + addr = svr.server_address if addr: self.__addr = addr + if self.__addr != svr.socket.getsockname(): + raise RuntimeError('server_address was %s, expected %s' % + (self.__addr, svr.socket.getsockname())) + self.ready.set() if verbose: print "thread: serving three times" svr.serve_a_few() if verbose: print "thread: done" @@ -136,7 +141,9 @@ t.start() if verbose: print "server running" for i in range(NREQ): - time.sleep(DELAY) + t.ready.wait(10*DELAY) + if not t.ready.isSet(): + raise RuntimeError("Server not ready within a reasonable time") if verbose: print "test client", i testfunc(proto, addr) if verbose: print "waiting for server" Modified: python/branches/bcannon-objcap/Lib/test/test_softspace.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_softspace.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_softspace.py Fri May 25 22:13:08 2007 @@ -1,14 +1,23 @@ -from test import test_support +from test.test_support import run_unittest +import unittest import StringIO -# SF bug 480215: softspace confused in nested print -f = StringIO.StringIO() -class C: - def __str__(self): - print >> f, 'a' - return 'b' +class SoftspaceTests(unittest.TestCase): + def test_bug_480215(self): + # SF bug 480215: softspace confused in nested print + f = StringIO.StringIO() + class C: + def __str__(self): + print >> f, 'a' + return 'b' -print >> f, C(), 'c ', 'd\t', 'e' -print >> f, 'f', 'g' -# In 2.2 & earlier, this printed ' a\nbc d\te\nf g\n' -test_support.vereq(f.getvalue(), 'a\nb c d\te\nf g\n') + print >> f, C(), 'c ', 'd\t', 'e' + print >> f, 'f', 'g' + # In 2.2 & earlier, this printed ' a\nbc d\te\nf g\n' + self.assertEqual(f.getvalue(), 'a\nb c d\te\nf g\n') + +def test_main(): + run_unittest(SoftspaceTests) + +if __name__ == '__main__': + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_stringprep.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_stringprep.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_stringprep.py Fri May 25 22:13:08 2007 @@ -1,88 +1,96 @@ # To fully test this module, we would need a copy of the stringprep tables. # Since we don't have them, this test checks only a few codepoints. -from test.test_support import verify, vereq +import unittest +from test import test_support -import stringprep from stringprep import * -verify(in_table_a1(u"\u0221")) -verify(not in_table_a1(u"\u0222")) +class StringprepTests(unittest.TestCase): + def test(self): + self.failUnless(in_table_a1(u"\u0221")) + self.failIf(in_table_a1(u"\u0222")) -verify(in_table_b1(u"\u00ad")) -verify(not in_table_b1(u"\u00ae")) + self.failUnless(in_table_b1(u"\u00ad")) + self.failIf(in_table_b1(u"\u00ae")) -verify(map_table_b2(u"\u0041"), u"\u0061") -verify(map_table_b2(u"\u0061"), u"\u0061") + self.failUnless(map_table_b2(u"\u0041"), u"\u0061") + self.failUnless(map_table_b2(u"\u0061"), u"\u0061") -verify(map_table_b3(u"\u0041"), u"\u0061") -verify(map_table_b3(u"\u0061"), u"\u0061") + self.failUnless(map_table_b3(u"\u0041"), u"\u0061") + self.failUnless(map_table_b3(u"\u0061"), u"\u0061") -verify(in_table_c11(u"\u0020")) -verify(not in_table_c11(u"\u0021")) + self.failUnless(in_table_c11(u"\u0020")) + self.failIf(in_table_c11(u"\u0021")) -verify(in_table_c12(u"\u00a0")) -verify(not in_table_c12(u"\u00a1")) + self.failUnless(in_table_c12(u"\u00a0")) + self.failIf(in_table_c12(u"\u00a1")) -verify(in_table_c12(u"\u00a0")) -verify(not in_table_c12(u"\u00a1")) + self.failUnless(in_table_c12(u"\u00a0")) + self.failIf(in_table_c12(u"\u00a1")) -verify(in_table_c11_c12(u"\u00a0")) -verify(not in_table_c11_c12(u"\u00a1")) + self.failUnless(in_table_c11_c12(u"\u00a0")) + self.failIf(in_table_c11_c12(u"\u00a1")) -verify(in_table_c21(u"\u001f")) -verify(not in_table_c21(u"\u0020")) + self.failUnless(in_table_c21(u"\u001f")) + self.failIf(in_table_c21(u"\u0020")) -verify(in_table_c22(u"\u009f")) -verify(not in_table_c22(u"\u00a0")) + self.failUnless(in_table_c22(u"\u009f")) + self.failIf(in_table_c22(u"\u00a0")) -verify(in_table_c21_c22(u"\u009f")) -verify(not in_table_c21_c22(u"\u00a0")) + self.failUnless(in_table_c21_c22(u"\u009f")) + self.failIf(in_table_c21_c22(u"\u00a0")) -verify(in_table_c3(u"\ue000")) -verify(not in_table_c3(u"\uf900")) + self.failUnless(in_table_c3(u"\ue000")) + self.failIf(in_table_c3(u"\uf900")) -verify(in_table_c4(u"\uffff")) -verify(not in_table_c4(u"\u0000")) + self.failUnless(in_table_c4(u"\uffff")) + self.failIf(in_table_c4(u"\u0000")) -verify(in_table_c5(u"\ud800")) -verify(not in_table_c5(u"\ud7ff")) + self.failUnless(in_table_c5(u"\ud800")) + self.failIf(in_table_c5(u"\ud7ff")) -verify(in_table_c6(u"\ufff9")) -verify(not in_table_c6(u"\ufffe")) + self.failUnless(in_table_c6(u"\ufff9")) + self.failIf(in_table_c6(u"\ufffe")) -verify(in_table_c7(u"\u2ff0")) -verify(not in_table_c7(u"\u2ffc")) + self.failUnless(in_table_c7(u"\u2ff0")) + self.failIf(in_table_c7(u"\u2ffc")) -verify(in_table_c8(u"\u0340")) -verify(not in_table_c8(u"\u0342")) + self.failUnless(in_table_c8(u"\u0340")) + self.failIf(in_table_c8(u"\u0342")) -# C.9 is not in the bmp -# verify(in_table_c9(u"\U000E0001")) -# verify(not in_table_c8(u"\U000E0002")) + # C.9 is not in the bmp + # self.failUnless(in_table_c9(u"\U000E0001")) + # self.failIf(in_table_c8(u"\U000E0002")) -verify(in_table_d1(u"\u05be")) -verify(not in_table_d1(u"\u05bf")) + self.failUnless(in_table_d1(u"\u05be")) + self.failIf(in_table_d1(u"\u05bf")) -verify(in_table_d2(u"\u0041")) -verify(not in_table_d2(u"\u0040")) + self.failUnless(in_table_d2(u"\u0041")) + self.failIf(in_table_d2(u"\u0040")) -# This would generate a hash of all predicates. However, running -# it is quite expensive, and only serves to detect changes in the -# unicode database. Instead, stringprep.py asserts the version of -# the database. + # This would generate a hash of all predicates. However, running + # it is quite expensive, and only serves to detect changes in the + # unicode database. Instead, stringprep.py asserts the version of + # the database. -# import hashlib -# predicates = [k for k in dir(stringprep) if k.startswith("in_table")] -# predicates.sort() -# for p in predicates: -# f = getattr(stringprep, p) -# # Collect all BMP code points -# data = ["0"] * 0x10000 -# for i in range(0x10000): -# if f(unichr(i)): -# data[i] = "1" -# data = "".join(data) -# h = hashlib.sha1() -# h.update(data) -# print p, h.hexdigest() + # import hashlib + # predicates = [k for k in dir(stringprep) if k.startswith("in_table")] + # predicates.sort() + # for p in predicates: + # f = getattr(stringprep, p) + # # Collect all BMP code points + # data = ["0"] * 0x10000 + # for i in range(0x10000): + # if f(unichr(i)): + # data[i] = "1" + # data = "".join(data) + # h = hashlib.sha1() + # h.update(data) + # print p, h.hexdigest() + +def test_main(): + test_support.run_unittest(StringprepTests) + +if __name__ == '__main__': + test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_strptime.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_strptime.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_strptime.py Fri May 25 22:13:08 2007 @@ -505,6 +505,35 @@ self.failIfEqual(locale_time_id, id(_strptime._TimeRE_cache.locale_time)) + def test_TimeRE_recreation(self): + # The TimeRE instance should be recreated upon changing the locale. + locale_info = locale.getlocale(locale.LC_TIME) + try: + locale.setlocale(locale.LC_TIME, ('en_US', 'UTF8')) + except locale.Error: + return + try: + _strptime.strptime('10', '%d') + # Get id of current cache object. + first_time_re_id = id(_strptime._TimeRE_cache) + try: + # Change the locale and force a recreation of the cache. + locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8')) + _strptime.strptime('10', '%d') + # Get the new cache object's id. + second_time_re_id = id(_strptime._TimeRE_cache) + # They should not be equal. + self.failIfEqual(first_time_re_id, second_time_re_id) + # Possible test locale is not supported while initial locale is. + # If this is the case just suppress the exception and fall-through + # to the reseting to the original locale. + except locale.Error: + pass + # Make sure we don't trample on the locale setting once we leave the + # test. + finally: + locale.setlocale(locale.LC_TIME, locale_info) + def test_main(): test_support.run_unittest( Modified: python/branches/bcannon-objcap/Lib/test/test_struct.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_struct.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_struct.py Fri May 25 22:13:08 2007 @@ -614,11 +614,19 @@ assertRaises(struct.error, pack_into, small_buf, 0, test_string) assertRaises(struct.error, pack_into, small_buf, 2, test_string) +def test_unpack_with_buffer(): + # SF bug 1563759: struct.unpack doens't support buffer protocol objects + data1 = array.array('B', '\x12\x34\x56\x78') + data2 = buffer('......\x12\x34\x56\x78......', 6, 4) + for data in [data1, data2]: + value, = struct.unpack('>I', data) + vereq(value, 0x12345678) # Test methods to pack and unpack from buffers rather than strings. test_unpack_from() test_pack_into() test_pack_into_fn() +test_unpack_with_buffer() def test_bool(): for prefix in tuple("<>!=")+('',): Modified: python/branches/bcannon-objcap/Lib/test/test_structmembers.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_structmembers.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_structmembers.py Fri May 25 22:13:08 2007 @@ -4,7 +4,7 @@ INT_MAX, INT_MIN, UINT_MAX, \ LONG_MAX, LONG_MIN, ULONG_MAX -import warnings, exceptions, unittest, test.test_warnings +import warnings, exceptions, unittest from test import test_support ts=test_structmembersType(1,2,3,4,5,6,7,8,9.99999,10.1010101010) @@ -39,34 +39,39 @@ ts.T_ULONG=ULONG_MAX self.assertEquals(ts.T_ULONG, ULONG_MAX) -class TestWarnings(test.test_warnings.TestModule): - def has_warned(self): - self.assertEqual(test.test_warnings.msg.category, - exceptions.RuntimeWarning.__name__) +class TestWarnings(unittest.TestCase): + def has_warned(self, w): + self.assert_(w.category is RuntimeWarning) def test_byte_max(self): - ts.T_BYTE=CHAR_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_BYTE=CHAR_MAX+1 + self.has_warned(w) def test_byte_min(self): - ts.T_BYTE=CHAR_MIN-1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_BYTE=CHAR_MIN-1 + self.has_warned(w) def test_ubyte_max(self): - ts.T_UBYTE=UCHAR_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_UBYTE=UCHAR_MAX+1 + self.has_warned(w) def test_short_max(self): - ts.T_SHORT=SHRT_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_SHORT=SHRT_MAX+1 + self.has_warned(w) def test_short_min(self): - ts.T_SHORT=SHRT_MIN-1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_SHORT=SHRT_MIN-1 + self.has_warned(w) def test_ushort_max(self): - ts.T_USHORT=USHRT_MAX+1 - self.has_warned() + with test_support.catch_warning() as w: + ts.T_USHORT=USHRT_MAX+1 + self.has_warned(w) Modified: python/branches/bcannon-objcap/Lib/test/test_sundry.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_sundry.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_sundry.py Fri May 25 22:13:08 2007 @@ -1,77 +1,74 @@ """Do a minimal test of all the modules that aren't otherwise tested.""" +from test.test_support import guard_warnings_filter import warnings -warnings.filterwarnings('ignore', r".*posixfile module", - DeprecationWarning, 'posixfile$') -warnings.filterwarnings("ignore", - "the gopherlib module is deprecated", - DeprecationWarning, - ".*test_sundry") +with guard_warnings_filter(): + warnings.filterwarnings('ignore', r".*posixfile", + DeprecationWarning) -from test.test_support import verbose + from test.test_support import verbose -import BaseHTTPServer -import DocXMLRPCServer -import CGIHTTPServer -import SimpleHTTPServer -import SimpleXMLRPCServer -import aifc -import audiodev -import bdb -import cgitb -import cmd -import code -import compileall -import encodings -import formatter -import ftplib -import getpass -import gopherlib -import htmlentitydefs -import ihooks -import imghdr -import imputil -import keyword -import linecache -import macurl2path -import mailcap -import mimify -import mutex -import nntplib -import nturl2path -import opcode -import os2emxpath -import pdb -import pipes -#import poplib -import posixfile -import pstats -import py_compile -import pydoc -import rexec -import rlcompleter -import sched -import smtplib -import sndhdr -import statvfs -import stringold -import sunau -import sunaudio -import symbol -import tabnanny -import telnetlib -import timeit -import toaiff -import token -try: - import tty # not available on Windows -except ImportError: - if verbose: - print "skipping tty" + import BaseHTTPServer + import DocXMLRPCServer + import CGIHTTPServer + import SimpleHTTPServer + import SimpleXMLRPCServer + import aifc + import audiodev + import bdb + import cgitb + import cmd + import code + import compileall + import encodings + import formatter + import ftplib + import getpass + import htmlentitydefs + import ihooks + import imghdr + import imputil + import keyword + import linecache + import macurl2path + import mailcap + import mimify + import mutex + import nntplib + import nturl2path + import opcode + import os2emxpath + import pdb + import pipes + #import poplib + import posixfile + import pstats + import py_compile + import pydoc + import rexec + import rlcompleter + import sched + import smtplib + import sndhdr + import statvfs + import stringold + import sunau + import sunaudio + import symbol + import tabnanny + import telnetlib + import timeit + import toaiff + import token + try: + import tty # not available on Windows + except ImportError: + if verbose: + print "skipping tty" -# Can't test the "user" module -- if the user has a ~/.pythonrc.py, it -# can screw up all sorts of things (esp. if it prints!). -#import user -import webbrowser -import xml + # Can't test the "user" module -- if the user has a ~/.pythonrc.py, it + # can screw up all sorts of things (esp. if it prints!). + #import user + import webbrowser + import xml Modified: python/branches/bcannon-objcap/Lib/test/test_support.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_support.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_support.py Fri May 25 22:13:08 2007 @@ -1,11 +1,17 @@ """Supporting definitions for the Python regression tests.""" if __name__ != 'test.test_support': - raise ImportError, 'test_support must be imported from the test package' + raise ImportError('test_support must be imported from the test package') -from contextlib import contextmanager +import contextlib +import errno +import socket import sys +import os +import os.path import warnings +import types +import unittest class Error(Exception): """Base class for regression test exceptions.""" @@ -54,7 +60,6 @@ pass def unlink(filename): - import os try: os.unlink(filename) except OSError: @@ -64,7 +69,6 @@ '''"Forget" a module was ever imported by removing it from sys.modules and deleting any .pyc and .pyo files.''' unload(modname) - import os for dirname in sys.path: unlink(os.path.join(dirname, modname + os.extsep + 'pyc')) # Deleting the .pyo file cannot be within the 'try' for the .pyc since @@ -96,7 +100,6 @@ tests and we don't try multiple ports, the test can fails. This makes the test more robust.""" - import socket, errno # some random ports that hopefully no one is listening on. for port in [preferred_port, 9907, 10243, 32999]: try: @@ -107,7 +110,7 @@ raise print >>sys.__stderr__, \ ' WARNING: failed to listen on port %d, trying another' % port - raise TestFailed, 'unable to find port to listen on' + raise TestFailed('unable to find port to listen on') FUZZ = 1e-6 @@ -130,13 +133,12 @@ try: unicode - have_unicode = 1 + have_unicode = True except NameError: - have_unicode = 0 + have_unicode = False is_jython = sys.platform.startswith('java') -import os # Filename used for testing if os.name == 'java': # Jython disallows @ in module names @@ -199,13 +201,12 @@ if fp is not None: fp.close() unlink(TESTFN) -del os, fp +del fp def findfile(file, here=__file__): """Try to find a file on sys.path and the working directory. If it is not found the argument passed to the function is returned (this does not necessarily signal failure; could still be the legitimate path).""" - import os if os.path.isabs(file): return file path = sys.path @@ -237,7 +238,7 @@ """ if not (a == b): - raise TestFailed, "%r == %r" % (a, b) + raise TestFailed("%r == %r" % (a, b)) def sortdict(dict): "Like repr(dict), but in sorted order." @@ -257,8 +258,8 @@ def open_urlresource(url): import urllib, urlparse - import os.path + requires('urlfetch') filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL! for path in [os.path.curdir, os.path.pardir]: @@ -266,12 +267,11 @@ if os.path.exists(fn): return open(fn) - requires('urlfetch') print >> get_original_stdout(), '\tfetching %s ...' % url fn, _ = urllib.urlretrieve(url, filename) return open(fn) - at contextmanager + at contextlib.contextmanager def guard_warnings_filter(): """Guard the warnings filter from being permanently changed.""" original_filters = warnings.filters[:] @@ -280,14 +280,49 @@ finally: warnings.filters = original_filters +class WarningMessage(object): + "Holds the result of the latest showwarning() call" + def __init__(self): + self.message = None + self.category = None + self.filename = None + self.lineno = None + + def _showwarning(self, message, category, filename, lineno, file=None): + self.message = message + self.category = category + self.filename = filename + self.lineno = lineno + + at contextlib.contextmanager +def catch_warning(): + """ + Guard the warnings filter from being permanently changed and record the + data of the last warning that has been issued. + + Use like this: + + with catch_warning as w: + warnings.warn("foo") + assert str(w.message) == "foo" + """ + warning = WarningMessage() + original_filters = warnings.filters[:] + original_showwarning = warnings.showwarning + warnings.showwarning = warning._showwarning + try: + yield warning + finally: + warnings.showwarning = original_showwarning + warnings.filters = original_filters + class EnvironmentVarGuard(object): """Class to help protect the environment variable properly. Can be used as a context manager.""" def __init__(self): - from os import environ - self._environ = environ + self._environ = os.environ self._unset = set() self._reset = dict() @@ -312,6 +347,40 @@ for unset in self._unset: del self._environ[unset] +class TransientResource(object): + + """Raise ResourceDenied if an exception is raised while the context manager + is in effect that matches the specified exception and attributes.""" + + def __init__(self, exc, **kwargs): + self.exc = exc + self.attrs = kwargs + + def __enter__(self): + return self + + def __exit__(self, type_=None, value=None, traceback=None): + """If type_ is a subclass of self.exc and value has attributes matching + self.attrs, raise ResourceDenied. Otherwise let the exception + propagate (if any).""" + if type_ is not None and issubclass(self.exc, type_): + for attr, attr_value in self.attrs.iteritems(): + if not hasattr(value, attr): + break + if getattr(value, attr) != attr_value: + break + else: + raise ResourceDenied("an optional resource is not available") + + +def transient_internet(): + """Return a context manager that raises ResourceDenied when various issues + with the Internet connection manifest themselves as exceptions.""" + time_out = TransientResource(IOError, errno=errno.ETIMEDOUT) + socket_peer_reset = TransientResource(socket.error, errno=errno.ECONNRESET) + ioerror_peer_reset = TransientResource(IOError, errno=errno.ECONNRESET) + return contextlib.nested(time_out, socket_peer_reset, ioerror_peer_reset) + #======================================================================= # Decorator for running a function in a different locale, correctly resetting @@ -435,10 +504,7 @@ return wrapper #======================================================================= -# Preliminary PyUNIT integration. - -import unittest - +# unittest integration. class BasicTestRunner: def run(self, test): @@ -447,7 +513,7 @@ return result -def run_suite(suite, testclass=None): +def _run_suite(suite): """Run tests from a unittest.TestSuite-derived class.""" if verbose: runner = unittest.TextTestRunner(sys.stdout, verbosity=2) @@ -461,28 +527,26 @@ elif len(result.failures) == 1 and not result.errors: err = result.failures[0][1] else: - if testclass is None: - msg = "errors occurred; run in verbose mode for details" - else: - msg = "errors occurred in %s.%s" \ - % (testclass.__module__, testclass.__name__) + msg = "errors occurred; run in verbose mode for details" raise TestFailed(msg) raise TestFailed(err) def run_unittest(*classes): """Run tests from unittest.TestCase-derived classes.""" + valid_types = (unittest.TestSuite, unittest.TestCase) suite = unittest.TestSuite() for cls in classes: - if isinstance(cls, (unittest.TestSuite, unittest.TestCase)): + if isinstance(cls, str): + if cls in sys.modules: + suite.addTest(unittest.findTestCases(sys.modules[cls])) + else: + raise ValueError("str arguments must be keys in sys.modules") + elif isinstance(cls, valid_types): suite.addTest(cls) else: suite.addTest(unittest.makeSuite(cls)) - if len(classes)==1: - testclass = classes[0] - else: - testclass = None - run_suite(suite, testclass) + _run_suite(suite) #======================================================================= @@ -548,7 +612,6 @@ # Reap all our dead child processes so we don't leave zombies around. # These hog resources and might be causing some of the buildbots to die. - import os if hasattr(os, 'waitpid'): any_process = -1 while True: Modified: python/branches/bcannon-objcap/Lib/test/test_syntax.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_syntax.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_syntax.py Fri May 25 22:13:08 2007 @@ -367,6 +367,56 @@ ... SystemError: too many statically nested blocks +This tests assignment-context; there was a bug in Python 2.5 where compiling +a complex 'if' (one with 'elif') would fail to notice an invalid suite, +leading to spurious errors. + + >>> if 1: + ... x() = 1 + ... elif 1: + ... pass + Traceback (most recent call last): + ... + SyntaxError: can't assign to function call (, line 2) + + >>> if 1: + ... pass + ... elif 1: + ... x() = 1 + Traceback (most recent call last): + ... + SyntaxError: can't assign to function call (, line 4) + + >>> if 1: + ... x() = 1 + ... elif 1: + ... pass + ... else: + ... pass + Traceback (most recent call last): + ... + SyntaxError: can't assign to function call (, line 2) + + >>> if 1: + ... pass + ... elif 1: + ... x() = 1 + ... else: + ... pass + Traceback (most recent call last): + ... + SyntaxError: can't assign to function call (, line 4) + + >>> if 1: + ... pass + ... elif 1: + ... pass + ... else: + ... x() = 1 + Traceback (most recent call last): + ... + SyntaxError: can't assign to function call (, line 6) + """ import re Modified: python/branches/bcannon-objcap/Lib/test/test_tarfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_tarfile.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_tarfile.py Fri May 25 22:13:08 2007 @@ -1,8 +1,12 @@ +# encoding: iso8859-1 + import sys import os import shutil import tempfile import StringIO +import md5 +import errno import unittest import tarfile @@ -20,397 +24,547 @@ except ImportError: bz2 = None +def md5sum(data): + return md5.new(data).hexdigest() + def path(path): return test_support.findfile(path) -testtar = path("testtar.tar") -tempdir = os.path.join(tempfile.gettempdir(), "testtar" + os.extsep + "dir") -tempname = test_support.TESTFN -membercount = 12 - -def tarname(comp=""): - if not comp: - return testtar - return os.path.join(tempdir, "%s%s%s" % (testtar, os.extsep, comp)) - -def dirname(): - if not os.path.exists(tempdir): - os.mkdir(tempdir) - return tempdir - -def tmpname(): - return tempname - - -class BaseTest(unittest.TestCase): - comp = '' - mode = 'r' - sep = ':' +TEMPDIR = os.path.join(tempfile.gettempdir(), "test_tarfile_tmp") +tarname = path("testtar.tar") +gzipname = os.path.join(TEMPDIR, "testtar.tar.gz") +bz2name = os.path.join(TEMPDIR, "testtar.tar.bz2") +tmpname = os.path.join(TEMPDIR, "tmp.tar") + +md5_regtype = "65f477c818ad9e15f7feab0c6d37742f" +md5_sparse = "a54fbc4ca4f4399a90e1b27164012fc6" + + +class ReadTest(unittest.TestCase): + + tarname = tarname + mode = "r:" def setUp(self): - mode = self.mode + self.sep + self.comp - self.tar = tarfile.open(tarname(self.comp), mode) + self.tar = tarfile.open(self.tarname, mode=self.mode, encoding="iso8859-1") def tearDown(self): self.tar.close() -class ReadTest(BaseTest): - def test(self): - """Test member extraction. - """ - members = 0 - for tarinfo in self.tar: - members += 1 - if not tarinfo.isreg(): - continue - f = self.tar.extractfile(tarinfo) - self.assert_(len(f.read()) == tarinfo.size, - "size read does not match expected size") - f.close() - - self.assert_(members == membercount, - "could not find all members") - - def test_sparse(self): - """Test sparse member extraction. - """ - if self.sep != "|": - f1 = self.tar.extractfile("S-SPARSE") - f2 = self.tar.extractfile("S-SPARSE-WITH-NULLS") - self.assert_(f1.read() == f2.read(), - "_FileObject failed on sparse file member") - - def test_readlines(self): - """Test readlines() method of _FileObject. - """ - if self.sep != "|": - filename = "0-REGTYPE-TEXT" - self.tar.extract(filename, dirname()) - f = open(os.path.join(dirname(), filename), "rU") - lines1 = f.readlines() - f.close() - lines2 = self.tar.extractfile(filename).readlines() - self.assert_(lines1 == lines2, - "_FileObject.readline() does not work correctly") - - def test_iter(self): - # Test iteration over ExFileObject. - if self.sep != "|": - filename = "0-REGTYPE-TEXT" - self.tar.extract(filename, dirname()) - f = open(os.path.join(dirname(), filename), "rU") - lines1 = f.readlines() - f.close() - lines2 = [line for line in self.tar.extractfile(filename)] - self.assert_(lines1 == lines2, - "ExFileObject iteration does not work correctly") - - def test_seek(self): - """Test seek() method of _FileObject, incl. random reading. - """ - if self.sep != "|": - filename = "0-REGTYPE-TEXT" - self.tar.extract(filename, dirname()) - f = open(os.path.join(dirname(), filename), "rb") - data = f.read() - f.close() - - tarinfo = self.tar.getmember(filename) - fobj = self.tar.extractfile(tarinfo) - - text = fobj.read() - fobj.seek(0) - self.assert_(0 == fobj.tell(), - "seek() to file's start failed") - fobj.seek(2048, 0) - self.assert_(2048 == fobj.tell(), - "seek() to absolute position failed") - fobj.seek(-1024, 1) - self.assert_(1024 == fobj.tell(), - "seek() to negative relative position failed") - fobj.seek(1024, 1) - self.assert_(2048 == fobj.tell(), - "seek() to positive relative position failed") - s = fobj.read(10) - self.assert_(s == data[2048:2058], - "read() after seek failed") - fobj.seek(0, 2) - self.assert_(tarinfo.size == fobj.tell(), - "seek() to file's end failed") - self.assert_(fobj.read() == "", - "read() at file's end did not return empty string") - fobj.seek(-tarinfo.size, 2) - self.assert_(0 == fobj.tell(), - "relative seek() to file's start failed") - fobj.seek(512) - s1 = fobj.readlines() - fobj.seek(512) - s2 = fobj.readlines() - self.assert_(s1 == s2, - "readlines() after seek failed") - fobj.seek(0) - self.assert_(len(fobj.readline()) == fobj.tell(), - "tell() after readline() failed") - fobj.seek(512) - self.assert_(len(fobj.readline()) + 512 == fobj.tell(), - "tell() after seek() and readline() failed") - fobj.seek(0) - line = fobj.readline() - self.assert_(fobj.read() == data[len(line):], - "read() after readline() failed") - fobj.close() +class UstarReadTest(ReadTest): - def test_old_dirtype(self): - """Test old style dirtype member (bug #1336623). - """ - # Old tars create directory members using a REGTYPE - # header with a "/" appended to the filename field. + def test_fileobj_regular_file(self): + tarinfo = self.tar.getmember("ustar/regtype") + fobj = self.tar.extractfile(tarinfo) + data = fobj.read() + self.assert_((len(data), md5sum(data)) == (tarinfo.size, md5_regtype), + "regular file extraction failed") + + def test_fileobj_readlines(self): + self.tar.extract("ustar/regtype", TEMPDIR) + tarinfo = self.tar.getmember("ustar/regtype") + fobj1 = open(os.path.join(TEMPDIR, "ustar/regtype"), "rU") + fobj2 = self.tar.extractfile(tarinfo) + + lines1 = fobj1.readlines() + lines2 = fobj2.readlines() + self.assert_(lines1 == lines2, + "fileobj.readlines() failed") + self.assert_(len(lines2) == 114, + "fileobj.readlines() failed") + self.assert_(lines2[83] == \ + "I will gladly admit that Python is not the fastest running scripting language.\n", + "fileobj.readlines() failed") + + def test_fileobj_iter(self): + self.tar.extract("ustar/regtype", TEMPDIR) + tarinfo = self.tar.getmember("ustar/regtype") + fobj1 = open(os.path.join(TEMPDIR, "ustar/regtype"), "rU") + fobj2 = self.tar.extractfile(tarinfo) + lines1 = fobj1.readlines() + lines2 = [line for line in fobj2] + self.assert_(lines1 == lines2, + "fileobj.__iter__() failed") + + def test_fileobj_seek(self): + self.tar.extract("ustar/regtype", TEMPDIR) + fobj = open(os.path.join(TEMPDIR, "ustar/regtype"), "rb") + data = fobj.read() + fobj.close() - # Create an old tar style directory entry. - filename = tmpname() - tarinfo = tarfile.TarInfo("directory/") - tarinfo.type = tarfile.REGTYPE + tarinfo = self.tar.getmember("ustar/regtype") + fobj = self.tar.extractfile(tarinfo) - fobj = open(filename, "w") - fobj.write(tarinfo.tobuf()) + text = fobj.read() + fobj.seek(0) + self.assert_(0 == fobj.tell(), + "seek() to file's start failed") + fobj.seek(2048, 0) + self.assert_(2048 == fobj.tell(), + "seek() to absolute position failed") + fobj.seek(-1024, 1) + self.assert_(1024 == fobj.tell(), + "seek() to negative relative position failed") + fobj.seek(1024, 1) + self.assert_(2048 == fobj.tell(), + "seek() to positive relative position failed") + s = fobj.read(10) + self.assert_(s == data[2048:2058], + "read() after seek failed") + fobj.seek(0, 2) + self.assert_(tarinfo.size == fobj.tell(), + "seek() to file's end failed") + self.assert_(fobj.read() == "", + "read() at file's end did not return empty string") + fobj.seek(-tarinfo.size, 2) + self.assert_(0 == fobj.tell(), + "relative seek() to file's start failed") + fobj.seek(512) + s1 = fobj.readlines() + fobj.seek(512) + s2 = fobj.readlines() + self.assert_(s1 == s2, + "readlines() after seek failed") + fobj.seek(0) + self.assert_(len(fobj.readline()) == fobj.tell(), + "tell() after readline() failed") + fobj.seek(512) + self.assert_(len(fobj.readline()) + 512 == fobj.tell(), + "tell() after seek() and readline() failed") + fobj.seek(0) + line = fobj.readline() + self.assert_(fobj.read() == data[len(line):], + "read() after readline() failed") fobj.close() - try: - # Test if it is still a directory entry when - # read back. - tar = tarfile.open(filename) - tarinfo = tar.getmembers()[0] - tar.close() - self.assert_(tarinfo.type == tarfile.DIRTYPE) - self.assert_(tarinfo.name.endswith("/")) - finally: - try: - os.unlink(filename) - except: - pass - -class ReadStreamTest(ReadTest): - sep = "|" - - def test(self): - """Test member extraction, and for StreamError when - seeking backwards. - """ - ReadTest.test(self) - tarinfo = self.tar.getmembers()[0] - f = self.tar.extractfile(tarinfo) - self.assertRaises(tarfile.StreamError, f.read) +class MiscReadTest(ReadTest): - def test_stream(self): - """Compare the normal tar and the stream tar. - """ - stream = self.tar - tar = tarfile.open(tarname(), 'r') - - while 1: - t1 = tar.next() - t2 = stream.next() - if t1 is None: - break - self.assert_(t2 is not None, "stream.next() failed.") + def test_no_filename(self): + fobj = open(self.tarname, "rb") + tar = tarfile.open(fileobj=fobj, mode=self.mode) + self.assertEqual(tar.name, os.path.abspath(fobj.name)) + + def test_fail_comp(self): + # For Gzip and Bz2 Tests: fail with a ReadError on an uncompressed file. + if self.mode == "r:": + return + self.assertRaises(tarfile.ReadError, tarfile.open, tarname, self.mode) + fobj = open(tarname, "rb") + self.assertRaises(tarfile.ReadError, tarfile.open, fileobj=fobj, mode=self.mode) + + def test_v7_dirtype(self): + # Test old style dirtype member (bug #1336623): + # Old V7 tars create directory members using an AREGTYPE + # header with a "/" appended to the filename field. + tarinfo = self.tar.getmember("misc/dirtype-old-v7") + self.assert_(tarinfo.type == tarfile.DIRTYPE, + "v7 dirtype failed") - if t2.islnk() or t2.issym(): - self.assertRaises(tarfile.StreamError, stream.extractfile, t2) - continue - v1 = tar.extractfile(t1) - v2 = stream.extractfile(t2) - if v1 is None: + def test_check_members(self): + for tarinfo in self.tar: + self.assert_(int(tarinfo.mtime) == 07606136617, + "wrong mtime for %s" % tarinfo.name) + if not tarinfo.name.startswith("ustar/"): continue - self.assert_(v2 is not None, "stream.extractfile() failed") - self.assert_(v1.read() == v2.read(), "stream extraction failed") + self.assert_(tarinfo.uname == "tarfile", + "wrong uname for %s" % tarinfo.name) - tar.close() - stream.close() - -class ReadDetectTest(ReadTest): - - def setUp(self): - self.tar = tarfile.open(tarname(self.comp), self.mode) + def test_find_members(self): + self.assert_(self.tar.getmembers()[-1].name == "misc/eof", + "could not find all members") + + def test_extract_hardlink(self): + # Test hardlink extraction (e.g. bug #857297). + tar = tarfile.open(tarname, errorlevel=1, encoding="iso8859-1") -class ReadDetectFileobjTest(ReadTest): + tar.extract("ustar/regtype", TEMPDIR) + try: + tar.extract("ustar/lnktype", TEMPDIR) + except EnvironmentError, e: + if e.errno == errno.ENOENT: + self.fail("hardlink not extracted properly") - def setUp(self): - name = tarname(self.comp) - self.tar = tarfile.open(name, mode=self.mode, - fileobj=open(name, "rb")) + data = open(os.path.join(TEMPDIR, "ustar/lnktype"), "rb").read() + self.assertEqual(md5sum(data), md5_regtype) -class ReadAsteriskTest(ReadTest): + try: + tar.extract("ustar/symtype", TEMPDIR) + except EnvironmentError, e: + if e.errno == errno.ENOENT: + self.fail("symlink not extracted properly") - def setUp(self): - mode = self.mode + self.sep + "*" - self.tar = tarfile.open(tarname(self.comp), mode) + data = open(os.path.join(TEMPDIR, "ustar/symtype"), "rb").read() + self.assertEqual(md5sum(data), md5_regtype) -class ReadStreamAsteriskTest(ReadStreamTest): - def setUp(self): - mode = self.mode + self.sep + "*" - self.tar = tarfile.open(tarname(self.comp), mode) +class StreamReadTest(ReadTest): -class WriteTest(BaseTest): - mode = 'w' + mode="r|" - def setUp(self): - mode = self.mode + self.sep + self.comp - self.src = tarfile.open(tarname(self.comp), 'r') - self.dstname = tmpname() - self.dst = tarfile.open(self.dstname, mode) + def test_fileobj_regular_file(self): + tarinfo = self.tar.next() # get "regtype" (can't use getmember) + fobj = self.tar.extractfile(tarinfo) + data = fobj.read() + self.assert_((len(data), md5sum(data)) == (tarinfo.size, md5_regtype), + "regular file extraction failed") - def tearDown(self): - self.src.close() - self.dst.close() + def test_provoke_stream_error(self): + tarinfos = self.tar.getmembers() + f = self.tar.extractfile(tarinfos[0]) # read the first member + self.assertRaises(tarfile.StreamError, f.read) - def test_posix(self): - self.dst.posix = 1 - self._test() + def test_compare_members(self): + tar1 = tarfile.open(tarname, encoding="iso8859-1") + tar2 = self.tar + + while True: + t1 = tar1.next() + t2 = tar2.next() + if t1 is None: + break + self.assert_(t2 is not None, "stream.next() failed.") - def test_nonposix(self): - self.dst.posix = 0 - self._test() + if t2.islnk() or t2.issym(): + self.assertRaises(tarfile.StreamError, tar2.extractfile, t2) + continue - def test_small(self): - self.dst.add(os.path.join(os.path.dirname(__file__),"cfgparser.1")) - self.dst.close() - self.assertNotEqual(os.stat(self.dstname).st_size, 0) - - def _test(self): - for tarinfo in self.src: - if not tarinfo.isreg(): + v1 = tar1.extractfile(t1) + v2 = tar2.extractfile(t2) + if v1 is None: continue - f = self.src.extractfile(tarinfo) - if self.dst.posix and len(tarinfo.name) > tarfile.LENGTH_NAME and "/" not in tarinfo.name: - self.assertRaises(ValueError, self.dst.addfile, - tarinfo, f) - else: - self.dst.addfile(tarinfo, f) + self.assert_(v2 is not None, "stream.extractfile() failed") + self.assert_(v1.read() == v2.read(), "stream extraction failed") - def test_add_self(self): - dstname = os.path.abspath(self.dstname) + tar1.close() - self.assertEqual(self.dst.name, dstname, "archive name must be absolute") - self.dst.add(dstname) - self.assertEqual(self.dst.getnames(), [], "added the archive to itself") +class DetectReadTest(unittest.TestCase): - cwd = os.getcwd() - os.chdir(dirname()) - self.dst.add(dstname) - os.chdir(cwd) - self.assertEqual(self.dst.getnames(), [], "added the archive to itself") + def _testfunc_file(self, name, mode): + try: + tarfile.open(name, mode) + except tarfile.ReadError: + self.fail() + def _testfunc_fileobj(self, name, mode): + try: + tarfile.open(name, mode, fileobj=open(name, "rb")) + except tarfile.ReadError: + self.fail() -class Write100Test(BaseTest): - # The name field in a tar header stores strings of at most 100 chars. - # If a string is shorter than 100 chars it has to be padded with '\0', - # which implies that a string of exactly 100 chars is stored without - # a trailing '\0'. + def _test_modes(self, testfunc): + testfunc(tarname, "r") + testfunc(tarname, "r:") + testfunc(tarname, "r:*") + testfunc(tarname, "r|") + testfunc(tarname, "r|*") - def setUp(self): - self.name = "01234567890123456789012345678901234567890123456789" - self.name += "01234567890123456789012345678901234567890123456789" + if gzip: + self.assertRaises(tarfile.ReadError, tarfile.open, tarname, mode="r:gz") + self.assertRaises(tarfile.ReadError, tarfile.open, tarname, mode="r|gz") + self.assertRaises(tarfile.ReadError, tarfile.open, gzipname, mode="r:") + self.assertRaises(tarfile.ReadError, tarfile.open, gzipname, mode="r|") + + testfunc(gzipname, "r") + testfunc(gzipname, "r:*") + testfunc(gzipname, "r:gz") + testfunc(gzipname, "r|*") + testfunc(gzipname, "r|gz") - self.tar = tarfile.open(tmpname(), "w") - t = tarfile.TarInfo(self.name) - self.tar.addfile(t) - self.tar.close() + if bz2: + self.assertRaises(tarfile.ReadError, tarfile.open, tarname, mode="r:bz2") + self.assertRaises(tarfile.ReadError, tarfile.open, tarname, mode="r|bz2") + self.assertRaises(tarfile.ReadError, tarfile.open, bz2name, mode="r:") + self.assertRaises(tarfile.ReadError, tarfile.open, bz2name, mode="r|") + + testfunc(bz2name, "r") + testfunc(bz2name, "r:*") + testfunc(bz2name, "r:bz2") + testfunc(bz2name, "r|*") + testfunc(bz2name, "r|bz2") + + def test_detect_file(self): + self._test_modes(self._testfunc_file) + + def test_detect_fileobj(self): + self._test_modes(self._testfunc_fileobj) + + +class MemberReadTest(ReadTest): + + def _test_member(self, tarinfo, chksum=None, **kwargs): + if chksum is not None: + self.assert_(md5sum(self.tar.extractfile(tarinfo).read()) == chksum, + "wrong md5sum for %s" % tarinfo.name) + + kwargs["mtime"] = 07606136617 + kwargs["uid"] = 1000 + kwargs["gid"] = 100 + if "old-v7" not in tarinfo.name: + # V7 tar can't handle alphabetic owners. + kwargs["uname"] = "tarfile" + kwargs["gname"] = "tarfile" + for k, v in kwargs.iteritems(): + self.assert_(getattr(tarinfo, k) == v, + "wrong value in %s field of %s" % (k, tarinfo.name)) + + def test_find_regtype(self): + tarinfo = self.tar.getmember("ustar/regtype") + self._test_member(tarinfo, size=7011, chksum=md5_regtype) + + def test_find_conttype(self): + tarinfo = self.tar.getmember("ustar/conttype") + self._test_member(tarinfo, size=7011, chksum=md5_regtype) + + def test_find_dirtype(self): + tarinfo = self.tar.getmember("ustar/dirtype") + self._test_member(tarinfo, size=0) + + def test_find_dirtype_with_size(self): + tarinfo = self.tar.getmember("ustar/dirtype-with-size") + self._test_member(tarinfo, size=255) + + def test_find_lnktype(self): + tarinfo = self.tar.getmember("ustar/lnktype") + self._test_member(tarinfo, size=0, linkname="ustar/regtype") + + def test_find_symtype(self): + tarinfo = self.tar.getmember("ustar/symtype") + self._test_member(tarinfo, size=0, linkname="regtype") + + def test_find_blktype(self): + tarinfo = self.tar.getmember("ustar/blktype") + self._test_member(tarinfo, size=0, devmajor=3, devminor=0) + + def test_find_chrtype(self): + tarinfo = self.tar.getmember("ustar/chrtype") + self._test_member(tarinfo, size=0, devmajor=1, devminor=3) + + def test_find_fifotype(self): + tarinfo = self.tar.getmember("ustar/fifotype") + self._test_member(tarinfo, size=0) + + def test_find_sparse(self): + tarinfo = self.tar.getmember("ustar/sparse") + self._test_member(tarinfo, size=86016, chksum=md5_sparse) + + def test_find_umlauts(self): + tarinfo = self.tar.getmember("ustar/umlauts-???????") + self._test_member(tarinfo, size=7011, chksum=md5_regtype) + + def test_find_ustar_longname(self): + name = "ustar/" + "12345/" * 39 + "1234567/longname" + self.assert_(name in self.tar.getnames()) + + def test_find_regtype_oldv7(self): + tarinfo = self.tar.getmember("misc/regtype-old-v7") + self._test_member(tarinfo, size=7011, chksum=md5_regtype) + + def test_find_pax_umlauts(self): + self.tar = tarfile.open(self.tarname, mode=self.mode, encoding="iso8859-1") + tarinfo = self.tar.getmember("pax/umlauts-???????") + self._test_member(tarinfo, size=7011, chksum=md5_regtype) + + +class LongnameTest(ReadTest): + + def test_read_longname(self): + # Test reading of longname (bug #1471427). + name = self.subdir + "/" + "123/" * 125 + "longname" + try: + tarinfo = self.tar.getmember(name) + except KeyError: + self.fail("longname not found") + self.assert_(tarinfo.type != tarfile.DIRTYPE, "read longname as dirtype") - self.tar = tarfile.open(tmpname()) + def test_read_longlink(self): + longname = self.subdir + "/" + "123/" * 125 + "longname" + longlink = self.subdir + "/" + "123/" * 125 + "longlink" + try: + tarinfo = self.tar.getmember(longlink) + except KeyError: + self.fail("longlink not found") + self.assert_(tarinfo.linkname == longname, "linkname wrong") - def tearDown(self): - self.tar.close() + def test_truncated_longname(self): + longname = self.subdir + "/" + "123/" * 125 + "longname" + tarinfo = self.tar.getmember(longname) + offset = tarinfo.offset + self.tar.fileobj.seek(offset) + fobj = StringIO.StringIO(self.tar.fileobj.read(1536)) + self.assertRaises(tarfile.ReadError, tarfile.open, name="foo.tar", fileobj=fobj) + + +class GNUReadTest(LongnameTest): + + subdir = "gnu" + + def test_sparse_file(self): + tarinfo1 = self.tar.getmember("ustar/sparse") + fobj1 = self.tar.extractfile(tarinfo1) + tarinfo2 = self.tar.getmember("gnu/sparse") + fobj2 = self.tar.extractfile(tarinfo2) + self.assert_(fobj1.read() == fobj2.read(), + "sparse file extraction failed") + + +class PaxReadTest(ReadTest): + + subdir = "pax" + + def test_pax_globheaders(self): + tar = tarfile.open(tarname, encoding="iso8859-1") + tarinfo = tar.getmember("pax/regtype1") + self.assertEqual(tarinfo.uname, "foo") + self.assertEqual(tarinfo.gname, "bar") + self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "???????") + + tarinfo = tar.getmember("pax/regtype2") + self.assertEqual(tarinfo.uname, "") + self.assertEqual(tarinfo.gname, "bar") + self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "???????") + + tarinfo = tar.getmember("pax/regtype3") + self.assertEqual(tarinfo.uname, "tarfile") + self.assertEqual(tarinfo.gname, "tarfile") + self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "???????") + + +class WriteTest(unittest.TestCase): + + mode = "w:" + + def test_100_char_name(self): + # The name field in a tar header stores strings of at most 100 chars. + # If a string is shorter than 100 chars it has to be padded with '\0', + # which implies that a string of exactly 100 chars is stored without + # a trailing '\0'. + name = "0123456789" * 10 + tar = tarfile.open(tmpname, self.mode) + t = tarfile.TarInfo(name) + tar.addfile(t) + tar.close() - def test(self): - self.assertEqual(self.tar.getnames()[0], self.name, + tar = tarfile.open(tmpname) + self.assert_(tar.getnames()[0] == name, "failed to store 100 char filename") + tar.close() + def test_tar_size(self): + # Test for bug #1013882. + tar = tarfile.open(tmpname, self.mode) + path = os.path.join(TEMPDIR, "file") + fobj = open(path, "wb") + fobj.write("aaa") + fobj.close() + tar.add(path) + tar.close() + self.assert_(os.path.getsize(tmpname) > 0, + "tarfile is empty") -class WriteSize0Test(BaseTest): - mode = 'w' - - def setUp(self): - self.tmpdir = dirname() - self.dstname = tmpname() - self.dst = tarfile.open(self.dstname, "w") - - def tearDown(self): - self.dst.close() + # The test_*_size tests test for bug #1167128. + def test_file_size(self): + tar = tarfile.open(tmpname, self.mode) - def test_file(self): - path = os.path.join(self.tmpdir, "file") - f = open(path, "w") - f.close() - tarinfo = self.dst.gettarinfo(path) + path = os.path.join(TEMPDIR, "file") + fobj = open(path, "wb") + fobj.close() + tarinfo = tar.gettarinfo(path) self.assertEqual(tarinfo.size, 0) - f = open(path, "w") - f.write("aaa") - f.close() - tarinfo = self.dst.gettarinfo(path) + + fobj = open(path, "wb") + fobj.write("aaa") + fobj.close() + tarinfo = tar.gettarinfo(path) self.assertEqual(tarinfo.size, 3) - def test_directory(self): - path = os.path.join(self.tmpdir, "directory") - if os.path.exists(path): - # This shouldn't be necessary, but is if a previous - # run was killed in mid-stream. - shutil.rmtree(path) + tar.close() + + def test_directory_size(self): + path = os.path.join(TEMPDIR, "directory") os.mkdir(path) - tarinfo = self.dst.gettarinfo(path) - self.assertEqual(tarinfo.size, 0) + try: + tar = tarfile.open(tmpname, self.mode) + tarinfo = tar.gettarinfo(path) + self.assertEqual(tarinfo.size, 0) + finally: + os.rmdir(path) - def test_symlink(self): + def test_link_size(self): + if hasattr(os, "link"): + link = os.path.join(TEMPDIR, "link") + target = os.path.join(TEMPDIR, "link_target") + open(target, "wb").close() + os.link(target, link) + try: + tar = tarfile.open(tmpname, self.mode) + tarinfo = tar.gettarinfo(link) + self.assertEqual(tarinfo.size, 0) + finally: + os.remove(target) + os.remove(link) + + def test_symlink_size(self): if hasattr(os, "symlink"): - path = os.path.join(self.tmpdir, "symlink") + path = os.path.join(TEMPDIR, "symlink") os.symlink("link_target", path) - tarinfo = self.dst.gettarinfo(path) - self.assertEqual(tarinfo.size, 0) + try: + tar = tarfile.open(tmpname, self.mode) + tarinfo = tar.gettarinfo(path) + self.assertEqual(tarinfo.size, 0) + finally: + os.remove(path) + + def test_add_self(self): + # Test for #1257255. + dstname = os.path.abspath(tmpname) + tar = tarfile.open(tmpname, self.mode) + self.assert_(tar.name == dstname, "archive name must be absolute") -class WriteStreamTest(WriteTest): - sep = '|' + tar.add(dstname) + self.assert_(tar.getnames() == [], "added the archive to itself") + + cwd = os.getcwd() + os.chdir(TEMPDIR) + tar.add(dstname) + os.chdir(cwd) + self.assert_(tar.getnames() == [], "added the archive to itself") - def test_padding(self): - self.dst.close() - if self.comp == "gz": - f = gzip.GzipFile(self.dstname) - s = f.read() - f.close() - elif self.comp == "bz2": - f = bz2.BZ2Decompressor() - s = open(self.dstname).read() - s = f.decompress(s) - self.assertEqual(len(f.unused_data), 0, "trailing data") +class StreamWriteTest(unittest.TestCase): + + mode = "w|" + + def test_stream_padding(self): + # Test for bug #1543303. + tar = tarfile.open(tmpname, self.mode) + tar.close() + + if self.mode.endswith("gz"): + fobj = gzip.GzipFile(tmpname) + data = fobj.read() + fobj.close() + elif self.mode.endswith("bz2"): + dec = bz2.BZ2Decompressor() + data = open(tmpname, "rb").read() + data = dec.decompress(data) + self.assert_(len(dec.unused_data) == 0, + "found trailing data") else: - f = open(self.dstname) - s = f.read() - f.close() + fobj = open(tmpname, "rb") + data = fobj.read() + fobj.close() - self.assertEqual(s.count("\0"), tarfile.RECORDSIZE, + self.assert_(data.count("\0") == tarfile.RECORDSIZE, "incorrect zero padding") -class WriteGNULongTest(unittest.TestCase): - """This testcase checks for correct creation of GNU Longname - and Longlink extensions. - - It creates a tarfile and adds empty members with either - long names, long linknames or both and compares the size - of the tarfile with the expected size. - - It checks for SF bug #812325 in TarFile._create_gnulong(). - - While I was writing this testcase, I noticed a second bug - in the same method: - Long{names,links} weren't null-terminated which lead to - bad tarfiles when their length was a multiple of 512. This - is tested as well. - """ +class GNUWriteTest(unittest.TestCase): + # This testcase checks for correct creation of GNU Longname + # and Longlink extended headers (cp. bug #812325). def _length(self, s): blocks, remainder = divmod(len(s) + 1, 512) @@ -419,19 +573,17 @@ return blocks * 512 def _calc_size(self, name, link=None): - # initial tar header + # Initial tar header count = 512 if len(name) > tarfile.LENGTH_NAME: - # gnu longname extended header + longname + # GNU longname extended header + longname count += 512 count += self._length(name) - if link is not None and len(link) > tarfile.LENGTH_LINK: - # gnu longlink extended header + longlink + # GNU longlink extended header + longlink count += 512 count += self._length(link) - return count def _test(self, name, link=None): @@ -440,17 +592,17 @@ tarinfo.linkname = link tarinfo.type = tarfile.LNKTYPE - tar = tarfile.open(tmpname(), "w") - tar.posix = False + tar = tarfile.open(tmpname, "w") + tar.format = tarfile.GNU_FORMAT tar.addfile(tarinfo) v1 = self._calc_size(name, link) v2 = tar.offset - self.assertEqual(v1, v2, "GNU longname/longlink creation failed") + self.assert_(v1 == v2, "GNU longname/longlink creation failed") tar.close() - tar = tarfile.open(tmpname()) + tar = tarfile.open(tmpname) member = tar.next() self.failIf(member is None, "unable to read longname member") self.assert_(tarinfo.name == member.name and \ @@ -487,267 +639,351 @@ self._test(("longnam/" * 127) + "longname_", ("longlnk/" * 127) + "longlink_") -class ReadGNULongTest(unittest.TestCase): + +class HardlinkTest(unittest.TestCase): + # Test the creation of LNKTYPE (hardlink) members in an archive. def setUp(self): - self.tar = tarfile.open(tarname()) + self.foo = os.path.join(TEMPDIR, "foo") + self.bar = os.path.join(TEMPDIR, "bar") + + fobj = open(self.foo, "wb") + fobj.write("foo") + fobj.close() + + os.link(self.foo, self.bar) + + self.tar = tarfile.open(tmpname, "w") + self.tar.add(self.foo) def tearDown(self): - self.tar.close() + os.remove(self.foo) + os.remove(self.bar) - def test_1471427(self): - """Test reading of longname (bug #1471427). - """ - name = "test/" * 20 + "0-REGTYPE" - try: - tarinfo = self.tar.getmember(name) - except KeyError: - tarinfo = None - self.assert_(tarinfo is not None, "longname not found") - self.assert_(tarinfo.type != tarfile.DIRTYPE, "read longname as dirtype") + def test_add_twice(self): + # The same name will be added as a REGTYPE every + # time regardless of st_nlink. + tarinfo = self.tar.gettarinfo(self.foo) + self.assert_(tarinfo.type == tarfile.REGTYPE, + "add file as regular failed") - def test_read_name(self): - name = ("0-LONGNAME-" * 10)[:101] - try: - tarinfo = self.tar.getmember(name) - except KeyError: - tarinfo = None - self.assert_(tarinfo is not None, "longname not found") + def test_add_hardlink(self): + tarinfo = self.tar.gettarinfo(self.bar) + self.assert_(tarinfo.type == tarfile.LNKTYPE, + "add file as hardlink failed") - def test_read_link(self): - link = ("1-LONGLINK-" * 10)[:101] - name = ("0-LONGNAME-" * 10)[:101] - try: - tarinfo = self.tar.getmember(link) - except KeyError: - tarinfo = None - self.assert_(tarinfo is not None, "longlink not found") - self.assert_(tarinfo.linkname == name, "linkname wrong") + def test_dereference_hardlink(self): + self.tar.dereference = True + tarinfo = self.tar.gettarinfo(self.bar) + self.assert_(tarinfo.type == tarfile.REGTYPE, + "dereferencing hardlink failed") - def test_truncated_longname(self): - f = open(tarname()) - fobj = StringIO.StringIO(f.read(1024)) - f.close() - tar = tarfile.open(name="foo.tar", fileobj=fobj) - self.assert_(len(tar.getmembers()) == 0, "") - tar.close() +class PaxWriteTest(GNUWriteTest): -class ExtractHardlinkTest(BaseTest): + def _test(self, name, link=None): + # See GNUWriteTest. + tarinfo = tarfile.TarInfo(name) + if link: + tarinfo.linkname = link + tarinfo.type = tarfile.LNKTYPE - def test_hardlink(self): - """Test hardlink extraction (bug #857297) - """ - # Prevent errors from being caught - self.tar.errorlevel = 1 + tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT) + tar.addfile(tarinfo) + tar.close() - self.tar.extract("0-REGTYPE", dirname()) - try: - # Extract 1-LNKTYPE which is a hardlink to 0-REGTYPE - self.tar.extract("1-LNKTYPE", dirname()) - except EnvironmentError, e: - import errno - if e.errno == errno.ENOENT: - self.fail("hardlink not extracted properly") + tar = tarfile.open(tmpname) + if link: + l = tar.getmembers()[0].linkname + self.assert_(link == l, "PAX longlink creation failed") + else: + n = tar.getmembers()[0].name + self.assert_(name == n, "PAX longname creation failed") -class CreateHardlinkTest(BaseTest): - """Test the creation of LNKTYPE (hardlink) members in an archive. - In this respect tarfile.py mimics the behaviour of GNU tar: If - a file has a st_nlink > 1, it will be added a REGTYPE member - only the first time. - """ + def test_iso8859_15_filename(self): + self._test_unicode_filename("iso8859-15") - def setUp(self): - self.tar = tarfile.open(tmpname(), "w") + def test_utf8_filename(self): + self._test_unicode_filename("utf8") - self.foo = os.path.join(dirname(), "foo") - self.bar = os.path.join(dirname(), "bar") + def test_utf16_filename(self): + self._test_unicode_filename("utf16") + + def _test_unicode_filename(self, encoding): + tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT) + name = u"\u20ac".encode(encoding) # Euro sign + tar.encoding = encoding + tar.addfile(tarfile.TarInfo(name)) + tar.close() - if os.path.exists(self.foo): - os.remove(self.foo) - if os.path.exists(self.bar): - os.remove(self.bar) - - f = open(self.foo, "w") - f.write("foo") - f.close() - self.tar.add(self.foo) + tar = tarfile.open(tmpname, encoding=encoding) + self.assertEqual(tar.getmembers()[0].name, name) + tar.close() - def test_add_twice(self): - # If st_nlink == 1 then the same file will be added as - # REGTYPE every time. - tarinfo = self.tar.gettarinfo(self.foo) - self.assertEqual(tarinfo.type, tarfile.REGTYPE, - "add file as regular failed") + def test_unicode_filename_error(self): + # The euro sign filename cannot be translated to iso8859-1 encoding. + tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, encoding="utf8") + name = u"\u20ac".encode("utf8") # Euro sign + tar.addfile(tarfile.TarInfo(name)) + tar.close() - def test_add_hardlink(self): - # If st_nlink > 1 then the same file will be added as - # LNKTYPE. - os.link(self.foo, self.bar) - tarinfo = self.tar.gettarinfo(self.foo) - self.assertEqual(tarinfo.type, tarfile.LNKTYPE, - "add file as hardlink failed") + self.assertRaises(UnicodeError, tarfile.open, tmpname, encoding="iso8859-1") - tarinfo = self.tar.gettarinfo(self.bar) - self.assertEqual(tarinfo.type, tarfile.LNKTYPE, - "add file as hardlink failed") + def test_pax_headers(self): + self._test_pax_headers({"foo": "bar", "uid": 0, "mtime": 1.23}) - def test_dereference_hardlink(self): - self.tar.dereference = True - os.link(self.foo, self.bar) - tarinfo = self.tar.gettarinfo(self.bar) - self.assertEqual(tarinfo.type, tarfile.REGTYPE, - "dereferencing hardlink failed") + self._test_pax_headers({"euro": u"\u20ac".encode("utf8")}) + + self._test_pax_headers({"euro": u"\u20ac"}, + {"euro": u"\u20ac".encode("utf8")}) + self._test_pax_headers({u"\u20ac": "euro"}, + {u"\u20ac".encode("utf8"): "euro"}) -# Gzip TestCases -class ReadTestGzip(ReadTest): - comp = "gz" -class ReadStreamTestGzip(ReadStreamTest): - comp = "gz" -class WriteTestGzip(WriteTest): - comp = "gz" -class WriteStreamTestGzip(WriteStreamTest): - comp = "gz" -class ReadDetectTestGzip(ReadDetectTest): - comp = "gz" -class ReadDetectFileobjTestGzip(ReadDetectFileobjTest): - comp = "gz" -class ReadAsteriskTestGzip(ReadAsteriskTest): - comp = "gz" -class ReadStreamAsteriskTestGzip(ReadStreamAsteriskTest): - comp = "gz" - -# Filemode test cases - -class FileModeTest(unittest.TestCase): - def test_modes(self): - self.assertEqual(tarfile.filemode(0755), '-rwxr-xr-x') - self.assertEqual(tarfile.filemode(07111), '---s--s--t') + def _test_pax_headers(self, pax_headers, cmp_headers=None): + if cmp_headers is None: + cmp_headers = pax_headers -class HeaderErrorTest(unittest.TestCase): + tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, \ + pax_headers=pax_headers, encoding="utf8") + tar.addfile(tarfile.TarInfo("test")) + tar.close() + + tar = tarfile.open(tmpname, encoding="utf8") + self.assertEqual(tar.pax_headers, cmp_headers) def test_truncated_header(self): - self.assertRaises(tarfile.HeaderError, tarfile.TarInfo.frombuf, "") - self.assertRaises(tarfile.HeaderError, tarfile.TarInfo.frombuf, "filename\0") - self.assertRaises(tarfile.HeaderError, tarfile.TarInfo.frombuf, "\0" * 511) - self.assertRaises(tarfile.HeaderError, tarfile.TarInfo.frombuf, "\0" * 513) - - def test_empty_header(self): - self.assertRaises(tarfile.HeaderError, tarfile.TarInfo.frombuf, "\0" * 512) - - def test_invalid_header(self): - buf = tarfile.TarInfo("filename").tobuf() - buf = buf[:148] + "foo\0\0\0\0\0" + buf[156:] # invalid number field. - self.assertRaises(tarfile.HeaderError, tarfile.TarInfo.frombuf, buf) - - def test_bad_checksum(self): - buf = tarfile.TarInfo("filename").tobuf() - b = buf[:148] + " " + buf[156:] # clear the checksum field. - self.assertRaises(tarfile.HeaderError, tarfile.TarInfo.frombuf, b) - b = "a" + buf[1:] # manipulate the buffer, so checksum won't match. - self.assertRaises(tarfile.HeaderError, tarfile.TarInfo.frombuf, b) + tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT) + tarinfo = tarfile.TarInfo("123/" * 126 + "longname") + tar.addfile(tarinfo) + tar.close() -class OpenFileobjTest(BaseTest): - # Test for SF bug #1496501. + # Simulate a premature EOF. + open(tmpname, "rb+").truncate(1536) + tar = tarfile.open(tmpname) + self.assertEqual(tar.getmembers(), []) - def test_opener(self): - fobj = StringIO.StringIO("foo\n") - try: - tarfile.open("", "r", fileobj=fobj) - except tarfile.ReadError: - self.assertEqual(fobj.tell(), 0, "fileobj's position has moved") -if bz2: - # Bzip2 TestCases - class ReadTestBzip2(ReadTestGzip): - comp = "bz2" - class ReadStreamTestBzip2(ReadStreamTestGzip): - comp = "bz2" - class WriteTestBzip2(WriteTest): - comp = "bz2" - class WriteStreamTestBzip2(WriteStreamTestGzip): - comp = "bz2" - class ReadDetectTestBzip2(ReadDetectTest): - comp = "bz2" - class ReadDetectFileobjTestBzip2(ReadDetectFileobjTest): - comp = "bz2" - class ReadAsteriskTestBzip2(ReadAsteriskTest): - comp = "bz2" - class ReadStreamAsteriskTestBzip2(ReadStreamAsteriskTest): - comp = "bz2" - -# If importing gzip failed, discard the Gzip TestCases. -if not gzip: - del ReadTestGzip - del ReadStreamTestGzip - del WriteTestGzip - del WriteStreamTestGzip +class AppendTest(unittest.TestCase): + # Test append mode (cp. patch #1652681). -def test_main(): - # Create archive. - f = open(tarname(), "rb") - fguts = f.read() - f.close() - if gzip: - # create testtar.tar.gz - tar = gzip.open(tarname("gz"), "wb") - tar.write(fguts) + def setUp(self): + self.tarname = tmpname + if os.path.exists(self.tarname): + os.remove(self.tarname) + + def _add_testfile(self, fileobj=None): + tar = tarfile.open(self.tarname, "a", fileobj=fileobj) + tar.addfile(tarfile.TarInfo("bar")) tar.close() - if bz2: - # create testtar.tar.bz2 - tar = bz2.BZ2File(tarname("bz2"), "wb") - tar.write(fguts) + + def _create_testtar(self, mode="w:"): + src = tarfile.open(tarname, encoding="iso8859-1") + t = src.getmember("ustar/regtype") + t.name = "foo" + f = src.extractfile(t) + tar = tarfile.open(self.tarname, mode) + tar.addfile(t, f) tar.close() + def _test(self, names=["bar"], fileobj=None): + tar = tarfile.open(self.tarname, fileobj=fileobj) + self.assertEqual(tar.getnames(), names) + + def test_non_existing(self): + self._add_testfile() + self._test() + + def test_empty(self): + open(self.tarname, "w").close() + self._add_testfile() + self._test() + + def test_empty_fileobj(self): + fobj = StringIO.StringIO() + self._add_testfile(fobj) + fobj.seek(0) + self._test(fileobj=fobj) + + def test_fileobj(self): + self._create_testtar() + data = open(self.tarname).read() + fobj = StringIO.StringIO(data) + self._add_testfile(fobj) + fobj.seek(0) + self._test(names=["foo", "bar"], fileobj=fobj) + + def test_existing(self): + self._create_testtar() + self._add_testfile() + self._test(names=["foo", "bar"]) + + def test_append_gz(self): + if gzip is None: + return + self._create_testtar("w:gz") + self.assertRaises(tarfile.ReadError, tarfile.open, tmpname, "a") + + def test_append_bz2(self): + if bz2 is None: + return + self._create_testtar("w:bz2") + self.assertRaises(tarfile.ReadError, tarfile.open, tmpname, "a") + + +class LimitsTest(unittest.TestCase): + + def test_ustar_limits(self): + # 100 char name + tarinfo = tarfile.TarInfo("0123456789" * 10) + tarinfo.create_ustar_header() + + # 101 char name that cannot be stored + tarinfo = tarfile.TarInfo("0123456789" * 10 + "0") + self.assertRaises(ValueError, tarinfo.create_ustar_header) + + # 256 char name with a slash at pos 156 + tarinfo = tarfile.TarInfo("123/" * 62 + "longname") + tarinfo.create_ustar_header() + + # 256 char name that cannot be stored + tarinfo = tarfile.TarInfo("1234567/" * 31 + "longname") + self.assertRaises(ValueError, tarinfo.create_ustar_header) + + # 512 char name + tarinfo = tarfile.TarInfo("123/" * 126 + "longname") + self.assertRaises(ValueError, tarinfo.create_ustar_header) + + # 512 char linkname + tarinfo = tarfile.TarInfo("longlink") + tarinfo.linkname = "123/" * 126 + "longname" + self.assertRaises(ValueError, tarinfo.create_ustar_header) + + # uid > 8 digits + tarinfo = tarfile.TarInfo("name") + tarinfo.uid = 010000000 + self.assertRaises(ValueError, tarinfo.create_ustar_header) + + def test_gnu_limits(self): + tarinfo = tarfile.TarInfo("123/" * 126 + "longname") + tarinfo.create_gnu_header() + + tarinfo = tarfile.TarInfo("longlink") + tarinfo.linkname = "123/" * 126 + "longname" + tarinfo.create_gnu_header() + + # uid >= 256 ** 7 + tarinfo = tarfile.TarInfo("name") + tarinfo.uid = 04000000000000000000L + self.assertRaises(ValueError, tarinfo.create_gnu_header) + + def test_pax_limits(self): + # A 256 char name that can be stored without an extended header. + tarinfo = tarfile.TarInfo("123/" * 62 + "longname") + self.assert_(len(tarinfo.create_pax_header("utf8")) == 512, + "create_pax_header attached superfluous extended header") + + tarinfo = tarfile.TarInfo("123/" * 126 + "longname") + tarinfo.create_pax_header("utf8") + + tarinfo = tarfile.TarInfo("longlink") + tarinfo.linkname = "123/" * 126 + "longname" + tarinfo.create_pax_header("utf8") + + tarinfo = tarfile.TarInfo("name") + tarinfo.uid = 04000000000000000000L + tarinfo.create_pax_header("utf8") + + +class GzipMiscReadTest(MiscReadTest): + tarname = gzipname + mode = "r:gz" +class GzipUstarReadTest(UstarReadTest): + tarname = gzipname + mode = "r:gz" +class GzipStreamReadTest(StreamReadTest): + tarname = gzipname + mode = "r|gz" +class GzipWriteTest(WriteTest): + mode = "w:gz" +class GzipStreamWriteTest(StreamWriteTest): + mode = "w|gz" + + +class Bz2MiscReadTest(MiscReadTest): + tarname = bz2name + mode = "r:bz2" +class Bz2UstarReadTest(UstarReadTest): + tarname = bz2name + mode = "r:bz2" +class Bz2StreamReadTest(StreamReadTest): + tarname = bz2name + mode = "r|bz2" +class Bz2WriteTest(WriteTest): + mode = "w:bz2" +class Bz2StreamWriteTest(StreamWriteTest): + mode = "w|bz2" + +def test_main(): + if not os.path.exists(TEMPDIR): + os.mkdir(TEMPDIR) + tests = [ - FileModeTest, - HeaderErrorTest, - OpenFileobjTest, - ReadTest, - ReadStreamTest, - ReadDetectTest, - ReadDetectFileobjTest, - ReadAsteriskTest, - ReadStreamAsteriskTest, + UstarReadTest, + MiscReadTest, + StreamReadTest, + DetectReadTest, + MemberReadTest, + GNUReadTest, + PaxReadTest, WriteTest, - Write100Test, - WriteSize0Test, - WriteStreamTest, - WriteGNULongTest, - ReadGNULongTest, + StreamWriteTest, + GNUWriteTest, + PaxWriteTest, + AppendTest, + LimitsTest, ] if hasattr(os, "link"): - tests.append(ExtractHardlinkTest) - tests.append(CreateHardlinkTest) + tests.append(HardlinkTest) + + fobj = open(tarname, "rb") + data = fobj.read() + fobj.close() if gzip: - tests.extend([ - ReadTestGzip, ReadStreamTestGzip, - WriteTestGzip, WriteStreamTestGzip, - ReadDetectTestGzip, ReadDetectFileobjTestGzip, - ReadAsteriskTestGzip, ReadStreamAsteriskTestGzip - ]) + # Create testtar.tar.gz and add gzip-specific tests. + tar = gzip.open(gzipname, "wb") + tar.write(data) + tar.close() + + tests += [ + GzipMiscReadTest, + GzipUstarReadTest, + GzipStreamReadTest, + GzipWriteTest, + GzipStreamWriteTest, + ] if bz2: - tests.extend([ - ReadTestBzip2, ReadStreamTestBzip2, - WriteTestBzip2, WriteStreamTestBzip2, - ReadDetectTestBzip2, ReadDetectFileobjTestBzip2, - ReadAsteriskTestBzip2, ReadStreamAsteriskTestBzip2 - ]) + # Create testtar.tar.bz2 and add bz2-specific tests. + tar = bz2.BZ2File(bz2name, "wb") + tar.write(data) + tar.close() + + tests += [ + Bz2MiscReadTest, + Bz2UstarReadTest, + Bz2StreamReadTest, + Bz2WriteTest, + Bz2StreamWriteTest, + ] + try: test_support.run_unittest(*tests) finally: - if gzip: - os.remove(tarname("gz")) - if bz2: - os.remove(tarname("bz2")) - if os.path.exists(dirname()): - shutil.rmtree(dirname()) - if os.path.exists(tmpname()): - os.remove(tmpname()) + if os.path.exists(TEMPDIR): + shutil.rmtree(TEMPDIR) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_tempfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_tempfile.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_tempfile.py Fri May 25 22:13:08 2007 @@ -81,7 +81,8 @@ "gettempprefix" : 1, "gettempdir" : 1, "tempdir" : 1, - "template" : 1 + "template" : 1, + "SpooledTemporaryFile" : 1 } unexp = [] @@ -561,11 +562,12 @@ class test_NamedTemporaryFile(TC): """Test NamedTemporaryFile().""" - def do_create(self, dir=None, pre="", suf=""): + def do_create(self, dir=None, pre="", suf="", delete=True): if dir is None: dir = tempfile.gettempdir() try: - file = tempfile.NamedTemporaryFile(dir=dir, prefix=pre, suffix=suf) + file = tempfile.NamedTemporaryFile(dir=dir, prefix=pre, suffix=suf, + delete=delete) except: self.failOnException("NamedTemporaryFile") @@ -599,6 +601,22 @@ finally: os.rmdir(dir) + def test_dis_del_on_close(self): + # Tests that delete-on-close can be disabled + dir = tempfile.mkdtemp() + tmp = None + try: + f = tempfile.NamedTemporaryFile(dir=dir, delete=False) + tmp = f.name + f.write('blat') + f.close() + self.failUnless(os.path.exists(f.name), + "NamedTemporaryFile %s missing after close" % f.name) + finally: + if tmp is not None: + os.unlink(tmp) + os.rmdir(dir) + def test_multiple_close(self): # A NamedTemporaryFile can be closed many times without error @@ -615,6 +633,107 @@ test_classes.append(test_NamedTemporaryFile) +class test_SpooledTemporaryFile(TC): + """Test SpooledTemporaryFile().""" + + def do_create(self, max_size=0, dir=None, pre="", suf=""): + if dir is None: + dir = tempfile.gettempdir() + try: + file = tempfile.SpooledTemporaryFile(max_size=max_size, dir=dir, prefix=pre, suffix=suf) + except: + self.failOnException("SpooledTemporaryFile") + + return file + + + def test_basic(self): + # SpooledTemporaryFile can create files + f = self.do_create() + self.failIf(f._rolled) + f = self.do_create(max_size=100, pre="a", suf=".txt") + self.failIf(f._rolled) + + def test_del_on_close(self): + # A SpooledTemporaryFile is deleted when closed + dir = tempfile.mkdtemp() + try: + f = tempfile.SpooledTemporaryFile(max_size=10, dir=dir) + self.failIf(f._rolled) + f.write('blat ' * 5) + self.failUnless(f._rolled) + filename = f.name + f.close() + self.failIf(os.path.exists(filename), + "SpooledTemporaryFile %s exists after close" % filename) + finally: + os.rmdir(dir) + + def test_rewrite_small(self): + # A SpooledTemporaryFile can be written to multiple within the max_size + f = self.do_create(max_size=30) + self.failIf(f._rolled) + for i in range(5): + f.seek(0, 0) + f.write('x' * 20) + self.failIf(f._rolled) + + def test_write_sequential(self): + # A SpooledTemporaryFile should hold exactly max_size bytes, and roll + # over afterward + f = self.do_create(max_size=30) + self.failIf(f._rolled) + f.write('x' * 20) + self.failIf(f._rolled) + f.write('x' * 10) + self.failIf(f._rolled) + f.write('x') + self.failUnless(f._rolled) + + def test_sparse(self): + # A SpooledTemporaryFile that is written late in the file will extend + # when that occurs + f = self.do_create(max_size=30) + self.failIf(f._rolled) + f.seek(100, 0) + self.failIf(f._rolled) + f.write('x') + self.failUnless(f._rolled) + + def test_fileno(self): + # A SpooledTemporaryFile should roll over to a real file on fileno() + f = self.do_create(max_size=30) + self.failIf(f._rolled) + self.failUnless(f.fileno() > 0) + self.failUnless(f._rolled) + + def test_multiple_close(self): + # A SpooledTemporaryFile can be closed many times without error + f = tempfile.SpooledTemporaryFile() + f.write('abc\n') + f.close() + try: + f.close() + f.close() + except: + self.failOnException("close") + + def test_bound_methods(self): + # It should be OK to steal a bound method from a SpooledTemporaryFile + # and use it independently; when the file rolls over, those bound + # methods should continue to function + f = self.do_create(max_size=30) + read = f.read + write = f.write + seek = f.seek + + write("a" * 35) + write("b" * 35) + seek(0, 0) + self.failUnless(read(70) == 'a'*35 + 'b'*35) + +test_classes.append(test_SpooledTemporaryFile) + class test_TemporaryFile(TC): """Test TemporaryFile().""" Modified: python/branches/bcannon-objcap/Lib/test/test_textwrap.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_textwrap.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_textwrap.py Fri May 25 22:13:08 2007 @@ -328,6 +328,14 @@ self.check_wrap(text, 30, [" This is a sentence with", "leading whitespace."]) + def test_no_drop_whitespace(self): + # SF patch #1581073 + text = " This is a sentence with much whitespace." + self.check_wrap(text, 10, + [" This is a", " ", "sentence ", + "with ", "much white", "space."], + drop_whitespace=False) + if test_support.have_unicode: def test_unicode(self): # *Very* simple test of wrapping Unicode strings. I'm sure Modified: python/branches/bcannon-objcap/Lib/test/test_threadedtempfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_threadedtempfile.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_threadedtempfile.py Fri May 25 22:13:08 2007 @@ -10,22 +10,20 @@ By default, NUM_THREADS == 20 and FILES_PER_THREAD == 50. This is enough to create about 150 failures per run under Win98SE in 2.0, and runs pretty quickly. Guido reports needing to boost FILES_PER_THREAD to 500 before -provoking a 2.0 failure under Linux. Run the test alone to boost either -via cmdline switches: - --f FILES_PER_THREAD (int) --t NUM_THREADS (int) +provoking a 2.0 failure under Linux. """ -NUM_THREADS = 20 # change w/ -t option -FILES_PER_THREAD = 50 # change w/ -f option +NUM_THREADS = 20 +FILES_PER_THREAD = 50 import thread # If this fails, we can't test this module import threading -from test.test_support import TestFailed, threading_setup, threading_cleanup +import tempfile + +from test.test_support import threading_setup, threading_cleanup, run_unittest +import unittest import StringIO from traceback import print_exc -import tempfile startEvent = threading.Event() @@ -46,41 +44,36 @@ else: self.ok_count += 1 -def test_main(): - threads = [] - thread_info = threading_setup() - print "Creating" - for i in range(NUM_THREADS): - t = TempFileGreedy() - threads.append(t) - t.start() - - print "Starting" - startEvent.set() - - print "Reaping" - ok = errors = 0 - for t in threads: - t.join() - ok += t.ok_count - errors += t.error_count - if t.error_count: - print '%s errors:\n%s' % (t.getName(), t.errors.getvalue()) - - msg = "Done: errors %d ok %d" % (errors, ok) - print msg - if errors: - raise TestFailed(msg) +class ThreadedTempFileTest(unittest.TestCase): + def test_main(self): + threads = [] + thread_info = threading_setup() + + for i in range(NUM_THREADS): + t = TempFileGreedy() + threads.append(t) + t.start() + + startEvent.set() + + ok = 0 + errors = [] + for t in threads: + t.join() + ok += t.ok_count + if t.error_count: + errors.append(str(t.getName()) + str(t.errors.getvalue())) + + threading_cleanup(*thread_info) + + msg = "Errors: errors %d ok %d\n%s" % (len(errors), ok, + '\n'.join(errors)) + self.assertEquals(errors, [], msg) + self.assertEquals(ok, NUM_THREADS * FILES_PER_THREAD) - threading_cleanup(*thread_info) +def test_main(): + run_unittest(ThreadedTempFileTest) if __name__ == "__main__": - import sys, getopt - opts, args = getopt.getopt(sys.argv[1:], "t:f:") - for o, v in opts: - if o == "-f": - FILES_PER_THREAD = int(v) - elif o == "-t": - NUM_THREADS = int(v) test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_threading_local.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_threading_local.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_threading_local.py Fri May 25 22:13:08 2007 @@ -20,7 +20,7 @@ setUp=setUp, tearDown=tearDown) ) - test_support.run_suite(suite) + test_support.run_unittest(suite) if __name__ == '__main__': test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_unicode.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_unicode.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_unicode.py Fri May 25 22:13:08 2007 @@ -822,7 +822,7 @@ def test_main(): - test_support.run_unittest(UnicodeTest) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_unicode_file.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_unicode_file.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_unicode_file.py Fri May 25 22:13:08 2007 @@ -5,7 +5,7 @@ import unicodedata import unittest -from test.test_support import run_suite, TestSkipped, TESTFN_UNICODE +from test.test_support import run_unittest, TestSkipped, TESTFN_UNICODE from test.test_support import TESTFN_ENCODING, TESTFN_UNICODE_UNENCODEABLE try: TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) @@ -205,9 +205,7 @@ False) def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestUnicodeFiles)) - run_suite(suite) + run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_unittest.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_unittest.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_unittest.py Fri May 25 22:13:08 2007 @@ -1,31 +1,2304 @@ """Test script for unittest. -This just includes tests for new features. We really need a -full set of tests. +By Collin Winter + +Still need testing: + TestCase.{assert,fail}* methods (some are tested implicitly) """ +from test import test_support import unittest +from unittest import TestCase + +### Support code +################################################################ + +class LoggingResult(unittest.TestResult): + def __init__(self, log): + self._events = log + super(LoggingResult, self).__init__() + + def startTest(self, test): + self._events.append('startTest') + super(LoggingResult, self).startTest(test) + + def stopTest(self, test): + self._events.append('stopTest') + super(LoggingResult, self).stopTest(test) + + def addFailure(self, *args): + self._events.append('addFailure') + super(LoggingResult, self).addFailure(*args) + + def addError(self, *args): + self._events.append('addError') + super(LoggingResult, self).addError(*args) + +class TestEquality(object): + # Check for a valid __eq__ implementation + def test_eq(self): + for obj_1, obj_2 in self.eq_pairs: + self.assertEqual(obj_1, obj_2) + self.assertEqual(obj_2, obj_1) + + # Check for a valid __ne__ implementation + def test_ne(self): + for obj_1, obj_2 in self.ne_pairs: + self.failIfEqual(obj_1, obj_2) + self.failIfEqual(obj_2, obj_1) + +class TestHashing(object): + # Check for a valid __hash__ implementation + def test_hash(self): + for obj_1, obj_2 in self.eq_pairs: + try: + assert hash(obj_1) == hash(obj_2) + except KeyboardInterrupt: + raise + except AssertionError: + self.fail("%s and %s do not hash equal" % (obj_1, obj_2)) + except Exception, e: + self.fail("Problem hashing %s and %s: %s" % (obj_1, obj_2, e)) + + for obj_1, obj_2 in self.ne_pairs: + try: + assert hash(obj_1) != hash(obj_2) + except KeyboardInterrupt: + raise + except AssertionError: + self.fail("%s and %s hash equal, but shouldn't" % (obj_1, obj_2)) + except Exception, e: + self.fail("Problem hashing %s and %s: %s" % (obj_1, obj_2, e)) + + +################################################################ +### /Support code + +class Test_TestLoader(TestCase): + + ### Tests for TestLoader.loadTestsFromTestCase + ################################################################ + + # "Return a suite of all tests cases contained in the TestCase-derived + # class testCaseClass" + def test_loadTestsFromTestCase(self): + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foo_bar(self): pass + + tests = unittest.TestSuite([Foo('test_1'), Foo('test_2')]) + + loader = unittest.TestLoader() + self.assertEqual(loader.loadTestsFromTestCase(Foo), tests) + + # "Return a suite of all tests cases contained in the TestCase-derived + # class testCaseClass" + # + # Make sure it does the right thing even if no tests were found + def test_loadTestsFromTestCase__no_matches(self): + class Foo(unittest.TestCase): + def foo_bar(self): pass + + empty_suite = unittest.TestSuite() + + loader = unittest.TestLoader() + self.assertEqual(loader.loadTestsFromTestCase(Foo), empty_suite) + + # "Return a suite of all tests cases contained in the TestCase-derived + # class testCaseClass" + # + # What happens if loadTestsFromTestCase() is given an object + # that isn't a subclass of TestCase? Specifically, what happens + # if testCaseClass is a subclass of TestSuite? + # + # This is checked for specifically in the code, so we better add a + # test for it. + def test_loadTestsFromTestCase__TestSuite_subclass(self): + class NotATestCase(unittest.TestSuite): + pass + + loader = unittest.TestLoader() + try: + loader.loadTestsFromTestCase(NotATestCase) + except TypeError: + pass + else: + self.fail('Should raise TypeError') + + # "Return a suite of all tests cases contained in the TestCase-derived + # class testCaseClass" + # + # Make sure loadTestsFromTestCase() picks up the default test method + # name (as specified by TestCase), even though the method name does + # not match the default TestLoader.testMethodPrefix string + def test_loadTestsFromTestCase__default_method_name(self): + class Foo(unittest.TestCase): + def runTest(self): + pass + + loader = unittest.TestLoader() + # This has to be false for the test to succeed + self.failIf('runTest'.startswith(loader.testMethodPrefix)) + + suite = loader.loadTestsFromTestCase(Foo) + self.failUnless(isinstance(suite, loader.suiteClass)) + self.assertEqual(list(suite), [Foo('runTest')]) + + ################################################################ + ### /Tests for TestLoader.loadTestsFromTestCase + + ### Tests for TestLoader.loadTestsFromModule + ################################################################ + + # "This method searches `module` for classes derived from TestCase" + def test_loadTestsFromModule__TestCase_subclass(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testcase_1 = MyTestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromModule(m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + expected = [loader.suiteClass([MyTestCase('test')])] + self.assertEqual(list(suite), expected) + + # "This method searches `module` for classes derived from TestCase" + # + # What happens if no tests are found (no TestCase instances)? + def test_loadTestsFromModule__no_TestCase_instances(self): + import new + m = new.module('m') + + loader = unittest.TestLoader() + suite = loader.loadTestsFromModule(m) + self.failUnless(isinstance(suite, loader.suiteClass)) + self.assertEqual(list(suite), []) + + # "This method searches `module` for classes derived from TestCase" + # + # What happens if no tests are found (TestCases instances, but no tests)? + def test_loadTestsFromModule__no_TestCase_tests(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + pass + m.testcase_1 = MyTestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromModule(m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + self.assertEqual(list(suite), [loader.suiteClass()]) + + # "This method searches `module` for classes derived from TestCase"s + # + # What happens if loadTestsFromModule() is given something other + # than a module? + # + # XXX Currently, it succeeds anyway. This flexibility + # should either be documented or loadTestsFromModule() should + # raise a TypeError + # + # XXX Certain people are using this behaviour. We'll add a test for it + def test_loadTestsFromModule__not_a_module(self): + class MyTestCase(unittest.TestCase): + def test(self): + pass + + class NotAModule(object): + test_2 = MyTestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromModule(NotAModule) + + reference = [unittest.TestSuite([MyTestCase('test')])] + self.assertEqual(list(suite), reference) + + ################################################################ + ### /Tests for TestLoader.loadTestsFromModule() + + ### Tests for TestLoader.loadTestsFromName() + ################################################################ + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # Is ValueError raised in response to an empty name? + def test_loadTestsFromName__empty_name(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromName('') + except ValueError, e: + self.assertEqual(str(e), "Empty module name") + else: + self.fail("TestLoader.loadTestsFromName failed to raise ValueError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # What happens when the name contains invalid characters? + def test_loadTestsFromName__malformed_name(self): + loader = unittest.TestLoader() + + # XXX Should this raise ValueError or ImportError? + try: + loader.loadTestsFromName('abc () //') + except ValueError: + pass + except ImportError: + pass + else: + self.fail("TestLoader.loadTestsFromName failed to raise ValueError") + + # "The specifier name is a ``dotted name'' that may resolve ... to a + # module" + # + # What happens when a module by that name can't be found? + def test_loadTestsFromName__unknown_module_name(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromName('sdasfasfasdf') + except ImportError, e: + self.assertEqual(str(e), "No module named sdasfasfasdf") + else: + self.fail("TestLoader.loadTestsFromName failed to raise ImportError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # What happens when the module is found, but the attribute can't? + def test_loadTestsFromName__unknown_attr_name(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromName('unittest.sdasfasfasdf') + except AttributeError, e: + self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'") + else: + self.fail("TestLoader.loadTestsFromName failed to raise AttributeError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # What happens when we provide the module, but the attribute can't be + # found? + def test_loadTestsFromName__relative_unknown_name(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromName('sdasfasfasdf', unittest) + except AttributeError, e: + self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'") + else: + self.fail("TestLoader.loadTestsFromName failed to raise AttributeError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # ... + # "The method optionally resolves name relative to the given module" + # + # Does loadTestsFromName raise ValueError when passed an empty + # name relative to a provided module? + # + # XXX Should probably raise a ValueError instead of an AttributeError + def test_loadTestsFromName__relative_empty_name(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromName('', unittest) + except AttributeError, e: + pass + else: + self.fail("Failed to raise AttributeError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # ... + # "The method optionally resolves name relative to the given module" + # + # What happens when an impossible name is given, relative to the provided + # `module`? + def test_loadTestsFromName__relative_malformed_name(self): + loader = unittest.TestLoader() + + # XXX Should this raise AttributeError or ValueError? + try: + loader.loadTestsFromName('abc () //', unittest) + except ValueError: + pass + except AttributeError: + pass + else: + self.fail("TestLoader.loadTestsFromName failed to raise ValueError") + + # "The method optionally resolves name relative to the given module" + # + # Does loadTestsFromName raise TypeError when the `module` argument + # isn't a module object? + # + # XXX Accepts the not-a-module object, ignorning the object's type + # This should raise an exception or the method name should be changed + # + # XXX Some people are relying on this, so keep it for now + def test_loadTestsFromName__relative_not_a_module(self): + class MyTestCase(unittest.TestCase): + def test(self): + pass + + class NotAModule(object): + test_2 = MyTestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromName('test_2', NotAModule) + + reference = [MyTestCase('test')] + self.assertEqual(list(suite), reference) + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # Does it raise an exception if the name resolves to an invalid + # object? + def test_loadTestsFromName__relative_bad_object(self): + import new + m = new.module('m') + m.testcase_1 = object() + + loader = unittest.TestLoader() + try: + loader.loadTestsFromName('testcase_1', m) + except TypeError: + pass + else: + self.fail("Should have raised TypeError") + + # "The specifier name is a ``dotted name'' that may + # resolve either to ... a test case class" + def test_loadTestsFromName__relative_TestCase_subclass(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testcase_1 = MyTestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromName('testcase_1', m) + self.failUnless(isinstance(suite, loader.suiteClass)) + self.assertEqual(list(suite), [MyTestCase('test')]) + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + def test_loadTestsFromName__relative_TestSuite(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testsuite = unittest.TestSuite([MyTestCase('test')]) + + loader = unittest.TestLoader() + suite = loader.loadTestsFromName('testsuite', m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + self.assertEqual(list(suite), [MyTestCase('test')]) + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a test method within a test case class" + def test_loadTestsFromName__relative_testmethod(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testcase_1 = MyTestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromName('testcase_1.test', m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + self.assertEqual(list(suite), [MyTestCase('test')]) + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # Does loadTestsFromName() raise the proper exception when trying to + # resolve "a test method within a test case class" that doesn't exist + # for the given name (relative to a provided module)? + def test_loadTestsFromName__relative_invalid_testmethod(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testcase_1 = MyTestCase + + loader = unittest.TestLoader() + try: + loader.loadTestsFromName('testcase_1.testfoo', m) + except AttributeError, e: + self.assertEqual(str(e), "type object 'MyTestCase' has no attribute 'testfoo'") + else: + self.fail("Failed to raise AttributeError") + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a callable object which returns a ... TestSuite instance" + def test_loadTestsFromName__callable__TestSuite(self): + import new + m = new.module('m') + testcase_1 = unittest.FunctionTestCase(lambda: None) + testcase_2 = unittest.FunctionTestCase(lambda: None) + def return_TestSuite(): + return unittest.TestSuite([testcase_1, testcase_2]) + m.return_TestSuite = return_TestSuite + + loader = unittest.TestLoader() + suite = loader.loadTestsFromName('return_TestSuite', m) + self.failUnless(isinstance(suite, loader.suiteClass)) + self.assertEqual(list(suite), [testcase_1, testcase_2]) + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a callable object which returns a TestCase ... instance" + def test_loadTestsFromName__callable__TestCase_instance(self): + import new + m = new.module('m') + testcase_1 = unittest.FunctionTestCase(lambda: None) + def return_TestCase(): + return testcase_1 + m.return_TestCase = return_TestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromName('return_TestCase', m) + self.failUnless(isinstance(suite, loader.suiteClass)) + self.assertEqual(list(suite), [testcase_1]) + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a callable object which returns a TestCase or TestSuite instance" + # + # What happens if the callable returns something else? + def test_loadTestsFromName__callable__wrong_type(self): + import new + m = new.module('m') + def return_wrong(): + return 6 + m.return_wrong = return_wrong + + loader = unittest.TestLoader() + try: + suite = loader.loadTestsFromName('return_wrong', m) + except TypeError: + pass + else: + self.fail("TestLoader.loadTestsFromName failed to raise TypeError") + + # "The specifier can refer to modules and packages which have not been + # imported; they will be imported as a side-effect" + def test_loadTestsFromName__module_not_loaded(self): + # We're going to try to load this module as a side-effect, so it + # better not be loaded before we try. + # + # Why pick audioop? Google shows it isn't used very often, so there's + # a good chance that it won't be imported when this test is run + module_name = 'audioop' + + import sys + if module_name in sys.modules: + del sys.modules[module_name] + + loader = unittest.TestLoader() + try: + suite = loader.loadTestsFromName(module_name) + + self.failUnless(isinstance(suite, loader.suiteClass)) + self.assertEqual(list(suite), []) + + # audioop should now be loaded, thanks to loadTestsFromName() + self.failUnless(module_name in sys.modules) + finally: + if module_name in sys.modules: + del sys.modules[module_name] + + ################################################################ + ### Tests for TestLoader.loadTestsFromName() + + ### Tests for TestLoader.loadTestsFromNames() + ################################################################ + + # "Similar to loadTestsFromName(), but takes a sequence of names rather + # than a single name." + # + # What happens if that sequence of names is empty? + def test_loadTestsFromNames__empty_name_list(self): + loader = unittest.TestLoader() + + suite = loader.loadTestsFromNames([]) + self.failUnless(isinstance(suite, loader.suiteClass)) + self.assertEqual(list(suite), []) + + # "Similar to loadTestsFromName(), but takes a sequence of names rather + # than a single name." + # ... + # "The method optionally resolves name relative to the given module" + # + # What happens if that sequence of names is empty? + # + # XXX Should this raise a ValueError or just return an empty TestSuite? + def test_loadTestsFromNames__relative_empty_name_list(self): + loader = unittest.TestLoader() + + suite = loader.loadTestsFromNames([], unittest) + self.failUnless(isinstance(suite, loader.suiteClass)) + self.assertEqual(list(suite), []) + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # Is ValueError raised in response to an empty name? + def test_loadTestsFromNames__empty_name(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromNames(['']) + except ValueError, e: + self.assertEqual(str(e), "Empty module name") + else: + self.fail("TestLoader.loadTestsFromNames failed to raise ValueError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # What happens when presented with an impossible module name? + def test_loadTestsFromNames__malformed_name(self): + loader = unittest.TestLoader() + + # XXX Should this raise ValueError or ImportError? + try: + loader.loadTestsFromNames(['abc () //']) + except ValueError: + pass + except ImportError: + pass + else: + self.fail("TestLoader.loadTestsFromNames failed to raise ValueError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # What happens when no module can be found for the given name? + def test_loadTestsFromNames__unknown_module_name(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromNames(['sdasfasfasdf']) + except ImportError, e: + self.assertEqual(str(e), "No module named sdasfasfasdf") + else: + self.fail("TestLoader.loadTestsFromNames failed to raise ImportError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # What happens when the module can be found, but not the attribute? + def test_loadTestsFromNames__unknown_attr_name(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromNames(['unittest.sdasfasfasdf', 'unittest']) + except AttributeError, e: + self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'") + else: + self.fail("TestLoader.loadTestsFromNames failed to raise AttributeError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # ... + # "The method optionally resolves name relative to the given module" + # + # What happens when given an unknown attribute on a specified `module` + # argument? + def test_loadTestsFromNames__unknown_name_relative_1(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromNames(['sdasfasfasdf'], unittest) + except AttributeError, e: + self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'") + else: + self.fail("TestLoader.loadTestsFromName failed to raise AttributeError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # ... + # "The method optionally resolves name relative to the given module" + # + # Do unknown attributes (relative to a provided module) still raise an + # exception even in the presence of valid attribute names? + def test_loadTestsFromNames__unknown_name_relative_2(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromNames(['TestCase', 'sdasfasfasdf'], unittest) + except AttributeError, e: + self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'") + else: + self.fail("TestLoader.loadTestsFromName failed to raise AttributeError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # ... + # "The method optionally resolves name relative to the given module" + # + # What happens when faced with the empty string? + # + # XXX This currently raises AttributeError, though ValueError is probably + # more appropriate + def test_loadTestsFromNames__relative_empty_name(self): + loader = unittest.TestLoader() + + try: + loader.loadTestsFromNames([''], unittest) + except AttributeError: + pass + else: + self.fail("Failed to raise ValueError") + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # ... + # "The method optionally resolves name relative to the given module" + # + # What happens when presented with an impossible attribute name? + def test_loadTestsFromNames__relative_malformed_name(self): + loader = unittest.TestLoader() + + # XXX Should this raise AttributeError or ValueError? + try: + loader.loadTestsFromNames(['abc () //'], unittest) + except AttributeError: + pass + except ValueError: + pass + else: + self.fail("TestLoader.loadTestsFromNames failed to raise ValueError") + + # "The method optionally resolves name relative to the given module" + # + # Does loadTestsFromNames() make sure the provided `module` is in fact + # a module? + # + # XXX This validation is currently not done. This flexibility should + # either be documented or a TypeError should be raised. + def test_loadTestsFromNames__relative_not_a_module(self): + class MyTestCase(unittest.TestCase): + def test(self): + pass + + class NotAModule(object): + test_2 = MyTestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromNames(['test_2'], NotAModule) + + reference = [unittest.TestSuite([MyTestCase('test')])] + self.assertEqual(list(suite), reference) + + # "The specifier name is a ``dotted name'' that may resolve either to + # a module, a test case class, a TestSuite instance, a test method + # within a test case class, or a callable object which returns a + # TestCase or TestSuite instance." + # + # Does it raise an exception if the name resolves to an invalid + # object? + def test_loadTestsFromNames__relative_bad_object(self): + import new + m = new.module('m') + m.testcase_1 = object() + + loader = unittest.TestLoader() + try: + loader.loadTestsFromNames(['testcase_1'], m) + except TypeError: + pass + else: + self.fail("Should have raised TypeError") + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a test case class" + def test_loadTestsFromNames__relative_TestCase_subclass(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testcase_1 = MyTestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromNames(['testcase_1'], m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + expected = loader.suiteClass([MyTestCase('test')]) + self.assertEqual(list(suite), [expected]) + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a TestSuite instance" + def test_loadTestsFromNames__relative_TestSuite(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testsuite = unittest.TestSuite([MyTestCase('test')]) + + loader = unittest.TestLoader() + suite = loader.loadTestsFromNames(['testsuite'], m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + self.assertEqual(list(suite), [m.testsuite]) + + # "The specifier name is a ``dotted name'' that may resolve ... to ... a + # test method within a test case class" + def test_loadTestsFromNames__relative_testmethod(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testcase_1 = MyTestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromNames(['testcase_1.test'], m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + ref_suite = unittest.TestSuite([MyTestCase('test')]) + self.assertEqual(list(suite), [ref_suite]) + + # "The specifier name is a ``dotted name'' that may resolve ... to ... a + # test method within a test case class" + # + # Does the method gracefully handle names that initially look like they + # resolve to "a test method within a test case class" but don't? + def test_loadTestsFromNames__relative_invalid_testmethod(self): + import new + m = new.module('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testcase_1 = MyTestCase + + loader = unittest.TestLoader() + try: + loader.loadTestsFromNames(['testcase_1.testfoo'], m) + except AttributeError, e: + self.assertEqual(str(e), "type object 'MyTestCase' has no attribute 'testfoo'") + else: + self.fail("Failed to raise AttributeError") + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a callable object which returns a ... TestSuite instance" + def test_loadTestsFromNames__callable__TestSuite(self): + import new + m = new.module('m') + testcase_1 = unittest.FunctionTestCase(lambda: None) + testcase_2 = unittest.FunctionTestCase(lambda: None) + def return_TestSuite(): + return unittest.TestSuite([testcase_1, testcase_2]) + m.return_TestSuite = return_TestSuite + + loader = unittest.TestLoader() + suite = loader.loadTestsFromNames(['return_TestSuite'], m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + expected = unittest.TestSuite([testcase_1, testcase_2]) + self.assertEqual(list(suite), [expected]) + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a callable object which returns a TestCase ... instance" + def test_loadTestsFromNames__callable__TestCase_instance(self): + import new + m = new.module('m') + testcase_1 = unittest.FunctionTestCase(lambda: None) + def return_TestCase(): + return testcase_1 + m.return_TestCase = return_TestCase + + loader = unittest.TestLoader() + suite = loader.loadTestsFromNames(['return_TestCase'], m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + ref_suite = unittest.TestSuite([testcase_1]) + self.assertEqual(list(suite), [ref_suite]) + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a callable object which returns a TestCase or TestSuite instance" + # + # Are staticmethods handled correctly? + def test_loadTestsFromNames__callable__call_staticmethod(self): + import new + m = new.module('m') + class Test1(unittest.TestCase): + def test(self): + pass + + testcase_1 = Test1('test') + class Foo(unittest.TestCase): + @staticmethod + def foo(): + return testcase_1 + m.Foo = Foo + + loader = unittest.TestLoader() + suite = loader.loadTestsFromNames(['Foo.foo'], m) + self.failUnless(isinstance(suite, loader.suiteClass)) + + ref_suite = unittest.TestSuite([testcase_1]) + self.assertEqual(list(suite), [ref_suite]) + + # "The specifier name is a ``dotted name'' that may resolve ... to + # ... a callable object which returns a TestCase or TestSuite instance" + # + # What happens when the callable returns something else? + def test_loadTestsFromNames__callable__wrong_type(self): + import new + m = new.module('m') + def return_wrong(): + return 6 + m.return_wrong = return_wrong + + loader = unittest.TestLoader() + try: + suite = loader.loadTestsFromNames(['return_wrong'], m) + except TypeError: + pass + else: + self.fail("TestLoader.loadTestsFromNames failed to raise TypeError") + + # "The specifier can refer to modules and packages which have not been + # imported; they will be imported as a side-effect" + def test_loadTestsFromNames__module_not_loaded(self): + # We're going to try to load this module as a side-effect, so it + # better not be loaded before we try. + # + # Why pick audioop? Google shows it isn't used very often, so there's + # a good chance that it won't be imported when this test is run + module_name = 'audioop' + + import sys + if module_name in sys.modules: + del sys.modules[module_name] + + loader = unittest.TestLoader() + try: + suite = loader.loadTestsFromNames([module_name]) + + self.failUnless(isinstance(suite, loader.suiteClass)) + self.assertEqual(list(suite), [unittest.TestSuite()]) + + # audioop should now be loaded, thanks to loadTestsFromName() + self.failUnless(module_name in sys.modules) + finally: + if module_name in sys.modules: + del sys.modules[module_name] + + ################################################################ + ### /Tests for TestLoader.loadTestsFromNames() + + ### Tests for TestLoader.getTestCaseNames() + ################################################################ + + # "Return a sorted sequence of method names found within testCaseClass" + # + # Test.foobar is defined to make sure getTestCaseNames() respects + # loader.testMethodPrefix + def test_getTestCaseNames(self): + class Test(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foobar(self): pass + + loader = unittest.TestLoader() + + self.assertEqual(loader.getTestCaseNames(Test), ['test_1', 'test_2']) + + # "Return a sorted sequence of method names found within testCaseClass" + # + # Does getTestCaseNames() behave appropriately if no tests are found? + def test_getTestCaseNames__no_tests(self): + class Test(unittest.TestCase): + def foobar(self): pass + + loader = unittest.TestLoader() + + self.assertEqual(loader.getTestCaseNames(Test), []) + + # "Return a sorted sequence of method names found within testCaseClass" + # + # Are not-TestCases handled gracefully? + # + # XXX This should raise a TypeError, not return a list + # + # XXX It's too late in the 2.5 release cycle to fix this, but it should + # probably be revisited for 2.6 + def test_getTestCaseNames__not_a_TestCase(self): + class BadCase(int): + def test_foo(self): + pass + + loader = unittest.TestLoader() + names = loader.getTestCaseNames(BadCase) + + self.assertEqual(names, ['test_foo']) + + # "Return a sorted sequence of method names found within testCaseClass" + # + # Make sure inherited names are handled. + # + # TestP.foobar is defined to make sure getTestCaseNames() respects + # loader.testMethodPrefix + def test_getTestCaseNames__inheritance(self): + class TestP(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foobar(self): pass + + class TestC(TestP): + def test_1(self): pass + def test_3(self): pass + + loader = unittest.TestLoader() + + names = ['test_1', 'test_2', 'test_3'] + self.assertEqual(loader.getTestCaseNames(TestC), names) + + ################################################################ + ### /Tests for TestLoader.getTestCaseNames() + + ### Tests for TestLoader.testMethodPrefix + ################################################################ + + # "String giving the prefix of method names which will be interpreted as + # test methods" + # + # Implicit in the documentation is that testMethodPrefix is respected by + # all loadTestsFrom* methods. + def test_testMethodPrefix__loadTestsFromTestCase(self): + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foo_bar(self): pass + + tests_1 = unittest.TestSuite([Foo('foo_bar')]) + tests_2 = unittest.TestSuite([Foo('test_1'), Foo('test_2')]) + + loader = unittest.TestLoader() + loader.testMethodPrefix = 'foo' + self.assertEqual(loader.loadTestsFromTestCase(Foo), tests_1) + + loader.testMethodPrefix = 'test' + self.assertEqual(loader.loadTestsFromTestCase(Foo), tests_2) + + # "String giving the prefix of method names which will be interpreted as + # test methods" + # + # Implicit in the documentation is that testMethodPrefix is respected by + # all loadTestsFrom* methods. + def test_testMethodPrefix__loadTestsFromModule(self): + import new + m = new.module('m') + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foo_bar(self): pass + m.Foo = Foo + + tests_1 = [unittest.TestSuite([Foo('foo_bar')])] + tests_2 = [unittest.TestSuite([Foo('test_1'), Foo('test_2')])] + + loader = unittest.TestLoader() + loader.testMethodPrefix = 'foo' + self.assertEqual(list(loader.loadTestsFromModule(m)), tests_1) + + loader.testMethodPrefix = 'test' + self.assertEqual(list(loader.loadTestsFromModule(m)), tests_2) + + # "String giving the prefix of method names which will be interpreted as + # test methods" + # + # Implicit in the documentation is that testMethodPrefix is respected by + # all loadTestsFrom* methods. + def test_testMethodPrefix__loadTestsFromName(self): + import new + m = new.module('m') + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foo_bar(self): pass + m.Foo = Foo + + tests_1 = unittest.TestSuite([Foo('foo_bar')]) + tests_2 = unittest.TestSuite([Foo('test_1'), Foo('test_2')]) + + loader = unittest.TestLoader() + loader.testMethodPrefix = 'foo' + self.assertEqual(loader.loadTestsFromName('Foo', m), tests_1) + + loader.testMethodPrefix = 'test' + self.assertEqual(loader.loadTestsFromName('Foo', m), tests_2) + + # "String giving the prefix of method names which will be interpreted as + # test methods" + # + # Implicit in the documentation is that testMethodPrefix is respected by + # all loadTestsFrom* methods. + def test_testMethodPrefix__loadTestsFromNames(self): + import new + m = new.module('m') + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foo_bar(self): pass + m.Foo = Foo + + tests_1 = unittest.TestSuite([unittest.TestSuite([Foo('foo_bar')])]) + tests_2 = unittest.TestSuite([Foo('test_1'), Foo('test_2')]) + tests_2 = unittest.TestSuite([tests_2]) + + loader = unittest.TestLoader() + loader.testMethodPrefix = 'foo' + self.assertEqual(loader.loadTestsFromNames(['Foo'], m), tests_1) + + loader.testMethodPrefix = 'test' + self.assertEqual(loader.loadTestsFromNames(['Foo'], m), tests_2) + + # "The default value is 'test'" + def test_testMethodPrefix__default_value(self): + loader = unittest.TestLoader() + self.failUnless(loader.testMethodPrefix == 'test') + + ################################################################ + ### /Tests for TestLoader.testMethodPrefix + + ### Tests for TestLoader.sortTestMethodsUsing + ################################################################ + + # "Function to be used to compare method names when sorting them in + # getTestCaseNames() and all the loadTestsFromX() methods" + def test_sortTestMethodsUsing__loadTestsFromTestCase(self): + def reversed_cmp(x, y): + return -cmp(x, y) + + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + + loader = unittest.TestLoader() + loader.sortTestMethodsUsing = reversed_cmp + + tests = loader.suiteClass([Foo('test_2'), Foo('test_1')]) + self.assertEqual(loader.loadTestsFromTestCase(Foo), tests) + + # "Function to be used to compare method names when sorting them in + # getTestCaseNames() and all the loadTestsFromX() methods" + def test_sortTestMethodsUsing__loadTestsFromModule(self): + def reversed_cmp(x, y): + return -cmp(x, y) + + import new + m = new.module('m') + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + m.Foo = Foo + + loader = unittest.TestLoader() + loader.sortTestMethodsUsing = reversed_cmp + + tests = [loader.suiteClass([Foo('test_2'), Foo('test_1')])] + self.assertEqual(list(loader.loadTestsFromModule(m)), tests) + + # "Function to be used to compare method names when sorting them in + # getTestCaseNames() and all the loadTestsFromX() methods" + def test_sortTestMethodsUsing__loadTestsFromName(self): + def reversed_cmp(x, y): + return -cmp(x, y) + + import new + m = new.module('m') + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + m.Foo = Foo + + loader = unittest.TestLoader() + loader.sortTestMethodsUsing = reversed_cmp + + tests = loader.suiteClass([Foo('test_2'), Foo('test_1')]) + self.assertEqual(loader.loadTestsFromName('Foo', m), tests) + + # "Function to be used to compare method names when sorting them in + # getTestCaseNames() and all the loadTestsFromX() methods" + def test_sortTestMethodsUsing__loadTestsFromNames(self): + def reversed_cmp(x, y): + return -cmp(x, y) + + import new + m = new.module('m') + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + m.Foo = Foo + + loader = unittest.TestLoader() + loader.sortTestMethodsUsing = reversed_cmp + + tests = [loader.suiteClass([Foo('test_2'), Foo('test_1')])] + self.assertEqual(list(loader.loadTestsFromNames(['Foo'], m)), tests) + + # "Function to be used to compare method names when sorting them in + # getTestCaseNames()" + # + # Does it actually affect getTestCaseNames()? + def test_sortTestMethodsUsing__getTestCaseNames(self): + def reversed_cmp(x, y): + return -cmp(x, y) + + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + + loader = unittest.TestLoader() + loader.sortTestMethodsUsing = reversed_cmp + + test_names = ['test_2', 'test_1'] + self.assertEqual(loader.getTestCaseNames(Foo), test_names) + + # "The default value is the built-in cmp() function" + def test_sortTestMethodsUsing__default_value(self): + loader = unittest.TestLoader() + self.failUnless(loader.sortTestMethodsUsing is cmp) + + # "it can be set to None to disable the sort." + # + # XXX How is this different from reassigning cmp? Are the tests returned + # in a random order or something? This behaviour should die + def test_sortTestMethodsUsing__None(self): + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + + loader = unittest.TestLoader() + loader.sortTestMethodsUsing = None + + test_names = ['test_2', 'test_1'] + self.assertEqual(set(loader.getTestCaseNames(Foo)), set(test_names)) + + ################################################################ + ### /Tests for TestLoader.sortTestMethodsUsing + + ### Tests for TestLoader.suiteClass + ################################################################ + + # "Callable object that constructs a test suite from a list of tests." + def test_suiteClass__loadTestsFromTestCase(self): + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foo_bar(self): pass + + tests = [Foo('test_1'), Foo('test_2')] + + loader = unittest.TestLoader() + loader.suiteClass = list + self.assertEqual(loader.loadTestsFromTestCase(Foo), tests) + + # It is implicit in the documentation for TestLoader.suiteClass that + # all TestLoader.loadTestsFrom* methods respect it. Let's make sure + def test_suiteClass__loadTestsFromModule(self): + import new + m = new.module('m') + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foo_bar(self): pass + m.Foo = Foo + + tests = [[Foo('test_1'), Foo('test_2')]] + + loader = unittest.TestLoader() + loader.suiteClass = list + self.assertEqual(loader.loadTestsFromModule(m), tests) + + # It is implicit in the documentation for TestLoader.suiteClass that + # all TestLoader.loadTestsFrom* methods respect it. Let's make sure + def test_suiteClass__loadTestsFromName(self): + import new + m = new.module('m') + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foo_bar(self): pass + m.Foo = Foo + + tests = [Foo('test_1'), Foo('test_2')] + + loader = unittest.TestLoader() + loader.suiteClass = list + self.assertEqual(loader.loadTestsFromName('Foo', m), tests) + + # It is implicit in the documentation for TestLoader.suiteClass that + # all TestLoader.loadTestsFrom* methods respect it. Let's make sure + def test_suiteClass__loadTestsFromNames(self): + import new + m = new.module('m') + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def foo_bar(self): pass + m.Foo = Foo + + tests = [[Foo('test_1'), Foo('test_2')]] + + loader = unittest.TestLoader() + loader.suiteClass = list + self.assertEqual(loader.loadTestsFromNames(['Foo'], m), tests) + + # "The default value is the TestSuite class" + def test_suiteClass__default_value(self): + loader = unittest.TestLoader() + self.failUnless(loader.suiteClass is unittest.TestSuite) + + ################################################################ + ### /Tests for TestLoader.suiteClass + +### Support code for Test_TestSuite +################################################################ + +class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + def test_3(self): pass + def runTest(self): pass + +def _mk_TestSuite(*names): + return unittest.TestSuite(Foo(n) for n in names) + +################################################################ +### /Support code for Test_TestSuite + +class Test_TestSuite(TestCase, TestEquality): + + ### Set up attributes needed by inherited tests + ################################################################ + + # Used by TestEquality.test_eq + eq_pairs = [(unittest.TestSuite(), unittest.TestSuite()) + ,(unittest.TestSuite(), unittest.TestSuite([])) + ,(_mk_TestSuite('test_1'), _mk_TestSuite('test_1'))] + + # Used by TestEquality.test_ne + ne_pairs = [(unittest.TestSuite(), _mk_TestSuite('test_1')) + ,(unittest.TestSuite([]), _mk_TestSuite('test_1')) + ,(_mk_TestSuite('test_1', 'test_2'), _mk_TestSuite('test_1', 'test_3')) + ,(_mk_TestSuite('test_1'), _mk_TestSuite('test_2'))] + + ################################################################ + ### /Set up attributes needed by inherited tests + + ### Tests for TestSuite.__init__ + ################################################################ + + # "class TestSuite([tests])" + # + # The tests iterable should be optional + def test_init__tests_optional(self): + suite = unittest.TestSuite() + + self.assertEqual(suite.countTestCases(), 0) + + # "class TestSuite([tests])" + # ... + # "If tests is given, it must be an iterable of individual test cases + # or other test suites that will be used to build the suite initially" + # + # TestSuite should deal with empty tests iterables by allowing the + # creation of an empty suite + def test_init__empty_tests(self): + suite = unittest.TestSuite([]) + + self.assertEqual(suite.countTestCases(), 0) + + # "class TestSuite([tests])" + # ... + # "If tests is given, it must be an iterable of individual test cases + # or other test suites that will be used to build the suite initially" + # + # TestSuite should allow any iterable to provide tests + def test_init__tests_from_any_iterable(self): + def tests(): + yield unittest.FunctionTestCase(lambda: None) + yield unittest.FunctionTestCase(lambda: None) + + suite_1 = unittest.TestSuite(tests()) + self.assertEqual(suite_1.countTestCases(), 2) + + suite_2 = unittest.TestSuite(suite_1) + self.assertEqual(suite_2.countTestCases(), 2) + + suite_3 = unittest.TestSuite(set(suite_1)) + self.assertEqual(suite_3.countTestCases(), 2) + + # "class TestSuite([tests])" + # ... + # "If tests is given, it must be an iterable of individual test cases + # or other test suites that will be used to build the suite initially" + # + # Does TestSuite() also allow other TestSuite() instances to be present + # in the tests iterable? + def test_init__TestSuite_instances_in_tests(self): + def tests(): + ftc = unittest.FunctionTestCase(lambda: None) + yield unittest.TestSuite([ftc]) + yield unittest.FunctionTestCase(lambda: None) + + suite = unittest.TestSuite(tests()) + self.assertEqual(suite.countTestCases(), 2) + + ################################################################ + ### /Tests for TestSuite.__init__ + + # Container types should support the iter protocol + def test_iter(self): + test1 = unittest.FunctionTestCase(lambda: None) + test2 = unittest.FunctionTestCase(lambda: None) + suite = unittest.TestSuite((test1, test2)) + + self.assertEqual(list(suite), [test1, test2]) + + # "Return the number of tests represented by the this test object. + # ...this method is also implemented by the TestSuite class, which can + # return larger [greater than 1] values" + # + # Presumably an empty TestSuite returns 0? + def test_countTestCases_zero_simple(self): + suite = unittest.TestSuite() + + self.assertEqual(suite.countTestCases(), 0) + + # "Return the number of tests represented by the this test object. + # ...this method is also implemented by the TestSuite class, which can + # return larger [greater than 1] values" + # + # Presumably an empty TestSuite (even if it contains other empty + # TestSuite instances) returns 0? + def test_countTestCases_zero_nested(self): + class Test1(unittest.TestCase): + def test(self): + pass + + suite = unittest.TestSuite([unittest.TestSuite()]) + + self.assertEqual(suite.countTestCases(), 0) + + # "Return the number of tests represented by the this test object. + # ...this method is also implemented by the TestSuite class, which can + # return larger [greater than 1] values" + def test_countTestCases_simple(self): + test1 = unittest.FunctionTestCase(lambda: None) + test2 = unittest.FunctionTestCase(lambda: None) + suite = unittest.TestSuite((test1, test2)) + + self.assertEqual(suite.countTestCases(), 2) + + # "Return the number of tests represented by the this test object. + # ...this method is also implemented by the TestSuite class, which can + # return larger [greater than 1] values" + # + # Make sure this holds for nested TestSuite instances, too + def test_countTestCases_nested(self): + class Test1(unittest.TestCase): + def test1(self): pass + def test2(self): pass + + test2 = unittest.FunctionTestCase(lambda: None) + test3 = unittest.FunctionTestCase(lambda: None) + child = unittest.TestSuite((Test1('test2'), test2)) + parent = unittest.TestSuite((test3, child, Test1('test1'))) + + self.assertEqual(parent.countTestCases(), 4) + + # "Run the tests associated with this suite, collecting the result into + # the test result object passed as result." + # + # And if there are no tests? What then? + def test_run__empty_suite(self): + events = [] + result = LoggingResult(events) + + suite = unittest.TestSuite() + + suite.run(result) + + self.assertEqual(events, []) + + # "Note that unlike TestCase.run(), TestSuite.run() requires the + # "result object to be passed in." + def test_run__requires_result(self): + suite = unittest.TestSuite() + + try: + suite.run() + except TypeError: + pass + else: + self.fail("Failed to raise TypeError") + + # "Run the tests associated with this suite, collecting the result into + # the test result object passed as result." + def test_run(self): + events = [] + result = LoggingResult(events) + + class LoggingCase(unittest.TestCase): + def run(self, result): + events.append('run %s' % self._testMethodName) + + def test1(self): pass + def test2(self): pass + + tests = [LoggingCase('test1'), LoggingCase('test2')] + + unittest.TestSuite(tests).run(result) + + self.assertEqual(events, ['run test1', 'run test2']) + + # "Add a TestCase ... to the suite" + def test_addTest__TestCase(self): + class Foo(unittest.TestCase): + def test(self): pass + + test = Foo('test') + suite = unittest.TestSuite() + + suite.addTest(test) + + self.assertEqual(suite.countTestCases(), 1) + self.assertEqual(list(suite), [test]) + + # "Add a ... TestSuite to the suite" + def test_addTest__TestSuite(self): + class Foo(unittest.TestCase): + def test(self): pass + + suite_2 = unittest.TestSuite([Foo('test')]) + + suite = unittest.TestSuite() + suite.addTest(suite_2) + + self.assertEqual(suite.countTestCases(), 1) + self.assertEqual(list(suite), [suite_2]) + + # "Add all the tests from an iterable of TestCase and TestSuite + # instances to this test suite." + # + # "This is equivalent to iterating over tests, calling addTest() for + # each element" + def test_addTests(self): + class Foo(unittest.TestCase): + def test_1(self): pass + def test_2(self): pass + + test_1 = Foo('test_1') + test_2 = Foo('test_2') + inner_suite = unittest.TestSuite([test_2]) + + def gen(): + yield test_1 + yield test_2 + yield inner_suite + + suite_1 = unittest.TestSuite() + suite_1.addTests(gen()) + + self.assertEqual(list(suite_1), list(gen())) + + # "This is equivalent to iterating over tests, calling addTest() for + # each element" + suite_2 = unittest.TestSuite() + for t in gen(): + suite_2.addTest(t) + + self.assertEqual(suite_1, suite_2) + + # "Add all the tests from an iterable of TestCase and TestSuite + # instances to this test suite." + # + # What happens if it doesn't get an iterable? + def test_addTest__noniterable(self): + suite = unittest.TestSuite() + + try: + suite.addTests(5) + except TypeError: + pass + else: + self.fail("Failed to raise TypeError") + + def test_addTest__noncallable(self): + suite = unittest.TestSuite() + self.assertRaises(TypeError, suite.addTest, 5) + + def test_addTest__casesuiteclass(self): + suite = unittest.TestSuite() + self.assertRaises(TypeError, suite.addTest, Test_TestSuite) + self.assertRaises(TypeError, suite.addTest, unittest.TestSuite) + + def test_addTests__string(self): + suite = unittest.TestSuite() + self.assertRaises(TypeError, suite.addTests, "foo") + + +class Test_FunctionTestCase(TestCase): + + # "Return the number of tests represented by the this test object. For + # TestCase instances, this will always be 1" + def test_countTestCases(self): + test = unittest.FunctionTestCase(lambda: None) + + self.assertEqual(test.countTestCases(), 1) + + # "When a setUp() method is defined, the test runner will run that method + # prior to each test. Likewise, if a tearDown() method is defined, the + # test runner will invoke that method after each test. In the example, + # setUp() was used to create a fresh sequence for each test." + # + # Make sure the proper call order is maintained, even if setUp() raises + # an exception. + def test_run_call_order__error_in_setUp(self): + events = [] + result = LoggingResult(events) + + def setUp(): + events.append('setUp') + raise RuntimeError('raised by setUp') + + def test(): + events.append('test') + + def tearDown(): + events.append('tearDown') + + expected = ['startTest', 'setUp', 'addError', 'stopTest'] + unittest.FunctionTestCase(test, setUp, tearDown).run(result) + self.assertEqual(events, expected) + + # "When a setUp() method is defined, the test runner will run that method + # prior to each test. Likewise, if a tearDown() method is defined, the + # test runner will invoke that method after each test. In the example, + # setUp() was used to create a fresh sequence for each test." + # + # Make sure the proper call order is maintained, even if the test raises + # an error (as opposed to a failure). + def test_run_call_order__error_in_test(self): + events = [] + result = LoggingResult(events) + + def setUp(): + events.append('setUp') + + def test(): + events.append('test') + raise RuntimeError('raised by test') + + def tearDown(): + events.append('tearDown') + + expected = ['startTest', 'setUp', 'test', 'addError', 'tearDown', + 'stopTest'] + unittest.FunctionTestCase(test, setUp, tearDown).run(result) + self.assertEqual(events, expected) + + # "When a setUp() method is defined, the test runner will run that method + # prior to each test. Likewise, if a tearDown() method is defined, the + # test runner will invoke that method after each test. In the example, + # setUp() was used to create a fresh sequence for each test." + # + # Make sure the proper call order is maintained, even if the test signals + # a failure (as opposed to an error). + def test_run_call_order__failure_in_test(self): + events = [] + result = LoggingResult(events) + + def setUp(): + events.append('setUp') + + def test(): + events.append('test') + self.fail('raised by test') + + def tearDown(): + events.append('tearDown') + + expected = ['startTest', 'setUp', 'test', 'addFailure', 'tearDown', + 'stopTest'] + unittest.FunctionTestCase(test, setUp, tearDown).run(result) + self.assertEqual(events, expected) + + # "When a setUp() method is defined, the test runner will run that method + # prior to each test. Likewise, if a tearDown() method is defined, the + # test runner will invoke that method after each test. In the example, + # setUp() was used to create a fresh sequence for each test." + # + # Make sure the proper call order is maintained, even if tearDown() raises + # an exception. + def test_run_call_order__error_in_tearDown(self): + events = [] + result = LoggingResult(events) + + def setUp(): + events.append('setUp') + + def test(): + events.append('test') + + def tearDown(): + events.append('tearDown') + raise RuntimeError('raised by tearDown') + + expected = ['startTest', 'setUp', 'test', 'tearDown', 'addError', + 'stopTest'] + unittest.FunctionTestCase(test, setUp, tearDown).run(result) + self.assertEqual(events, expected) + + # "Return a string identifying the specific test case." + # + # Because of the vague nature of the docs, I'm not going to lock this + # test down too much. Really all that can be asserted is that the id() + # will be a string (either 8-byte or unicode -- again, because the docs + # just say "string") + def test_id(self): + test = unittest.FunctionTestCase(lambda: None) + + self.failUnless(isinstance(test.id(), basestring)) + + # "Returns a one-line description of the test, or None if no description + # has been provided. The default implementation of this method returns + # the first line of the test method's docstring, if available, or None." + def test_shortDescription__no_docstring(self): + test = unittest.FunctionTestCase(lambda: None) + + self.assertEqual(test.shortDescription(), None) + + # "Returns a one-line description of the test, or None if no description + # has been provided. The default implementation of this method returns + # the first line of the test method's docstring, if available, or None." + def test_shortDescription__singleline_docstring(self): + desc = "this tests foo" + test = unittest.FunctionTestCase(lambda: None, description=desc) + + self.assertEqual(test.shortDescription(), "this tests foo") + +class Test_TestResult(TestCase): + # Note: there are not separate tests for TestResult.wasSuccessful(), + # TestResult.errors, TestResult.failures, TestResult.testsRun or + # TestResult.shouldStop because these only have meaning in terms of + # other TestResult methods. + # + # Accordingly, tests for the aforenamed attributes are incorporated + # in with the tests for the defining methods. + ################################################################ + + def test_init(self): + result = unittest.TestResult() + + self.failUnless(result.wasSuccessful()) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(result.testsRun, 0) + self.assertEqual(result.shouldStop, False) + + # "This method can be called to signal that the set of tests being + # run should be aborted by setting the TestResult's shouldStop + # attribute to True." + def test_stop(self): + result = unittest.TestResult() + + result.stop() + + self.assertEqual(result.shouldStop, True) + + # "Called when the test case test is about to be run. The default + # implementation simply increments the instance's testsRun counter." + def test_startTest(self): + class Foo(unittest.TestCase): + def test_1(self): + pass + + test = Foo('test_1') + + result = unittest.TestResult() + + result.startTest(test) + + self.failUnless(result.wasSuccessful()) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(result.testsRun, 1) + self.assertEqual(result.shouldStop, False) + + result.stopTest(test) + + # "Called after the test case test has been executed, regardless of + # the outcome. The default implementation does nothing." + def test_stopTest(self): + class Foo(unittest.TestCase): + def test_1(self): + pass + + test = Foo('test_1') + + result = unittest.TestResult() + + result.startTest(test) + + self.failUnless(result.wasSuccessful()) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(result.testsRun, 1) + self.assertEqual(result.shouldStop, False) + + result.stopTest(test) + + # Same tests as above; make sure nothing has changed + self.failUnless(result.wasSuccessful()) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(result.testsRun, 1) + self.assertEqual(result.shouldStop, False) + + # "addSuccess(test)" + # ... + # "Called when the test case test succeeds" + # ... + # "wasSuccessful() - Returns True if all tests run so far have passed, + # otherwise returns False" + # ... + # "testsRun - The total number of tests run so far." + # ... + # "errors - A list containing 2-tuples of TestCase instances and + # formatted tracebacks. Each tuple represents a test which raised an + # unexpected exception. Contains formatted + # tracebacks instead of sys.exc_info() results." + # ... + # "failures - A list containing 2-tuples of TestCase instances and + # formatted tracebacks. Each tuple represents a test where a failure was + # explicitly signalled using the TestCase.fail*() or TestCase.assert*() + # methods. Contains formatted tracebacks instead + # of sys.exc_info() results." + def test_addSuccess(self): + class Foo(unittest.TestCase): + def test_1(self): + pass + + test = Foo('test_1') + + result = unittest.TestResult() + + result.startTest(test) + result.addSuccess(test) + result.stopTest(test) + + self.failUnless(result.wasSuccessful()) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 0) + self.assertEqual(result.testsRun, 1) + self.assertEqual(result.shouldStop, False) + + # "addFailure(test, err)" + # ... + # "Called when the test case test signals a failure. err is a tuple of + # the form returned by sys.exc_info(): (type, value, traceback)" + # ... + # "wasSuccessful() - Returns True if all tests run so far have passed, + # otherwise returns False" + # ... + # "testsRun - The total number of tests run so far." + # ... + # "errors - A list containing 2-tuples of TestCase instances and + # formatted tracebacks. Each tuple represents a test which raised an + # unexpected exception. Contains formatted + # tracebacks instead of sys.exc_info() results." + # ... + # "failures - A list containing 2-tuples of TestCase instances and + # formatted tracebacks. Each tuple represents a test where a failure was + # explicitly signalled using the TestCase.fail*() or TestCase.assert*() + # methods. Contains formatted tracebacks instead + # of sys.exc_info() results." + def test_addFailure(self): + import sys + + class Foo(unittest.TestCase): + def test_1(self): + pass + + test = Foo('test_1') + try: + test.fail("foo") + except: + exc_info_tuple = sys.exc_info() + + result = unittest.TestResult() + + result.startTest(test) + result.addFailure(test, exc_info_tuple) + result.stopTest(test) + + self.failIf(result.wasSuccessful()) + self.assertEqual(len(result.errors), 0) + self.assertEqual(len(result.failures), 1) + self.assertEqual(result.testsRun, 1) + self.assertEqual(result.shouldStop, False) + + test_case, formatted_exc = result.failures[0] + self.failUnless(test_case is test) + self.failUnless(isinstance(formatted_exc, str)) + + # "addError(test, err)" + # ... + # "Called when the test case test raises an unexpected exception err + # is a tuple of the form returned by sys.exc_info(): + # (type, value, traceback)" + # ... + # "wasSuccessful() - Returns True if all tests run so far have passed, + # otherwise returns False" + # ... + # "testsRun - The total number of tests run so far." + # ... + # "errors - A list containing 2-tuples of TestCase instances and + # formatted tracebacks. Each tuple represents a test which raised an + # unexpected exception. Contains formatted + # tracebacks instead of sys.exc_info() results." + # ... + # "failures - A list containing 2-tuples of TestCase instances and + # formatted tracebacks. Each tuple represents a test where a failure was + # explicitly signalled using the TestCase.fail*() or TestCase.assert*() + # methods. Contains formatted tracebacks instead + # of sys.exc_info() results." + def test_addError(self): + import sys + + class Foo(unittest.TestCase): + def test_1(self): + pass + + test = Foo('test_1') + try: + raise TypeError() + except: + exc_info_tuple = sys.exc_info() + + result = unittest.TestResult() + + result.startTest(test) + result.addError(test, exc_info_tuple) + result.stopTest(test) + + self.failIf(result.wasSuccessful()) + self.assertEqual(len(result.errors), 1) + self.assertEqual(len(result.failures), 0) + self.assertEqual(result.testsRun, 1) + self.assertEqual(result.shouldStop, False) + + test_case, formatted_exc = result.errors[0] + self.failUnless(test_case is test) + self.failUnless(isinstance(formatted_exc, str)) + +### Support code for Test_TestCase +################################################################ + +class Foo(unittest.TestCase): + def runTest(self): pass + def test1(self): pass + +class Bar(Foo): + def test2(self): pass + +################################################################ +### /Support code for Test_TestCase + +class Test_TestCase(TestCase, TestEquality, TestHashing): + + ### Set up attributes used by inherited tests + ################################################################ + + # Used by TestHashing.test_hash and TestEquality.test_eq + eq_pairs = [(Foo('test1'), Foo('test1'))] + + # Used by TestEquality.test_ne + ne_pairs = [(Foo('test1'), Foo('runTest')) + ,(Foo('test1'), Bar('test1')) + ,(Foo('test1'), Bar('test2'))] + + ################################################################ + ### /Set up attributes used by inherited tests + + + # "class TestCase([methodName])" + # ... + # "Each instance of TestCase will run a single test method: the + # method named methodName." + # ... + # "methodName defaults to "runTest"." + # + # Make sure it really is optional, and that it defaults to the proper + # thing. + def test_init__no_test_name(self): + class Test(unittest.TestCase): + def runTest(self): raise MyException() + def test(self): pass + + self.assertEqual(Test().id()[-13:], '.Test.runTest') + + # "class TestCase([methodName])" + # ... + # "Each instance of TestCase will run a single test method: the + # method named methodName." + def test_init__test_name__valid(self): + class Test(unittest.TestCase): + def runTest(self): raise MyException() + def test(self): pass + + self.assertEqual(Test('test').id()[-10:], '.Test.test') + + # "class TestCase([methodName])" + # ... + # "Each instance of TestCase will run a single test method: the + # method named methodName." + def test_init__test_name__invalid(self): + class Test(unittest.TestCase): + def runTest(self): raise MyException() + def test(self): pass + + try: + Test('testfoo') + except ValueError: + pass + else: + self.fail("Failed to raise ValueError") + + # "Return the number of tests represented by the this test object. For + # TestCase instances, this will always be 1" + def test_countTestCases(self): + class Foo(unittest.TestCase): + def test(self): pass + + self.assertEqual(Foo('test').countTestCases(), 1) + + # "Return the default type of test result object to be used to run this + # test. For TestCase instances, this will always be + # unittest.TestResult; subclasses of TestCase should + # override this as necessary." + def test_defaultTestResult(self): + class Foo(unittest.TestCase): + def runTest(self): + pass + + result = Foo().defaultTestResult() + self.assertEqual(type(result), unittest.TestResult) + + # "When a setUp() method is defined, the test runner will run that method + # prior to each test. Likewise, if a tearDown() method is defined, the + # test runner will invoke that method after each test. In the example, + # setUp() was used to create a fresh sequence for each test." + # + # Make sure the proper call order is maintained, even if setUp() raises + # an exception. + def test_run_call_order__error_in_setUp(self): + events = [] + result = LoggingResult(events) + + class Foo(unittest.TestCase): + def setUp(self): + events.append('setUp') + raise RuntimeError('raised by Foo.setUp') + + def test(self): + events.append('test') + + def tearDown(self): + events.append('tearDown') + + Foo('test').run(result) + expected = ['startTest', 'setUp', 'addError', 'stopTest'] + self.assertEqual(events, expected) + + # "When a setUp() method is defined, the test runner will run that method + # prior to each test. Likewise, if a tearDown() method is defined, the + # test runner will invoke that method after each test. In the example, + # setUp() was used to create a fresh sequence for each test." + # + # Make sure the proper call order is maintained, even if the test raises + # an error (as opposed to a failure). + def test_run_call_order__error_in_test(self): + events = [] + result = LoggingResult(events) + + class Foo(unittest.TestCase): + def setUp(self): + events.append('setUp') + + def test(self): + events.append('test') + raise RuntimeError('raised by Foo.test') + + def tearDown(self): + events.append('tearDown') + + expected = ['startTest', 'setUp', 'test', 'addError', 'tearDown', + 'stopTest'] + Foo('test').run(result) + self.assertEqual(events, expected) + + # "When a setUp() method is defined, the test runner will run that method + # prior to each test. Likewise, if a tearDown() method is defined, the + # test runner will invoke that method after each test. In the example, + # setUp() was used to create a fresh sequence for each test." + # + # Make sure the proper call order is maintained, even if the test signals + # a failure (as opposed to an error). + def test_run_call_order__failure_in_test(self): + events = [] + result = LoggingResult(events) + + class Foo(unittest.TestCase): + def setUp(self): + events.append('setUp') + + def test(self): + events.append('test') + self.fail('raised by Foo.test') + + def tearDown(self): + events.append('tearDown') + + expected = ['startTest', 'setUp', 'test', 'addFailure', 'tearDown', + 'stopTest'] + Foo('test').run(result) + self.assertEqual(events, expected) + + # "When a setUp() method is defined, the test runner will run that method + # prior to each test. Likewise, if a tearDown() method is defined, the + # test runner will invoke that method after each test. In the example, + # setUp() was used to create a fresh sequence for each test." + # + # Make sure the proper call order is maintained, even if tearDown() raises + # an exception. + def test_run_call_order__error_in_tearDown(self): + events = [] + result = LoggingResult(events) + + class Foo(unittest.TestCase): + def setUp(self): + events.append('setUp') + + def test(self): + events.append('test') + + def tearDown(self): + events.append('tearDown') + raise RuntimeError('raised by Foo.tearDown') + + Foo('test').run(result) + expected = ['startTest', 'setUp', 'test', 'tearDown', 'addError', + 'stopTest'] + self.assertEqual(events, expected) + + # "This class attribute gives the exception raised by the test() method. + # If a test framework needs to use a specialized exception, possibly to + # carry additional information, it must subclass this exception in + # order to ``play fair'' with the framework. The initial value of this + # attribute is AssertionError" + def test_failureException__default(self): + class Foo(unittest.TestCase): + def test(self): + pass + + self.failUnless(Foo('test').failureException is AssertionError) + + # "This class attribute gives the exception raised by the test() method. + # If a test framework needs to use a specialized exception, possibly to + # carry additional information, it must subclass this exception in + # order to ``play fair'' with the framework." + # + # Make sure TestCase.run() respects the designated failureException + def test_failureException__subclassing__explicit_raise(self): + events = [] + result = LoggingResult(events) + + class Foo(unittest.TestCase): + def test(self): + raise RuntimeError() + + failureException = RuntimeError + + self.failUnless(Foo('test').failureException is RuntimeError) + + + Foo('test').run(result) + expected = ['startTest', 'addFailure', 'stopTest'] + self.assertEqual(events, expected) + + # "This class attribute gives the exception raised by the test() method. + # If a test framework needs to use a specialized exception, possibly to + # carry additional information, it must subclass this exception in + # order to ``play fair'' with the framework." + # + # Make sure TestCase.run() respects the designated failureException + def test_failureException__subclassing__implicit_raise(self): + events = [] + result = LoggingResult(events) + + class Foo(unittest.TestCase): + def test(self): + self.fail("foo") + + failureException = RuntimeError + + self.failUnless(Foo('test').failureException is RuntimeError) + + + Foo('test').run(result) + expected = ['startTest', 'addFailure', 'stopTest'] + self.assertEqual(events, expected) + + # "The default implementation does nothing." + def test_setUp(self): + class Foo(unittest.TestCase): + def runTest(self): + pass + + # ... and nothing should happen + Foo().setUp() + + # "The default implementation does nothing." + def test_tearDown(self): + class Foo(unittest.TestCase): + def runTest(self): + pass + + # ... and nothing should happen + Foo().tearDown() + + # "Return a string identifying the specific test case." + # + # Because of the vague nature of the docs, I'm not going to lock this + # test down too much. Really all that can be asserted is that the id() + # will be a string (either 8-byte or unicode -- again, because the docs + # just say "string") + def test_id(self): + class Foo(unittest.TestCase): + def runTest(self): + pass + + self.failUnless(isinstance(Foo().id(), basestring)) + + # "Returns a one-line description of the test, or None if no description + # has been provided. The default implementation of this method returns + # the first line of the test method's docstring, if available, or None." + def test_shortDescription__no_docstring(self): + class Foo(unittest.TestCase): + def runTest(self): + pass + + self.assertEqual(Foo().shortDescription(), None) + + # "Returns a one-line description of the test, or None if no description + # has been provided. The default implementation of this method returns + # the first line of the test method's docstring, if available, or None." + def test_shortDescription__singleline_docstring(self): + class Foo(unittest.TestCase): + def runTest(self): + "this tests foo" + pass + + self.assertEqual(Foo().shortDescription(), "this tests foo") + + # "Returns a one-line description of the test, or None if no description + # has been provided. The default implementation of this method returns + # the first line of the test method's docstring, if available, or None." + def test_shortDescription__multiline_docstring(self): + class Foo(unittest.TestCase): + def runTest(self): + """this tests foo + blah, bar and baz are also tested""" + pass + + self.assertEqual(Foo().shortDescription(), "this tests foo") + + # "If result is omitted or None, a temporary result object is created + # and used, but is not made available to the caller" + def test_run__uses_defaultTestResult(self): + events = [] + + class Foo(unittest.TestCase): + def test(self): + events.append('test') + + def defaultTestResult(self): + return LoggingResult(events) -def test_TestSuite_iter(): - """ - >>> test1 = unittest.FunctionTestCase(lambda: None) - >>> test2 = unittest.FunctionTestCase(lambda: None) - >>> suite = unittest.TestSuite((test1, test2)) - >>> tests = [] - >>> for test in suite: - ... tests.append(test) - >>> tests == [test1, test2] - True - """ + # Make run() find a result object on its own + Foo('test').run() + expected = ['startTest', 'test', 'stopTest'] + self.assertEqual(events, expected) ###################################################################### ## Main ###################################################################### def test_main(): - from test import test_support, test_unittest - test_support.run_doctest(test_unittest, verbosity=True) + test_support.run_unittest(Test_TestCase, Test_TestLoader, + Test_TestSuite, Test_TestResult, Test_FunctionTestCase) -if __name__ == '__main__': +if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_unpack.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_unpack.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_unpack.py Fri May 25 22:13:08 2007 @@ -55,7 +55,7 @@ >>> a, b, c = 7 Traceback (most recent call last): ... - TypeError: unpack non-sequence + TypeError: 'int' object is not iterable Unpacking tuple of wrong size Modified: python/branches/bcannon-objcap/Lib/test/test_urllib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_urllib.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_urllib.py Fri May 25 22:13:08 2007 @@ -8,6 +8,10 @@ import mimetools import tempfile import StringIO +import ftplib +import threading +import socket +import time def hexescape(char): """Escape char as RFC 2396 specifies""" @@ -122,6 +126,15 @@ finally: self.unfakehttp() + def test_empty_socket(self): + """urlopen() raises IOError if the underlying socket does not send any + data. (#1680230) """ + self.fakehttp('') + try: + self.assertRaises(IOError, urllib.urlopen, 'http://something') + finally: + self.unfakehttp() + class urlretrieve_FileTests(unittest.TestCase): """Test urllib.urlretrieve() on local files""" @@ -532,6 +545,65 @@ "url2pathname() failed; %s != %s" % (expect, result)) +def server(evt): + serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + serv.settimeout(3) + serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + serv.bind(("", 9091)) + serv.listen(5) + try: + conn, addr = serv.accept() + except socket.timeout: + pass + else: + conn.send("1 Hola mundo\n") + conn.send("2 No more lines\n") + conn.close() + finally: + serv.close() + evt.set() + +class FTPWrapperTests(unittest.TestCase): + + def setUp(self): + ftplib.FTP.port = 9091 + self.evt = threading.Event() + threading.Thread(target=server, args=(self.evt,)).start() + time.sleep(.1) + + def tearDown(self): + self.evt.wait() + + def testBasic(self): + # connects + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) + ftp.ftp.sock.close() + + def testTimeoutDefault(self): + # default + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) + self.assertTrue(ftp.ftp.sock.gettimeout() is None) + ftp.ftp.sock.close() + + def testTimeoutValue(self): + # a value + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) + self.assertEqual(ftp.ftp.sock.gettimeout(), 30) + ftp.ftp.sock.close() + + + def testTimeoutNone(self): + # None, having other default + previous = socket.getdefaulttimeout() + socket.setdefaulttimeout(30) + try: + ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) + finally: + socket.setdefaulttimeout(previous) + self.assertEqual(ftp.ftp.sock.gettimeout(), 30) + ftp.ftp.close() + + def test_main(): @@ -542,7 +614,8 @@ QuotingTests, UnquotingTests, urlencode_Tests, - Pathname_Tests + Pathname_Tests, + FTPWrapperTests, ) Modified: python/branches/bcannon-objcap/Lib/test/test_urllib2.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_urllib2.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_urllib2.py Fri May 25 22:13:08 2007 @@ -626,11 +626,11 @@ for url in [ "file://localhost:80%s" % urlpath, -# XXXX bug: these fail with socket.gaierror, should be URLError -## "file://%s:80%s/%s" % (socket.gethostbyname('localhost'), -## os.getcwd(), TESTFN), -## "file://somerandomhost.ontheinternet.com%s/%s" % -## (os.getcwd(), TESTFN), + "file:///file_does_not_exist.txt", + "file://%s:80%s/%s" % (socket.gethostbyname('localhost'), + os.getcwd(), TESTFN), + "file://somerandomhost.ontheinternet.com%s/%s" % + (os.getcwd(), TESTFN), ]: try: f = open(TESTFN, "wb") @@ -766,16 +766,24 @@ url = "http://example.com/" req = Request(url) - # 200 OK is passed through + # all 2xx are passed through r = MockResponse(200, "OK", {}, "", url) newr = h.http_response(req, r) self.assert_(r is newr) self.assert_(not hasattr(o, "proto")) # o.error not called + r = MockResponse(202, "Accepted", {}, "", url) + newr = h.http_response(req, r) + self.assert_(r is newr) + self.assert_(not hasattr(o, "proto")) # o.error not called + r = MockResponse(206, "Partial content", {}, "", url) + newr = h.http_response(req, r) + self.assert_(r is newr) + self.assert_(not hasattr(o, "proto")) # o.error not called # anything else calls o.error (and MockOpener returns None, here) - r = MockResponse(201, "Created", {}, "", url) + r = MockResponse(502, "Bad gateway", {}, "", url) self.assert_(h.http_response(req, r) is None) self.assertEqual(o.proto, "http") # o.error called - self.assertEqual(o.args, (req, r, 201, "Created", {})) + self.assertEqual(o.args, (req, r, 502, "Bad gateway", {})) def test_cookies(self): cj = MockCookieJar() Modified: python/branches/bcannon-objcap/Lib/test/test_urllib2net.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_urllib2net.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_urllib2net.py Fri May 25 22:13:08 2007 @@ -173,19 +173,6 @@ ] self._test_urls(urls, self._extra_handlers()) - def test_gopher(self): - import warnings - warnings.filterwarnings("ignore", - "the gopherlib module is deprecated", - DeprecationWarning, - "urllib2$") - urls = [ - # Thanks to Fred for finding these! - 'gopher://gopher.lib.ncsu.edu./11/library/stacks/Alex', - 'gopher://gopher.vt.edu.:10010/10/33', - ] - self._test_urls(urls, self._extra_handlers()) - def test_file(self): TESTFN = test_support.TESTFN f = open(TESTFN, 'w') @@ -264,7 +251,8 @@ (expected_err, url, req, err)) self.assert_(isinstance(err, expected_err), msg) else: - buf = f.read() + with test_support.transient_internet(): + buf = f.read() f.close() debug("read %d bytes" % len(buf)) debug("******** next url coming up...") @@ -273,8 +261,6 @@ def _extra_handlers(self): handlers = [] - handlers.append(urllib2.GopherHandler) - cfh = urllib2.CacheFTPHandler() cfh.setTimeout(1) handlers.append(cfh) Modified: python/branches/bcannon-objcap/Lib/test/test_userdict.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_userdict.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_userdict.py Fri May 25 22:13:08 2007 @@ -174,7 +174,7 @@ except RuntimeError, err: self.assertEqual(err.args, (42,)) else: - self.fail_("e[42] didn't raise RuntimeError") + self.fail("e[42] didn't raise RuntimeError") class F(UserDict.UserDict): def __init__(self): # An instance variable __missing__ should have no effect @@ -186,7 +186,7 @@ except KeyError, err: self.assertEqual(err.args, (42,)) else: - self.fail_("f[42] didn't raise KeyError") + self.fail("f[42] didn't raise KeyError") class G(UserDict.UserDict): pass g = G() @@ -195,7 +195,7 @@ except KeyError, err: self.assertEqual(err.args, (42,)) else: - self.fail_("g[42] didn't raise KeyError") + self.fail("g[42] didn't raise KeyError") ########################## # Test Dict Mixin Modified: python/branches/bcannon-objcap/Lib/test/test_warnings.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_warnings.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_warnings.py Fri May 25 22:13:08 2007 @@ -3,95 +3,97 @@ import unittest from test import test_support -# The warnings module isn't easily tested, because it relies on module -# globals to store configuration information. setUp() and tearDown() -# preserve the current settings to avoid bashing them while running tests. - -# To capture the warning messages, a replacement for showwarning() is -# used to save warning information in a global variable. - -class WarningMessage: - "Holds results of latest showwarning() call" - pass - -def showwarning(message, category, filename, lineno, file=None): - msg.message = str(message) - msg.category = category.__name__ - msg.filename = os.path.basename(filename) - msg.lineno = lineno +import warning_tests class TestModule(unittest.TestCase): - def setUp(self): - global msg - msg = WarningMessage() - self._filters = warnings.filters[:] - self._showwarning = warnings.showwarning - warnings.showwarning = showwarning - self.ignored = [w[2].__name__ for w in self._filters + self.ignored = [w[2].__name__ for w in warnings.filters if w[0]=='ignore' and w[1] is None and w[3] is None] - def tearDown(self): - warnings.filters = self._filters[:] - warnings.showwarning = self._showwarning - def test_warn_default_category(self): - for i in range(4): - text = 'multi %d' %i # Different text on each call - warnings.warn(text) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, 'UserWarning') + with test_support.catch_warning() as w: + for i in range(4): + text = 'multi %d' %i # Different text on each call + warnings.warn(text) + self.assertEqual(str(w.message), text) + self.assert_(w.category is UserWarning) def test_warn_specific_category(self): - text = 'None' - for category in [DeprecationWarning, FutureWarning, - PendingDeprecationWarning, RuntimeWarning, - SyntaxWarning, UserWarning, Warning]: - if category.__name__ in self.ignored: - text = 'filtered out' + category.__name__ - warnings.warn(text, category) - self.assertNotEqual(msg.message, text) - else: - text = 'unfiltered %s' % category.__name__ - warnings.warn(text, category) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, category.__name__) + with test_support.catch_warning() as w: + text = 'None' + for category in [DeprecationWarning, FutureWarning, + PendingDeprecationWarning, RuntimeWarning, + SyntaxWarning, UserWarning, Warning]: + if category.__name__ in self.ignored: + text = 'filtered out' + category.__name__ + warnings.warn(text, category) + self.assertNotEqual(w.message, text) + else: + text = 'unfiltered %s' % category.__name__ + warnings.warn(text, category) + self.assertEqual(str(w.message), text) + self.assert_(w.category is category) def test_filtering(self): + with test_support.catch_warning() as w: + warnings.filterwarnings("error", "", Warning, "", 0) + self.assertRaises(UserWarning, warnings.warn, 'convert to error') + + warnings.resetwarnings() + text = 'handle normally' + warnings.warn(text) + self.assertEqual(str(w.message), text) + self.assert_(w.category is UserWarning) - warnings.filterwarnings("error", "", Warning, "", 0) - self.assertRaises(UserWarning, warnings.warn, 'convert to error') + warnings.filterwarnings("ignore", "", Warning, "", 0) + text = 'filtered out' + warnings.warn(text) + self.assertNotEqual(str(w.message), text) - warnings.resetwarnings() - text = 'handle normally' - warnings.warn(text) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, 'UserWarning') - - warnings.filterwarnings("ignore", "", Warning, "", 0) - text = 'filtered out' - warnings.warn(text) - self.assertNotEqual(msg.message, text) - - warnings.resetwarnings() - warnings.filterwarnings("error", "hex*", Warning, "", 0) - self.assertRaises(UserWarning, warnings.warn, 'hex/oct') - text = 'nonmatching text' - warnings.warn(text) - self.assertEqual(msg.message, text) - self.assertEqual(msg.category, 'UserWarning') + warnings.resetwarnings() + warnings.filterwarnings("error", "hex*", Warning, "", 0) + self.assertRaises(UserWarning, warnings.warn, 'hex/oct') + text = 'nonmatching text' + warnings.warn(text) + self.assertEqual(str(w.message), text) + self.assert_(w.category is UserWarning) def test_options(self): # Uses the private _setoption() function to test the parsing # of command-line warning arguments - self.assertRaises(warnings._OptionError, - warnings._setoption, '1:2:3:4:5:6') - self.assertRaises(warnings._OptionError, - warnings._setoption, 'bogus::Warning') - self.assertRaises(warnings._OptionError, - warnings._setoption, 'ignore:2::4:-5') - warnings._setoption('error::Warning::0') - self.assertRaises(UserWarning, warnings.warn, 'convert to error') + with test_support.guard_warnings_filter(): + self.assertRaises(warnings._OptionError, + warnings._setoption, '1:2:3:4:5:6') + self.assertRaises(warnings._OptionError, + warnings._setoption, 'bogus::Warning') + self.assertRaises(warnings._OptionError, + warnings._setoption, 'ignore:2::4:-5') + warnings._setoption('error::Warning::0') + self.assertRaises(UserWarning, warnings.warn, 'convert to error') + + def test_filename(self): + with test_support.catch_warning() as w: + warning_tests.inner("spam1") + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") + warning_tests.outer("spam2") + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") + + def test_stacklevel(self): + # Test stacklevel argument + # make sure all messages are different, so the warning won't be skipped + with test_support.catch_warning() as w: + warning_tests.inner("spam3", stacklevel=1) + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") + warning_tests.outer("spam4", stacklevel=1) + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") + + warning_tests.inner("spam5", stacklevel=2) + self.assertEqual(os.path.basename(w.filename), "test_warnings.py") + warning_tests.outer("spam6", stacklevel=2) + self.assertEqual(os.path.basename(w.filename), "warning_tests.py") + + warning_tests.inner("spam7", stacklevel=9999) + self.assertEqual(os.path.basename(w.filename), "sys") def test_main(verbose=None): Modified: python/branches/bcannon-objcap/Lib/test/test_wsgiref.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_wsgiref.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_wsgiref.py Fri May 25 22:13:08 2007 @@ -1,5 +1,5 @@ from __future__ import nested_scopes # Backward compat for 2.1 -from unittest import TestSuite, TestCase, makeSuite +from unittest import TestCase from wsgiref.util import setup_testing_defaults from wsgiref.headers import Headers from wsgiref.handlers import BaseHandler, BaseCGIHandler @@ -11,6 +11,7 @@ from SocketServer import BaseServer import re, sys +from test import test_support class MockServer(WSGIServer): """Non-socket HTTP server""" @@ -575,11 +576,7 @@ # This epilogue is needed for compatibility with the Python 2.5 regrtest module def test_main(): - import unittest - from test.test_support import run_suite - run_suite( - unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) - ) + test_support.run_unittest(__name__) if __name__ == "__main__": test_main() Modified: python/branches/bcannon-objcap/Lib/test/test_xmlrpc.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_xmlrpc.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_xmlrpc.py Fri May 25 22:13:08 2007 @@ -114,7 +114,7 @@ xmlrpclib.loads(strg)[0][0]) self.assertRaises(TypeError, xmlrpclib.dumps, (arg1,)) - def test_default_encoding_issues(self): + def XXX_test_default_encoding_issues(self): # SF bug #1115989: wrong decoding in '_stringify' utf8 = """ Modified: python/branches/bcannon-objcap/Lib/test/test_zipfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_zipfile.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_zipfile.py Fri May 25 22:13:08 2007 @@ -4,26 +4,30 @@ except ImportError: zlib = None -import zipfile, os, unittest, sys, shutil +import zipfile, os, unittest, sys, shutil, struct from StringIO import StringIO from tempfile import TemporaryFile +from random import randint, random +import test.test_support as support from test.test_support import TESTFN, run_unittest TESTFN2 = TESTFN + "2" +FIXEDTEST_SIZE = 10 class TestsWithSourceFile(unittest.TestCase): def setUp(self): - line_gen = ("Test of zipfile line %d." % i for i in range(0, 1000)) - self.data = '\n'.join(line_gen) + self.line_gen = ("Zipfile test line %d. random float: %f" % (i, random()) + for i in xrange(FIXEDTEST_SIZE)) + self.data = '\n'.join(self.line_gen) + '\n' # Make a source file with some lines fp = open(TESTFN, "wb") fp.write(self.data) fp.close() - def zipTest(self, f, compression): + def makeTestArchive(self, f, compression): # Create the ZIP archive zipfp = zipfile.ZipFile(f, "w", compression) zipfp.write(TESTFN, "another"+os.extsep+"name") @@ -31,6 +35,9 @@ zipfp.writestr("strfile", self.data) zipfp.close() + def zipTest(self, f, compression): + self.makeTestArchive(f, compression) + # Read the ZIP archive zipfp = zipfile.ZipFile(f, "r", compression) self.assertEqual(zipfp.read(TESTFN), self.data) @@ -85,22 +92,144 @@ # Check that testzip doesn't raise an exception zipfp.testzip() + zipfp.close() + + def testStored(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipTest(f, zipfile.ZIP_STORED) + def zipOpenTest(self, f, compression): + self.makeTestArchive(f, compression) + + # Read the ZIP archive + zipfp = zipfile.ZipFile(f, "r", compression) + zipdata1 = [] + zipopen1 = zipfp.open(TESTFN) + while 1: + read_data = zipopen1.read(256) + if not read_data: + break + zipdata1.append(read_data) + + zipdata2 = [] + zipopen2 = zipfp.open("another"+os.extsep+"name") + while 1: + read_data = zipopen2.read(256) + if not read_data: + break + zipdata2.append(read_data) + self.assertEqual(''.join(zipdata1), self.data) + self.assertEqual(''.join(zipdata2), self.data) zipfp.close() + def testOpenStored(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipOpenTest(f, zipfile.ZIP_STORED) + + def zipRandomOpenTest(self, f, compression): + self.makeTestArchive(f, compression) + # Read the ZIP archive + zipfp = zipfile.ZipFile(f, "r", compression) + zipdata1 = [] + zipopen1 = zipfp.open(TESTFN) + while 1: + read_data = zipopen1.read(randint(1, 1024)) + if not read_data: + break + zipdata1.append(read_data) + self.assertEqual(''.join(zipdata1), self.data) + zipfp.close() - def testStored(self): + def testRandomOpenStored(self): for f in (TESTFN2, TemporaryFile(), StringIO()): - self.zipTest(f, zipfile.ZIP_STORED) + self.zipRandomOpenTest(f, zipfile.ZIP_STORED) + + def zipReadlineTest(self, f, compression): + self.makeTestArchive(f, compression) + + # Read the ZIP archive + zipfp = zipfile.ZipFile(f, "r") + zipopen = zipfp.open(TESTFN) + for line in self.line_gen: + linedata = zipopen.readline() + self.assertEqual(linedata, line + '\n') + + zipfp.close() + + def zipReadlinesTest(self, f, compression): + self.makeTestArchive(f, compression) + + # Read the ZIP archive + zipfp = zipfile.ZipFile(f, "r") + ziplines = zipfp.open(TESTFN).readlines() + for line, zipline in zip(self.line_gen, ziplines): + self.assertEqual(zipline, line + '\n') + + zipfp.close() + + def zipIterlinesTest(self, f, compression): + self.makeTestArchive(f, compression) + + # Read the ZIP archive + zipfp = zipfile.ZipFile(f, "r") + for line, zipline in zip(self.line_gen, zipfp.open(TESTFN)): + self.assertEqual(zipline, line + '\n') + + zipfp.close() + + def testReadlineStored(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipReadlineTest(f, zipfile.ZIP_STORED) + + def testReadlinesStored(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipReadlinesTest(f, zipfile.ZIP_STORED) + + def testIterlinesStored(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipIterlinesTest(f, zipfile.ZIP_STORED) if zlib: def testDeflated(self): for f in (TESTFN2, TemporaryFile(), StringIO()): self.zipTest(f, zipfile.ZIP_DEFLATED) + def testOpenDeflated(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipOpenTest(f, zipfile.ZIP_DEFLATED) + + def testRandomOpenDeflated(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipRandomOpenTest(f, zipfile.ZIP_DEFLATED) + + def testReadlineDeflated(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipReadlineTest(f, zipfile.ZIP_DEFLATED) + + def testReadlinesDeflated(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipReadlinesTest(f, zipfile.ZIP_DEFLATED) + + def testIterlinesDeflated(self): + for f in (TESTFN2, TemporaryFile(), StringIO()): + self.zipIterlinesTest(f, zipfile.ZIP_DEFLATED) + + def testLowCompression(self): + # Checks for cases where compressed data is larger than original + # Create the ZIP archive + zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_DEFLATED) + zipfp.writestr("strfile", '12') + zipfp.close() + + # Get an open object for strfile + zipfp = zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_DEFLATED) + openobj = zipfp.open("strfile") + self.assertEqual(openobj.read(1), '1') + self.assertEqual(openobj.read(1), '2') + def testAbsoluteArcnames(self): zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) zipfp.write(TESTFN, "/absolute") @@ -110,7 +239,6 @@ self.assertEqual(zipfp.namelist(), ["absolute"]) zipfp.close() - def tearDown(self): os.remove(TESTFN) os.remove(TESTFN2) @@ -123,7 +251,7 @@ self._limit = zipfile.ZIP64_LIMIT zipfile.ZIP64_LIMIT = 5 - line_gen = ("Test of zipfile line %d." % i for i in range(0, 1000)) + line_gen = ("Test of zipfile line %d." % i for i in range(0, FIXEDTEST_SIZE)) self.data = '\n'.join(line_gen) # Make a source file with some lines @@ -307,6 +435,26 @@ class OtherTests(unittest.TestCase): + def testCreateNonExistentFileForAppend(self): + if os.path.exists(TESTFN): + os.unlink(TESTFN) + + filename = 'testfile.txt' + content = 'hello, world. this is some content.' + + try: + zf = zipfile.ZipFile(TESTFN, 'a') + zf.writestr(filename, content) + zf.close() + except IOError, (errno, errmsg): + self.fail('Could not append data to a non-existent zip file.') + + self.assert_(os.path.exists(TESTFN)) + + zf = zipfile.ZipFile(TESTFN, 'r') + self.assertEqual(zf.read(filename), content) + zf.close() + def testCloseErroneousFile(self): # This test checks that the ZipFile constructor closes the file object # it opens if there's an error in the file. If it doesn't, the traceback @@ -320,7 +468,25 @@ try: zf = zipfile.ZipFile(TESTFN) except zipfile.BadZipfile: - os.unlink(TESTFN) + pass + + def testIsZipErroneousFile(self): + # This test checks that the is_zipfile function correctly identifies + # a file that is not a zip file + fp = open(TESTFN, "w") + fp.write("this is not a legal zip file\n") + fp.close() + chk = zipfile.is_zipfile(TESTFN) + self.assert_(chk is False) + + def testIsZipValidFile(self): + # This test checks that the is_zipfile function correctly identifies + # a file that is a zip file + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + chk = zipfile.is_zipfile(TESTFN) + self.assert_(chk is True) def testNonExistentFileRaisesIOError(self): # make sure we don't raise an AttributeError when a partially-constructed @@ -349,9 +515,303 @@ # and report that the first file in the archive was corrupt. self.assertRaises(RuntimeError, zipf.testzip) + def tearDown(self): + support.unlink(TESTFN) + support.unlink(TESTFN2) + +class DecryptionTests(unittest.TestCase): + # This test checks that ZIP decryption works. Since the library does not + # support encryption at the moment, we use a pre-generated encrypted + # ZIP file + + data = ( + 'PK\x03\x04\x14\x00\x01\x00\x00\x00n\x92i.#y\xef?&\x00\x00\x00\x1a\x00' + '\x00\x00\x08\x00\x00\x00test.txt\xfa\x10\xa0gly|\xfa-\xc5\xc0=\xf9y' + '\x18\xe0\xa8r\xb3Z}Lg\xbc\xae\xf9|\x9b\x19\xe4\x8b\xba\xbb)\x8c\xb0\xdbl' + 'PK\x01\x02\x14\x00\x14\x00\x01\x00\x00\x00n\x92i.#y\xef?&\x00\x00\x00' + '\x1a\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x01\x00 \x00\xb6\x81' + '\x00\x00\x00\x00test.txtPK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x006\x00' + '\x00\x00L\x00\x00\x00\x00\x00' ) + + plain = 'zipfile.py encryption test' + + def setUp(self): + fp = open(TESTFN, "wb") + fp.write(self.data) + fp.close() + self.zip = zipfile.ZipFile(TESTFN, "r") + + def tearDown(self): + self.zip.close() + os.unlink(TESTFN) + + def testNoPassword(self): + # Reading the encrypted file without password + # must generate a RunTime exception + self.assertRaises(RuntimeError, self.zip.read, "test.txt") + + def testBadPassword(self): + self.zip.setpassword("perl") + self.assertRaises(RuntimeError, self.zip.read, "test.txt") + + def testGoodPassword(self): + self.zip.setpassword("python") + self.assertEquals(self.zip.read("test.txt"), self.plain) + + +class TestsWithRandomBinaryFiles(unittest.TestCase): + def setUp(self): + datacount = randint(16, 64)*1024 + randint(1, 1024) + self.data = ''.join((struct.pack(' # '/path', ['attr1=value1', 'attr2=value2', ...] # splitvalue('attr=value') --> 'attr', 'value' -# splitgophertype('/Xselector') --> 'X', 'selector' # unquote('abc%20def') -> 'abc def' # quote('abc def') -> 'abc%20def') @@ -1131,12 +1123,6 @@ if match: return match.group(1, 2) return attr, None -def splitgophertype(selector): - """splitgophertype('/Xselector') --> 'X', 'selector'.""" - if selector[:1] == '/' and selector[1:2]: - return selector[1], selector[2:] - return None, selector - _hextochr = dict(('%02x' % i, chr(i)) for i in range(256)) _hextochr.update(('%02X' % i, chr(i)) for i in range(256)) @@ -1471,8 +1457,7 @@ '/etc/passwd', 'file:/etc/passwd', 'file://localhost/etc/passwd', - 'ftp://ftp.python.org/pub/python/README', -## 'gopher://gopher.micro.umn.edu/1/', + 'ftp://ftp.gnu.org/pub/README', 'http://www.python.org/index.html', ] if hasattr(URLopener, "open_https"): Modified: python/branches/bcannon-objcap/Lib/urllib2.py ============================================================================== --- python/branches/bcannon-objcap/Lib/urllib2.py (original) +++ python/branches/bcannon-objcap/Lib/urllib2.py Fri May 25 22:13:08 2007 @@ -14,36 +14,36 @@ HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler deals with digest authentication. -urlopen(url, data=None) -- basic usage is the same as original +urlopen(url, data=None) -- Basic usage is the same as original urllib. pass the url and optionally data to post to an HTTP URL, and get a file-like object back. One difference is that you can also pass a Request instance instead of URL. Raises a URLError (subclass of IOError); for HTTP errors, raises an HTTPError, which can also be treated as a valid response. -build_opener -- function that creates a new OpenerDirector instance. -will install the default handlers. accepts one or more Handlers as +build_opener -- Function that creates a new OpenerDirector instance. +Will install the default handlers. Accepts one or more Handlers as arguments, either instances or Handler classes that it will -instantiate. if one of the argument is a subclass of the default +instantiate. If one of the argument is a subclass of the default handler, the argument will be installed instead of the default. -install_opener -- installs a new opener as the default opener. +install_opener -- Installs a new opener as the default opener. objects of interest: OpenerDirector -- -Request -- an object that encapsulates the state of a request. the -state can be a simple as the URL. it can also include extra HTTP +Request -- An object that encapsulates the state of a request. The +state can be as simple as the URL. It can also include extra HTTP headers, e.g. a User-Agent. BaseHandler -- exceptions: -URLError-- a subclass of IOError, individual protocols have their own -specific subclass +URLError -- A subclass of IOError, individual protocols have their own +specific subclass. -HTTPError-- also a valid HTTP response, so you can treat an HTTP error -as an exceptional event or valid response +HTTPError -- Also a valid HTTP response, so you can treat an HTTP error +as an exceptional event or valid response. internals: BaseHandler and parent @@ -55,7 +55,10 @@ # set up authentication info authinfo = urllib2.HTTPBasicAuthHandler() -authinfo.add_password('realm', 'host', 'username', 'password') +authinfo.add_password(realm='PDQ Application', + uri='https://mahler:8092/site-updates.py', + user='klem', + passwd='geheim$parole') proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"}) @@ -104,7 +107,7 @@ from StringIO import StringIO from urllib import (unwrap, unquote, splittype, splithost, quote, - addinfourl, splitport, splitgophertype, splitquery, + addinfourl, splitport, splitquery, splitattr, ftpwrapper, noheaders, splituser, splitpasswd, splitvalue) # support for FileHandler, proxies via environment variables @@ -161,9 +164,6 @@ def __str__(self): return 'HTTP Error %s: %s' % (self.code, self.msg) -class GopherError(URLError): - pass - # copied from cookielib.py _cut_port_re = re.compile(r":\d+$") def request_host(request): @@ -334,7 +334,8 @@ added = True if added: - # XXX why does self.handlers need to be sorted? + # the handlers must work in an specific order, the order + # is specified in a Handler attribute bisect.insort(self.handlers, handler) handler.add_parent(self) @@ -486,7 +487,9 @@ def http_response(self, request, response): code, msg, hdrs = response.code, response.msg, response.info() - if code not in (200, 206): + # According to RFC 2616, "2xx" code indicates that the client's + # request was successfully received, understood, and accepted. + if not (200 <= code < 300): response = self.parent.error( 'http', request, response, code, msg, hdrs) @@ -766,11 +769,10 @@ class AbstractBasicAuthHandler: - rx = re.compile('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', re.I) + # XXX this allows for multiple auth-schemes, but will stupidly pick + # the last one with a realm specified. - # XXX there can actually be multiple auth-schemes in a - # www-authenticate header. should probably be a lot more careful - # in parsing them to extract multiple alternatives + rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', re.I) # XXX could pre-emptively send auth info already accepted (RFC 2617, # end of section 2, and section 1.2 immediately after "credentials" @@ -1214,19 +1216,23 @@ host = req.get_host() file = req.get_selector() localfile = url2pathname(file) - stats = os.stat(localfile) - size = stats.st_size - modified = email.utils.formatdate(stats.st_mtime, usegmt=True) - mtype = mimetypes.guess_type(file)[0] - headers = mimetools.Message(StringIO( - 'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' % - (mtype or 'text/plain', size, modified))) - if host: - host, port = splitport(host) - if not host or \ - (not port and socket.gethostbyname(host) in self.get_names()): - return addinfourl(open(localfile, 'rb'), - headers, 'file:'+file) + try: + stats = os.stat(localfile) + size = stats.st_size + modified = email.utils.formatdate(stats.st_mtime, usegmt=True) + mtype = mimetypes.guess_type(file)[0] + headers = mimetools.Message(StringIO( + 'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' % + (mtype or 'text/plain', size, modified))) + if host: + host, port = splitport(host) + if not host or \ + (not port and socket.gethostbyname(host) in self.get_names()): + return addinfourl(open(localfile, 'rb'), + headers, 'file:'+file) + except OSError, msg: + # urllib2 users shouldn't expect OSErrors coming from urlopen() + raise URLError(msg) raise URLError('file not on local host') class FTPHandler(BaseHandler): @@ -1333,22 +1339,3 @@ del self.timeout[k] break self.soonest = min(self.timeout.values()) - -class GopherHandler(BaseHandler): - def gopher_open(self, req): - # XXX can raise socket.error - import gopherlib # this raises DeprecationWarning in 2.5 - host = req.get_host() - if not host: - raise GopherError('no host given') - host = unquote(host) - selector = req.get_selector() - type, selector = splitgophertype(selector) - selector, query = splitquery(selector) - selector = unquote(selector) - if query: - query = unquote(query) - fp = gopherlib.send_query(selector, query, host) - else: - fp = gopherlib.send_selector(selector, host) - return addinfourl(fp, noheaders(), req.get_full_url()) Modified: python/branches/bcannon-objcap/Lib/wave.py ============================================================================== --- python/branches/bcannon-objcap/Lib/wave.py (original) +++ python/branches/bcannon-objcap/Lib/wave.py Fri May 25 22:13:08 2007 @@ -159,7 +159,12 @@ f = __builtin__.open(f, 'rb') self._i_opened_the_file = f # else, assume it is an open file object already - self.initfp(f) + try: + self.initfp(f) + except: + if self._i_opened_the_file: + f.close() + raise def __del__(self): self.close() @@ -297,7 +302,12 @@ if isinstance(f, basestring): f = __builtin__.open(f, 'wb') self._i_opened_the_file = f - self.initfp(f) + try: + self.initfp(f) + except: + if self._i_opened_the_file: + f.close() + raise def initfp(self, file): self._file = file Modified: python/branches/bcannon-objcap/Lib/webbrowser.py ============================================================================== --- python/branches/bcannon-objcap/Lib/webbrowser.py (original) +++ python/branches/bcannon-objcap/Lib/webbrowser.py Fri May 25 22:13:08 2007 @@ -2,6 +2,7 @@ """Interfaces for launching and remotely controlling Web browsers.""" import os +import shlex import sys import stat import subprocess @@ -32,7 +33,11 @@ for browser in alternatives: if '%s' in browser: # User gave us a command line, split it into name and args - return GenericBrowser(browser.split()) + browser = shlex.split(browser) + if browser[-1] == '&': + return BackgroundBrowser(browser[:-1]) + else: + return GenericBrowser(browser) else: # User gave us a browser name or path. try: @@ -437,19 +442,16 @@ # a console terminal or an X display to run. def register_X_browsers(): - # The default Gnome browser - if _iscommand("gconftool-2"): - # get the web browser string from gconftool - gc = 'gconftool-2 -g /desktop/gnome/url-handlers/http/command 2>/dev/null' - out = os.popen(gc) - commd = out.read().strip() - retncode = out.close() - - # if successful, register it - if retncode is None and commd: - register("gnome", None, BackgroundBrowser(commd.split())) - # First, the Mozilla/Netscape browsers + # The default GNOME browser + if "GNOME_DESKTOP_SESSION_ID" in os.environ and _iscommand("gnome-open"): + register("gnome-open", None, BackgroundBrowser("gnome-open")) + + # The default KDE browser + if "KDE_FULL_SESSION" in os.environ and _iscommand("kfmclient"): + register("kfmclient", Konqueror, Konqueror("kfmclient")) + + # The Mozilla/Netscape browsers for browser in ("mozilla-firefox", "firefox", "mozilla-firebird", "firebird", "seamonkey", "mozilla", "netscape"): @@ -508,17 +510,28 @@ if sys.platform[:3] == "win": class WindowsDefault(BaseBrowser): def open(self, url, new=0, autoraise=1): - os.startfile(url) - return True # Oh, my... + try: + os.startfile(url) + except WindowsError: + # [Error 22] No application is associated with the specified + # file for this operation: '' + return False + else: + return True _tryorder = [] _browsers = {} - # Prefer mozilla/netscape/opera if present + + # First try to use the default Windows browser + register("windows-default", WindowsDefault) + + # Detect some common Windows browsers, fallback to IE + iexplore = os.path.join(os.environ.get("PROGRAMFILES", "C:\\Program Files"), + "Internet Explorer\\IEXPLORE.EXE") for browser in ("firefox", "firebird", "seamonkey", "mozilla", - "netscape", "opera"): + "netscape", "opera", iexplore): if _iscommand(browser): register(browser, None, BackgroundBrowser(browser)) - register("windows-default", WindowsDefault) # # Platform support for MacOS Modified: python/branches/bcannon-objcap/Lib/xml/sax/saxutils.py ============================================================================== --- python/branches/bcannon-objcap/Lib/xml/sax/saxutils.py (original) +++ python/branches/bcannon-objcap/Lib/xml/sax/saxutils.py Fri May 25 22:13:08 2007 @@ -100,6 +100,17 @@ else: self._out.write(text.encode(self._encoding, _error_handling)) + def _qname(self, name): + """Builds a qualified name from a (ns_url, localname) pair""" + if name[0]: + # The name is in a non-empty namespace + prefix = self._current_context[name[0]] + if prefix: + # If it is not the default namespace, prepend the prefix + return prefix + ":" + name[1] + # Return the unqualified name + return name[1] + # ContentHandler methods def startDocument(self): @@ -125,29 +136,21 @@ self._write('' % name) def startElementNS(self, name, qname, attrs): - if name[0] is None: - # if the name was not namespace-scoped, use the unqualified part - name = name[1] - else: - # else try to restore the original prefix from the namespace - name = self._current_context[name[0]] + ":" + name[1] - self._write('<' + name) + self._write('<' + self._qname(name)) - for pair in self._undeclared_ns_maps: - self._write(' xmlns:%s="%s"' % pair) + for prefix, uri in self._undeclared_ns_maps: + if prefix: + self._out.write(' xmlns:%s="%s"' % (prefix, uri)) + else: + self._out.write(' xmlns="%s"' % uri) self._undeclared_ns_maps = [] for (name, value) in attrs.items(): - name = self._current_context[name[0]] + ":" + name[1] - self._write(' %s=%s' % (name, quoteattr(value))) + self._write(' %s=%s' % (self._qname(name), quoteattr(value))) self._write('>') def endElementNS(self, name, qname): - if name[0] is None: - name = name[1] - else: - name = self._current_context[name[0]] + ":" + name[1] - self._write('' % name) + self._write('' % self._qname(name)) def characters(self, content): self._write(escape(content)) Modified: python/branches/bcannon-objcap/Lib/zipfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/zipfile.py (original) +++ python/branches/bcannon-objcap/Lib/zipfile.py Fri May 25 22:13:08 2007 @@ -296,6 +296,259 @@ extra = extra[ln+4:] +class _ZipDecrypter: + """Class to handle decryption of files stored within a ZIP archive. + + ZIP supports a password-based form of encryption. Even though known + plaintext attacks have been found against it, it is still useful + for low-level securicy. + + Usage: + zd = _ZipDecrypter(mypwd) + plain_char = zd(cypher_char) + plain_text = map(zd, cypher_text) + """ + + def _GenerateCRCTable(): + """Generate a CRC-32 table. + + ZIP encryption uses the CRC32 one-byte primitive for scrambling some + internal keys. We noticed that a direct implementation is faster than + relying on binascii.crc32(). + """ + poly = 0xedb88320 + table = [0] * 256 + for i in range(256): + crc = i + for j in range(8): + if crc & 1: + crc = ((crc >> 1) & 0x7FFFFFFF) ^ poly + else: + crc = ((crc >> 1) & 0x7FFFFFFF) + table[i] = crc + return table + crctable = _GenerateCRCTable() + + def _crc32(self, ch, crc): + """Compute the CRC32 primitive on one byte.""" + return ((crc >> 8) & 0xffffff) ^ self.crctable[(crc ^ ord(ch)) & 0xff] + + def __init__(self, pwd): + self.key0 = 305419896 + self.key1 = 591751049 + self.key2 = 878082192 + for p in pwd: + self._UpdateKeys(p) + + def _UpdateKeys(self, c): + self.key0 = self._crc32(c, self.key0) + self.key1 = (self.key1 + (self.key0 & 255)) & 4294967295 + self.key1 = (self.key1 * 134775813 + 1) & 4294967295 + self.key2 = self._crc32(chr((self.key1 >> 24) & 255), self.key2) + + def __call__(self, c): + """Decrypt a single character.""" + c = ord(c) + k = self.key2 | 2 + c = c ^ (((k * (k^1)) >> 8) & 255) + c = chr(c) + self._UpdateKeys(c) + return c + +class ZipExtFile: + """File-like object for reading an archive member. + Is returned by ZipFile.open(). + """ + + def __init__(self, fileobj, zipinfo, decrypt=None): + self.fileobj = fileobj + self.decrypter = decrypt + self.bytes_read = 0L + self.rawbuffer = '' + self.readbuffer = '' + self.linebuffer = '' + self.eof = False + self.univ_newlines = False + self.nlSeps = ("\n", ) + self.lastdiscard = '' + + self.compress_type = zipinfo.compress_type + self.compress_size = zipinfo.compress_size + + self.closed = False + self.mode = "r" + self.name = zipinfo.filename + + # read from compressed files in 64k blocks + self.compreadsize = 64*1024 + if self.compress_type == ZIP_DEFLATED: + self.dc = zlib.decompressobj(-15) + + def set_univ_newlines(self, univ_newlines): + self.univ_newlines = univ_newlines + + # pick line separator char(s) based on universal newlines flag + self.nlSeps = ("\n", ) + if self.univ_newlines: + self.nlSeps = ("\r\n", "\r", "\n") + + def __iter__(self): + return self + + def next(self): + nextline = self.readline() + if not nextline: + raise StopIteration() + + return nextline + + def close(self): + self.closed = True + + def _checkfornewline(self): + nl, nllen = -1, -1 + if self.linebuffer: + # ugly check for cases where half of an \r\n pair was + # read on the last pass, and the \r was discarded. In this + # case we just throw away the \n at the start of the buffer. + if (self.lastdiscard, self.linebuffer[0]) == ('\r','\n'): + self.linebuffer = self.linebuffer[1:] + + for sep in self.nlSeps: + nl = self.linebuffer.find(sep) + if nl >= 0: + nllen = len(sep) + return nl, nllen + + return nl, nllen + + def readline(self, size = -1): + """Read a line with approx. size. If size is negative, + read a whole line. + """ + if size < 0: + size = sys.maxint + elif size == 0: + return '' + + # check for a newline already in buffer + nl, nllen = self._checkfornewline() + + if nl >= 0: + # the next line was already in the buffer + nl = min(nl, size) + else: + # no line break in buffer - try to read more + size -= len(self.linebuffer) + while nl < 0 and size > 0: + buf = self.read(min(size, 100)) + if not buf: + break + self.linebuffer += buf + size -= len(buf) + + # check for a newline in buffer + nl, nllen = self._checkfornewline() + + # we either ran out of bytes in the file, or + # met the specified size limit without finding a newline, + # so return current buffer + if nl < 0: + s = self.linebuffer + self.linebuffer = '' + return s + + buf = self.linebuffer[:nl] + self.lastdiscard = self.linebuffer[nl:nl + nllen] + self.linebuffer = self.linebuffer[nl + nllen:] + + # line is always returned with \n as newline char (except possibly + # for a final incomplete line in the file, which is handled above). + return buf + "\n" + + def readlines(self, sizehint = -1): + """Return a list with all (following) lines. The sizehint parameter + is ignored in this implementation. + """ + result = [] + while True: + line = self.readline() + if not line: break + result.append(line) + return result + + def read(self, size = None): + # act like file() obj and return empty string if size is 0 + if size == 0: + return '' + + # determine read size + bytesToRead = self.compress_size - self.bytes_read + + # adjust read size for encrypted files since the first 12 bytes + # are for the encryption/password information + if self.decrypter is not None: + bytesToRead -= 12 + + if size is not None and size >= 0: + if self.compress_type == ZIP_STORED: + lr = len(self.readbuffer) + bytesToRead = min(bytesToRead, size - lr) + elif self.compress_type == ZIP_DEFLATED: + if len(self.readbuffer) > size: + # the user has requested fewer bytes than we've already + # pulled through the decompressor; don't read any more + bytesToRead = 0 + else: + # user will use up the buffer, so read some more + lr = len(self.rawbuffer) + bytesToRead = min(bytesToRead, self.compreadsize - lr) + + # avoid reading past end of file contents + if bytesToRead + self.bytes_read > self.compress_size: + bytesToRead = self.compress_size - self.bytes_read + + # try to read from file (if necessary) + if bytesToRead > 0: + bytes = self.fileobj.read(bytesToRead) + self.bytes_read += len(bytes) + self.rawbuffer += bytes + + # handle contents of raw buffer + if self.rawbuffer: + newdata = self.rawbuffer + self.rawbuffer = '' + + # decrypt new data if we were given an object to handle that + if newdata and self.decrypter is not None: + newdata = ''.join(map(self.decrypter, newdata)) + + # decompress newly read data if necessary + if newdata and self.compress_type == ZIP_DEFLATED: + newdata = self.dc.decompress(newdata) + self.rawbuffer = self.dc.unconsumed_tail + if self.eof and len(self.rawbuffer) == 0: + # we're out of raw bytes (both from the file and + # the local buffer); flush just to make sure the + # decompressor is done + newdata += self.dc.flush() + # prevent decompressor from being used again + self.dc = None + + self.readbuffer += newdata + + + # return what the user asked for + if size is None or len(self.readbuffer) <= size: + bytes = self.readbuffer + self.readbuffer = '' + else: + bytes = self.readbuffer[:size] + self.readbuffer = self.readbuffer[size:] + + return bytes + + class ZipFile: """ Class with methods to open, read, write, close, list zip files. @@ -330,13 +583,21 @@ self.filelist = [] # List of ZipInfo instances for archive self.compression = compression # Method of compression self.mode = key = mode.replace('b', '')[0] + self.pwd = None # Check if we were passed a file-like object if isinstance(file, basestring): self._filePassed = 0 self.filename = file modeDict = {'r' : 'rb', 'w': 'wb', 'a' : 'r+b'} - self.fp = open(file, modeDict[mode]) + try: + self.fp = open(file, modeDict[mode]) + except IOError: + if mode == 'a': + mode = key = 'w' + self.fp = open(file, modeDict[mode]) + else: + raise else: self._filePassed = 1 self.fp = file @@ -461,56 +722,81 @@ """Return the instance of ZipInfo given 'name'.""" return self.NameToInfo[name] - def read(self, name): + def setpassword(self, pwd): + """Set default password for encrypted files.""" + self.pwd = pwd + + def read(self, name, pwd=None): """Return file bytes (as a string) for name.""" - if self.mode not in ("r", "a"): - raise RuntimeError, 'read() requires mode "r" or "a"' + return self.open(name, "r", pwd).read() + + def open(self, name, mode="r", pwd=None): + """Return file-like object for 'name'.""" + if mode not in ("r", "U", "rU"): + raise RuntimeError, 'open() requires mode "r", "U", or "rU"' if not self.fp: raise RuntimeError, \ "Attempt to read ZIP archive that was already closed" + + # Only open a new file for instances where we were not + # given a file object in the constructor + if self._filePassed: + zef_file = self.fp + else: + zef_file = open(self.filename, 'rb') + + # Get info object for name zinfo = self.getinfo(name) - filepos = self.fp.tell() - self.fp.seek(zinfo.header_offset, 0) + filepos = zef_file.tell() + + zef_file.seek(zinfo.header_offset, 0) # Skip the file header: - fheader = self.fp.read(30) + fheader = zef_file.read(30) if fheader[0:4] != stringFileHeader: raise BadZipfile, "Bad magic number for file header" fheader = struct.unpack(structFileHeader, fheader) - fname = self.fp.read(fheader[_FH_FILENAME_LENGTH]) + fname = zef_file.read(fheader[_FH_FILENAME_LENGTH]) if fheader[_FH_EXTRA_FIELD_LENGTH]: - self.fp.read(fheader[_FH_EXTRA_FIELD_LENGTH]) + zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH]) if fname != zinfo.orig_filename: raise BadZipfile, \ 'File name in directory "%s" and header "%s" differ.' % ( zinfo.orig_filename, fname) - bytes = self.fp.read(zinfo.compress_size) - self.fp.seek(filepos, 0) - if zinfo.compress_type == ZIP_STORED: - pass - elif zinfo.compress_type == ZIP_DEFLATED: - if not zlib: - raise RuntimeError, \ - "De-compression requires the (missing) zlib module" - # zlib compress/decompress code by Jeremy Hylton of CNRI - dc = zlib.decompressobj(-15) - bytes = dc.decompress(bytes) - # need to feed in unused pad byte so that zlib won't choke - ex = dc.decompress('Z') + dc.flush() - if ex: - bytes = bytes + ex - else: - raise BadZipfile, \ - "Unsupported compression method %d for file %s" % \ - (zinfo.compress_type, name) - crc = binascii.crc32(bytes) - if crc != zinfo.CRC: - raise BadZipfile, "Bad CRC-32 for file %s" % name - return bytes + # check for encrypted flag & handle password + is_encrypted = zinfo.flag_bits & 0x1 + zd = None + if is_encrypted: + if not pwd: + pwd = self.pwd + if not pwd: + raise RuntimeError, "File %s is encrypted, " \ + "password required for extraction" % name + + zd = _ZipDecrypter(pwd) + # The first 12 bytes in the cypher stream is an encryption header + # used to strengthen the algorithm. The first 11 bytes are + # completely random, while the 12th contains the MSB of the CRC, + # and is used to check the correctness of the password. + bytes = zef_file.read(12) + h = map(zd, bytes[0:12]) + if ord(h[11]) != ((zinfo.CRC>>24)&255): + raise RuntimeError, "Bad password for file %s" % name + + # build and return a ZipExtFile + if zd is None: + zef = ZipExtFile(zef_file, zinfo) + else: + zef = ZipExtFile(zef_file, zinfo, zd) + + # set universal newlines on ZipExtFile if necessary + if "U" in mode: + zef.set_univ_newlines(True) + return zef def _writecheck(self, zinfo): """Check for errors before writing a file to the archive.""" Modified: python/branches/bcannon-objcap/Misc/ACKS ============================================================================== --- python/branches/bcannon-objcap/Misc/ACKS (original) +++ python/branches/bcannon-objcap/Misc/ACKS Fri May 25 22:13:08 2007 @@ -29,12 +29,14 @@ Donovan Baarda Attila Babo Alfonso Baciero +Dwayne Bailey Stig Bakken Greg Ball Luigi Ballabio Michael J. Barber Chris Barker Quentin Barnes +Richard Barran Cesar Eduardo Barros Des Barry Ulf Bartelt @@ -106,6 +108,7 @@ Brett Cannon Mike Carlton Terry Carroll +Brian Leair Luke Kenneth Casson Leighton Donn Cave Per Cederqvist @@ -154,8 +157,10 @@ Jonathan Dasteel John DeGood Vincent Delft +Erik Demaine Roger Dev Toby Dickenson +Mark Dickinson Yves Dionne Daniel Dittmar Walter D?rwald @@ -200,6 +205,7 @@ Niels Ferguson Sebastian Fernandez Vincent Fiack +Tomer Filiba Russell Finn Nils Fischbeck Frederik Fix @@ -216,6 +222,7 @@ Peter Funk Geoff Furnish Lele Gaifax +Santiago Gala Yitzchak Gale Raymund Galvin Nitin Ganatra @@ -239,6 +246,7 @@ Eddy De Greef Duncan Grisby Dag Gruneau +Thomas G?ttler Michael Guravage Lars Gust?bel Barry Haddow @@ -270,6 +278,7 @@ Ivan Herman J?rgen Hermann Gary Herron +Thomas Herve Bernhard Herzog Magnus L. Hetland Raymond Hettinger @@ -324,6 +333,7 @@ Gregory K. Johnson Simon Johnston Evan Jones +Jeremy Jones Richard Jones Irmen de Jong Lucas de Jonge @@ -353,9 +363,11 @@ Lenny Kneler Pat Knight Greg Kochanski +Damon Kohler Joseph Koshy Bob Kras Holger Krekel +Fabian Kreutz Hannu Krosing Andrew Kuchling Vladimir Kushnir @@ -377,11 +389,13 @@ Kip Lehman Joerg Lehmann Marc-Andre Lemburg +Mark Levinson William Lewis Robert van Liere Martin Ligr Christopher Lindblad Eric Lindvall +Bjorn Lindqvist Per Lindqvist Nick Lockwood Stephanie Lockwood @@ -407,6 +421,7 @@ Doug Marien Alex Martelli Anthony Martin +S?bastien Martini Roger Masse Nick Mathewson Graham Matthews @@ -414,6 +429,7 @@ Greg McFarlane Michael McLay Gordon McMillan +Damien Miller Jay T. Miller Chris McDonough Andrew McNamara @@ -426,8 +442,10 @@ Steven Miale Trent Mick Chad Miller +Damien Miller Roman Milner Dom Mitchell +Dustin J. Mitchell Doug Moen Paul Moore The Dragon De Monsyne @@ -467,6 +485,7 @@ Mike Pall Todd R. Palmer Jan Palus +Peter Parente Alexandre Parenteau Dan Parisien Harri Pasanen @@ -554,6 +573,7 @@ Gregor Schmid Ralf Schmitt Peter Schneider-Kamp +Arvin Schnell Chad J. Schroeder Sam Schulenburg Stefan Schwarzer @@ -564,6 +584,7 @@ ??iga Seilnach Fred Sells Jiwon Seo +Jerry Seutter Denis Severson Ha Shao Bruce Sherwood @@ -687,6 +708,7 @@ Richard Wolff Gordon Worley Thomas Wouters +Heiko Wundram Doug Wyatt Ka-Ping Yee Bob Yodlowski Modified: python/branches/bcannon-objcap/Misc/BeOS-NOTES ============================================================================== --- python/branches/bcannon-objcap/Misc/BeOS-NOTES (original) +++ python/branches/bcannon-objcap/Misc/BeOS-NOTES Fri May 25 22:13:08 2007 @@ -39,5 +39,4 @@ make install -- Donn Cave (donn at oz.net) - October 4, 2000 +Maintainer: Mikael Jansson (mail at mikael.jansson.be) Modified: python/branches/bcannon-objcap/Misc/NEWS ============================================================================== --- python/branches/bcannon-objcap/Misc/NEWS (original) +++ python/branches/bcannon-objcap/Misc/NEWS Fri May 25 22:13:08 2007 @@ -12,6 +12,99 @@ Core and builtins ----------------- +- Add -3 option to the interpreter to warn about features that are + deprecated and will be changed/removed in Python 3.0. + +- Patch #1686487: you can now pass any mapping after '**' in function + calls. + +- except clauses may now be spelled either "except E, target:" or + "except E as target:". This is to provide forwards compatibility with + Python 3.0. + +- Deprecate BaseException.message as per PEP 352. + +- Bug #1303614: don't expose object's __dict__ when the dict is + inherited from a builtin base. + +- When __slots__ are set to a unicode string, make it work the same as + setting a plain string, ie don't expand to single letter identifiers. + +- Request #1191699: Slices can now be pickled. + +- Request #1193128: str.translate() now allows a None argument for + translations that only remove characters without re-mapping the + remaining characters. + +- Patch #1682205: a TypeError while unpacking an iterable is no longer + masked by a generic one with the message "unpack non-sequence". + +- Remove unused file Python/fmod.c. + +- Bug #1683368: The object.__init__() and object.__new__() methods are + now stricter in rejecting excess arguments. The only time when + either allows excess arguments is when it is not overridden and the + other one is. For backwards compatibility, when both are + overridden, it is a deprecation warning (for now; maybe a Py3k + warning later). Also, type.__init__() insists on the same signature + as supported by type.__new__(). + +- Patch #1675423: PyComplex_AsCComplex() now tries to convert an object + to complex using its __complex__() method before falling back to the + __float__() method. Therefore, the functions in the cmath module now + can operate on objects that define a __complex__() method. + +- Patch #1623563: allow __class__ assignment for classes with __slots__. + The old and the new class are still required to have the same slot names. + +- Patch #1642547: Fix an error/crash when encountering syntax errors in + complex if statements. + +- Patch #1462488: Python no longer segfaults when ``object.__reduce_ex__()`` + is called with an object that is faking its type. + +- Patch #1680015: Don't modify __slots__ tuple if it contains an unicode + name. + +- Patch #1444529: the builtin compile() now accepts keyword arguments. + +- Bug #1678647: write a newline after printing an exception in any + case, even when converting the value to a string failed. + +- The dir() function has been extended to call the __dir__() method on + its argument, if it exists. If not, it will work like before. This allows + customizing the output of dir() in the presence of a __getattr__(). + +- Patch #922167: Python no longer segfaults when faced with infinitely + self-recursive reload() calls (as reported by bug #742342). + +- Patch #1675981: remove unreachable code from ``type.__new__()`` method. + +- Patch #1491866: change the complex() constructor to allow parthensized + forms. This means complex(repr(x)) now works instead of raising a + ValueError. + +- Patch #703779: unset __file__ in __main__ after running a file. This + makes the filenames the warning module prints much more sensible when + a PYTHONSTARTUP file is used. + +- Variant of patch #697613: don't exit the interpreter on a SystemExit + exception if the -i command line option or PYTHONINSPECT environment + variable is given, but break into the interactive interpreter just like + on other exceptions or normal program exit. + +- Patch #1638879: don't accept strings with embedded NUL bytes in long(). + +- Bug #1674503: close the file opened by execfile() in an error condition. + +- Patch #1674228: when assigning a slice (old-style), check for the + sq_ass_slice instead of the sq_slice slot. + +- When printing an unraisable error, don't print exceptions. before the name. + This duplicates the behavior whening normally printing exceptions. + +- Bug #1653736: Properly discard third argument to slot_nb_inplace_power. + - PEP 352: Raising a string exception now triggers a TypeError. Attempting to catch a string exception raises DeprecationWarning. @@ -24,9 +117,6 @@ - patch #1630975: Fix crash when replacing sys.stdout in sitecustomize.py -- Patch #1507247: tarfile.py: use current umask for intermediate - directories. - - Bug #1637022: Prefix AST symbols with _Py_. - Prevent seg fault on shutdown which could occur if an object @@ -122,10 +212,227 @@ - with and as are now keywords. +- Bug #1664966: Fix crash in exec if Unicode filename can't be decoded. Library ------- +- urllib.ftpwrapper class now accepts an optional timeout. + +- shlex.split() now has an optional "posix" parameter. + +- The posixfile module now raises a DeprecationWarning. + +- Remove the gopherlib module. This also leads to the removal of gopher + support in urllib/urllib2. + +- Fix bug in marshal where bad data would cause a segfault due to + lack of an infinite recursion check. + +- Removed plat-freebsd2 and plat-freebsd3 directories (and IN.py in + the directories). + +- HTML-escape the plain traceback in cgitb's HTML output, to prevent + the traceback inadvertently or maliciously closing the comment and + injecting HTML into the error page. + +- The popen2 module and os.popen* are deprecated. Use the subprocess module. + +- Added an optional credentials argument to SMTPHandler, for use with SMTP + servers which require authentication. + +- Patch #1695948: Added optional timeout parameter to SocketHandler. + +- Bug #1652788: Minor fix for currentframe. + +- Patch #1598415: Added WatchedFileHandler to better support external + log file rotation using e.g. newsyslog or logrotate. This handler is + only useful in Unix/Linux environments. + +- Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file + (as opposed to the command line) will now write file names ending in + ".cpp" too. + +- As specified in RFC 2616, an HTTP response like 2xx indicates that + the client's request was successfully received, understood, and accepted. + Now in these cases no error is raised in urllib2. + +- Bug #1290505: time.strptime's internal cache of locale information is now + properly recreated when the locale is changed. + +- Patch #1685563: remove (don't add) duplicate paths in distutils.MSVCCompiler. + +- Added a timeout parameter to the constructor of other protocols + (telnetlib, ftplib, smtplib and poplib). This is second part of the + work started with create_connection() and timeout in httplib, and + closes patch #723312. + +- Patch #1676823: Added create_connection() to socket.py, which may be + called with a timeout, and use it from httplib (whose HTTPConnection + and HTTPSConnection now accept an optional timeout). + +- Bug #978833: Revert r50844, as it broke _socketobject.dup. + +- Bug #1675967: re patterns pickled with Python 2.4 and earlier can + now be unpickled with Python 2.5 and newer. + +- Patch #1630118: add a SpooledTemporaryFile class to tempfile.py. + +- Patch #1273829: os.walk() now has a "followlinks" parameter. If set to + True (which is not the default), it visits symlinks pointing to + directories. + +- Bug #1681228: the webbrowser module now correctly uses the default + GNOME or KDE browser, depending on whether there is a session of one + of those present. Also, it tries the Windows default browser before + trying Mozilla variants. + +- Patch #1339796: add a relpath() function to os.path. + +- Patch #1681153: the wave module now closes a file object it opened if + initialization failed. + +- Bug #767111: fix long-standing bug in urllib which caused an + AttributeError instead of an IOError when the server's response didn't + contain a valid HTTP status line. + +- Patch #957650: "%var%" environment variable references are now properly + expanded in ntpath.expandvars(), also "~user" home directory references + are recognized and handled on Windows. + +- Patch #1429539: pdb now correctly initializes the __main__ module for + the debugged script, which means that imports from __main__ work + correctly now. + +- The nonobvious commands.getstatus() function is now deprecated. + +- Patch #1393667: pdb now has a "run" command which restarts the debugged + Python program, optionally with different arguments. + +- Patch #1649190: Adding support for _Bool to ctypes as c_bool. + +- Patch #1530482: add pydoc.render_doc() which returns the documentation + for a thing instead of paging it to stdout, which pydoc.doc() does. + +- Patch #1533909: the timeit module now accepts callables in addition to + strings for the code to time and the setup code. Also added two + convenience functions for instantiating a Timer and calling its methods. + +- Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter + which can be set to False to prevent the default delete-on-close + behavior. + +- Patch #1581073: add a flag to textwrap that prevents the dropping of + whitespace while wrapping. + +- Patch #1603688: ConfigParser.SafeConfigParser now checks values that + are set for invalid interpolation sequences that would lead to errors + on reading back those values. + +- Added support for the POSIX.1-2001 (pax) format to tarfile.py. Extended + and cleaned up the test suite. Added a new testtar.tar. + +- Patch #1449244: Support Unicode strings in + email.message.Message.{set_charset,get_content_charset}. + +- Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to + pydoc's help keywords. + +- Patch #1555098: use str.join() instead of repeated string + concatenation in robotparser. + +- Patch #1635454: the csv.DictWriter class now includes the offending + field names in its exception message if you try to write a record with + a dictionary containing fields not in the CSV field names list. + +- Patch #1668100: urllib2 now correctly raises URLError instead of + OSError if accessing a local file via the file:// protocol fails. + +- Patch #1677862: Require a space or tab after import in .pth files. + +- Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap + the IndexError caused by passing in an invalid breakpoint number. + +- Patch #1599845: Add an option to disable the implicit calls to server_bind() + and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer + and DocXMLRPCServer. + +- Bug #1531963: Make SocketServer.TCPServer's server_address always + be equal to calling getsockname() on the server's socket. Fixed by + patch #1545011. + +- Bug #1651235: When a tuple was passed to a ctypes function call, + Python would crash instead of raising an error. + +- Bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0) + returned string up to the first NUL character. + +- Patch #957003: Implement smtplib.LMTP. + +- Patch #1481079: add support for HTTP_REFERER to CGIHTTPServer. + +- Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', ''). + +- unittest now verifies more of its assumptions. In particular, TestCase + and TestSuite subclasses (not instances) are no longer accepted in + TestSuite.addTest(). This should cause no incompatibility since it + never made sense with ordinary subclasses -- the failure just occurred + later, with a more cumbersome exception. + +- Patch #787789: allow to pass custom TestRunner instances to unittest's + main() function. + +- Patches #1550273, #1550272: fix a few bugs in unittest and add a + comprehensive test suite for the module. + +- Patch #1001604: glob.glob() now returns unicode filenames if it was + given a unicode argument and os.listdir() returns unicode filenames. + +- Patch #1673619: setup.py identifies extension modules it doesn't know how + to build and those it knows how to build but that fail to build. + +- Patch #912410: Replace HTML entity references for attribute values + in HTMLParser. + +- Patch #1663234: you can now run doctest on test files and modules + using "python -m doctest [-v] filename ...". + +- Patch #1121142: Implement ZipFile.open. + +- Taught setup.py how to locate Berkeley DB on Macs using MacPorts. + +- Added heapq.merge() for merging sorted input streams. + +- Added collections.NamedTuple() for assigning field names to tuples. + +- Added itertools.izip_longest(). + +- Have the encoding package's search function dynamically import using absolute + import semantics. + +- Patch #1647484: Renamed GzipFile's filename attribute to name. + +- Patch #1517891: Mode 'a' for ZipFile now creates the file if it + doesn't exist. + +- Patch #698833: Support file decryption in zipfile. + +- Patch #685268: Consider a package's __path__ in imputil. + +- Patch 1463026: Support default namespace in XMLGenerator. + +- Patch 1571379: Make trace's --ignore-dir facility work in the face of + relative directory names. + +- Bug #1600860: Search for shared python library in LIBDIR, + not lib/python/config, on "linux" and "gnu" systems. + +- Patch #1652681: tarfile.py: create nonexistent files in append mode and + allow appending to empty files. + +- Bug #1124861: Automatically create pipes if GetStdHandle fails in + subprocess. + - Patch #1634778: add missing encoding aliases for iso8859_15 and iso8859_16. @@ -135,7 +442,8 @@ - Bug #1643943: Fix time.strptime's support for the %U directive. -- Patch #1643874: memory leak in ctypes fixed. +- Patch #1507247: tarfile.py: use current umask for intermediate + directories. - Patch #1627441: close sockets properly in urllib2. @@ -192,7 +500,7 @@ - Patch #1604907: Fix problems in logging.handlers caused at logging shutdown when syslog handlers fail to initialize because of syslogd problems. -- Patch #1608267: fix a race condition in os.makedirs() is the directory +- Patch #1608267: fix a race condition in os.makedirs() if the directory to be created is already there. - Patch #1610437: fix a tarfile bug with long filename headers. @@ -332,15 +640,45 @@ - Bug #1531862: Do not close standard file descriptors in subprocess. -- fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments - were transposed. - - idle: Honor the "Cancel" action in the save dialog (Debian bug #299092). +- Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the + first chunk fed to the decoder started with a BOM, but was longer than 3 bytes. Extension Modules ----------------- +- Removed the rgbimg module; been deprecated since Python 2.5. + +- Bug #1721309: prevent bsddb module from freeing random memory. + +- Bug #1686475: Support stat'ing open files on Windows again. + +- Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters + with ASCII value less than 32. Also, it correctly quotes dots only if + they occur on a single line, as opposed to the previous behavior of + quoting dots if they are the second character of any line. + +- Bug #1622896: fix a rare corner case where the bz2 module raised an + error in spite of a succesful compression. + +- Patch #1654417: make operator.{get,set,del}slice use the full range + of Py_ssize_t. + +- Patch #1646728: datetime.fromtimestamp fails with negative + fractional times. With unittest. + +- Patch #1490190: posixmodule now includes os.chflags() and os.lchflags() + functions on platforms where the underlying system calls are available. + +- Patch #1494140: Add documentation for the new struct.Struct object. + +- Patch #1432399: Support the HCI protocol for bluetooth sockets + +- Patch #1657276: Make NETLINK_DNRTMSG conditional. + +- Bug #1653736: Complain about keyword arguments to time.isoformat. + - Bug #1486663: don't reject keyword arguments for subclasses of builtin types. @@ -400,12 +738,29 @@ been defined. This prevents an interactive Python from waking up 10 times per second. Patch by Richard Boulton. +- fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments + were transposed. + - Added support for linking the bsddb module against BerkeleyDB 4.5.x. +- Bug #1633621: if curses.resizeterm() or curses.resize_term() is called, + update _curses.LINES, _curses.COLS, curses.LINES and curses.COLS. + +- Fix an off-by-one bug in locale.strxfrm(). + Tests ----- +- Capture socket connection resets and timeouts in test_socket_ssl and + test_urllib2net and raise test.test_support.ResourceDenied. + +- Patch #1559413: Fix test_cmd_line if sys.executable contains a space. + +- Added test.test_support.TransientResource which is a context manager to + surround calls to resources that are not guaranteed to work even if + test.test_support.requires says that the resource should exist. + - Added a test for slicing of an exception. - Added test.test_support.EnvironmentVarGuard. It's a class that provides a @@ -423,6 +778,9 @@ - Fix bsddb test_basics.test06_Transactions to check the version number properly. +- test.test_support.catch_warning is a new context manager that can be used + to catch the warnings issued by the warning framework. + Tools ----- @@ -441,6 +799,25 @@ Documentation ------------- +- Patch #1698768: updated the "using Python on the Mac" intro. + +- Bug #1569057: Document that calling file.next() when the file is open for + writing is undefined. + +- Patch #1489771: the syntax rules in Python Reference Manual were + updated to reflect the current Python syntax. + +- Patch #1686451: Fix return type for + PySequence_{Count,Index,Fast_GET_SIZE}. + +- Patch #1679379: add documentation for fnmatch.translate(). + +- Bug #1629566: clarify the docs on the return values of parsedate() + and parsedate_tz() in email.utils and rfc822. + +- Patch #1671450: add a section about subclassing builtin types to the + "extending and embedding" tutorial. + - Bug #1629125: fix wrong data type (int -> Py_ssize_t) in PyDict_Next docs. @@ -472,6 +849,15 @@ Build ----- +- Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS + returned by python-config if Python was built with --enable-shared + because that prevented the shared library from being used. + +- Patch #1569798: fix a bug in distutils when building Python from a + directory within sys.exec_prefix. + +- Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86. + - Disable _XOPEN_SOURCE on NetBSD 1.x. - configure now checks whether gcc supports the PyArg_ParseTuple format @@ -509,6 +895,10 @@ Mac --- +- Removed the macfs module. It had been deprecated since Python 2.5. This + lead to the deprecation of macostools.touched() as it relied solely on macfs + and was a no-op under OS X. + What's New in Python 2.5 release candidate 1? ============================================= Modified: python/branches/bcannon-objcap/Misc/build.sh ============================================================================== --- python/branches/bcannon-objcap/Misc/build.sh (original) +++ python/branches/bcannon-objcap/Misc/build.sh Fri May 25 22:13:08 2007 @@ -47,6 +47,7 @@ FAILURE_SUBJECT="Python Regression Test Failures" #FAILURE_MAILTO="YOUR_ACCOUNT at gmail.com" FAILURE_MAILTO="python-checkins at python.org" +#FAILURE_CC="optional--uncomment and set to desired address" REMOTE_SYSTEM="neal at dinsdale.python.org" REMOTE_DIR="/data/ftp.python.org/pub/docs.python.org/dev/" @@ -66,7 +67,7 @@ # Note: test_XXX (none currently) really leak, but are disabled # so we don't send spam. Any test which really leaks should only # be listed here if there are also test cases under Lib/test/leakers. -LEAKY_TESTS="test_(XXX)" # Currently no tests should report spurious leaks. +LEAKY_TESTS="test_(cmd_line|socket)" # Skip these tests altogether when looking for leaks. These tests # do not need to be stored above in LEAKY_TESTS too. @@ -91,7 +92,12 @@ mail_on_failure() { if [ "$NUM_FAILURES" != "0" ]; then - mutt -s "$FAILURE_SUBJECT $1 ($NUM_FAILURES)" $FAILURE_MAILTO < $2 + dest=$FAILURE_MAILTO + # FAILURE_CC is optional. + if [ "$FAILURE_CC" != "" ]; then + dest="$dest -c $FAILURE_CC" + fi + mutt -s "$FAILURE_SUBJECT $1 ($NUM_FAILURES)" $dest < $2 fi } @@ -186,7 +192,7 @@ ## ensure that the reflog exists so the grep doesn't fail touch $REFLOG $PYTHON $REGRTEST_ARGS -R 4:3:$REFLOG -u network $LEAKY_SKIPS >& build/$F - NUM_FAILURES=`egrep -vc "$LEAKY_TESTS" $REFLOG` + NUM_FAILURES=`egrep -vc "($LEAKY_TESTS|sum=0)" $REFLOG` update_status "Testing refleaks ($NUM_FAILURES failures)" "$F" $start mail_on_failure "refleak" $REFLOG @@ -208,8 +214,19 @@ cd $DIR/Doc F="make-doc.out" start=`current_time` -make >& ../build/$F -err=$? +# Doc/commontex/boilerplate.tex is expected to always have an outstanding +# modification for the date. When a release is cut, a conflict occurs. +# This allows us to detect this problem and not try to build the docs +# which will definitely fail with a conflict. +CONFLICTED_FILE=commontex/boilerplate.tex +conflict_count=`grep -c "<<<" $CONFLICTED_FILE` +if [ $conflict_count != 0 ]; then + echo "Conflict detected in $CONFLICTED_FILE. Doc build skipped." > ../build/$F + err=1 +else + make >& ../build/$F + err=$? +fi update_status "Making doc" "$F" $start if [ $err != 0 ]; then NUM_FAILURES=1 @@ -224,4 +241,3 @@ rsync $RSYNC_OPTS html/* $REMOTE_SYSTEM:$REMOTE_DIR cd ../build rsync $RSYNC_OPTS index.html *.out $REMOTE_SYSTEM:$REMOTE_DIR/results/ - Modified: python/branches/bcannon-objcap/Misc/cheatsheet ============================================================================== --- python/branches/bcannon-objcap/Misc/cheatsheet (original) +++ python/branches/bcannon-objcap/Misc/cheatsheet Fri May 25 22:13:08 2007 @@ -41,6 +41,7 @@ -h print this help message and exit -i Inspect interactively after running script (also PYTHONINSPECT=x) and force prompts, even if stdin appears not to be a terminal +-m mod run library module as a script (terminates option list -O optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x) -OO remove doc-strings in addition to the -O optimizations -Q arg division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew @@ -51,6 +52,7 @@ -W arg : warning control (arg is action:message:category:module:lineno) -x Skip first line of source, allowing use of non-unix Forms of #!cmd -? Help! +-3 warn about Python 3.x incompatibilities -c Specify the command to execute (see next section). This terminates the command option list (following options are passed as arguments to the command). the name of a python file (.py) to execute read from stdin. @@ -2072,12 +2074,6 @@ sha Interface to the SHA message digest algorithm HMAC Keyed-Hashing for Message Authentication -- RFC 2104. -* Stdwin * Standard Window System - - stdwin Standard Window System interface - stdwinevents Stdwin event, command, and selection constants - rect Rectangle manipulation operations - * SGI IRIX * (4 & 5) al SGI audio facilities Modified: python/branches/bcannon-objcap/Misc/developers.txt ============================================================================== --- python/branches/bcannon-objcap/Misc/developers.txt (original) +++ python/branches/bcannon-objcap/Misc/developers.txt Fri May 25 22:13:08 2007 @@ -17,6 +17,25 @@ Permissions History ------------------- +- Alexandre Vassalotti was given SVN access on May 21 2007 + by MvL, for his Summer-of-Code project, mentored by + Brett Cannon. + +- Travis Oliphant was given SVN access on 17 Apr 2007 by MvL, + for implementing the extended buffer protocol. + +- Ziga Seilnacht was given SVN access on 09 Mar 2007 by MvL, + for general maintenance. + +- Pete Shinners was given SVN access on 04 Mar 2007 by NCN, + for PEP 3101 work in the sandbox. + +- Pat Maupin and Eric V. Smith were given SVN access on 28 Feb 2007 by NCN, + for PEP 3101 work in the sandbox. + +- Steven Bethard (SF name "bediviere") added to the SourceForge Python + project 26 Feb 2007, by NCN, as a tracker tech. + - Josiah Carlson (SF name "josiahcarlson") added to the SourceForge Python project 06 Jan 2007, by NCN, as a tracker tech. He will maintain asyncore. @@ -148,3 +167,4 @@ RDH: Raymond Hettinger TGP: Tim Peters DJG: David Goodger +MvL: Martin v. Loewis Modified: python/branches/bcannon-objcap/Misc/python-config.in ============================================================================== --- python/branches/bcannon-objcap/Misc/python-config.in (original) +++ python/branches/bcannon-objcap/Misc/python-config.in Fri May 25 22:13:08 2007 @@ -45,7 +45,9 @@ elif opt in ('--libs', '--ldflags'): libs = getvar('LIBS').split() + getvar('SYSLIBS').split() libs.append('-lpython'+pyver) - if opt == '--ldflags': + # add the prefix/lib/pythonX.Y/config dir, but only if there is no + # shared library in prefix/lib/. + if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'): libs.insert(0, '-L' + getvar('LIBPL')) print ' '.join(libs) Modified: python/branches/bcannon-objcap/Modules/Setup.dist ============================================================================== --- python/branches/bcannon-objcap/Modules/Setup.dist (original) +++ python/branches/bcannon-objcap/Modules/Setup.dist Fri May 25 22:13:08 2007 @@ -231,7 +231,6 @@ #audioop audioop.c # Operations on audio samples #imageop imageop.c # Operations on images -#rgbimg rgbimgmodule.c # Read SGI RGB image files (but coded portably) # Note that the _md5 and _sha modules are normally only built if the Modified: python/branches/bcannon-objcap/Modules/_bsddb.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_bsddb.c (original) +++ python/branches/bcannon-objcap/Modules/_bsddb.c Fri May 25 22:13:08 2007 @@ -749,6 +749,24 @@ Py_XDECREF(v); } + +/* The same, when the value is a time_t */ +static void _addTimeTToDict(PyObject* dict, char *name, time_t value) +{ + PyObject* v; + /* if the value fits in regular int, use that. */ +#ifdef HAVE_LONG_LONG + if (sizeof(time_t) > sizeof(long)) + v = PyLong_FromLongLong((PY_LONG_LONG) value); + else +#endif + v = PyInt_FromLong((long) value); + if (!v || PyDict_SetItemString(dict, name, v)) + PyErr_Clear(); + + Py_XDECREF(v); +} + #if (DBVER >= 43) /* add an db_seq_t to a dictionary using the given name as a key */ static void _addDb_seq_tToDict(PyObject* dict, char *name, db_seq_t value) @@ -1706,6 +1724,7 @@ CHECK_DB_NOT_CLOSED(self); if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; + CLEAR_DBT(data); if ( !make_dbt(dataobj, &data) || !checkTxnObj(txnobj, &txn) ) { @@ -4633,8 +4652,9 @@ } #define MAKE_ENTRY(name) _addIntToDict(d, #name, sp->st_##name) +#define MAKE_TIME_T_ENTRY(name)_addTimeTToDict(d, #name, sp->st_##name) - MAKE_ENTRY(time_ckp); + MAKE_TIME_T_ENTRY(time_ckp); MAKE_ENTRY(last_txnid); MAKE_ENTRY(maxtxns); MAKE_ENTRY(nactive); @@ -4647,6 +4667,7 @@ MAKE_ENTRY(region_nowait); #undef MAKE_ENTRY +#undef MAKE_TIME_T_ENTRY free(sp); return d; } Modified: python/branches/bcannon-objcap/Modules/_ctypes/_ctypes.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/_ctypes.c (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/_ctypes.c Fri May 25 22:13:08 2007 @@ -339,24 +339,6 @@ ((PyTypeObject *)type)->tp_name, ob_name); return NULL; } -#if 1 -/* XXX Remove this section ??? */ - /* tuple returned by byref: */ - /* ('i', addr, obj) */ - if (PyTuple_Check(value)) { - PyObject *ob; - StgDictObject *dict; - - dict = PyType_stgdict(type); - ob = PyTuple_GetItem(value, 2); - if (dict && ob && - 0 == PyObject_IsInstance(value, dict->proto)) { - Py_INCREF(value); - return value; - } - } -/* ... and leave the rest */ -#endif as_parameter = PyObject_GetAttrString(value, "_as_parameter_"); if (as_parameter) { @@ -1020,6 +1002,12 @@ } itemsize = itemdict->size; + if (length * itemsize < 0) { + PyErr_SetString(PyExc_OverflowError, + "array too large"); + return NULL; + } + itemalign = itemdict->align; stgdict->size = itemsize * length; @@ -1119,7 +1107,7 @@ */ -static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOv"; +static char *SIMPLE_TYPE_CHARS = "cbBhHiIlLdfuzZqQPXOvt"; static PyObject * c_wchar_p_from_param(PyObject *type, PyObject *value) @@ -2194,21 +2182,32 @@ 0, /* tp_free */ }; -static void CData_MallocBuffer(CDataObject *obj, StgDictObject *dict) +static int CData_MallocBuffer(CDataObject *obj, StgDictObject *dict) { if ((size_t)dict->size <= sizeof(obj->b_value)) { /* No need to call malloc, can use the default buffer */ obj->b_ptr = (char *)&obj->b_value; + /* The b_needsfree flag does not mean that we actually did + call PyMem_Malloc to allocate the memory block; instead it + means we are the *owner* of the memory and are responsible + for freeing resources associated with the memory. This is + also the reason that b_needsfree is exposed to Python. + */ obj->b_needsfree = 1; } else { /* In python 2.4, and ctypes 0.9.6, the malloc call took about 33% of the creation time for c_int(). */ obj->b_ptr = (char *)PyMem_Malloc(dict->size); + if (obj->b_ptr == NULL) { + PyErr_NoMemory(); + return -1; + } obj->b_needsfree = 1; memset(obj->b_ptr, 0, dict->size); } obj->b_size = dict->size; + return 0; } PyObject * @@ -2240,7 +2239,10 @@ cmem->b_base = (CDataObject *)base; cmem->b_index = index; } else { /* copy contents of adr */ - CData_MallocBuffer(cmem, dict); + if (-1 == CData_MallocBuffer(cmem, dict)) { + return NULL; + Py_DECREF(cmem); + } memcpy(cmem->b_ptr, adr, dict->size); cmem->b_index = index; } @@ -2453,7 +2455,10 @@ obj->b_objects = NULL; obj->b_length = dict->length; - CData_MallocBuffer(obj, dict); + if (-1 == CData_MallocBuffer(obj, dict)) { + Py_DECREF(obj); + return NULL; + } return (PyObject *)obj; } /*****************************************************************/ @@ -4537,9 +4542,9 @@ #endif static PyObject * -string_at(const char *ptr, Py_ssize_t size) +string_at(const char *ptr, int size) { - if (size == 0) + if (size == -1) return PyString_FromString(ptr); return PyString_FromStringAndSize(ptr, size); } @@ -4624,7 +4629,7 @@ static PyObject * wstring_at(const wchar_t *ptr, int size) { - if (size == 0) + if (size == -1) size = wcslen(ptr); return PyUnicode_FromWideChar(ptr, size); } Modified: python/branches/bcannon-objcap/Modules/_ctypes/callbacks.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/callbacks.c (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/callbacks.c Fri May 25 22:13:08 2007 @@ -383,8 +383,27 @@ return E_FAIL; } - result = PyObject_CallFunction(func, - "iii", rclsid, riid, ppv); + { + PyObject *py_rclsid = PyLong_FromVoidPtr(rclsid); + PyObject *py_riid = PyLong_FromVoidPtr(riid); + PyObject *py_ppv = PyLong_FromVoidPtr(ppv); + if (!py_rclsid || !py_riid || !py_ppv) { + Py_XDECREF(py_rclsid); + Py_XDECREF(py_riid); + Py_XDECREF(py_ppv); + Py_DECREF(func); + PyErr_WriteUnraisable(context ? context : Py_None); + return E_FAIL; + } + result = PyObject_CallFunctionObjArgs(func, + py_rclsid, + py_riid, + py_ppv, + NULL); + Py_DECREF(py_rclsid); + Py_DECREF(py_riid); + Py_DECREF(py_ppv); + } Py_DECREF(func); if (!result) { PyErr_WriteUnraisable(context ? context : Py_None); Modified: python/branches/bcannon-objcap/Modules/_ctypes/callproc.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/callproc.c (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/callproc.c Fri May 25 22:13:08 2007 @@ -64,6 +64,7 @@ #ifdef MS_WIN32 #include +#include #else #include "ctypes_dlfcn.h" #endif @@ -97,9 +98,9 @@ 0, NULL); if (n) { - while (isspace(lpMsgBuf[n-1])) + while (_istspace(lpMsgBuf[n-1])) --n; - lpMsgBuf[n] = '\0'; /* rstrip() */ + lpMsgBuf[n] = _T('\0'); /* rstrip() */ } return lpMsgBuf; } @@ -538,8 +539,10 @@ size += 1; /* terminating NUL */ size *= sizeof(wchar_t); pa->value.p = PyMem_Malloc(size); - if (!pa->value.p) + if (!pa->value.p) { + PyErr_NoMemory(); return -1; + } memset(pa->value.p, 0, size); pa->keep = PyCObject_FromVoidPtr(pa->value.p, PyMem_Free); if (!pa->keep) { @@ -1125,10 +1128,10 @@ Free the handle of an executable previously loaded by LoadLibrary.\n"; static PyObject *free_library(PyObject *self, PyObject *args) { - HMODULE hMod; - if (!PyArg_ParseTuple(args, "i:FreeLibrary", &hMod)) + void *hMod; + if (!PyArg_ParseTuple(args, PY_VOID_P_CODE ":FreeLibrary", &hMod)) return NULL; - if (!FreeLibrary(hMod)) + if (!FreeLibrary((HMODULE)hMod)) return PyErr_SetFromWindowsErr(GetLastError()); Py_INCREF(Py_None); return Py_None; @@ -1247,11 +1250,11 @@ static PyObject *py_dl_close(PyObject *self, PyObject *args) { - int handle; + void *handle; - if (!PyArg_ParseTuple(args, "i:dlclose", &handle)) + if (!PyArg_ParseTuple(args, PY_VOID_P_CODE ":dlclose", &handle)) return NULL; - if (dlclose((void*)handle)) { + if (dlclose(handle)) { PyErr_SetString(PyExc_OSError, ctypes_dlerror()); return NULL; @@ -1263,10 +1266,10 @@ static PyObject *py_dl_sym(PyObject *self, PyObject *args) { char *name; - int handle; + void *handle; void *ptr; - if (!PyArg_ParseTuple(args, "is:dlsym", &handle, &name)) + if (!PyArg_ParseTuple(args, PY_VOID_P_CODE "s:dlsym", &handle, &name)) return NULL; ptr = ctypes_dlsym((void*)handle, name); if (!ptr) { @@ -1274,7 +1277,7 @@ ctypes_dlerror()); return NULL; } - return Py_BuildValue("i", ptr); + return PyLong_FromVoidPtr(ptr); } #endif @@ -1286,12 +1289,12 @@ static PyObject * call_function(PyObject *self, PyObject *args) { - int func; + void *func; PyObject *arguments; PyObject *result; if (!PyArg_ParseTuple(args, - "iO!", + PY_VOID_P_CODE "O!", &func, &PyTuple_Type, &arguments)) return NULL; @@ -1317,12 +1320,12 @@ static PyObject * call_cdeclfunction(PyObject *self, PyObject *args) { - int func; + void *func; PyObject *arguments; PyObject *result; if (!PyArg_ParseTuple(args, - "iO!", + PY_VOID_P_CODE "O!", &func, &PyTuple_Type, &arguments)) return NULL; Modified: python/branches/bcannon-objcap/Modules/_ctypes/cfield.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/cfield.c (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/cfield.c Fri May 25 22:13:08 2007 @@ -725,6 +725,35 @@ } #endif +#ifdef HAVE_C99_BOOL +#define BOOL_TYPE _Bool +#else +#define BOOL_TYPE char +#undef SIZEOF__BOOL +#define SIZEOF__BOOL 1 +#endif + +static PyObject * +t_set(void *ptr, PyObject *value, unsigned size) +{ + switch (PyObject_IsTrue(value)) { + case -1: + return NULL; + case 0: + *(BOOL_TYPE *)ptr = 0; + _RET(value); + default: + *(BOOL_TYPE *)ptr = 1; + _RET(value); + } +} + +static PyObject * +t_get(void *ptr, unsigned size) +{ + return PyBool_FromLong((long)*(BOOL_TYPE *)ptr); +} + static PyObject * I_set(void *ptr, PyObject *value, unsigned size) { @@ -1337,7 +1366,7 @@ if (IsBadStringPtrA(*(char **)ptr, -1)) { PyErr_Format(PyExc_ValueError, "invalid string pointer %p", - ptr); + *(char **)ptr); return NULL; } #endif @@ -1397,7 +1426,7 @@ size *= sizeof(wchar_t); buffer = (wchar_t *)PyMem_Malloc(size); if (!buffer) - return NULL; + return PyErr_NoMemory(); memset(buffer, 0, size); keep = PyCObject_FromVoidPtr(buffer, PyMem_Free); if (!keep) { @@ -1422,9 +1451,17 @@ { wchar_t *p; p = *(wchar_t **)ptr; - if (p) + if (p) { +#if defined(MS_WIN32) && !defined(_WIN32_WCE) + if (IsBadStringPtrW(*(wchar_t **)ptr, -1)) { + PyErr_Format(PyExc_ValueError, + "invalid string pointer %p", + *(wchar_t **)ptr); + return NULL; + } +#endif return PyUnicode_FromWideChar(p, wcslen(p)); - else { + } else { Py_INCREF(Py_None); return Py_None; } @@ -1432,19 +1469,10 @@ #endif #ifdef MS_WIN32 -/* We cannot use SysFreeString as the PyCObject_FromVoidPtr - because of different calling convention -*/ -static void _my_SysFreeString(void *p) -{ - SysFreeString((BSTR)p); -} - static PyObject * BSTR_set(void *ptr, PyObject *value, unsigned size) { BSTR bstr; - PyObject *result; /* convert value into a PyUnicodeObject or NULL */ if (Py_None == value) { @@ -1472,19 +1500,15 @@ } else bstr = NULL; - if (bstr) { - result = PyCObject_FromVoidPtr((void *)bstr, _my_SysFreeString); - if (result == NULL) { - SysFreeString(bstr); - return NULL; - } - } else { - result = Py_None; - Py_INCREF(result); - } - + /* free the previous contents, if any */ + if (*(BSTR *)ptr) + SysFreeString(*(BSTR *)ptr); + + /* and store it */ *(BSTR *)ptr = bstr; - return result; + + /* We don't need to keep any other object */ + _RET(value); } @@ -1585,6 +1609,17 @@ { 'X', BSTR_set, BSTR_get, &ffi_type_pointer}, { 'v', vBOOL_set, vBOOL_get, &ffi_type_sshort}, #endif +#if SIZEOF__BOOL == 1 + { 't', t_set, t_get, &ffi_type_uchar}, /* Also fallback for no native _Bool support */ +#elif SIZEOF__BOOL == SIZEOF_SHORT + { 't', t_set, t_get, &ffi_type_ushort}, +#elif SIZEOF__BOOL == SIZEOF_INT + { 't', t_set, t_get, &ffi_type_uint, I_set_sw, I_get_sw}, +#elif SIZEOF__BOOL == SIZEOF_LONG + { 't', t_set, t_get, &ffi_type_ulong, L_set_sw, L_get_sw}, +#elif SIZEOF__BOOL == SIZEOF_LONG_LONG + { 't', t_set, t_get, &ffi_type_ulong, Q_set_sw, Q_get_sw}, +#endif /* SIZEOF__BOOL */ { 'O', O_set, O_get, &ffi_type_pointer}, { 0, NULL, NULL, NULL}, }; Modified: python/branches/bcannon-objcap/Modules/_ctypes/ctypes.h ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/ctypes.h (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/ctypes.h Fri May 25 22:13:08 2007 @@ -23,6 +23,12 @@ #define PY_LONG_LONG LONG_LONG #endif +#if SIZEOF_VOID_P == SIZEOF_LONG +#define PY_VOID_P_CODE "k" +#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG) +#define PY_VOID_P_CODE "K" +#endif + typedef struct tagPyCArgObject PyCArgObject; typedef struct tagCDataObject CDataObject; typedef PyObject *(* GETFUNC)(void *, unsigned size); Modified: python/branches/bcannon-objcap/Modules/_ctypes/libffi/configure ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/libffi/configure (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/libffi/configure Fri May 25 22:13:08 2007 @@ -934,7 +934,7 @@ else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi - cd "$ac_popdir" + cd $ac_popdir done fi @@ -1973,7 +1973,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2031,7 +2032,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2147,7 +2149,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2201,7 +2204,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2246,7 +2250,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2290,7 +2295,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2617,7 +2623,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2787,7 +2794,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2854,7 +2862,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3038,7 +3047,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3101,7 +3111,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3279,7 +3290,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3396,7 +3408,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3569,7 +3582,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3770,7 +3784,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3833,7 +3848,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3914,7 +3930,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4055,7 +4072,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4191,7 +4209,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4253,7 +4272,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4293,7 +4313,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4349,7 +4370,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4389,7 +4411,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4453,7 +4476,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4484,8 +4508,10 @@ esac else if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 -echo "$as_me: error: internal error: not reached in cross-compile" >&2;} + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF @@ -4597,7 +4623,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4659,7 +4686,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4699,7 +4727,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4755,7 +4784,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4795,7 +4825,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4859,7 +4890,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4890,8 +4922,10 @@ esac else if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 -echo "$as_me: error: internal error: not reached in cross-compile" >&2;} + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF @@ -4986,6 +5020,479 @@ fi +echo "$as_me:$LINENO: checking for _Bool support" >&5 +echo $ECHO_N "checking for _Bool support... $ECHO_C" >&6 +have_c99_bool=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +_Bool x; x = (_Bool)0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_C99_BOOL 1 +_ACEOF + + have_c99_bool=yes + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $have_c99_bool" >&5 +echo "${ECHO_T}$have_c99_bool" >&6 +if test "$have_c99_bool" = yes ; then +echo "$as_me:$LINENO: checking for _Bool" >&5 +echo $ECHO_N "checking for _Bool... $ECHO_C" >&6 +if test "${ac_cv_type__Bool+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((_Bool *) 0) + return 0; +if (sizeof (_Bool)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type__Bool=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type__Bool=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 +echo "${ECHO_T}$ac_cv_type__Bool" >&6 + +echo "$as_me:$LINENO: checking size of _Bool" >&5 +echo $ECHO_N "checking size of _Bool... $ECHO_C" >&6 +if test "${ac_cv_sizeof__Bool+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type__Bool" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof__Bool=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (_Bool), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (_Bool)); } +unsigned long ulongval () { return (long) (sizeof (_Bool)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (_Bool))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (_Bool)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (_Bool)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof__Bool=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (_Bool), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof__Bool=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof__Bool" >&5 +echo "${ECHO_T}$ac_cv_sizeof__Bool" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF__BOOL $ac_cv_sizeof__Bool +_ACEOF + + +fi + echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 if test "${ac_cv_c_bigendian+set}" = set; then @@ -5021,7 +5528,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5063,7 +5571,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5120,7 +5629,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5252,7 +5762,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5318,7 +5829,8 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6277,6 +6789,11 @@ + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ @@ -6315,12 +6832,6 @@ fi;; esac done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub Modified: python/branches/bcannon-objcap/Modules/_ctypes/libffi/configure.ac ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/libffi/configure.ac (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/libffi/configure.ac Fri May 25 22:13:08 2007 @@ -106,6 +106,17 @@ fi AC_SUBST(HAVE_LONG_DOUBLE) +AC_MSG_CHECKING(for _Bool support) +have_c99_bool=no +AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [ + AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.]) + have_c99_bool=yes +]) +AC_MSG_RESULT($have_c99_bool) +if test "$have_c99_bool" = yes ; then +AC_CHECK_SIZEOF(_Bool, 1) +fi + AC_C_BIGENDIAN AH_VERBATIM([WORDS_BIGENDIAN], [ Modified: python/branches/bcannon-objcap/Modules/_ctypes/libffi/fficonfig.h.in ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/libffi/fficonfig.h.in (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/libffi/fficonfig.h.in Fri May 25 22:13:08 2007 @@ -28,6 +28,9 @@ */ #undef HAVE_AS_SPARC_UA_PCREL +/* Define this if you have the type _Bool. */ +#undef HAVE_C99_BOOL + /* Define if __attribute__((visibility("hidden"))) is supported. */ #undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE @@ -103,6 +106,9 @@ /* The size of a `long double', as computed by sizeof. */ #undef SIZEOF_LONG_DOUBLE +/* The size of a `_Bool', as computed by sizeof. */ +#undef SIZEOF__BOOL + /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. Modified: python/branches/bcannon-objcap/Modules/_ctypes/libffi_msvc/ffitarget.h ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/libffi_msvc/ffitarget.h (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/libffi_msvc/ffitarget.h Fri May 25 22:13:08 2007 @@ -36,7 +36,11 @@ /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM +#ifndef _WIN64 typedef unsigned long ffi_arg; +#else +typedef unsigned __int64 ffi_arg; +#endif typedef signed long ffi_sarg; typedef enum ffi_abi { Modified: python/branches/bcannon-objcap/Modules/_ctypes/stgdict.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_ctypes/stgdict.c (original) +++ python/branches/bcannon-objcap/Modules/_ctypes/stgdict.c Fri May 25 22:13:08 2007 @@ -72,8 +72,10 @@ return 0; size = sizeof(ffi_type *) * (src->length + 1); dst->ffi_type_pointer.elements = PyMem_Malloc(size); - if (dst->ffi_type_pointer.elements == NULL) + if (dst->ffi_type_pointer.elements == NULL) { + PyErr_NoMemory(); return -1; + } memcpy(dst->ffi_type_pointer.elements, src->ffi_type_pointer.elements, size); @@ -359,6 +361,10 @@ total_align = align ? align : 1; stgdict->ffi_type_pointer.type = FFI_TYPE_STRUCT; stgdict->ffi_type_pointer.elements = PyMem_Malloc(sizeof(ffi_type *) * (basedict->length + len + 1)); + if (stgdict->ffi_type_pointer.elements == NULL) { + PyErr_NoMemory(); + return -1; + } memset(stgdict->ffi_type_pointer.elements, 0, sizeof(ffi_type *) * (basedict->length + len + 1)); memcpy(stgdict->ffi_type_pointer.elements, @@ -373,6 +379,10 @@ total_align = 1; stgdict->ffi_type_pointer.type = FFI_TYPE_STRUCT; stgdict->ffi_type_pointer.elements = PyMem_Malloc(sizeof(ffi_type *) * (len + 1)); + if (stgdict->ffi_type_pointer.elements == NULL) { + PyErr_NoMemory(); + return -1; + } memset(stgdict->ffi_type_pointer.elements, 0, sizeof(ffi_type *) * (len + 1)); ffi_ofs = 0; Modified: python/branches/bcannon-objcap/Modules/_cursesmodule.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_cursesmodule.c (original) +++ python/branches/bcannon-objcap/Modules/_cursesmodule.c Fri May 25 22:13:08 2007 @@ -35,19 +35,22 @@ /* -A number of SysV or ncurses functions don't have wrappers yet; if you need -a given function, add it and send a patch. Here's a list of currently -unsupported functions: +A number of SysV or ncurses functions don't have wrappers yet; if you +need a given function, add it and send a patch. See +http://www.python.org/dev/patches/ for instructions on how to submit +patches to Python. - addchnstr addchstr chgat color_set define_key +Here's a list of currently unsupported functions: + + addchnstr addchstr color_set define_key del_curterm delscreen dupwin inchnstr inchstr innstr keyok - mcprint mvaddchnstr mvaddchstr mvchgat mvcur mvinchnstr - mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr mvwchgat + mcprint mvaddchnstr mvaddchstr mvcur mvinchnstr + mvinchstr mvinnstr mmvwaddchnstr mvwaddchstr mvwinchnstr mvwinchstr mvwinnstr newterm restartterm ripoffline scr_dump scr_init scr_restore scr_set scrl set_curterm set_term setterm tgetent tgetflag tgetnum tgetstr tgoto timeout tputs - vidattr vidputs waddchnstr waddchstr wchgat + vidattr vidputs waddchnstr waddchstr wcolor_set winchnstr winchstr winnstr wmouse_trafo wscrl Low-priority: @@ -620,6 +623,56 @@ } #endif +/* chgat, added by Fabian Kreutz */ + +static PyObject * +PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args) +{ + int rtn; + int x, y; + int num = -1; + short color; + attr_t attr = A_NORMAL; + int use_xy = FALSE; + + switch (PyTuple_Size(args)) { + case 1: + if (!PyArg_ParseTuple(args,"l;attr", &attr)) + return NULL; + break; + case 2: + if (!PyArg_ParseTuple(args,"il;n,attr", &num, &attr)) + return NULL; + break; + case 3: + if (!PyArg_ParseTuple(args,"iil;int,int,attr", &y, &x, &attr)) + return NULL; + use_xy = TRUE; + break; + case 4: + if (!PyArg_ParseTuple(args,"iiil;int,int,n,attr", &y, &x, &num, &attr)) + return NULL; + use_xy = TRUE; + break; + default: + PyErr_SetString(PyExc_TypeError, "chgat requires 1 to 4 arguments"); + return NULL; + } + + color = (short)((attr >> 8) & 0xff); + attr = attr - (color << 8); + + if (use_xy == TRUE) { + rtn = mvwchgat(self->win,y,x,num,attr,color,NULL); + touchline(self->win,y,1); + } else { + getyx(self->win,y,x); + rtn = wchgat(self->win,num,attr,color,NULL); + touchline(self->win,y,1); + } + return PyCursesCheckERR(rtn, "chgat"); +} + static PyObject * PyCursesWindow_DelCh(PyCursesWindowObject *self, PyObject *args) @@ -1246,7 +1299,7 @@ PyCursesWindow_RedrawLine(PyCursesWindowObject *self, PyObject *args) { int beg, num; - if (!PyArg_ParseTuple(args,"ii;beg,num", &beg, &num)) + if (!PyArg_ParseTuple(args, "ii;beg,num", &beg, &num)) return NULL; return PyCursesCheckERR(wredrawln(self->win,beg,num), "redrawln"); } @@ -1428,6 +1481,7 @@ {"attron", (PyCFunction)PyCursesWindow_wattron, METH_VARARGS}, {"attrset", (PyCFunction)PyCursesWindow_wattrset, METH_VARARGS}, {"bkgd", (PyCFunction)PyCursesWindow_Bkgd, METH_VARARGS}, + {"chgat", (PyCFunction)PyCursesWindow_ChgAt, METH_VARARGS}, {"bkgdset", (PyCFunction)PyCursesWindow_BkgdSet, METH_VARARGS}, {"border", (PyCFunction)PyCursesWindow_Border, METH_VARARGS}, {"box", (PyCFunction)PyCursesWindow_Box, METH_VARARGS}, @@ -1479,7 +1533,7 @@ {"overwrite", (PyCFunction)PyCursesWindow_Overwrite, METH_VARARGS}, {"putwin", (PyCFunction)PyCursesWindow_PutWin, METH_VARARGS}, - {"redrawln", (PyCFunction)PyCursesWindow_RedrawLine}, + {"redrawln", (PyCFunction)PyCursesWindow_RedrawLine, METH_VARARGS}, {"redrawwin", (PyCFunction)PyCursesWindow_redrawwin, METH_NOARGS}, {"refresh", (PyCFunction)PyCursesWindow_Refresh, METH_VARARGS}, #ifndef STRICT_SYSV_CURSES @@ -2196,19 +2250,72 @@ } } +/* Internal helper used for updating curses.LINES, curses.COLS, _curses.LINES + * and _curses.COLS */ +static int +update_lines_cols(void) +{ + PyObject *o; + PyObject *m = PyImport_ImportModule("curses"); + + if (!m) + return 0; + + o = PyInt_FromLong(LINES); + if (!o) { + Py_DECREF(m); + return 0; + } + if (PyObject_SetAttrString(m, "LINES", o)) { + Py_DECREF(m); + Py_DECREF(o); + return 0; + } + if (PyDict_SetItemString(ModDict, "LINES", o)) { + Py_DECREF(m); + Py_DECREF(o); + return 0; + } + Py_DECREF(o); + o = PyInt_FromLong(COLS); + if (!o) { + Py_DECREF(m); + return 0; + } + if (PyObject_SetAttrString(m, "COLS", o)) { + Py_DECREF(m); + Py_DECREF(o); + return 0; + } + if (PyDict_SetItemString(ModDict, "COLS", o)) { + Py_DECREF(m); + Py_DECREF(o); + return 0; + } + Py_DECREF(o); + Py_DECREF(m); + return 1; +} + #ifdef HAVE_CURSES_RESIZETERM static PyObject * PyCurses_ResizeTerm(PyObject *self, PyObject *args) { int lines; int columns; + PyObject *result; PyCursesInitialised if (!PyArg_ParseTuple(args,"ii:resizeterm", &lines, &columns)) return NULL; - return PyCursesCheckERR(resizeterm(lines, columns), "resizeterm"); + result = PyCursesCheckERR(resizeterm(lines, columns), "resizeterm"); + if (!result) + return NULL; + if (!update_lines_cols()) + return NULL; + return result; } #endif @@ -2220,12 +2327,19 @@ int lines; int columns; + PyObject *result; + PyCursesInitialised if (!PyArg_ParseTuple(args,"ii:resize_term", &lines, &columns)) return NULL; - return PyCursesCheckERR(resize_term(lines, columns), "resize_term"); + result = PyCursesCheckERR(resize_term(lines, columns), "resize_term"); + if (!result) + return NULL; + if (!update_lines_cols()) + return NULL; + return result; } #endif /* HAVE_CURSES_RESIZE_TERM */ Modified: python/branches/bcannon-objcap/Modules/_localemodule.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_localemodule.c (original) +++ python/branches/bcannon-objcap/Modules/_localemodule.c Fri May 25 22:13:08 2007 @@ -360,7 +360,7 @@ buf = PyMem_Malloc(n1); if (!buf) return PyErr_NoMemory(); - n2 = strxfrm(buf, s, n1); + n2 = strxfrm(buf, s, n1) + 1; if (n2 > n1) { /* more space needed */ buf = PyMem_Realloc(buf, n2); Modified: python/branches/bcannon-objcap/Modules/_struct.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_struct.c (original) +++ python/branches/bcannon-objcap/Modules/_struct.c Fri May 25 22:13:08 2007 @@ -849,7 +849,7 @@ } while (--i > 0); /* Extend the sign bit. */ if (SIZEOF_LONG_LONG > f->size) - x |= -(x & (1L << ((8 * f->size) - 1))); + x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); @@ -1085,7 +1085,7 @@ } while (i > 0); /* Extend the sign bit. */ if (SIZEOF_LONG_LONG > f->size) - x |= -(x & (1L << ((8 * f->size) - 1))); + x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); @@ -1534,17 +1534,35 @@ static PyObject * s_unpack(PyObject *self, PyObject *inputstr) { + char *start; + Py_ssize_t len; + PyObject *args=NULL, *result; PyStructObject *soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); - if (inputstr == NULL || !PyString_Check(inputstr) || - PyString_GET_SIZE(inputstr) != soself->s_size) { - PyErr_Format(StructError, - "unpack requires a string argument of length %zd", - soself->s_size); - return NULL; + if (inputstr == NULL) + goto fail; + if (PyString_Check(inputstr) && + PyString_GET_SIZE(inputstr) == soself->s_size) { + return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); } - return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); + args = PyTuple_Pack(1, inputstr); + if (args == NULL) + return NULL; + if (!PyArg_ParseTuple(args, "s#:unpack", &start, &len)) + goto fail; + if (soself->s_size != len) + goto fail; + result = s_unpack_internal(soself, start); + Py_DECREF(args); + return result; + +fail: + Py_XDECREF(args); + PyErr_Format(StructError, + "unpack requires a string argument of length %zd", + soself->s_size); + return NULL; } PyDoc_STRVAR(s_unpack_from__doc__, @@ -1771,7 +1789,7 @@ {"pack", s_pack, METH_VARARGS, s_pack__doc__}, {"pack_into", s_pack_into, METH_VARARGS, s_pack_into__doc__}, {"unpack", s_unpack, METH_O, s_unpack__doc__}, - {"unpack_from", (PyCFunction)s_unpack_from, METH_KEYWORDS, + {"unpack_from", (PyCFunction)s_unpack_from, METH_VARARGS|METH_KEYWORDS, s_unpack_from__doc__}, {NULL, NULL} /* sentinel */ }; Modified: python/branches/bcannon-objcap/Modules/_tkinter.c ============================================================================== --- python/branches/bcannon-objcap/Modules/_tkinter.c (original) +++ python/branches/bcannon-objcap/Modules/_tkinter.c Fri May 25 22:13:08 2007 @@ -2698,8 +2698,8 @@ { {"willdispatch", Tkapp_WillDispatch, METH_NOARGS}, {"wantobjects", Tkapp_WantObjects, METH_VARARGS}, - {"call", Tkapp_Call, METH_OLDARGS}, - {"globalcall", Tkapp_GlobalCall, METH_OLDARGS}, + {"call", Tkapp_Call, METH_VARARGS}, + {"globalcall", Tkapp_GlobalCall, METH_VARARGS}, {"eval", Tkapp_Eval, METH_VARARGS}, {"globaleval", Tkapp_GlobalEval, METH_VARARGS}, {"evalfile", Tkapp_EvalFile, METH_VARARGS}, @@ -2720,7 +2720,7 @@ {"exprboolean", Tkapp_ExprBoolean, METH_VARARGS}, {"splitlist", Tkapp_SplitList, METH_VARARGS}, {"split", Tkapp_Split, METH_VARARGS}, - {"merge", Tkapp_Merge, METH_OLDARGS}, + {"merge", Tkapp_Merge, METH_VARARGS}, {"createcommand", Tkapp_CreateCommand, METH_VARARGS}, {"deletecommand", Tkapp_DeleteCommand, METH_VARARGS}, #ifdef HAVE_CREATEFILEHANDLER Modified: python/branches/bcannon-objcap/Modules/arraymodule.c ============================================================================== --- python/branches/bcannon-objcap/Modules/arraymodule.c (original) +++ python/branches/bcannon-objcap/Modules/arraymodule.c Fri May 25 22:13:08 2007 @@ -1147,12 +1147,19 @@ dict = Py_None; Py_INCREF(dict); } - result = Py_BuildValue("O(cs#)O", - array->ob_type, - array->ob_descr->typecode, - array->ob_item, - array->ob_size * array->ob_descr->itemsize, - dict); + if (array->ob_size > 0) { + result = Py_BuildValue("O(cs#)O", + array->ob_type, + array->ob_descr->typecode, + array->ob_item, + array->ob_size * array->ob_descr->itemsize, + dict); + } else { + result = Py_BuildValue("O(c)O", + array->ob_type, + array->ob_descr->typecode, + dict); + } Py_DECREF(dict); return result; } @@ -1738,6 +1745,8 @@ (objobjargproc)array_ass_subscr }; +static const void *emptybuf = ""; + static Py_ssize_t array_buffer_getreadbuf(arrayobject *self, Py_ssize_t index, const void **ptr) { @@ -1747,6 +1756,8 @@ return -1; } *ptr = (void *)self->ob_item; + if (*ptr == NULL) + *ptr = emptybuf; return self->ob_size*self->ob_descr->itemsize; } @@ -1759,6 +1770,8 @@ return -1; } *ptr = (void *)self->ob_item; + if (*ptr == NULL) + *ptr = emptybuf; return self->ob_size*self->ob_descr->itemsize; } Modified: python/branches/bcannon-objcap/Modules/binascii.c ============================================================================== --- python/branches/bcannon-objcap/Modules/binascii.c (original) +++ python/branches/bcannon-objcap/Modules/binascii.c Fri May 25 22:13:08 2007 @@ -1150,7 +1150,7 @@ /* XXX: this function has the side effect of converting all of * the end of lines to be the same depending on this detection * here */ - p = (unsigned char *) strchr((char *)data, '\n'); + p = (unsigned char *) memchr(data, '\n', datalen); if ((p != NULL) && (p > data) && (*(p-1) == '\r')) crlf = 1; @@ -1160,12 +1160,14 @@ if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || - ((data[in] == '.') && (linelen == 1)) || + ((data[in] == '.') && (linelen == 0) && + (data[in+1] == '\n' || data[in+1] == '\r' || data[in+1] == 0)) || (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ((data[in] < 33) && (data[in] != '\r') && (data[in] != '\n') && - (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) + (quotetabs || + (!quotetabs && ((data[in] != '\t') && (data[in] != ' ')))))) { if ((linelen + 3) >= MAXLINESIZE) { linelen = 0; @@ -1230,12 +1232,14 @@ if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || - ((data[in] == '.') && (linelen == 1)) || + ((data[in] == '.') && (linelen == 0) && + (data[in+1] == '\n' || data[in+1] == '\r' || data[in+1] == 0)) || (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ((data[in] < 33) && (data[in] != '\r') && (data[in] != '\n') && - (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) + (quotetabs || + (!quotetabs && ((data[in] != '\t') && (data[in] != ' ')))))) { if ((linelen + 3 )>= MAXLINESIZE) { odata[out++] = '='; Modified: python/branches/bcannon-objcap/Modules/bz2module.c ============================================================================== --- python/branches/bcannon-objcap/Modules/bz2module.c (original) +++ python/branches/bcannon-objcap/Modules/bz2module.c Fri May 25 22:13:08 2007 @@ -1592,6 +1592,8 @@ Util_CatchBZ2Error(bzerror); goto error; } + if (bzs->avail_in == 0) + break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); if (_PyString_Resize(&ret, bufsize) < 0) { @@ -1601,8 +1603,6 @@ bzs->next_out = BUF(ret) + (BZS_TOTAL_OUT(bzs) - totalout); bzs->avail_out = bufsize - (bzs->next_out - BUF(ret)); - } else if (bzs->avail_in == 0) { - break; } } @@ -1884,6 +1884,8 @@ Util_CatchBZ2Error(bzerror); goto error; } + if (bzs->avail_in == 0) + break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); if (_PyString_Resize(&ret, bufsize) < 0) { @@ -1894,8 +1896,6 @@ bzs->next_out = BUF(ret) + (BZS_TOTAL_OUT(bzs) - totalout); bzs->avail_out = bufsize - (bzs->next_out - BUF(ret)); - } else if (bzs->avail_in == 0) { - break; } } @@ -2173,6 +2173,13 @@ Py_DECREF(ret); return NULL; } + if (bzs->avail_in == 0) { + BZ2_bzDecompressEnd(bzs); + PyErr_SetString(PyExc_ValueError, + "couldn't find end of stream"); + Py_DECREF(ret); + return NULL; + } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); if (_PyString_Resize(&ret, bufsize) < 0) { @@ -2182,12 +2189,6 @@ } bzs->next_out = BUF(ret) + BZS_TOTAL_OUT(bzs); bzs->avail_out = bufsize - (bzs->next_out - BUF(ret)); - } else if (bzs->avail_in == 0) { - BZ2_bzDecompressEnd(bzs); - PyErr_SetString(PyExc_ValueError, - "couldn't find end of stream"); - Py_DECREF(ret); - return NULL; } } Modified: python/branches/bcannon-objcap/Modules/cPickle.c ============================================================================== --- python/branches/bcannon-objcap/Modules/cPickle.c (original) +++ python/branches/bcannon-objcap/Modules/cPickle.c Fri May 25 22:13:08 2007 @@ -533,11 +533,12 @@ self->buf_size = size; } else if (n > self->buf_size) { - self->buf = (char *)realloc(self->buf, n); - if (!self->buf) { + char *newbuf = (char *)realloc(self->buf, n); + if (!newbuf) { PyErr_NoMemory(); return -1; } + self->buf = newbuf; self->buf_size = n; } @@ -576,6 +577,7 @@ i = 0; while (1) { int bigger; + char *newbuf; for (; i < (self->buf_size - 1); i++) { if (feof(self->fp) || (self->buf[i] = getc(self->fp)) == '\n') { @@ -589,11 +591,12 @@ PyErr_NoMemory(); return -1; } - self->buf = (char *)realloc(self->buf, bigger); - if (!self->buf) { + newbuf = (char *)realloc(self->buf, bigger); + if (!newbuf) { PyErr_NoMemory(); return -1; } + self->buf = newbuf; self->buf_size = bigger; } } @@ -4365,17 +4368,19 @@ */ if ((self->num_marks + 1) >= self->marks_size) { + int *marks; s=self->marks_size+20; if (s <= self->num_marks) s=self->num_marks + 1; if (self->marks == NULL) - self->marks=(int *)malloc(s * sizeof(int)); + marks=(int *)malloc(s * sizeof(int)); else - self->marks=(int *)realloc(self->marks, + marks=(int *)realloc(self->marks, s * sizeof(int)); - if (! self->marks) { + if (!marks) { PyErr_NoMemory(); return -1; } + self->marks = marks; self->marks_size = s; } Modified: python/branches/bcannon-objcap/Modules/cStringIO.c ============================================================================== --- python/branches/bcannon-objcap/Modules/cStringIO.c (original) +++ python/branches/bcannon-objcap/Modules/cStringIO.c Fri May 25 22:13:08 2007 @@ -349,13 +349,17 @@ } if (position > self->buf_size) { + char *newbuf; self->buf_size*=2; if (self->buf_size <= position) self->buf_size=position+1; - self->buf = (char*) realloc(self->buf,self->buf_size); - if (!self->buf) { + newbuf = (char*) realloc(self->buf,self->buf_size); + if (!newbuf) { + free(self->buf); + self->buf = 0; self->buf_size=self->pos=0; return PyErr_NoMemory(); } + self->buf = newbuf; } else if (position < 0) position=0; @@ -376,6 +380,7 @@ O_cwrite(PyObject *self, const char *c, Py_ssize_t l) { Py_ssize_t newl; Oobject *oself; + char *newbuf; if (!IO__opencheck(IOOOBJECT(self))) return -1; oself = (Oobject *)self; @@ -387,12 +392,15 @@ assert(newl + 1 < INT_MAX); oself->buf_size = (int)(newl+1); } - oself->buf = (char*)realloc(oself->buf, oself->buf_size); - if (!oself->buf) { + newbuf = (char*)realloc(oself->buf, oself->buf_size); + if (!newbuf) { PyErr_SetString(PyExc_MemoryError,"out of memory"); + free(oself->buf); + oself->buf = 0; oself->buf_size = oself->pos = 0; return -1; } + oself->buf = newbuf; } memcpy(oself->buf+oself->pos,c,l); Deleted: /python/branches/bcannon-objcap/Modules/collectionsmodule.c ============================================================================== --- /python/branches/bcannon-objcap/Modules/collectionsmodule.c Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,1360 +0,0 @@ -#include "Python.h" -#include "structmember.h" - -/* collections module implementation of a deque() datatype - Written and maintained by Raymond D. Hettinger - Copyright (c) 2004 Python Software Foundation. - All rights reserved. -*/ - -/* The block length may be set to any number over 1. Larger numbers - * reduce the number of calls to the memory allocator but take more - * memory. Ideally, BLOCKLEN should be set with an eye to the - * length of a cache line. - */ - -#define BLOCKLEN 62 -#define CENTER ((BLOCKLEN - 1) / 2) - -/* A `dequeobject` is composed of a doubly-linked list of `block` nodes. - * This list is not circular (the leftmost block has leftlink==NULL, - * and the rightmost block has rightlink==NULL). A deque d's first - * element is at d.leftblock[leftindex] and its last element is at - * d.rightblock[rightindex]; note that, unlike as for Python slice - * indices, these indices are inclusive on both ends. By being inclusive - * on both ends, algorithms for left and right operations become - * symmetrical which simplifies the design. - * - * The list of blocks is never empty, so d.leftblock and d.rightblock - * are never equal to NULL. - * - * The indices, d.leftindex and d.rightindex are always in the range - * 0 <= index < BLOCKLEN. - * Their exact relationship is: - * (d.leftindex + d.len - 1) % BLOCKLEN == d.rightindex. - * - * Empty deques have d.len == 0; d.leftblock==d.rightblock; - * d.leftindex == CENTER+1; and d.rightindex == CENTER. - * Checking for d.len == 0 is the intended way to see whether d is empty. - * - * Whenever d.leftblock == d.rightblock, - * d.leftindex + d.len - 1 == d.rightindex. - * - * However, when d.leftblock != d.rightblock, d.leftindex and d.rightindex - * become indices into distinct blocks and either may be larger than the - * other. - */ - -typedef struct BLOCK { - struct BLOCK *leftlink; - struct BLOCK *rightlink; - PyObject *data[BLOCKLEN]; -} block; - -static block * -newblock(block *leftlink, block *rightlink, int len) { - block *b; - /* To prevent len from overflowing INT_MAX on 64-bit machines, we - * refuse to allocate new blocks if the current len is dangerously - * close. There is some extra margin to prevent spurious arithmetic - * overflows at various places. The following check ensures that - * the blocks allocated to the deque, in the worst case, can only - * have INT_MAX-2 entries in total. - */ - if (len >= INT_MAX - 2*BLOCKLEN) { - PyErr_SetString(PyExc_OverflowError, - "cannot add more blocks to the deque"); - return NULL; - } - b = PyMem_Malloc(sizeof(block)); - if (b == NULL) { - PyErr_NoMemory(); - return NULL; - } - b->leftlink = leftlink; - b->rightlink = rightlink; - return b; -} - -typedef struct { - PyObject_HEAD - block *leftblock; - block *rightblock; - int leftindex; /* in range(BLOCKLEN) */ - int rightindex; /* in range(BLOCKLEN) */ - int len; - long state; /* incremented whenever the indices move */ - PyObject *weakreflist; /* List of weak references */ -} dequeobject; - -static PyTypeObject deque_type; - -static PyObject * -deque_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - dequeobject *deque; - block *b; - - if (type == &deque_type && !_PyArg_NoKeywords("deque()", kwds)) - return NULL; - - /* create dequeobject structure */ - deque = (dequeobject *)type->tp_alloc(type, 0); - if (deque == NULL) - return NULL; - - b = newblock(NULL, NULL, 0); - if (b == NULL) { - Py_DECREF(deque); - return NULL; - } - - assert(BLOCKLEN >= 2); - deque->leftblock = b; - deque->rightblock = b; - deque->leftindex = CENTER + 1; - deque->rightindex = CENTER; - deque->len = 0; - deque->state = 0; - deque->weakreflist = NULL; - - return (PyObject *)deque; -} - -static PyObject * -deque_append(dequeobject *deque, PyObject *item) -{ - deque->state++; - if (deque->rightindex == BLOCKLEN-1) { - block *b = newblock(deque->rightblock, NULL, deque->len); - if (b == NULL) - return NULL; - assert(deque->rightblock->rightlink == NULL); - deque->rightblock->rightlink = b; - deque->rightblock = b; - deque->rightindex = -1; - } - Py_INCREF(item); - deque->len++; - deque->rightindex++; - deque->rightblock->data[deque->rightindex] = item; - Py_RETURN_NONE; -} - -PyDoc_STRVAR(append_doc, "Add an element to the right side of the deque."); - -static PyObject * -deque_appendleft(dequeobject *deque, PyObject *item) -{ - deque->state++; - if (deque->leftindex == 0) { - block *b = newblock(NULL, deque->leftblock, deque->len); - if (b == NULL) - return NULL; - assert(deque->leftblock->leftlink == NULL); - deque->leftblock->leftlink = b; - deque->leftblock = b; - deque->leftindex = BLOCKLEN; - } - Py_INCREF(item); - deque->len++; - deque->leftindex--; - deque->leftblock->data[deque->leftindex] = item; - Py_RETURN_NONE; -} - -PyDoc_STRVAR(appendleft_doc, "Add an element to the left side of the deque."); - -static PyObject * -deque_pop(dequeobject *deque, PyObject *unused) -{ - PyObject *item; - block *prevblock; - - if (deque->len == 0) { - PyErr_SetString(PyExc_IndexError, "pop from an empty deque"); - return NULL; - } - item = deque->rightblock->data[deque->rightindex]; - deque->rightindex--; - deque->len--; - deque->state++; - - if (deque->rightindex == -1) { - if (deque->len == 0) { - assert(deque->leftblock == deque->rightblock); - assert(deque->leftindex == deque->rightindex+1); - /* re-center instead of freeing a block */ - deque->leftindex = CENTER + 1; - deque->rightindex = CENTER; - } else { - prevblock = deque->rightblock->leftlink; - assert(deque->leftblock != deque->rightblock); - PyMem_Free(deque->rightblock); - prevblock->rightlink = NULL; - deque->rightblock = prevblock; - deque->rightindex = BLOCKLEN - 1; - } - } - return item; -} - -PyDoc_STRVAR(pop_doc, "Remove and return the rightmost element."); - -static PyObject * -deque_popleft(dequeobject *deque, PyObject *unused) -{ - PyObject *item; - block *prevblock; - - if (deque->len == 0) { - PyErr_SetString(PyExc_IndexError, "pop from an empty deque"); - return NULL; - } - assert(deque->leftblock != NULL); - item = deque->leftblock->data[deque->leftindex]; - deque->leftindex++; - deque->len--; - deque->state++; - - if (deque->leftindex == BLOCKLEN) { - if (deque->len == 0) { - assert(deque->leftblock == deque->rightblock); - assert(deque->leftindex == deque->rightindex+1); - /* re-center instead of freeing a block */ - deque->leftindex = CENTER + 1; - deque->rightindex = CENTER; - } else { - assert(deque->leftblock != deque->rightblock); - prevblock = deque->leftblock->rightlink; - PyMem_Free(deque->leftblock); - assert(prevblock != NULL); - prevblock->leftlink = NULL; - deque->leftblock = prevblock; - deque->leftindex = 0; - } - } - return item; -} - -PyDoc_STRVAR(popleft_doc, "Remove and return the leftmost element."); - -static PyObject * -deque_extend(dequeobject *deque, PyObject *iterable) -{ - PyObject *it, *item; - - it = PyObject_GetIter(iterable); - if (it == NULL) - return NULL; - - while ((item = PyIter_Next(it)) != NULL) { - deque->state++; - if (deque->rightindex == BLOCKLEN-1) { - block *b = newblock(deque->rightblock, NULL, - deque->len); - if (b == NULL) { - Py_DECREF(item); - Py_DECREF(it); - return NULL; - } - assert(deque->rightblock->rightlink == NULL); - deque->rightblock->rightlink = b; - deque->rightblock = b; - deque->rightindex = -1; - } - deque->len++; - deque->rightindex++; - deque->rightblock->data[deque->rightindex] = item; - } - Py_DECREF(it); - if (PyErr_Occurred()) - return NULL; - Py_RETURN_NONE; -} - -PyDoc_STRVAR(extend_doc, -"Extend the right side of the deque with elements from the iterable"); - -static PyObject * -deque_extendleft(dequeobject *deque, PyObject *iterable) -{ - PyObject *it, *item; - - it = PyObject_GetIter(iterable); - if (it == NULL) - return NULL; - - while ((item = PyIter_Next(it)) != NULL) { - deque->state++; - if (deque->leftindex == 0) { - block *b = newblock(NULL, deque->leftblock, - deque->len); - if (b == NULL) { - Py_DECREF(item); - Py_DECREF(it); - return NULL; - } - assert(deque->leftblock->leftlink == NULL); - deque->leftblock->leftlink = b; - deque->leftblock = b; - deque->leftindex = BLOCKLEN; - } - deque->len++; - deque->leftindex--; - deque->leftblock->data[deque->leftindex] = item; - } - Py_DECREF(it); - if (PyErr_Occurred()) - return NULL; - Py_RETURN_NONE; -} - -PyDoc_STRVAR(extendleft_doc, -"Extend the left side of the deque with elements from the iterable"); - -static int -_deque_rotate(dequeobject *deque, Py_ssize_t n) -{ - int i, len=deque->len, halflen=(len+1)>>1; - PyObject *item, *rv; - - if (len == 0) - return 0; - if (n > halflen || n < -halflen) { - n %= len; - if (n > halflen) - n -= len; - else if (n < -halflen) - n += len; - } - - for (i=0 ; in ; i--) { - item = deque_popleft(deque, NULL); - assert (item != NULL); - rv = deque_append(deque, item); - Py_DECREF(item); - if (rv == NULL) - return -1; - Py_DECREF(rv); - } - return 0; -} - -static PyObject * -deque_rotate(dequeobject *deque, PyObject *args) -{ - int n=1; - - if (!PyArg_ParseTuple(args, "|i:rotate", &n)) - return NULL; - if (_deque_rotate(deque, n) == 0) - Py_RETURN_NONE; - return NULL; -} - -PyDoc_STRVAR(rotate_doc, -"Rotate the deque n steps to the right (default n=1). If n is negative, rotates left."); - -static Py_ssize_t -deque_len(dequeobject *deque) -{ - return deque->len; -} - -static PyObject * -deque_remove(dequeobject *deque, PyObject *value) -{ - Py_ssize_t i, n=deque->len; - - for (i=0 ; ileftblock->data[deque->leftindex]; - int cmp = PyObject_RichCompareBool(item, value, Py_EQ); - - if (deque->len != n) { - PyErr_SetString(PyExc_IndexError, - "deque mutated during remove()."); - return NULL; - } - if (cmp > 0) { - PyObject *tgt = deque_popleft(deque, NULL); - assert (tgt != NULL); - Py_DECREF(tgt); - if (_deque_rotate(deque, i) == -1) - return NULL; - Py_RETURN_NONE; - } - else if (cmp < 0) { - _deque_rotate(deque, i); - return NULL; - } - _deque_rotate(deque, -1); - } - PyErr_SetString(PyExc_ValueError, "deque.remove(x): x not in deque"); - return NULL; -} - -PyDoc_STRVAR(remove_doc, -"D.remove(value) -- remove first occurrence of value."); - -static int -deque_clear(dequeobject *deque) -{ - PyObject *item; - - while (deque->len) { - item = deque_pop(deque, NULL); - assert (item != NULL); - Py_DECREF(item); - } - assert(deque->leftblock == deque->rightblock && - deque->leftindex - 1 == deque->rightindex && - deque->len == 0); - return 0; -} - -static PyObject * -deque_item(dequeobject *deque, int i) -{ - block *b; - PyObject *item; - int n, index=i; - - if (i < 0 || i >= deque->len) { - PyErr_SetString(PyExc_IndexError, - "deque index out of range"); - return NULL; - } - - if (i == 0) { - i = deque->leftindex; - b = deque->leftblock; - } else if (i == deque->len - 1) { - i = deque->rightindex; - b = deque->rightblock; - } else { - i += deque->leftindex; - n = i / BLOCKLEN; - i %= BLOCKLEN; - if (index < (deque->len >> 1)) { - b = deque->leftblock; - while (n--) - b = b->rightlink; - } else { - n = (deque->leftindex + deque->len - 1) / BLOCKLEN - n; - b = deque->rightblock; - while (n--) - b = b->leftlink; - } - } - item = b->data[i]; - Py_INCREF(item); - return item; -} - -/* delitem() implemented in terms of rotate for simplicity and reasonable - performance near the end points. If for some reason this method becomes - popular, it is not hard to re-implement this using direct data movement - (similar to code in list slice assignment) and achieve a two or threefold - performance boost. -*/ - -static int -deque_del_item(dequeobject *deque, Py_ssize_t i) -{ - PyObject *item; - - assert (i >= 0 && i < deque->len); - if (_deque_rotate(deque, -i) == -1) - return -1; - - item = deque_popleft(deque, NULL); - assert (item != NULL); - Py_DECREF(item); - - return _deque_rotate(deque, i); -} - -static int -deque_ass_item(dequeobject *deque, Py_ssize_t i, PyObject *v) -{ - PyObject *old_value; - block *b; - Py_ssize_t n, len=deque->len, halflen=(len+1)>>1, index=i; - - if (i < 0 || i >= len) { - PyErr_SetString(PyExc_IndexError, - "deque index out of range"); - return -1; - } - if (v == NULL) - return deque_del_item(deque, i); - - i += deque->leftindex; - n = i / BLOCKLEN; - i %= BLOCKLEN; - if (index <= halflen) { - b = deque->leftblock; - while (n--) - b = b->rightlink; - } else { - n = (deque->leftindex + len - 1) / BLOCKLEN - n; - b = deque->rightblock; - while (n--) - b = b->leftlink; - } - Py_INCREF(v); - old_value = b->data[i]; - b->data[i] = v; - Py_DECREF(old_value); - return 0; -} - -static PyObject * -deque_clearmethod(dequeobject *deque) -{ - int rv; - - rv = deque_clear(deque); - assert (rv != -1); - Py_RETURN_NONE; -} - -PyDoc_STRVAR(clear_doc, "Remove all elements from the deque."); - -static void -deque_dealloc(dequeobject *deque) -{ - PyObject_GC_UnTrack(deque); - if (deque->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) deque); - if (deque->leftblock != NULL) { - deque_clear(deque); - assert(deque->leftblock != NULL); - PyMem_Free(deque->leftblock); - } - deque->leftblock = NULL; - deque->rightblock = NULL; - deque->ob_type->tp_free(deque); -} - -static int -deque_traverse(dequeobject *deque, visitproc visit, void *arg) -{ - block *b; - PyObject *item; - int index; - int indexlo = deque->leftindex; - - for (b = deque->leftblock; b != NULL; b = b->rightlink) { - const int indexhi = b == deque->rightblock ? - deque->rightindex : - BLOCKLEN - 1; - - for (index = indexlo; index <= indexhi; ++index) { - item = b->data[index]; - Py_VISIT(item); - } - indexlo = 0; - } - return 0; -} - -static long -deque_nohash(PyObject *self) -{ - PyErr_SetString(PyExc_TypeError, "deque objects are unhashable"); - return -1; -} - -static PyObject * -deque_copy(PyObject *deque) -{ - return PyObject_CallFunctionObjArgs((PyObject *)(deque->ob_type), - deque, NULL); -} - -PyDoc_STRVAR(copy_doc, "Return a shallow copy of a deque."); - -static PyObject * -deque_reduce(dequeobject *deque) -{ - PyObject *dict, *result, *it; - - dict = PyObject_GetAttrString((PyObject *)deque, "__dict__"); - if (dict == NULL) { - PyErr_Clear(); - dict = Py_None; - Py_INCREF(dict); - } - it = PyObject_GetIter((PyObject *)deque); - if (it == NULL) { - Py_DECREF(dict); - return NULL; - } - result = Py_BuildValue("O()ON", deque->ob_type, dict, it); - Py_DECREF(dict); - return result; -} - -PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); - -static PyObject * -deque_repr(PyObject *deque) -{ - PyObject *aslist, *result, *fmt; - int i; - - i = Py_ReprEnter(deque); - if (i != 0) { - if (i < 0) - return NULL; - return PyString_FromString("[...]"); - } - - aslist = PySequence_List(deque); - if (aslist == NULL) { - Py_ReprLeave(deque); - return NULL; - } - - fmt = PyString_FromString("deque(%r)"); - if (fmt == NULL) { - Py_DECREF(aslist); - Py_ReprLeave(deque); - return NULL; - } - result = PyString_Format(fmt, aslist); - Py_DECREF(fmt); - Py_DECREF(aslist); - Py_ReprLeave(deque); - return result; -} - -static int -deque_tp_print(PyObject *deque, FILE *fp, int flags) -{ - PyObject *it, *item; - char *emit = ""; /* No separator emitted on first pass */ - char *separator = ", "; - int i; - - i = Py_ReprEnter(deque); - if (i != 0) { - if (i < 0) - return i; - fputs("[...]", fp); - return 0; - } - - it = PyObject_GetIter(deque); - if (it == NULL) - return -1; - - fputs("deque([", fp); - while ((item = PyIter_Next(it)) != NULL) { - fputs(emit, fp); - emit = separator; - if (PyObject_Print(item, fp, 0) != 0) { - Py_DECREF(item); - Py_DECREF(it); - Py_ReprLeave(deque); - return -1; - } - Py_DECREF(item); - } - Py_ReprLeave(deque); - Py_DECREF(it); - if (PyErr_Occurred()) - return -1; - fputs("])", fp); - return 0; -} - -static PyObject * -deque_richcompare(PyObject *v, PyObject *w, int op) -{ - PyObject *it1=NULL, *it2=NULL, *x, *y; - int b, vs, ws, cmp=-1; - - if (!PyObject_TypeCheck(v, &deque_type) || - !PyObject_TypeCheck(w, &deque_type)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - /* Shortcuts */ - vs = ((dequeobject *)v)->len; - ws = ((dequeobject *)w)->len; - if (op == Py_EQ) { - if (v == w) - Py_RETURN_TRUE; - if (vs != ws) - Py_RETURN_FALSE; - } - if (op == Py_NE) { - if (v == w) - Py_RETURN_FALSE; - if (vs != ws) - Py_RETURN_TRUE; - } - - /* Search for the first index where items are different */ - it1 = PyObject_GetIter(v); - if (it1 == NULL) - goto done; - it2 = PyObject_GetIter(w); - if (it2 == NULL) - goto done; - for (;;) { - x = PyIter_Next(it1); - if (x == NULL && PyErr_Occurred()) - goto done; - y = PyIter_Next(it2); - if (x == NULL || y == NULL) - break; - b = PyObject_RichCompareBool(x, y, Py_EQ); - if (b == 0) { - cmp = PyObject_RichCompareBool(x, y, op); - Py_DECREF(x); - Py_DECREF(y); - goto done; - } - Py_DECREF(x); - Py_DECREF(y); - if (b == -1) - goto done; - } - /* We reached the end of one deque or both */ - Py_XDECREF(x); - Py_XDECREF(y); - if (PyErr_Occurred()) - goto done; - switch (op) { - case Py_LT: cmp = y != NULL; break; /* if w was longer */ - case Py_LE: cmp = x == NULL; break; /* if v was not longer */ - case Py_EQ: cmp = x == y; break; /* if we reached the end of both */ - case Py_NE: cmp = x != y; break; /* if one deque continues */ - case Py_GT: cmp = x != NULL; break; /* if v was longer */ - case Py_GE: cmp = y == NULL; break; /* if w was not longer */ - } - -done: - Py_XDECREF(it1); - Py_XDECREF(it2); - if (cmp == 1) - Py_RETURN_TRUE; - if (cmp == 0) - Py_RETURN_FALSE; - return NULL; -} - -static int -deque_init(dequeobject *deque, PyObject *args, PyObject *kwds) -{ - PyObject *iterable = NULL; - - if (!PyArg_UnpackTuple(args, "deque", 0, 1, &iterable)) - return -1; - - if (iterable != NULL) { - PyObject *rv = deque_extend(deque, iterable); - if (rv == NULL) - return -1; - Py_DECREF(rv); - } - return 0; -} - -static PySequenceMethods deque_as_sequence = { - (lenfunc)deque_len, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - (ssizeargfunc)deque_item, /* sq_item */ - 0, /* sq_slice */ - (ssizeobjargproc)deque_ass_item, /* sq_ass_item */ -}; - -/* deque object ********************************************************/ - -static PyObject *deque_iter(dequeobject *deque); -static PyObject *deque_reviter(dequeobject *deque); -PyDoc_STRVAR(reversed_doc, - "D.__reversed__() -- return a reverse iterator over the deque"); - -static PyMethodDef deque_methods[] = { - {"append", (PyCFunction)deque_append, - METH_O, append_doc}, - {"appendleft", (PyCFunction)deque_appendleft, - METH_O, appendleft_doc}, - {"clear", (PyCFunction)deque_clearmethod, - METH_NOARGS, clear_doc}, - {"__copy__", (PyCFunction)deque_copy, - METH_NOARGS, copy_doc}, - {"extend", (PyCFunction)deque_extend, - METH_O, extend_doc}, - {"extendleft", (PyCFunction)deque_extendleft, - METH_O, extendleft_doc}, - {"pop", (PyCFunction)deque_pop, - METH_NOARGS, pop_doc}, - {"popleft", (PyCFunction)deque_popleft, - METH_NOARGS, popleft_doc}, - {"__reduce__", (PyCFunction)deque_reduce, - METH_NOARGS, reduce_doc}, - {"remove", (PyCFunction)deque_remove, - METH_O, remove_doc}, - {"__reversed__", (PyCFunction)deque_reviter, - METH_NOARGS, reversed_doc}, - {"rotate", (PyCFunction)deque_rotate, - METH_VARARGS, rotate_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(deque_doc, -"deque(iterable) --> deque object\n\ -\n\ -Build an ordered collection accessible from endpoints only."); - -static PyTypeObject deque_type = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "collections.deque", /* tp_name */ - sizeof(dequeobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)deque_dealloc, /* tp_dealloc */ - deque_tp_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - deque_repr, /* tp_repr */ - 0, /* tp_as_number */ - &deque_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - deque_nohash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ - deque_doc, /* tp_doc */ - (traverseproc)deque_traverse, /* tp_traverse */ - (inquiry)deque_clear, /* tp_clear */ - (richcmpfunc)deque_richcompare, /* tp_richcompare */ - offsetof(dequeobject, weakreflist), /* tp_weaklistoffset*/ - (getiterfunc)deque_iter, /* tp_iter */ - 0, /* tp_iternext */ - deque_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)deque_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - deque_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/*********************** Deque Iterator **************************/ - -typedef struct { - PyObject_HEAD - int index; - block *b; - dequeobject *deque; - long state; /* state when the iterator is created */ - int counter; /* number of items remaining for iteration */ -} dequeiterobject; - -PyTypeObject dequeiter_type; - -static PyObject * -deque_iter(dequeobject *deque) -{ - dequeiterobject *it; - - it = PyObject_New(dequeiterobject, &dequeiter_type); - if (it == NULL) - return NULL; - it->b = deque->leftblock; - it->index = deque->leftindex; - Py_INCREF(deque); - it->deque = deque; - it->state = deque->state; - it->counter = deque->len; - return (PyObject *)it; -} - -static void -dequeiter_dealloc(dequeiterobject *dio) -{ - Py_XDECREF(dio->deque); - dio->ob_type->tp_free(dio); -} - -static PyObject * -dequeiter_next(dequeiterobject *it) -{ - PyObject *item; - - if (it->deque->state != it->state) { - it->counter = 0; - PyErr_SetString(PyExc_RuntimeError, - "deque mutated during iteration"); - return NULL; - } - if (it->counter == 0) - return NULL; - assert (!(it->b == it->deque->rightblock && - it->index > it->deque->rightindex)); - - item = it->b->data[it->index]; - it->index++; - it->counter--; - if (it->index == BLOCKLEN && it->counter > 0) { - assert (it->b->rightlink != NULL); - it->b = it->b->rightlink; - it->index = 0; - } - Py_INCREF(item); - return item; -} - -static PyObject * -dequeiter_len(dequeiterobject *it) -{ - return PyInt_FromLong(it->counter); -} - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef dequeiter_methods[] = { - {"__length_hint__", (PyCFunction)dequeiter_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject dequeiter_type = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "deque_iterator", /* tp_name */ - sizeof(dequeiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dequeiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)dequeiter_next, /* tp_iternext */ - dequeiter_methods, /* tp_methods */ - 0, -}; - -/*********************** Deque Reverse Iterator **************************/ - -PyTypeObject dequereviter_type; - -static PyObject * -deque_reviter(dequeobject *deque) -{ - dequeiterobject *it; - - it = PyObject_New(dequeiterobject, &dequereviter_type); - if (it == NULL) - return NULL; - it->b = deque->rightblock; - it->index = deque->rightindex; - Py_INCREF(deque); - it->deque = deque; - it->state = deque->state; - it->counter = deque->len; - return (PyObject *)it; -} - -static PyObject * -dequereviter_next(dequeiterobject *it) -{ - PyObject *item; - if (it->counter == 0) - return NULL; - - if (it->deque->state != it->state) { - it->counter = 0; - PyErr_SetString(PyExc_RuntimeError, - "deque mutated during iteration"); - return NULL; - } - assert (!(it->b == it->deque->leftblock && - it->index < it->deque->leftindex)); - - item = it->b->data[it->index]; - it->index--; - it->counter--; - if (it->index == -1 && it->counter > 0) { - assert (it->b->leftlink != NULL); - it->b = it->b->leftlink; - it->index = BLOCKLEN - 1; - } - Py_INCREF(item); - return item; -} - -PyTypeObject dequereviter_type = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "deque_reverse_iterator", /* tp_name */ - sizeof(dequeiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dequeiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)dequereviter_next, /* tp_iternext */ - dequeiter_methods, /* tp_methods */ - 0, -}; - -/* defaultdict type *********************************************************/ - -typedef struct { - PyDictObject dict; - PyObject *default_factory; -} defdictobject; - -static PyTypeObject defdict_type; /* Forward */ - -PyDoc_STRVAR(defdict_missing_doc, -"__missing__(key) # Called by __getitem__ for missing key; pseudo-code:\n\ - if self.default_factory is None: raise KeyError(key)\n\ - self[key] = value = self.default_factory()\n\ - return value\n\ -"); - -static PyObject * -defdict_missing(defdictobject *dd, PyObject *key) -{ - PyObject *factory = dd->default_factory; - PyObject *value; - if (factory == NULL || factory == Py_None) { - /* XXX Call dict.__missing__(key) */ - PyErr_SetObject(PyExc_KeyError, key); - return NULL; - } - value = PyEval_CallObject(factory, NULL); - if (value == NULL) - return value; - if (PyObject_SetItem((PyObject *)dd, key, value) < 0) { - Py_DECREF(value); - return NULL; - } - return value; -} - -PyDoc_STRVAR(defdict_copy_doc, "D.copy() -> a shallow copy of D."); - -static PyObject * -defdict_copy(defdictobject *dd) -{ - /* This calls the object's class. That only works for subclasses - whose class constructor has the same signature. Subclasses that - define a different constructor signature must override copy(). - */ - return PyObject_CallFunctionObjArgs((PyObject *)dd->dict.ob_type, - dd->default_factory, dd, NULL); -} - -static PyObject * -defdict_reduce(defdictobject *dd) -{ - /* __reduce__ must return a 5-tuple as follows: - - - factory function - - tuple of args for the factory function - - additional state (here None) - - sequence iterator (here None) - - dictionary iterator (yielding successive (key, value) pairs - - This API is used by pickle.py and copy.py. - - For this to be useful with pickle.py, the default_factory - must be picklable; e.g., None, a built-in, or a global - function in a module or package. - - Both shallow and deep copying are supported, but for deep - copying, the default_factory must be deep-copyable; e.g. None, - or a built-in (functions are not copyable at this time). - - This only works for subclasses as long as their constructor - signature is compatible; the first argument must be the - optional default_factory, defaulting to None. - */ - PyObject *args; - PyObject *items; - PyObject *result; - if (dd->default_factory == NULL || dd->default_factory == Py_None) - args = PyTuple_New(0); - else - args = PyTuple_Pack(1, dd->default_factory); - if (args == NULL) - return NULL; - items = PyObject_CallMethod((PyObject *)dd, "iteritems", "()"); - if (items == NULL) { - Py_DECREF(args); - return NULL; - } - result = PyTuple_Pack(5, dd->dict.ob_type, args, - Py_None, Py_None, items); - Py_DECREF(items); - Py_DECREF(args); - return result; -} - -static PyMethodDef defdict_methods[] = { - {"__missing__", (PyCFunction)defdict_missing, METH_O, - defdict_missing_doc}, - {"copy", (PyCFunction)defdict_copy, METH_NOARGS, - defdict_copy_doc}, - {"__copy__", (PyCFunction)defdict_copy, METH_NOARGS, - defdict_copy_doc}, - {"__reduce__", (PyCFunction)defdict_reduce, METH_NOARGS, - reduce_doc}, - {NULL} -}; - -static PyMemberDef defdict_members[] = { - {"default_factory", T_OBJECT, - offsetof(defdictobject, default_factory), 0, - PyDoc_STR("Factory for default value called by __missing__().")}, - {NULL} -}; - -static void -defdict_dealloc(defdictobject *dd) -{ - Py_CLEAR(dd->default_factory); - PyDict_Type.tp_dealloc((PyObject *)dd); -} - -static int -defdict_print(defdictobject *dd, FILE *fp, int flags) -{ - int sts; - fprintf(fp, "defaultdict("); - if (dd->default_factory == NULL) - fprintf(fp, "None"); - else { - PyObject_Print(dd->default_factory, fp, 0); - } - fprintf(fp, ", "); - sts = PyDict_Type.tp_print((PyObject *)dd, fp, 0); - fprintf(fp, ")"); - return sts; -} - -static PyObject * -defdict_repr(defdictobject *dd) -{ - PyObject *defrepr; - PyObject *baserepr; - PyObject *result; - baserepr = PyDict_Type.tp_repr((PyObject *)dd); - if (baserepr == NULL) - return NULL; - if (dd->default_factory == NULL) - defrepr = PyString_FromString("None"); - else - defrepr = PyObject_Repr(dd->default_factory); - if (defrepr == NULL) { - Py_DECREF(baserepr); - return NULL; - } - result = PyString_FromFormat("defaultdict(%s, %s)", - PyString_AS_STRING(defrepr), - PyString_AS_STRING(baserepr)); - Py_DECREF(defrepr); - Py_DECREF(baserepr); - return result; -} - -static int -defdict_traverse(PyObject *self, visitproc visit, void *arg) -{ - Py_VISIT(((defdictobject *)self)->default_factory); - return PyDict_Type.tp_traverse(self, visit, arg); -} - -static int -defdict_tp_clear(defdictobject *dd) -{ - Py_CLEAR(dd->default_factory); - return PyDict_Type.tp_clear((PyObject *)dd); -} - -static int -defdict_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - defdictobject *dd = (defdictobject *)self; - PyObject *olddefault = dd->default_factory; - PyObject *newdefault = NULL; - PyObject *newargs; - int result; - if (args == NULL || !PyTuple_Check(args)) - newargs = PyTuple_New(0); - else { - Py_ssize_t n = PyTuple_GET_SIZE(args); - if (n > 0) - newdefault = PyTuple_GET_ITEM(args, 0); - newargs = PySequence_GetSlice(args, 1, n); - } - if (newargs == NULL) - return -1; - Py_XINCREF(newdefault); - dd->default_factory = newdefault; - result = PyDict_Type.tp_init(self, newargs, kwds); - Py_DECREF(newargs); - Py_XDECREF(olddefault); - return result; -} - -PyDoc_STRVAR(defdict_doc, -"defaultdict(default_factory) --> dict with default factory\n\ -\n\ -The default factory is called without arguments to produce\n\ -a new value when a key is not present, in __getitem__ only.\n\ -A defaultdict compares equal to a dict with the same items.\n\ -"); - -/* See comment in xxsubtype.c */ -#define DEFERRED_ADDRESS(ADDR) 0 - -static PyTypeObject defdict_type = { - PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type)) - 0, /* ob_size */ - "collections.defaultdict", /* tp_name */ - sizeof(defdictobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)defdict_dealloc, /* tp_dealloc */ - (printfunc)defdict_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)defdict_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ - defdict_doc, /* tp_doc */ - defdict_traverse, /* tp_traverse */ - (inquiry)defdict_tp_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - defdict_methods, /* tp_methods */ - defdict_members, /* tp_members */ - 0, /* tp_getset */ - DEFERRED_ADDRESS(&PyDict_Type), /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - defdict_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - 0, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/* module level code ********************************************************/ - -PyDoc_STRVAR(module_doc, -"High performance data structures.\n\ -- deque: ordered collection accessible from endpoints only\n\ -- defaultdict: dict subclass with a default value factory\n\ -"); - -PyMODINIT_FUNC -initcollections(void) -{ - PyObject *m; - - m = Py_InitModule3("collections", NULL, module_doc); - if (m == NULL) - return; - - if (PyType_Ready(&deque_type) < 0) - return; - Py_INCREF(&deque_type); - PyModule_AddObject(m, "deque", (PyObject *)&deque_type); - - defdict_type.tp_base = &PyDict_Type; - if (PyType_Ready(&defdict_type) < 0) - return; - Py_INCREF(&defdict_type); - PyModule_AddObject(m, "defaultdict", (PyObject *)&defdict_type); - - if (PyType_Ready(&dequeiter_type) < 0) - return; - - if (PyType_Ready(&dequereviter_type) < 0) - return; - - return; -} Modified: python/branches/bcannon-objcap/Modules/datetimemodule.c ============================================================================== --- python/branches/bcannon-objcap/Modules/datetimemodule.c (original) +++ python/branches/bcannon-objcap/Modules/datetimemodule.c Fri May 25 22:13:08 2007 @@ -13,7 +13,9 @@ /* Differentiate between building the core module and building extension * modules. */ +#ifndef Py_BUILD_CORE #define Py_BUILD_CORE +#endif #include "datetime.h" #undef Py_BUILD_CORE @@ -2629,7 +2631,7 @@ {"ctime", (PyCFunction)date_ctime, METH_NOARGS, PyDoc_STR("Return ctime() style string.")}, - {"strftime", (PyCFunction)date_strftime, METH_KEYWORDS, + {"strftime", (PyCFunction)date_strftime, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("format -> strftime() style string.")}, {"timetuple", (PyCFunction)date_timetuple, METH_NOARGS, @@ -2654,7 +2656,7 @@ PyDoc_STR("Return the day of the week represented by the date.\n" "Monday == 0 ... Sunday == 6")}, - {"replace", (PyCFunction)date_replace, METH_KEYWORDS, + {"replace", (PyCFunction)date_replace, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("Return date with new specified fields.")}, {"__reduce__", (PyCFunction)date_reduce, METH_NOARGS, @@ -3167,7 +3169,7 @@ } static PyObject * -time_isoformat(PyDateTime_Time *self) +time_isoformat(PyDateTime_Time *self, PyObject *unused) { char buf[100]; PyObject *result; @@ -3411,11 +3413,11 @@ static PyMethodDef time_methods[] = { - {"isoformat", (PyCFunction)time_isoformat, METH_KEYWORDS, + {"isoformat", (PyCFunction)time_isoformat, METH_NOARGS, PyDoc_STR("Return string in ISO 8601 format, HH:MM:SS[.mmmmmm]" "[+HH:MM].")}, - {"strftime", (PyCFunction)time_strftime, METH_KEYWORDS, + {"strftime", (PyCFunction)time_strftime, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("format -> strftime() style string.")}, {"utcoffset", (PyCFunction)time_utcoffset, METH_NOARGS, @@ -3427,7 +3429,7 @@ {"dst", (PyCFunction)time_dst, METH_NOARGS, PyDoc_STR("Return self.tzinfo.dst(self).")}, - {"replace", (PyCFunction)time_replace, METH_KEYWORDS, + {"replace", (PyCFunction)time_replace, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("Return time with new specified fields.")}, {"__reduce__", (PyCFunction)time_reduce, METH_NOARGS, @@ -3683,6 +3685,12 @@ return NULL; fraction = timestamp - (double)timet; us = (int)round_to_long(fraction * 1e6); + if (us < 0) { + /* Truncation towards zero is not what we wanted + for negative numbers (Python's mod semantics) */ + timet -= 1; + us += 1000000; + } /* If timestamp is less than one microsecond smaller than a * full second, round up. Otherwise, ValueErrors are raised * for some floats. */ @@ -4460,7 +4468,7 @@ /* Class methods: */ {"now", (PyCFunction)datetime_now, - METH_KEYWORDS | METH_CLASS, + METH_VARARGS | METH_KEYWORDS | METH_CLASS, PyDoc_STR("[tz] -> new datetime with tz's local day and time.")}, {"utcnow", (PyCFunction)datetime_utcnow, @@ -4468,7 +4476,7 @@ PyDoc_STR("Return a new datetime representing UTC day and time.")}, {"fromtimestamp", (PyCFunction)datetime_fromtimestamp, - METH_KEYWORDS | METH_CLASS, + METH_VARARGS | METH_KEYWORDS | METH_CLASS, PyDoc_STR("timestamp[, tz] -> tz's local time from POSIX timestamp.")}, {"utcfromtimestamp", (PyCFunction)datetime_utcfromtimestamp, @@ -4505,7 +4513,7 @@ {"utctimetuple", (PyCFunction)datetime_utctimetuple, METH_NOARGS, PyDoc_STR("Return UTC time tuple, compatible with time.localtime().")}, - {"isoformat", (PyCFunction)datetime_isoformat, METH_KEYWORDS, + {"isoformat", (PyCFunction)datetime_isoformat, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("[sep] -> string in ISO 8601 format, " "YYYY-MM-DDTHH:MM:SS[.mmmmmm][+HH:MM].\n\n" "sep is used to separate the year from the time, and " @@ -4520,10 +4528,10 @@ {"dst", (PyCFunction)datetime_dst, METH_NOARGS, PyDoc_STR("Return self.tzinfo.dst(self).")}, - {"replace", (PyCFunction)datetime_replace, METH_KEYWORDS, + {"replace", (PyCFunction)datetime_replace, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("Return datetime with new specified fields.")}, - {"astimezone", (PyCFunction)datetime_astimezone, METH_KEYWORDS, + {"astimezone", (PyCFunction)datetime_astimezone, METH_VARARGS | METH_KEYWORDS, PyDoc_STR("tz -> convert to local time in new timezone tz\n")}, {"__reduce__", (PyCFunction)datetime_reduce, METH_NOARGS, Modified: python/branches/bcannon-objcap/Modules/getbuildinfo.c ============================================================================== --- python/branches/bcannon-objcap/Modules/getbuildinfo.c (original) +++ python/branches/bcannon-objcap/Modules/getbuildinfo.c Fri May 25 22:13:08 2007 @@ -20,10 +20,7 @@ #endif #endif -#ifdef SUBWCREV #define SVNVERSION "$WCRANGE$$WCMODS?M:$" -#endif - const char * Py_GetBuildInfo(void) { @@ -40,9 +37,9 @@ const char * _Py_svnversion(void) { -#ifdef SVNVERSION - return SVNVERSION; -#else + /* the following string can be modified by subwcrev.exe */ + static const char svnversion[] = SVNVERSION; + if (!strstr(svnversion, "$")) + return svnversion; /* it was interpolated */ return "exported"; -#endif } Modified: python/branches/bcannon-objcap/Modules/getpath.c ============================================================================== --- python/branches/bcannon-objcap/Modules/getpath.c (original) +++ python/branches/bcannon-objcap/Modules/getpath.c Fri May 25 22:13:08 2007 @@ -26,7 +26,7 @@ * as best as is possible, but most imports will fail. * * Before any searches are done, the location of the executable is - * determined. If argv[0] has one or more slashs in it, it is used + * determined. If argv[0] has one or more slashes in it, it is used * unchanged. Otherwise, it must have been invoked from the shell's path, * so we search $PATH for the named executable and use that. If the * executable was not found on $PATH (or there was no $PATH environment Modified: python/branches/bcannon-objcap/Modules/itertoolsmodule.c ============================================================================== --- python/branches/bcannon-objcap/Modules/itertoolsmodule.c (original) +++ python/branches/bcannon-objcap/Modules/itertoolsmodule.c Fri May 25 22:13:08 2007 @@ -2073,6 +2073,11 @@ static PyObject * count_next(countobject *lz) { + if (lz->cnt == PY_SSIZE_T_MAX) { + PyErr_SetString(PyExc_OverflowError, + "cannot count beyond PY_SSIZE_T_MAX"); + return NULL; + } return PyInt_FromSsize_t(lz->cnt++); } @@ -2467,6 +2472,234 @@ PyObject_GC_Del, /* tp_free */ }; +/* iziplongest object ************************************************************/ + +#include "Python.h" + +typedef struct { + PyObject_HEAD + Py_ssize_t tuplesize; + Py_ssize_t numactive; + PyObject *ittuple; /* tuple of iterators */ + PyObject *result; + PyObject *fillvalue; +} iziplongestobject; + +static PyTypeObject iziplongest_type; + +static PyObject * +izip_longest_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + iziplongestobject *lz; + Py_ssize_t i; + PyObject *ittuple; /* tuple of iterators */ + PyObject *result; + PyObject *fillvalue = Py_None; + Py_ssize_t tuplesize = PySequence_Length(args); + + if (kwds != NULL && PyDict_CheckExact(kwds) && PyDict_Size(kwds) > 0) { + fillvalue = PyDict_GetItemString(kwds, "fillvalue"); + if (fillvalue == NULL || PyDict_Size(kwds) > 1) { + PyErr_SetString(PyExc_TypeError, + "izip_longest() got an unexpected keyword argument"); + return NULL; + } + } + + /* args must be a tuple */ + assert(PyTuple_Check(args)); + + /* obtain iterators */ + ittuple = PyTuple_New(tuplesize); + if (ittuple == NULL) + return NULL; + for (i=0; i < tuplesize; ++i) { + PyObject *item = PyTuple_GET_ITEM(args, i); + PyObject *it = PyObject_GetIter(item); + if (it == NULL) { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "izip_longest argument #%zd must support iteration", + i+1); + Py_DECREF(ittuple); + return NULL; + } + PyTuple_SET_ITEM(ittuple, i, it); + } + + /* create a result holder */ + result = PyTuple_New(tuplesize); + if (result == NULL) { + Py_DECREF(ittuple); + return NULL; + } + for (i=0 ; i < tuplesize ; i++) { + Py_INCREF(Py_None); + PyTuple_SET_ITEM(result, i, Py_None); + } + + /* create iziplongestobject structure */ + lz = (iziplongestobject *)type->tp_alloc(type, 0); + if (lz == NULL) { + Py_DECREF(ittuple); + Py_DECREF(result); + return NULL; + } + lz->ittuple = ittuple; + lz->tuplesize = tuplesize; + lz->numactive = tuplesize; + lz->result = result; + Py_INCREF(fillvalue); + lz->fillvalue = fillvalue; + return (PyObject *)lz; +} + +static void +izip_longest_dealloc(iziplongestobject *lz) +{ + PyObject_GC_UnTrack(lz); + Py_XDECREF(lz->ittuple); + Py_XDECREF(lz->result); + Py_XDECREF(lz->fillvalue); + lz->ob_type->tp_free(lz); +} + +static int +izip_longest_traverse(iziplongestobject *lz, visitproc visit, void *arg) +{ + Py_VISIT(lz->ittuple); + Py_VISIT(lz->result); + Py_VISIT(lz->fillvalue); + return 0; +} + +static PyObject * +izip_longest_next(iziplongestobject *lz) +{ + Py_ssize_t i; + Py_ssize_t tuplesize = lz->tuplesize; + PyObject *result = lz->result; + PyObject *it; + PyObject *item; + PyObject *olditem; + + if (tuplesize == 0) + return NULL; + if (lz->numactive == 0) + return NULL; + if (result->ob_refcnt == 1) { + Py_INCREF(result); + for (i=0 ; i < tuplesize ; i++) { + it = PyTuple_GET_ITEM(lz->ittuple, i); + if (it == NULL) { + Py_INCREF(lz->fillvalue); + item = lz->fillvalue; + } else { + assert(PyIter_Check(it)); + item = (*it->ob_type->tp_iternext)(it); + if (item == NULL) { + lz->numactive -= 1; + if (lz->numactive == 0) { + Py_DECREF(result); + return NULL; + } else { + Py_INCREF(lz->fillvalue); + item = lz->fillvalue; + PyTuple_SET_ITEM(lz->ittuple, i, NULL); + Py_DECREF(it); + } + } + } + olditem = PyTuple_GET_ITEM(result, i); + PyTuple_SET_ITEM(result, i, item); + Py_DECREF(olditem); + } + } else { + result = PyTuple_New(tuplesize); + if (result == NULL) + return NULL; + for (i=0 ; i < tuplesize ; i++) { + it = PyTuple_GET_ITEM(lz->ittuple, i); + if (it == NULL) { + Py_INCREF(lz->fillvalue); + item = lz->fillvalue; + } else { + assert(PyIter_Check(it)); + item = (*it->ob_type->tp_iternext)(it); + if (item == NULL) { + lz->numactive -= 1; + if (lz->numactive == 0) { + Py_DECREF(result); + return NULL; + } else { + Py_INCREF(lz->fillvalue); + item = lz->fillvalue; + PyTuple_SET_ITEM(lz->ittuple, i, NULL); + Py_DECREF(it); + } + } + } + PyTuple_SET_ITEM(result, i, item); + } + } + return result; +} + +PyDoc_STRVAR(izip_longest_doc, +"izip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> izip_longest object\n\ +\n\ +Return an izip_longest object whose .next() method returns a tuple where\n\ +the i-th element comes from the i-th iterable argument. The .next()\n\ +method continues until the longest iterable in the argument sequence\n\ +is exhausted and then it raises StopIteration. When the shorter iterables\n\ +are exhausted, the fillvalue is substituted in their place. The fillvalue\n\ +defaults to None or can be specified by a keyword argument.\n\ +"); + +static PyTypeObject iziplongest_type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "itertools.izip_longest", /* tp_name */ + sizeof(iziplongestobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)izip_longest_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | + Py_TPFLAGS_BASETYPE, /* tp_flags */ + izip_longest_doc, /* tp_doc */ + (traverseproc)izip_longest_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)izip_longest_next, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + izip_longest_new, /* tp_new */ + PyObject_GC_Del, /* tp_free */ +}; /* module level code ********************************************************/ @@ -2480,6 +2713,7 @@ \n\ Iterators terminating on the shortest input sequence:\n\ izip(p, q, ...) --> (p[0], q[0]), (p[1], q[1]), ... \n\ +izip_longest(p, q, ...) --> (p[0], q[0]), (p[1], q[1]), ... \n\ ifilter(pred, seq) --> elements of seq where pred(elem) is True\n\ ifilterfalse(pred, seq) --> elements of seq where pred(elem) is False\n\ islice(seq, [start,] stop [, step]) --> elements from\n\ @@ -2517,6 +2751,7 @@ &ifilterfalse_type, &count_type, &izip_type, + &iziplongest_type, &repeat_type, &groupby_type, NULL Modified: python/branches/bcannon-objcap/Modules/main.c ============================================================================== --- python/branches/bcannon-objcap/Modules/main.c (original) +++ python/branches/bcannon-objcap/Modules/main.c Fri May 25 22:13:08 2007 @@ -40,7 +40,7 @@ static int orig_argc; /* command line options */ -#define BASE_OPTS "c:dEhim:OQ:StuUvVW:xX?" +#define BASE_OPTS "3c:dEhim:OQ:StuUvVW:xX?" #ifndef RISCOS #define PROGRAM_OPTS BASE_OPTS @@ -82,6 +82,7 @@ -V : print the Python version number and exit (also --version)\n\ -W arg : warning control; arg is action:message:category:module:lineno\n\ -x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\ +-3 : warn about Python 3.x incompatibilities\n\ file : program read from script file\n\ - : program read from stdin (default; interactive mode if a tty)\n\ "; @@ -216,13 +217,11 @@ char *module = NULL; FILE *fp = stdin; char *p; - int inspect = 0; int unbuffered = 0; int skipfirstline = 0; int stdin_is_interactive = 0; int help = 0; int version = 0; - int saw_inspect_flag = 0; int saw_unbuffered_flag = 0; PyCompilerFlags cf; @@ -269,6 +268,10 @@ Py_DebugFlag++; break; + case '3': + Py_Py3kWarningFlag++; + break; + case 'Q': if (strcmp(_PyOS_optarg, "old") == 0) { Py_DivisionWarningFlag = 0; @@ -297,8 +300,7 @@ /* NOTREACHED */ case 'i': - inspect++; - saw_inspect_flag = 1; + Py_InspectFlag++; Py_InteractiveFlag++; break; @@ -369,9 +371,9 @@ return 0; } - if (!saw_inspect_flag && + if (!Py_InspectFlag && (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') - inspect = 1; + Py_InspectFlag = 1; if (!saw_unbuffered_flag && (p = Py_GETENV("PYTHONUNBUFFERED")) && *p != '\0') unbuffered = 1; @@ -499,7 +501,7 @@ PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind); - if ((inspect || (command == NULL && filename == NULL && module == NULL)) && + if ((Py_InspectFlag || (command == NULL && filename == NULL && module == NULL)) && isatty(fileno(stdin))) { PyObject *v; v = PyImport_ImportModule("readline"); @@ -518,6 +520,7 @@ } else { if (filename == NULL && stdin_is_interactive) { + Py_InspectFlag = 0; /* do exit on SystemExit */ RunStartupFile(&cf); } /* XXX */ @@ -530,16 +533,18 @@ /* Check this environment variable at the end, to give programs the * opportunity to set it from Python. */ - if (!saw_inspect_flag && + if (!Py_InspectFlag && (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') { - inspect = 1; + Py_InspectFlag = 1; } - if (inspect && stdin_is_interactive && - (filename != NULL || command != NULL || module != NULL)) + if (Py_InspectFlag && stdin_is_interactive && + (filename != NULL || command != NULL || module != NULL)) { + Py_InspectFlag = 0; /* XXX */ sts = PyRun_AnyFileFlags(stdin, "", &cf) != 0; + } WaitForThreadShutdown(); Modified: python/branches/bcannon-objcap/Modules/operator.c ============================================================================== --- python/branches/bcannon-objcap/Modules/operator.c (original) +++ python/branches/bcannon-objcap/Modules/operator.c Fri May 25 22:13:08 2007 @@ -168,43 +168,41 @@ op_getslice(PyObject *s, PyObject *a) { PyObject *a1; - int a2,a3; + Py_ssize_t a2, a3; - if (!PyArg_ParseTuple(a,"Oii:getslice",&a1,&a2,&a3)) + if (!PyArg_ParseTuple(a, "Onn:getslice", &a1, &a2, &a3)) return NULL; - return PySequence_GetSlice(a1,a2,a3); + return PySequence_GetSlice(a1, a2, a3); } static PyObject* op_setslice(PyObject *s, PyObject *a) { PyObject *a1, *a4; - int a2,a3; + Py_ssize_t a2, a3; - if (!PyArg_ParseTuple(a,"OiiO:setslice",&a1,&a2,&a3,&a4)) + if (!PyArg_ParseTuple(a, "OnnO:setslice", &a1, &a2, &a3, &a4)) return NULL; - if (-1 == PySequence_SetSlice(a1,a2,a3,a4)) + if (-1 == PySequence_SetSlice(a1, a2, a3, a4)) return NULL; - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } static PyObject* op_delslice(PyObject *s, PyObject *a) { PyObject *a1; - int a2,a3; + Py_ssize_t a2, a3; - if(! PyArg_ParseTuple(a,"Oii:delslice",&a1,&a2,&a3)) + if (!PyArg_ParseTuple(a, "Onn:delslice", &a1, &a2, &a3)) return NULL; - if (-1 == PySequence_DelSlice(a1,a2,a3)) + if (-1 == PySequence_DelSlice(a1, a2, a3)) return NULL; - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } #undef spam1 Modified: python/branches/bcannon-objcap/Modules/posixmodule.c ============================================================================== --- python/branches/bcannon-objcap/Modules/posixmodule.c (original) +++ python/branches/bcannon-objcap/Modules/posixmodule.c Fri May 25 22:13:08 2007 @@ -263,7 +263,6 @@ #include #endif #include "osdefs.h" -#define _WIN32_WINNT 0x0400 /* Needed for CryptoAPI on some systems */ #include #include /* for ShellExecute() */ #define popen _popen @@ -844,14 +843,48 @@ *(FARPROC*)&gfaxw = GetProcAddress(hKernel32, "GetFileAttributesExW"); } +static BOOL +attributes_from_dir(LPCSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) +{ + HANDLE hFindFile; + WIN32_FIND_DATAA FileData; + hFindFile = FindFirstFileA(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + +static BOOL +attributes_from_dir_w(LPCWSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) +{ + HANDLE hFindFile; + WIN32_FIND_DATAW FileData; + hFindFile = FindFirstFileW(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + static BOOL WINAPI Py_GetFileAttributesExA(LPCSTR pszFile, GET_FILEEX_INFO_LEVELS level, LPVOID pv) { BOOL result; - HANDLE hFindFile; - WIN32_FIND_DATAA FileData; LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than @@ -873,17 +906,7 @@ accept). */ if (GetFileAttributesA(pszFile) == 0xFFFFFFFF) return FALSE; - hFindFile = FindFirstFileA(pszFile, &FileData); - if (hFindFile == INVALID_HANDLE_VALUE) - return FALSE; - FindClose(hFindFile); - pfad->dwFileAttributes = FileData.dwFileAttributes; - pfad->ftCreationTime = FileData.ftCreationTime; - pfad->ftLastAccessTime = FileData.ftLastAccessTime; - pfad->ftLastWriteTime = FileData.ftLastWriteTime; - pfad->nFileSizeHigh = FileData.nFileSizeHigh; - pfad->nFileSizeLow = FileData.nFileSizeLow; - return TRUE; + return attributes_from_dir(pszFile, pfad); } static BOOL WINAPI @@ -892,8 +915,6 @@ LPVOID pv) { BOOL result; - HANDLE hFindFile; - WIN32_FIND_DATAW FileData; LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than @@ -915,17 +936,7 @@ accept). */ if (GetFileAttributesW(pszFile) == 0xFFFFFFFF) return FALSE; - hFindFile = FindFirstFileW(pszFile, &FileData); - if (hFindFile == INVALID_HANDLE_VALUE) - return FALSE; - FindClose(hFindFile); - pfad->dwFileAttributes = FileData.dwFileAttributes; - pfad->ftCreationTime = FileData.ftCreationTime; - pfad->ftLastAccessTime = FileData.ftLastAccessTime; - pfad->ftLastWriteTime = FileData.ftLastWriteTime; - pfad->nFileSizeHigh = FileData.nFileSizeHigh; - pfad->nFileSizeLow = FileData.nFileSizeLow; - return TRUE; + return attributes_from_dir_w(pszFile, pfad); } static int @@ -936,10 +947,20 @@ char *dot; /* XXX not supported on Win95 and NT 3.x */ if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { - /* Protocol violation: we explicitly clear errno, instead of - setting it to a POSIX error. Callers should use GetLastError. */ - errno = 0; - return -1; + if (GetLastError() != ERROR_SHARING_VIOLATION) { + /* Protocol violation: we explicitly clear errno, instead of + setting it to a POSIX error. Callers should use GetLastError. */ + errno = 0; + return -1; + } else { + /* Could not get attributes on open file. Fall back to + reading the directory. */ + if (!attributes_from_dir(path, &info)) { + /* Very strange. This should not fail now */ + errno = 0; + return -1; + } + } } code = attribute_data_to_stat(&info, result); if (code != 0) @@ -964,10 +985,20 @@ WIN32_FILE_ATTRIBUTE_DATA info; /* XXX not supported on Win95 and NT 3.x */ if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { - /* Protocol violation: we explicitly clear errno, instead of - setting it to a POSIX error. Callers should use GetLastError. */ - errno = 0; - return -1; + if (GetLastError() != ERROR_SHARING_VIOLATION) { + /* Protocol violation: we explicitly clear errno, instead of + setting it to a POSIX error. Callers should use GetLastError. */ + errno = 0; + return -1; + } else { + /* Could not get attributes on open file. Fall back to + reading the directory. */ + if (!attributes_from_dir_w(path, &info)) { + /* Very strange. This should not fail now */ + errno = 0; + return -1; + } + } } code = attribute_data_to_stat(&info, result); if (code < 0) @@ -1692,6 +1723,57 @@ } +#ifdef HAVE_CHFLAGS +PyDoc_STRVAR(posix_chflags__doc__, +"chflags(path, flags)\n\n\ +Set file flags."); + +static PyObject * +posix_chflags(PyObject *self, PyObject *args) +{ + char *path; + unsigned long flags; + int res; + if (!PyArg_ParseTuple(args, "etk:chflags", + Py_FileSystemDefaultEncoding, &path, &flags)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = chflags(path, flags); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_CHFLAGS */ + +#ifdef HAVE_LCHFLAGS +PyDoc_STRVAR(posix_lchflags__doc__, +"lchflags(path, flags)\n\n\ +Set file flags.\n\ +This function will not follow symbolic links."); + +static PyObject * +posix_lchflags(PyObject *self, PyObject *args) +{ + char *path; + unsigned long flags; + int res; + if (!PyArg_ParseTuple(args, "etk:lchflags", + Py_FileSystemDefaultEncoding, &path, &flags)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = lchflags(path, flags); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; +} +#endif /* HAVE_LCHFLAGS */ + #ifdef HAVE_CHROOT PyDoc_STRVAR(posix_chroot__doc__, "chroot(path)\n\n\ @@ -4758,18 +4840,19 @@ (sizeof(modulepath)/sizeof(modulepath[0])) -strlen(modulepath)); if (stat(modulepath, &statinfo) != 0) { + size_t mplen = sizeof(modulepath)/sizeof(modulepath[0]); /* Eeek - file-not-found - possibly an embedding situation - see if we can locate it in sys.prefix */ strncpy(modulepath, Py_GetExecPrefix(), - sizeof(modulepath)/sizeof(modulepath[0])); + mplen); + modulepath[mplen-1] = '\0'; if (modulepath[strlen(modulepath)-1] != '\\') strcat(modulepath, "\\"); strncat(modulepath, szConsoleSpawn, - (sizeof(modulepath)/sizeof(modulepath[0])) - -strlen(modulepath)); + mplen-strlen(modulepath)); /* No where else to look - raise an easily identifiable error, rather than leaving Windows to report "file not found" - as the user is probably blissfully @@ -6175,16 +6258,23 @@ posix_fdopen(PyObject *self, PyObject *args) { int fd; - char *mode = "r"; + char *orgmode = "r"; int bufsize = -1; FILE *fp; PyObject *f; - if (!PyArg_ParseTuple(args, "i|si", &fd, &mode, &bufsize)) + char *mode; + if (!PyArg_ParseTuple(args, "i|si", &fd, &orgmode, &bufsize)) return NULL; - if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') { - PyErr_Format(PyExc_ValueError, - "invalid file mode '%s'", mode); + /* Sanitize mode. See fileobject.c */ + mode = PyMem_MALLOC(strlen(orgmode)+3); + if (!mode) { + PyErr_NoMemory(); + return NULL; + } + strcpy(mode, orgmode); + if (_PyFile_SanitizeMode(mode)) { + PyMem_FREE(mode); return NULL; } Py_BEGIN_ALLOW_THREADS @@ -6206,9 +6296,10 @@ fp = fdopen(fd, mode); #endif Py_END_ALLOW_THREADS + PyMem_FREE(mode); if (fp == NULL) return posix_error(); - f = PyFile_FromFile(fp, "", mode, fclose); + f = PyFile_FromFile(fp, "", orgmode, fclose); if (f != NULL) PyFile_SetBufSize(f, bufsize); return f; @@ -8081,10 +8172,16 @@ {"ttyname", posix_ttyname, METH_VARARGS, posix_ttyname__doc__}, #endif {"chdir", posix_chdir, METH_VARARGS, posix_chdir__doc__}, +#ifdef HAVE_CHFLAGS + {"chflags", posix_chflags, METH_VARARGS, posix_chflags__doc__}, +#endif /* HAVE_CHFLAGS */ {"chmod", posix_chmod, METH_VARARGS, posix_chmod__doc__}, #ifdef HAVE_CHOWN {"chown", posix_chown, METH_VARARGS, posix_chown__doc__}, #endif /* HAVE_CHOWN */ +#ifdef HAVE_LCHFLAGS + {"lchflags", posix_lchflags, METH_VARARGS, posix_lchflags__doc__}, +#endif /* HAVE_LCHFLAGS */ #ifdef HAVE_LCHOWN {"lchown", posix_lchown, METH_VARARGS, posix_lchown__doc__}, #endif /* HAVE_LCHOWN */ Modified: python/branches/bcannon-objcap/Modules/readline.c ============================================================================== --- python/branches/bcannon-objcap/Modules/readline.c (original) +++ python/branches/bcannon-objcap/Modules/readline.c Fri May 25 22:13:08 2007 @@ -34,6 +34,8 @@ #ifdef HAVE_RL_COMPLETION_MATCHES #define completion_matches(x, y) \ rl_completion_matches((x), ((rl_compentry_func_t *)(y))) +#else +extern char **completion_matches(char *, rl_compentry_func_t *); #endif @@ -632,7 +634,7 @@ /* C function to call the Python completer. */ static char * -on_completion(char *text, int state) +on_completion(const char *text, int state) { char *result = NULL; if (completer != NULL) { Deleted: /python/branches/bcannon-objcap/Modules/rgbimgmodule.c ============================================================================== --- /python/branches/bcannon-objcap/Modules/rgbimgmodule.c Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,780 +0,0 @@ -/* - * fastimg - - * Faster reading and writing of image files. - * - * This code should work on machines with any byte order. - * - * Could someone make this run real fast using multiple processors - * or how about using memory mapped files to speed it up? - * - * Paul Haeberli - 1991 - * - * Changed to return sizes. - * Sjoerd Mullender - 1993 - * Changed to incorporate into Python. - * Sjoerd Mullender - 1993 - */ -#include "Python.h" - -#if SIZEOF_INT == 4 -typedef int Py_Int32; -typedef unsigned int Py_UInt32; -#else -#if SIZEOF_LONG == 4 -typedef long Py_Int32; -typedef unsigned long Py_UInt32; -#else -#error "No 4-byte integral type" -#endif -#endif - -#include - -/* - * from image.h - * - */ -typedef struct { - unsigned short imagic; /* stuff saved on disk . . */ - unsigned short type; - unsigned short dim; - unsigned short xsize; - unsigned short ysize; - unsigned short zsize; - Py_UInt32 min; - Py_UInt32 max; - Py_UInt32 wastebytes; - char name[80]; - Py_UInt32 colormap; - - Py_Int32 file; /* stuff used in core only */ - unsigned short flags; - short dorev; - short x; - short y; - short z; - short cnt; - unsigned short *ptr; - unsigned short *base; - unsigned short *tmpbuf; - Py_UInt32 offset; - Py_UInt32 rleend; /* for rle images */ - Py_UInt32 *rowstart; /* for rle images */ - Py_Int32 *rowsize; /* for rle images */ -} IMAGE; - -#define IMAGIC 0732 - -#define TYPEMASK 0xff00 -#define BPPMASK 0x00ff -#define ITYPE_VERBATIM 0x0000 -#define ITYPE_RLE 0x0100 -#define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE) -#define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM) -#define BPP(type) ((type) & BPPMASK) -#define RLE(bpp) (ITYPE_RLE | (bpp)) -#define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp)) -/* - * end of image.h stuff - * - */ - -#define RINTLUM (79) -#define GINTLUM (156) -#define BINTLUM (21) - -#define ILUM(r,g,b) ((int)(RINTLUM*(r)+GINTLUM*(g)+BINTLUM*(b))>>8) - -#define OFFSET_R 3 /* this is byte order dependent */ -#define OFFSET_G 2 -#define OFFSET_B 1 -#define OFFSET_A 0 - -#define CHANOFFSET(z) (3-(z)) /* this is byte order dependent */ - -static void expandrow(unsigned char *, unsigned char *, int); -static void setalpha(unsigned char *, int); -static void copybw(Py_Int32 *, int); -static void interleaverow(unsigned char*, unsigned char*, int, int); -static int compressrow(unsigned char *, unsigned char *, int, int); -static void lumrow(unsigned char *, unsigned char *, int); - -#ifdef ADD_TAGS -#define TAGLEN (5) -#else -#define TAGLEN (0) -#endif - -static PyObject *ImgfileError; - -static int reverse_order; - -#ifdef ADD_TAGS -/* - * addlongimgtag - - * this is used to extract image data from core dumps. - * - */ -static void -addlongimgtag(Py_UInt32 *dptr, int xsize, int ysize) -{ - dptr = dptr + (xsize * ysize); - dptr[0] = 0x12345678; - dptr[1] = 0x59493333; - dptr[2] = 0x69434222; - dptr[3] = xsize; - dptr[4] = ysize; -} -#endif - -/* - * byte order independent read/write of shorts and longs. - * - */ -static unsigned short -getshort(FILE *inf) -{ - unsigned char buf[2]; - - fread(buf, 2, 1, inf); - return (buf[0] << 8) + (buf[1] << 0); -} - -static Py_UInt32 -getlong(FILE *inf) -{ - unsigned char buf[4]; - - fread(buf, 4, 1, inf); - return (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + (buf[3] << 0); -} - -static void -putshort(FILE *outf, unsigned short val) -{ - unsigned char buf[2]; - - buf[0] = (val >> 8); - buf[1] = (val >> 0); - fwrite(buf, 2, 1, outf); -} - -static int -putlong(FILE *outf, Py_UInt32 val) -{ - unsigned char buf[4]; - - buf[0] = (unsigned char) (val >> 24); - buf[1] = (unsigned char) (val >> 16); - buf[2] = (unsigned char) (val >> 8); - buf[3] = (unsigned char) (val >> 0); - return (int)fwrite(buf, 4, 1, outf); -} - -static void -readheader(FILE *inf, IMAGE *image) -{ - memset(image ,0, sizeof(IMAGE)); - image->imagic = getshort(inf); - image->type = getshort(inf); - image->dim = getshort(inf); - image->xsize = getshort(inf); - image->ysize = getshort(inf); - image->zsize = getshort(inf); -} - -static int -writeheader(FILE *outf, IMAGE *image) -{ - IMAGE t; - - memset(&t, 0, sizeof(IMAGE)); - fwrite(&t, sizeof(IMAGE), 1, outf); - fseek(outf, 0, SEEK_SET); - putshort(outf, image->imagic); - putshort(outf, image->type); - putshort(outf, image->dim); - putshort(outf, image->xsize); - putshort(outf, image->ysize); - putshort(outf, image->zsize); - putlong(outf, image->min); - putlong(outf, image->max); - putlong(outf, 0); - return (int)fwrite("no name", 8, 1, outf); -} - -static int -writetab(FILE *outf, /*unsigned*/ Py_Int32 *tab, int len) -{ - int r = 0; - - while(len) { - r = putlong(outf, *tab++); - len--; - } - return r; -} - -static void -readtab(FILE *inf, /*unsigned*/ Py_Int32 *tab, int len) -{ - while(len) { - *tab++ = getlong(inf); - len--; - } -} - -/* - * sizeofimage - - * return the xsize and ysize of an iris image file. - * - */ -static PyObject * -sizeofimage(PyObject *self, PyObject *args) -{ - char *name; - IMAGE image; - FILE *inf; - - if (!PyArg_ParseTuple(args, "s:sizeofimage", &name)) - return NULL; - - inf = fopen(name, "rb"); - if (!inf) { - PyErr_SetString(ImgfileError, "can't open image file"); - return NULL; - } - readheader(inf, &image); - fclose(inf); - if (image.imagic != IMAGIC) { - PyErr_SetString(ImgfileError, - "bad magic number in image file"); - return NULL; - } - return Py_BuildValue("(ii)", image.xsize, image.ysize); -} - -/* - * longimagedata - - * read in a B/W RGB or RGBA iris image file and return a - * pointer to an array of longs. - * - */ -static PyObject * -longimagedata(PyObject *self, PyObject *args) -{ - char *name; - unsigned char *base, *lptr; - unsigned char *rledat = NULL, *verdat = NULL; - Py_Int32 *starttab = NULL, *lengthtab = NULL; - FILE *inf = NULL; - IMAGE image; - int y, z, tablen; - int xsize, ysize, zsize; - int bpp, rle, cur, badorder; - int rlebuflen; - PyObject *rv = NULL; - - if (!PyArg_ParseTuple(args, "s:longimagedata", &name)) - return NULL; - - inf = fopen(name,"rb"); - if (!inf) { - PyErr_SetString(ImgfileError, "can't open image file"); - return NULL; - } - readheader(inf,&image); - if (image.imagic != IMAGIC) { - PyErr_SetString(ImgfileError, - "bad magic number in image file"); - goto finally; - } - rle = ISRLE(image.type); - bpp = BPP(image.type); - if (bpp != 1) { - PyErr_SetString(ImgfileError, - "image must have 1 byte per pix chan"); - goto finally; - } - xsize = image.xsize; - ysize = image.ysize; - zsize = image.zsize; - if (rle) { - tablen = ysize * zsize * sizeof(Py_Int32); - starttab = (Py_Int32 *)malloc(tablen); - lengthtab = (Py_Int32 *)malloc(tablen); - rlebuflen = (int) (1.05 * xsize +10); - rledat = (unsigned char *)malloc(rlebuflen); - if (!starttab || !lengthtab || !rledat) { - PyErr_NoMemory(); - goto finally; - } - - fseek(inf, 512, SEEK_SET); - readtab(inf, starttab, ysize*zsize); - readtab(inf, lengthtab, ysize*zsize); - - /* check data order */ - cur = 0; - badorder = 0; - for(y = 0; y < ysize; y++) { - for(z = 0; z < zsize; z++) { - if (starttab[y + z * ysize] < cur) { - badorder = 1; - break; - } - cur = starttab[y +z * ysize]; - } - if (badorder) - break; - } - - fseek(inf, 512 + 2 * tablen, SEEK_SET); - cur = 512 + 2 * tablen; - rv = PyString_FromStringAndSize((char *)NULL, - (xsize * ysize + TAGLEN) * sizeof(Py_Int32)); - if (rv == NULL) - goto finally; - - base = (unsigned char *) PyString_AsString(rv); -#ifdef ADD_TAGS - addlongimgtag(base,xsize,ysize); -#endif - if (badorder) { - for (z = 0; z < zsize; z++) { - lptr = base; - if (reverse_order) - lptr += (ysize - 1) * xsize - * sizeof(Py_UInt32); - for (y = 0; y < ysize; y++) { - int idx = y + z * ysize; - if (cur != starttab[idx]) { - fseek(inf,starttab[idx], - SEEK_SET); - cur = starttab[idx]; - } - if (lengthtab[idx] > rlebuflen) { - PyErr_SetString(ImgfileError, - "rlebuf is too small"); - Py_DECREF(rv); - rv = NULL; - goto finally; - } - fread(rledat, lengthtab[idx], 1, inf); - cur += lengthtab[idx]; - expandrow(lptr, rledat, 3-z); - if (reverse_order) - lptr -= xsize - * sizeof(Py_UInt32); - else - lptr += xsize - * sizeof(Py_UInt32); - } - } - } else { - lptr = base; - if (reverse_order) - lptr += (ysize - 1) * xsize - * sizeof(Py_UInt32); - for (y = 0; y < ysize; y++) { - for(z = 0; z < zsize; z++) { - int idx = y + z * ysize; - if (cur != starttab[idx]) { - fseek(inf, starttab[idx], - SEEK_SET); - cur = starttab[idx]; - } - fread(rledat, lengthtab[idx], 1, inf); - cur += lengthtab[idx]; - expandrow(lptr, rledat, 3-z); - } - if (reverse_order) - lptr -= xsize * sizeof(Py_UInt32); - else - lptr += xsize * sizeof(Py_UInt32); - } - } - if (zsize == 3) - setalpha(base, xsize * ysize); - else if (zsize < 3) - copybw((Py_Int32 *) base, xsize * ysize); - } - else { - rv = PyString_FromStringAndSize((char *) 0, - (xsize*ysize+TAGLEN)*sizeof(Py_Int32)); - if (rv == NULL) - goto finally; - - base = (unsigned char *) PyString_AsString(rv); -#ifdef ADD_TAGS - addlongimgtag(base, xsize, ysize); -#endif - verdat = (unsigned char *)malloc(xsize); - if (!verdat) { - Py_CLEAR(rv); - goto finally; - } - - fseek(inf, 512, SEEK_SET); - for (z = 0; z < zsize; z++) { - lptr = base; - if (reverse_order) - lptr += (ysize - 1) * xsize - * sizeof(Py_UInt32); - for (y = 0; y < ysize; y++) { - fread(verdat, xsize, 1, inf); - interleaverow(lptr, verdat, 3-z, xsize); - if (reverse_order) - lptr -= xsize * sizeof(Py_UInt32); - else - lptr += xsize * sizeof(Py_UInt32); - } - } - if (zsize == 3) - setalpha(base, xsize * ysize); - else if (zsize < 3) - copybw((Py_Int32 *) base, xsize * ysize); - } - finally: - if (starttab) - free(starttab); - if (lengthtab) - free(lengthtab); - if (rledat) - free(rledat); - if (verdat) - free(verdat); - fclose(inf); - return rv; -} - -/* static utility functions for longimagedata */ - -static void -interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n) -{ - lptr += z; - while (n--) { - *lptr = *cptr++; - lptr += 4; - } -} - -static void -copybw(Py_Int32 *lptr, int n) -{ - while (n >= 8) { - lptr[0] = 0xff000000 + (0x010101 * (lptr[0] & 0xff)); - lptr[1] = 0xff000000 + (0x010101 * (lptr[1] & 0xff)); - lptr[2] = 0xff000000 + (0x010101 * (lptr[2] & 0xff)); - lptr[3] = 0xff000000 + (0x010101 * (lptr[3] & 0xff)); - lptr[4] = 0xff000000 + (0x010101 * (lptr[4] & 0xff)); - lptr[5] = 0xff000000 + (0x010101 * (lptr[5] & 0xff)); - lptr[6] = 0xff000000 + (0x010101 * (lptr[6] & 0xff)); - lptr[7] = 0xff000000 + (0x010101 * (lptr[7] & 0xff)); - lptr += 8; - n -= 8; - } - while (n--) { - *lptr = 0xff000000 + (0x010101 * (*lptr&0xff)); - lptr++; - } -} - -static void -setalpha(unsigned char *lptr, int n) -{ - while (n >= 8) { - lptr[0 * 4] = 0xff; - lptr[1 * 4] = 0xff; - lptr[2 * 4] = 0xff; - lptr[3 * 4] = 0xff; - lptr[4 * 4] = 0xff; - lptr[5 * 4] = 0xff; - lptr[6 * 4] = 0xff; - lptr[7 * 4] = 0xff; - lptr += 4 * 8; - n -= 8; - } - while (n--) { - *lptr = 0xff; - lptr += 4; - } -} - -static void -expandrow(unsigned char *optr, unsigned char *iptr, int z) -{ - unsigned char pixel, count; - - optr += z; - while (1) { - pixel = *iptr++; - if (!(count = (pixel & 0x7f))) - return; - if (pixel & 0x80) { - while (count >= 8) { - optr[0 * 4] = iptr[0]; - optr[1 * 4] = iptr[1]; - optr[2 * 4] = iptr[2]; - optr[3 * 4] = iptr[3]; - optr[4 * 4] = iptr[4]; - optr[5 * 4] = iptr[5]; - optr[6 * 4] = iptr[6]; - optr[7 * 4] = iptr[7]; - optr += 8 * 4; - iptr += 8; - count -= 8; - } - while (count--) { - *optr = *iptr++; - optr += 4; - } - } - else { - pixel = *iptr++; - while (count >= 8) { - optr[0 * 4] = pixel; - optr[1 * 4] = pixel; - optr[2 * 4] = pixel; - optr[3 * 4] = pixel; - optr[4 * 4] = pixel; - optr[5 * 4] = pixel; - optr[6 * 4] = pixel; - optr[7 * 4] = pixel; - optr += 8 * 4; - count -= 8; - } - while (count--) { - *optr = pixel; - optr += 4; - } - } - } -} - -/* - * longstoimage - - * copy an array of longs to an iris image file. Each long - * represents one pixel. xsize and ysize specify the dimensions of - * the pixel array. zsize specifies what kind of image file to - * write out. if zsize is 1, the luminance of the pixels are - * calculated, and a single channel black and white image is saved. - * If zsize is 3, an RGB image file is saved. If zsize is 4, an - * RGBA image file is saved. - * - */ -static PyObject * -longstoimage(PyObject *self, PyObject *args) -{ - unsigned char *lptr; - char *name; - int xsize, ysize, zsize; - FILE *outf = NULL; - IMAGE image; - int tablen, y, z, pos, len; - Py_Int32 *starttab = NULL, *lengthtab = NULL; - unsigned char *rlebuf = NULL; - unsigned char *lumbuf = NULL; - int rlebuflen; - Py_ssize_t goodwrite; - PyObject *retval = NULL; - - if (!PyArg_ParseTuple(args, "s#iiis:longstoimage", &lptr, &len, - &xsize, &ysize, &zsize, &name)) - return NULL; - - goodwrite = 1; - outf = fopen(name, "wb"); - if (!outf) { - PyErr_SetString(ImgfileError, "can't open output file"); - return NULL; - } - tablen = ysize * zsize * sizeof(Py_Int32); - - starttab = (Py_Int32 *)malloc(tablen); - lengthtab = (Py_Int32 *)malloc(tablen); - rlebuflen = (int) (1.05 * xsize + 10); - rlebuf = (unsigned char *)malloc(rlebuflen); - lumbuf = (unsigned char *)malloc(xsize * sizeof(Py_Int32)); - if (!starttab || !lengthtab || !rlebuf || !lumbuf) { - PyErr_NoMemory(); - goto finally; - } - - memset(&image, 0, sizeof(IMAGE)); - image.imagic = IMAGIC; - image.type = RLE(1); - if (zsize>1) - image.dim = 3; - else - image.dim = 2; - image.xsize = xsize; - image.ysize = ysize; - image.zsize = zsize; - image.min = 0; - image.max = 255; - goodwrite *= writeheader(outf, &image); - pos = 512 + 2 * tablen; - fseek(outf, pos, SEEK_SET); - if (reverse_order) - lptr += (ysize - 1) * xsize * sizeof(Py_UInt32); - for (y = 0; y < ysize; y++) { - for (z = 0; z < zsize; z++) { - if (zsize == 1) { - lumrow(lptr, lumbuf, xsize); - len = compressrow(lumbuf, rlebuf, - CHANOFFSET(z), xsize); - } else { - len = compressrow(lptr, rlebuf, - CHANOFFSET(z), xsize); - } - if(len > rlebuflen) { - PyErr_SetString(ImgfileError, - "rlebuf is too small"); - goto finally; - } - goodwrite *= fwrite(rlebuf, len, 1, outf); - starttab[y + z * ysize] = pos; - lengthtab[y + z * ysize] = len; - pos += len; - } - if (reverse_order) - lptr -= xsize * sizeof(Py_UInt32); - else - lptr += xsize * sizeof(Py_UInt32); - } - - fseek(outf, 512, SEEK_SET); - goodwrite *= writetab(outf, starttab, ysize*zsize); - goodwrite *= writetab(outf, lengthtab, ysize*zsize); - if (goodwrite) { - Py_INCREF(Py_None); - retval = Py_None; - } else - PyErr_SetString(ImgfileError, "not enough space for image"); - - finally: - fclose(outf); - free(starttab); - free(lengthtab); - free(rlebuf); - free(lumbuf); - return retval; -} - -/* static utility functions for longstoimage */ - -static void -lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n) -{ - lumptr += CHANOFFSET(0); - while (n--) { - *lumptr = ILUM(rgbptr[OFFSET_R], - rgbptr[OFFSET_G], - rgbptr[OFFSET_B]); - lumptr += 4; - rgbptr += 4; - } -} - -static int -compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cnt) -{ - unsigned char *iptr, *ibufend, *sptr, *optr; - short todo, cc; - Py_Int32 count; - - lbuf += z; - iptr = lbuf; - ibufend = iptr + cnt * 4; - optr = rlebuf; - - while(iptr < ibufend) { - sptr = iptr; - iptr += 8; - while ((iptr 126 ? 126 : (short)count; - count -= todo; - *optr++ = 0x80 | todo; - while (todo > 8) { - optr[0] = sptr[0 * 4]; - optr[1] = sptr[1 * 4]; - optr[2] = sptr[2 * 4]; - optr[3] = sptr[3 * 4]; - optr[4] = sptr[4 * 4]; - optr[5] = sptr[5 * 4]; - optr[6] = sptr[6 * 4]; - optr[7] = sptr[7 * 4]; - optr += 8; - sptr += 8 * 4; - todo -= 8; - } - while (todo--) { - *optr++ = *sptr; - sptr += 4; - } - } - sptr = iptr; - cc = *iptr; - iptr += 4; - while ((iptr < ibufend) && (*iptr == cc)) - iptr += 4; - count = (iptr - sptr) / 4; - while (count) { - todo = count > 126 ? 126 : (short)count; - count -= todo; - *optr++ = (unsigned char) todo; - *optr++ = (unsigned char) cc; - } - } - *optr++ = 0; - return optr - (unsigned char *)rlebuf; -} - -static PyObject * -ttob(PyObject *self, PyObject *args) -{ - int order, oldorder; - - if (!PyArg_ParseTuple(args, "i:ttob", &order)) - return NULL; - oldorder = reverse_order; - reverse_order = order; - return PyInt_FromLong(oldorder); -} - -static PyMethodDef -rgbimg_methods[] = { - {"sizeofimage", sizeofimage, METH_VARARGS}, - {"longimagedata", longimagedata, METH_VARARGS}, - {"longstoimage", longstoimage, METH_VARARGS}, - {"ttob", ttob, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - - -PyMODINIT_FUNC -initrgbimg(void) -{ - PyObject *m, *d; - m = Py_InitModule("rgbimg", rgbimg_methods); - if (m == NULL) - return; - - if (PyErr_Warn(PyExc_DeprecationWarning, - "the rgbimg module is deprecated")) - return; - - d = PyModule_GetDict(m); - ImgfileError = PyErr_NewException("rgbimg.error", NULL, NULL); - if (ImgfileError != NULL) - PyDict_SetItemString(d, "error", ImgfileError); -} Modified: python/branches/bcannon-objcap/Modules/socketmodule.c ============================================================================== --- python/branches/bcannon-objcap/Modules/socketmodule.c (original) +++ python/branches/bcannon-objcap/Modules/socketmodule.c Fri May 25 22:13:08 2007 @@ -362,20 +362,25 @@ #if defined(__FreeBSD__) #define BTPROTO_L2CAP BLUETOOTH_PROTO_L2CAP #define BTPROTO_RFCOMM BLUETOOTH_PROTO_RFCOMM +#define BTPROTO_HCI BLUETOOTH_PROTO_HCI #define sockaddr_l2 sockaddr_l2cap #define sockaddr_rc sockaddr_rfcomm #define _BT_L2_MEMB(sa, memb) ((sa)->l2cap_##memb) #define _BT_RC_MEMB(sa, memb) ((sa)->rfcomm_##memb) +#define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb) #elif defined(__NetBSD__) #define sockaddr_l2 sockaddr_bt #define sockaddr_rc sockaddr_bt +#define sockaddr_hci sockaddr_bt #define sockaddr_sco sockaddr_bt #define _BT_L2_MEMB(sa, memb) ((sa)->bt_##memb) #define _BT_RC_MEMB(sa, memb) ((sa)->bt_##memb) +#define _BT_HCI_MEMB(sa, memb) ((sa)->bt_##memb) #define _BT_SCO_MEMB(sa, memb) ((sa)->bt_##memb) #else #define _BT_L2_MEMB(sa, memb) ((sa)->l2_##memb) #define _BT_RC_MEMB(sa, memb) ((sa)->rc_##memb) +#define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb) #define _BT_SCO_MEMB(sa, memb) ((sa)->sco_##memb) #endif #endif @@ -1119,6 +1124,14 @@ return ret; } + case BTPROTO_HCI: + { + struct sockaddr_hci *a = (struct sockaddr_hci *) addr; + PyObject *ret = NULL; + ret = Py_BuildValue("i", _BT_HCI_MEMB(a, dev)); + return ret; + } + #if !defined(__FreeBSD__) case BTPROTO_SCO: { @@ -1347,6 +1360,18 @@ *len_ret = sizeof *addr; return 1; } + case BTPROTO_HCI: + { + struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret; + _BT_HCI_MEMB(addr, family) = AF_BLUETOOTH; + if (!PyArg_ParseTuple(args, "i", &_BT_HCI_MEMB(addr, dev))) { + PyErr_SetString(socket_error, "getsockaddrarg: " + "wrong format"); + return 0; + } + *len_ret = sizeof *addr; + return 1; + } #if !defined(__FreeBSD__) case BTPROTO_SCO: { @@ -1485,6 +1510,9 @@ case BTPROTO_RFCOMM: *len_ret = sizeof (struct sockaddr_rc); return 1; + case BTPROTO_HCI: + *len_ret = sizeof (struct sockaddr_hci); + return 1; #if !defined(__FreeBSD__) case BTPROTO_SCO: *len_ret = sizeof (struct sockaddr_sco); @@ -2356,14 +2384,14 @@ int buflen; /* Get the buffer's memory */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "w#|ii:recv", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, kwds, "w#|ii:recv_into", kwlist, &buf, &buflen, &recvlen, &flags)) return NULL; assert(buf != 0 && buflen > 0); if (recvlen < 0) { PyErr_SetString(PyExc_ValueError, - "negative buffersize in recv"); + "negative buffersize in recv_into"); return NULL; } if (recvlen == 0) { @@ -2479,6 +2507,12 @@ if (!PyArg_ParseTuple(args, "i|i:recvfrom", &recvlen, &flags)) return NULL; + if (recvlen < 0) { + PyErr_SetString(PyExc_ValueError, + "negative buffersize in recvfrom"); + return NULL; + } + buf = PyString_FromStringAndSize((char *) 0, recvlen); if (buf == NULL) return NULL; @@ -2525,14 +2559,15 @@ PyObject *addr = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "w#|ii:recvfrom", kwlist, - &buf, &buflen, &recvlen, &flags)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "w#|ii:recvfrom_into", + kwlist, &buf, &buflen, + &recvlen, &flags)) return NULL; assert(buf != 0 && buflen > 0); if (recvlen < 0) { PyErr_SetString(PyExc_ValueError, - "negative buffersize in recv"); + "negative buffersize in recvfrom_into"); return NULL; } if (recvlen == 0) { @@ -4383,7 +4418,9 @@ PyModule_AddIntConstant(m, "NETLINK_ROUTE6", NETLINK_ROUTE6); #endif PyModule_AddIntConstant(m, "NETLINK_IP6_FW", NETLINK_IP6_FW); +#ifdef NETLINK_DNRTMSG PyModule_AddIntConstant(m, "NETLINK_DNRTMSG", NETLINK_DNRTMSG); +#endif #ifdef NETLINK_TAPBASE PyModule_AddIntConstant(m, "NETLINK_TAPBASE", NETLINK_TAPBASE); #endif @@ -4428,6 +4465,11 @@ #ifdef USE_BLUETOOTH PyModule_AddIntConstant(m, "AF_BLUETOOTH", AF_BLUETOOTH); PyModule_AddIntConstant(m, "BTPROTO_L2CAP", BTPROTO_L2CAP); + PyModule_AddIntConstant(m, "BTPROTO_HCI", BTPROTO_HCI); + PyModule_AddIntConstant(m, "SOL_HCI", SOL_HCI); + PyModule_AddIntConstant(m, "HCI_TIME_STAMP", HCI_TIME_STAMP); + PyModule_AddIntConstant(m, "HCI_DATA_DIR", HCI_DATA_DIR); + PyModule_AddIntConstant(m, "HCI_FILTER", HCI_FILTER); #if !defined(__FreeBSD__) PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO); #endif Modified: python/branches/bcannon-objcap/Modules/socketmodule.h ============================================================================== --- python/branches/bcannon-objcap/Modules/socketmodule.h (original) +++ python/branches/bcannon-objcap/Modules/socketmodule.h Fri May 25 22:13:08 2007 @@ -46,6 +46,7 @@ #include #include #include +#include #endif #ifdef HAVE_BLUETOOTH_H @@ -98,6 +99,7 @@ struct sockaddr_l2 bt_l2; struct sockaddr_rc bt_rc; struct sockaddr_sco bt_sco; + struct sockaddr_hci bt_hci; #endif #ifdef HAVE_NETPACKET_PACKET_H struct sockaddr_ll ll; Modified: python/branches/bcannon-objcap/Modules/timemodule.c ============================================================================== --- python/branches/bcannon-objcap/Modules/timemodule.c (original) +++ python/branches/bcannon-objcap/Modules/timemodule.c Fri May 25 22:13:08 2007 @@ -175,7 +175,8 @@ if (!QueryPerformanceFrequency(&freq) || freq.QuadPart == 0) { /* Unlikely to happen - this works on all intel machines at least! Revert to clock() */ - return PyFloat_FromDouble(clock()); + return PyFloat_FromDouble(((double)clock()) / + CLOCKS_PER_SEC); } divisor = (double)freq.QuadPart; } Modified: python/branches/bcannon-objcap/Objects/abstract.c ============================================================================== --- python/branches/bcannon-objcap/Objects/abstract.c (original) +++ python/branches/bcannon-objcap/Objects/abstract.c Fri May 25 22:13:08 2007 @@ -1157,6 +1157,8 @@ { if (s && PyInstance_Check(s)) return PyObject_HasAttrString(s, "__getitem__"); + if (PyObject_IsInstance(s, (PyObject *)&PyDict_Type)) + return 0; return s != NULL && s->ob_type->tp_as_sequence && s->ob_type->tp_as_sequence->sq_item != NULL; } Modified: python/branches/bcannon-objcap/Objects/classobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/classobject.c (original) +++ python/branches/bcannon-objcap/Objects/classobject.c Fri May 25 22:13:08 2007 @@ -1539,6 +1539,18 @@ return generic_unary_op(self, o); \ } +/* unary function with a fallback */ +#define UNARY_FB(funcname, methodname, funcname_fb) \ +static PyObject *funcname(PyInstanceObject *self) { \ + static PyObject *o; \ + if (o == NULL) { o = PyString_InternFromString(methodname); \ + if (o == NULL) return NULL; } \ + if (PyObject_HasAttr((PyObject*)self, o)) \ + return generic_unary_op(self, o); \ + else \ + return funcname_fb(self); \ +} + #define BINARY(f, m, n) \ static PyObject *f(PyObject *v, PyObject *w) { \ return do_binop(v, w, "__" m "__", "__r" m "__", n); \ @@ -1777,7 +1789,7 @@ UNARY(instance_invert, "__invert__") UNARY(instance_int, "__int__") -UNARY(instance_long, "__long__") +UNARY_FB(instance_long, "__long__", instance_int) UNARY(instance_float, "__float__") UNARY(instance_oct, "__oct__") UNARY(instance_hex, "__hex__") Modified: python/branches/bcannon-objcap/Objects/complexobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/complexobject.c (original) +++ python/branches/bcannon-objcap/Objects/complexobject.c Fri May 25 22:13:08 2007 @@ -252,12 +252,59 @@ PyComplex_AsCComplex(PyObject *op) { Py_complex cv; + PyObject *newop = NULL; + static PyObject *complex_str = NULL; + + assert(op); + /* If op is already of type PyComplex_Type, return its value */ if (PyComplex_Check(op)) { return ((PyComplexObject *)op)->cval; } + /* If not, use op's __complex__ method, if it exists */ + + /* return -1 on failure */ + cv.real = -1.; + cv.imag = 0.; + + if (PyInstance_Check(op)) { + /* this can go away in python 3000 */ + if (PyObject_HasAttrString(op, "__complex__")) { + newop = PyObject_CallMethod(op, "__complex__", NULL); + if (!newop) + return cv; + } + /* else try __float__ */ + } else { + PyObject *complexfunc; + if (!complex_str) { + if (!(complex_str = PyString_FromString("__complex__"))) + return cv; + } + complexfunc = _PyType_Lookup(op->ob_type, complex_str); + /* complexfunc is a borrowed reference */ + if (complexfunc) { + newop = PyObject_CallFunctionObjArgs(complexfunc, op, NULL); + if (!newop) + return cv; + } + } + + if (newop) { + if (!PyComplex_Check(newop)) { + PyErr_SetString(PyExc_TypeError, + "__complex__ should return a complex object"); + Py_DECREF(newop); + return cv; + } + cv = ((PyComplexObject *)newop)->cval; + Py_DECREF(newop); + return cv; + } + /* If neither of the above works, interpret op as a float giving the + real part of the result, and fill in the imaginary part as 0. */ else { + /* PyFloat_AsDouble will return -1 on failure */ cv.real = PyFloat_AsDouble(op); - cv.imag = 0.; return cv; } } @@ -481,7 +528,7 @@ } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, - "complex exponentiaion"); + "complex exponentiation"); return NULL; } return PyComplex_FromCComplex(p); @@ -672,7 +719,7 @@ const char *s, *start; char *end; double x=0.0, y=0.0, z; - int got_re=0, got_im=0, done=0; + int got_re=0, got_im=0, got_bracket=0, done=0; int digit_or_dot; int sw_error=0; int sign; @@ -712,10 +759,17 @@ start = s; while (*s && isspace(Py_CHARMASK(*s))) s++; - if (s[0] == '\0') { + if (s[0] == '\0') { PyErr_SetString(PyExc_ValueError, "complex() arg is an empty string"); return NULL; + } + if (s[0] == '(') { + /* Skip over possible bracket from repr(). */ + got_bracket = 1; + s++; + while (*s && isspace(Py_CHARMASK(*s))) + s++; } z = -1.0; @@ -734,13 +788,26 @@ if(!done) sw_error=1; break; + case ')': + if (!got_bracket || !(got_re || got_im)) { + sw_error=1; + break; + } + got_bracket=0; + done=1; + s++; + while (*s && isspace(Py_CHARMASK(*s))) + s++; + if (*s) sw_error=1; + break; + case '-': sign = -1; /* Fallthrough */ case '+': if (done) sw_error=1; s++; - if ( *s=='\0'||*s=='+'||*s=='-' || + if ( *s=='\0'||*s=='+'||*s=='-'||*s==')'|| isspace(Py_CHARMASK(*s)) ) sw_error=1; break; @@ -766,7 +833,7 @@ if (isspace(Py_CHARMASK(*s))) { while (*s && isspace(Py_CHARMASK(*s))) s++; - if (s[0] != '\0') + if (*s && *s != ')') sw_error=1; else done = 1; @@ -812,7 +879,7 @@ } while (s - start < len && !sw_error); - if (sw_error) { + if (sw_error || got_bracket) { PyErr_SetString(PyExc_ValueError, "complex() arg is a malformed string"); return NULL; @@ -837,12 +904,14 @@ &r, &i)) return NULL; - /* Special-case for single argument that is already complex */ + /* Special-case for a single argument when type(arg) is complex. */ if (PyComplex_CheckExact(r) && i == NULL && type == &PyComplex_Type) { /* Note that we can't know whether it's safe to return a complex *subclass* instance as-is, hence the restriction - to exact complexes here. */ + to exact complexes here. If either the input or the + output is a complex subclass, it will be handled below + as a non-orthogonal vector. */ Py_INCREF(r); return r; } @@ -893,6 +962,14 @@ } return NULL; } + + /* If we get this far, then the "real" and "imag" parts should + both be treated as numbers, and the constructor should return a + complex number equal to (real + imag*1j). + + Note that we do NOT assume the input to already be in canonical + form; the "real" and "imag" parts might themselves be complex + numbers, which slightly complicates the code below. */ if (PyComplex_Check(r)) { /* Note that if r is of a complex subtype, we're only retaining its real & imag parts here, and the return @@ -903,8 +980,14 @@ } } else { + /* The "real" part really is entirely real, and contributes + nothing in the imaginary direction. + Just treat it as a double. */ + cr.imag = 0.0; tmp = PyNumber_Float(r); if (own_r) { + /* r was a newly created complex number, rather + than the original "real" argument. */ Py_DECREF(r); } if (tmp == NULL) @@ -917,7 +1000,6 @@ } cr.real = PyFloat_AsDouble(tmp); Py_DECREF(tmp); - cr.imag = 0.0; } if (i == NULL) { ci.real = 0.0; @@ -926,13 +1008,19 @@ else if (PyComplex_Check(i)) ci = ((PyComplexObject*)i)->cval; else { + /* The "imag" part really is entirely imaginary, and + contributes nothing in the real direction. + Just treat it as a double. */ + ci.imag = 0.0; tmp = (*nbi->nb_float)(i); if (tmp == NULL) return NULL; ci.real = PyFloat_AsDouble(tmp); Py_DECREF(tmp); - ci.imag = 0.; } + /* If the input was in canonical form, then the "real" and "imag" + parts are real numbers, so that ci.real and cr.imag are zero. + We need this correction in case they were not real numbers. */ cr.real -= ci.imag; cr.imag += ci.real; return complex_subtype_from_c_complex(type, cr); Modified: python/branches/bcannon-objcap/Objects/dictnotes.txt ============================================================================== --- python/branches/bcannon-objcap/Objects/dictnotes.txt (original) +++ python/branches/bcannon-objcap/Objects/dictnotes.txt Fri May 25 22:13:08 2007 @@ -98,6 +98,17 @@ depending on the size of the dictionary. Setting to *4 eliminates every other resize step. +* Maximum sparseness (minimum dictionary load). What percentage + of entries can be unused before the dictionary shrinks to + free up memory and speed up iteration? (The current CPython + code does not represent this parameter directly.) + +* Shrinkage rate upon exceeding maximum sparseness. The current + CPython code never even checks sparseness when deleting a + key. When a new key is added, it resizes based on the number + of active keys, so that the addition may trigger shrinkage + rather than growth. + Tune-ups should be measured across a broad range of applications and use cases. A change to any parameter will help in some situations and hurt in others. The key is to find settings that help the most common @@ -115,6 +126,15 @@ Also, every dictionary iterates at least twice, once for the memset() when it is created and once by dealloc(). +Dictionary operations involving only a single key can be O(1) unless +resizing is possible. By checking for a resize only when the +dictionary can grow (and may *require* resizing), other operations +remain O(1), and the odds of resize thrashing or memory fragmentation +are reduced. In particular, an algorithm that empties a dictionary +by repeatedly invoking .pop will see no resizing, which might +not be necessary at all because the dictionary is eventually +discarded entirely. + Results of Cache Locality Experiments ------------------------------------- Modified: python/branches/bcannon-objcap/Objects/dictobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/dictobject.c (original) +++ python/branches/bcannon-objcap/Objects/dictobject.c Fri May 25 22:13:08 2007 @@ -803,6 +803,34 @@ return 1; } +/* Internal version of PyDict_Next that returns a hash value in addition to the key and value.*/ +int +_PyDict_Next(PyObject *op, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue, long *phash) +{ + register Py_ssize_t i; + register Py_ssize_t mask; + register dictentry *ep; + + if (!PyDict_Check(op)) + return 0; + i = *ppos; + if (i < 0) + return 0; + ep = ((dictobject *)op)->ma_table; + mask = ((dictobject *)op)->ma_mask; + while (i <= mask && ep[i].me_value == NULL) + i++; + *ppos = i+1; + if (i > mask) + return 0; + *phash = (long)(ep[i].me_hash); + if (pkey) + *pkey = ep[i].me_key; + if (pvalue) + *pvalue = ep[i].me_value; + return 1; +} + /* Methods */ static void @@ -1147,6 +1175,24 @@ if (d == NULL) return NULL; + if (PyDict_CheckExact(d) && PyAnySet_CheckExact(seq)) { + dictobject *mp = (dictobject *)d; + Py_ssize_t pos = 0; + PyObject *key; + long hash; + + if (dictresize(mp, PySet_GET_SIZE(seq))) + return NULL; + + while (_PySet_NextEntry(seq, &pos, &key, &hash)) { + Py_INCREF(key); + Py_INCREF(value); + if (insertdict(mp, key, hash, value)) + return NULL; + } + return d; + } + it = PyObject_GetIter(seq); if (it == NULL){ Py_DECREF(d); @@ -1306,7 +1352,7 @@ return -1; } mp = (dictobject*)a; - if (PyDict_Check(b)) { + if (PyDict_CheckExact(b)) { other = (dictobject*)b; if (other == mp || other->ma_used == 0) /* a.update(a) or a.update({}); nothing to do */ @@ -1642,7 +1688,7 @@ } static PyObject * -dict_has_key(register dictobject *mp, PyObject *key) +dict_contains(register dictobject *mp, PyObject *key) { long hash; dictentry *ep; @@ -1660,6 +1706,16 @@ } static PyObject * +dict_has_key(register dictobject *mp, PyObject *key) +{ + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "dict.has_key() not supported in 3.x") < 0) + return NULL; + return dict_contains(mp, key); +} + +static PyObject * dict_get(register dictobject *mp, PyObject *args) { PyObject *key; @@ -1932,7 +1988,7 @@ "D.iteritems() -> an iterator over the (key, value) items of D"); static PyMethodDef mapp_methods[] = { - {"__contains__",(PyCFunction)dict_has_key, METH_O | METH_COEXIST, + {"__contains__",(PyCFunction)dict_contains, METH_O | METH_COEXIST, contains__doc__}, {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST, getitem__doc__}, @@ -1987,6 +2043,17 @@ return ep == NULL ? -1 : (ep->me_value != NULL); } +/* Internal version of PyDict_Contains used when the hash value is already known */ +int +_PyDict_Contains(PyObject *op, PyObject *key, long hash) +{ + dictobject *mp = (dictobject *)op; + dictentry *ep; + + ep = (mp->ma_lookup)(mp, key, hash); + return ep == NULL ? -1 : (ep->me_value != NULL); +} + /* Hack to implement "key in dict" */ static PySequenceMethods dict_as_sequence = { 0, /* sq_length */ @@ -2073,7 +2140,7 @@ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DICT_SUBCLASS, /* tp_flags */ dictionary_doc, /* tp_doc */ dict_traverse, /* tp_traverse */ dict_tp_clear, /* tp_clear */ Modified: python/branches/bcannon-objcap/Objects/enumobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/enumobject.c (original) +++ python/branches/bcannon-objcap/Objects/enumobject.c Fri May 25 22:13:08 2007 @@ -62,6 +62,12 @@ PyObject *result = en->en_result; PyObject *it = en->en_sit; + if (en->en_index == LONG_MAX) { + PyErr_SetString(PyExc_OverflowError, + "enumerate() is limited to LONG_MAX items"); + return NULL; + } + next_item = (*it->ob_type->tp_iternext)(it); if (next_item == NULL) return NULL; Modified: python/branches/bcannon-objcap/Objects/exceptions.c ============================================================================== --- python/branches/bcannon-objcap/Objects/exceptions.c (original) +++ python/branches/bcannon-objcap/Objects/exceptions.c Fri May 25 22:13:08 2007 @@ -33,6 +33,8 @@ PyBaseExceptionObject *self; self = (PyBaseExceptionObject *)type->tp_alloc(type, 0); + if (!self) + return NULL; /* the dict is created on the fly in PyObject_GenericSetAttr */ self->message = self->dict = NULL; @@ -210,13 +212,6 @@ 0 /* sq_inplace_repeat; */ }; -static PyMemberDef BaseException_members[] = { - {"message", T_OBJECT, offsetof(PyBaseExceptionObject, message), 0, - PyDoc_STR("exception message")}, - {NULL} /* Sentinel */ -}; - - static PyObject * BaseException_get_dict(PyBaseExceptionObject *self) { @@ -272,9 +267,42 @@ return 0; } +static PyObject * +BaseException_get_message(PyBaseExceptionObject *self) +{ + int ret; + ret = PyErr_WarnEx(PyExc_DeprecationWarning, + "BaseException.message has been deprecated as " + "of Python 2.6", + 1); + if (ret == -1) + return NULL; + + Py_INCREF(self->message); + return self->message; +} + +static int +BaseException_set_message(PyBaseExceptionObject *self, PyObject *val) +{ + int ret; + ret = PyErr_WarnEx(PyExc_DeprecationWarning, + "BaseException.message has been deprecated as " + "of Python 2.6", + 1); + if (ret == -1) + return -1; + Py_INCREF(val); + Py_DECREF(self->message); + self->message = val; + return 0; +} + static PyGetSetDef BaseException_getset[] = { {"__dict__", (getter)BaseException_get_dict, (setter)BaseException_set_dict}, {"args", (getter)BaseException_get_args, (setter)BaseException_set_args}, + {"message", (getter)BaseException_get_message, + (setter)BaseException_set_message}, {NULL}, }; @@ -300,7 +328,8 @@ PyObject_GenericGetAttr, /*tp_getattro*/ PyObject_GenericSetAttr, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | + Py_TPFLAGS_BASE_EXC_SUBCLASS, /*tp_flags*/ PyDoc_STR("Common base class for all exceptions"), /* tp_doc */ (traverseproc)BaseException_traverse, /* tp_traverse */ (inquiry)BaseException_clear, /* tp_clear */ @@ -309,7 +338,7 @@ 0, /* tp_iter */ 0, /* tp_iternext */ BaseException_methods, /* tp_methods */ - BaseException_members, /* tp_members */ + 0, /* tp_members */ BaseException_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ @@ -460,8 +489,6 @@ } static PyMemberDef SystemExit_members[] = { - {"message", T_OBJECT, offsetof(PySystemExitObject, message), 0, - PyDoc_STR("exception message")}, {"code", T_OBJECT, offsetof(PySystemExitObject, code), 0, PyDoc_STR("exception code")}, {NULL} /* Sentinel */ @@ -662,8 +689,6 @@ } static PyMemberDef EnvironmentError_members[] = { - {"message", T_OBJECT, offsetof(PyEnvironmentErrorObject, message), 0, - PyDoc_STR("exception message")}, {"errno", T_OBJECT, offsetof(PyEnvironmentErrorObject, myerrno), 0, PyDoc_STR("exception errno")}, {"strerror", T_OBJECT, offsetof(PyEnvironmentErrorObject, strerror), 0, @@ -895,8 +920,6 @@ } static PyMemberDef WindowsError_members[] = { - {"message", T_OBJECT, offsetof(PyWindowsErrorObject, message), 0, - PyDoc_STR("exception message")}, {"errno", T_OBJECT, offsetof(PyWindowsErrorObject, myerrno), 0, PyDoc_STR("POSIX exception code")}, {"strerror", T_OBJECT, offsetof(PyWindowsErrorObject, strerror), 0, @@ -1127,8 +1150,6 @@ } static PyMemberDef SyntaxError_members[] = { - {"message", T_OBJECT, offsetof(PySyntaxErrorObject, message), 0, - PyDoc_STR("exception message")}, {"msg", T_OBJECT, offsetof(PySyntaxErrorObject, msg), 0, PyDoc_STR("exception msg")}, {"filename", T_OBJECT, offsetof(PySyntaxErrorObject, filename), 0, @@ -1563,8 +1584,6 @@ } static PyMemberDef UnicodeError_members[] = { - {"message", T_OBJECT, offsetof(PyUnicodeErrorObject, message), 0, - PyDoc_STR("exception message")}, {"encoding", T_OBJECT, offsetof(PyUnicodeErrorObject, encoding), 0, PyDoc_STR("exception encoding")}, {"object", T_OBJECT, offsetof(PyUnicodeErrorObject, object), 0, Modified: python/branches/bcannon-objcap/Objects/fileobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/fileobject.c (original) +++ python/branches/bcannon-objcap/Objects/fileobject.c Fri May 25 22:13:08 2007 @@ -139,17 +139,16 @@ ignore stuff they don't understand... write or append mode with universal newline support is expressly forbidden by PEP 278. Additionally, remove the 'U' from the mode string as platforms - won't know what it is. */ -/* zero return is kewl - one is un-kewl */ -static int -sanitize_the_mode(char *mode) + won't know what it is. Non-zero return signals an exception */ +int +_PyFile_SanitizeMode(char *mode) { char *upos; size_t len = strlen(mode); if (!len) { PyErr_SetString(PyExc_ValueError, "empty mode string"); - return 1; + return -1; } upos = strchr(mode, 'U'); @@ -160,7 +159,7 @@ PyErr_Format(PyExc_ValueError, "universal newline " "mode can only be used with modes " "starting with 'r'"); - return 1; + return -1; } if (mode[0] != 'r') { @@ -175,7 +174,7 @@ } else if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') { PyErr_Format(PyExc_ValueError, "mode string must begin with " "one of 'r', 'w', 'a' or 'U', not '%.200s'", mode); - return 1; + return -1; } return 0; @@ -204,7 +203,7 @@ } strcpy(newmode, mode); - if (sanitize_the_mode(newmode)) { + if (_PyFile_SanitizeMode(newmode)) { f = NULL; goto cleanup; } Modified: python/branches/bcannon-objcap/Objects/floatobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/floatobject.c (original) +++ python/branches/bcannon-objcap/Objects/floatobject.c Fri May 25 22:13:08 2007 @@ -764,18 +764,7 @@ /* Sort out special cases here instead of relying on pow() */ if (iw == 0) { /* v**0 is 1, even 0**0 */ - PyFPE_START_PROTECT("pow", return NULL) - if ((PyObject *)z != Py_None) { - double iz; - CONVERT_TO_DOUBLE(z, iz); - ix = fmod(1.0, iz); - if (ix != 0 && iz < 0) - ix += iz; - } - else - ix = 1.0; - PyFPE_END_PROTECT(ix) - return PyFloat_FromDouble(ix); + return PyFloat_FromDouble(1.0); } if (iv == 0.0) { /* 0**w is error if w<0, else 1 */ if (iw < 0.0) { Modified: python/branches/bcannon-objcap/Objects/frameobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/frameobject.c (original) +++ python/branches/bcannon-objcap/Objects/frameobject.c Fri May 25 22:13:08 2007 @@ -48,7 +48,7 @@ } /* Setter for f_lineno - you can set f_lineno from within a trace function in - * order to jump to a given line of code, subject to some restrictions. Most + * order to jump to a given line of code, subject to some restrictions. Most * lines are OK to jump to because they don't make any assumptions about the * state of the stack (obvious because you could remove the line and the code * would still work without any stack errors), but there are some constructs @@ -68,7 +68,7 @@ int new_lineno = 0; /* The new value of f_lineno */ int new_lasti = 0; /* The new value of f_lasti */ int new_iblock = 0; /* The new value of f_iblock */ - char *code = NULL; /* The bytecode for the frame... */ + unsigned char *code = NULL; /* The bytecode for the frame... */ Py_ssize_t code_len = 0; /* ...and its length */ char *lnotab = NULL; /* Iterating over co_lnotab */ Py_ssize_t lnotab_len = 0; /* (ditto) */ @@ -85,7 +85,7 @@ int blockstack[CO_MAXBLOCKS]; /* Walking the 'finally' blocks */ int in_finally[CO_MAXBLOCKS]; /* (ditto) */ int blockstack_top = 0; /* (ditto) */ - int setup_op = 0; /* (ditto) */ + unsigned char setup_op = 0; /* (ditto) */ /* f_lineno must be an integer. */ if (!PyInt_Check(p_new_lineno)) { @@ -137,7 +137,7 @@ } /* We're now ready to look at the bytecode. */ - PyString_AsStringAndSize(f->f_code->co_code, &code, &code_len); + PyString_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); min_addr = MIN(new_lasti, f->f_lasti); max_addr = MAX(new_lasti, f->f_lasti); @@ -159,7 +159,7 @@ /* You can't jump into or out of a 'finally' block because the 'try' * block leaves something on the stack for the END_FINALLY to clean - * up. So we walk the bytecode, maintaining a simulated blockstack. + * up. So we walk the bytecode, maintaining a simulated blockstack. * When we reach the old or new address and it's in a 'finally' block * we note the address of the corresponding SETUP_FINALLY. The jump * is only legal if neither address is in a 'finally' block or @@ -383,7 +383,7 @@ ob_type == &Frametype f_back next item on free list, or NULL f_stacksize size of value stack - ob_size size of localsplus + ob_size size of localsplus Note that the value and block stacks are preserved -- this can save another malloc() call or two (and two free() calls as well!). Also note that, unlike for integers, each frame object is a @@ -408,12 +408,12 @@ PyObject **p, **valuestack; PyCodeObject *co; - PyObject_GC_UnTrack(f); + PyObject_GC_UnTrack(f); Py_TRASHCAN_SAFE_BEGIN(f) /* Kill all local variables */ - valuestack = f->f_valuestack; - for (p = f->f_localsplus; p < valuestack; p++) - Py_CLEAR(*p); + valuestack = f->f_valuestack; + for (p = f->f_localsplus; p < valuestack; p++) + Py_CLEAR(*p); /* Free stack */ if (f->f_stacktop != NULL) { @@ -430,18 +430,18 @@ Py_CLEAR(f->f_exc_value); Py_CLEAR(f->f_exc_traceback); - co = f->f_code; - if (co->co_zombieframe == NULL) - co->co_zombieframe = f; + co = f->f_code; + if (co->co_zombieframe == NULL) + co->co_zombieframe = f; else if (numfree < MAXFREELIST) { ++numfree; f->f_back = free_list; free_list = f; - } + } else PyObject_GC_Del(f); - Py_DECREF(co); + Py_DECREF(co); Py_TRASHCAN_SAFE_END(f) } @@ -482,12 +482,12 @@ int i, slots; /* Before anything else, make sure that this frame is clearly marked - * as being defunct! Else, e.g., a generator reachable from this - * frame may also point to this frame, believe itself to still be - * active, and try cleaning up this frame again. - */ + * as being defunct! Else, e.g., a generator reachable from this + * frame may also point to this frame, believe itself to still be + * active, and try cleaning up this frame again. + */ oldtop = f->f_stacktop; - f->f_stacktop = NULL; + f->f_stacktop = NULL; Py_CLEAR(f->f_exc_type); Py_CLEAR(f->f_exc_value); @@ -514,10 +514,10 @@ "frame", sizeof(PyFrameObject), sizeof(PyObject *), - (destructor)frame_dealloc, /* tp_dealloc */ + (destructor)frame_dealloc, /* tp_dealloc */ 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ @@ -530,8 +530,8 @@ PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)frame_traverse, /* tp_traverse */ + 0, /* tp_doc */ + (traverseproc)frame_traverse, /* tp_traverse */ (inquiry)frame_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ @@ -579,7 +579,7 @@ builtins = NULL; } if (builtins == NULL) { - /* No builtins! Make up a minimal one + /* No builtins! Make up a minimal one Give them 'None', at least. */ builtins = PyDict_New(); if (builtins == NULL || @@ -599,39 +599,39 @@ Py_INCREF(builtins); } if (code->co_zombieframe != NULL) { - f = code->co_zombieframe; - code->co_zombieframe = NULL; - _Py_NewReference((PyObject *)f); - assert(f->f_code == code); - } - else { - Py_ssize_t extras, ncells, nfrees; - ncells = PyTuple_GET_SIZE(code->co_cellvars); - nfrees = PyTuple_GET_SIZE(code->co_freevars); - extras = code->co_stacksize + code->co_nlocals + ncells + - nfrees; - if (free_list == NULL) { - f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, - extras); - if (f == NULL) { - Py_DECREF(builtins); - return NULL; - } - } - else { - assert(numfree > 0); - --numfree; - f = free_list; - free_list = free_list->f_back; - if (f->ob_size < extras) { - f = PyObject_GC_Resize(PyFrameObject, f, extras); - if (f == NULL) { - Py_DECREF(builtins); - return NULL; - } - } - _Py_NewReference((PyObject *)f); - } + f = code->co_zombieframe; + code->co_zombieframe = NULL; + _Py_NewReference((PyObject *)f); + assert(f->f_code == code); + } + else { + Py_ssize_t extras, ncells, nfrees; + ncells = PyTuple_GET_SIZE(code->co_cellvars); + nfrees = PyTuple_GET_SIZE(code->co_freevars); + extras = code->co_stacksize + code->co_nlocals + ncells + + nfrees; + if (free_list == NULL) { + f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, + extras); + if (f == NULL) { + Py_DECREF(builtins); + return NULL; + } + } + else { + assert(numfree > 0); + --numfree; + f = free_list; + free_list = free_list->f_back; + if (f->ob_size < extras) { + f = PyObject_GC_Resize(PyFrameObject, f, extras); + if (f == NULL) { + Py_DECREF(builtins); + return NULL; + } + } + _Py_NewReference((PyObject *)f); + } f->f_code = code; extras = code->co_nlocals + ncells + nfrees; @@ -640,7 +640,7 @@ f->f_localsplus[i] = NULL; f->f_locals = NULL; f->f_trace = NULL; - f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL; + f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL; } f->f_stacktop = f->f_valuestack; f->f_builtins = builtins; @@ -659,13 +659,13 @@ Py_DECREF(f); return NULL; } - f->f_locals = locals; + f->f_locals = locals; } else { if (locals == NULL) locals = globals; Py_INCREF(locals); - f->f_locals = locals; + f->f_locals = locals; } f->f_tstate = tstate; @@ -701,18 +701,38 @@ return b; } -/* Convert between "fast" version of locals and dictionary version */ +/* Convert between "fast" version of locals and dictionary version. + + map and values are input arguments. map is a tuple of strings. + values is an array of PyObject*. At index i, map[i] is the name of + the variable with value values[i]. The function copies the first + nmap variable from map/values into dict. If values[i] is NULL, + the variable is deleted from dict. + + If deref is true, then the values being copied are cell variables + and the value is extracted from the cell variable before being put + in dict. + + Exceptions raised while modifying the dict are silently ignored, + because there is no good way to report them. + */ static void map_to_dict(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values, - Py_ssize_t deref) + int deref) { Py_ssize_t j; + assert(PyTuple_Check(map)); + assert(PyDict_Check(dict)); + assert(PyTuple_Size(map) >= nmap); for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = values[j]; - if (deref) + assert(PyString_Check(key)); + if (deref) { + assert(PyCell_Check(value)); value = PyCell_GET(value); + } if (value == NULL) { if (PyObject_DelItem(dict, key) != 0) PyErr_Clear(); @@ -724,29 +744,55 @@ } } +/* Copy values from the "locals" dict into the fast locals. + + dict is an input argument containing string keys representing + variables names and arbitrary PyObject* as values. + + map and values are input arguments. map is a tuple of strings. + values is an array of PyObject*. At index i, map[i] is the name of + the variable with value values[i]. The function copies the first + nmap variable from map/values into dict. If values[i] is NULL, + the variable is deleted from dict. + + If deref is true, then the values being copied are cell variables + and the value is extracted from the cell variable before being put + in dict. If clear is true, then variables in map but not in dict + are set to NULL in map; if clear is false, variables missing in + dict are ignored. + + Exceptions raised while modifying the dict are silently ignored, + because there is no good way to report them. +*/ + static void dict_to_map(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values, - Py_ssize_t deref, int clear) + int deref, int clear) { Py_ssize_t j; + assert(PyTuple_Check(map)); + assert(PyDict_Check(dict)); + assert(PyTuple_Size(map) >= nmap); for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = PyObject_GetItem(dict, key); - if (value == NULL) + assert(PyString_Check(key)); + /* We only care about NULLs if clear is true. */ + if (value == NULL) { PyErr_Clear(); + if (!clear) + continue; + } if (deref) { - if (value || clear) { - if (PyCell_GET(values[j]) != value) { - if (PyCell_Set(values[j], value) < 0) - PyErr_Clear(); - } - } - } else if (value != NULL || clear) { - if (values[j] != value) { - Py_XINCREF(value); - Py_XDECREF(values[j]); - values[j] = value; + assert(PyCell_Check(values[j])); + if (PyCell_GET(values[j]) != value) { + if (PyCell_Set(values[j], value) < 0) + PyErr_Clear(); } + } else if (values[j] != value) { + Py_XINCREF(value); + Py_XDECREF(values[j]); + values[j] = value; } Py_XDECREF(value); } @@ -761,7 +807,7 @@ PyObject *error_type, *error_value, *error_traceback; PyCodeObject *co; Py_ssize_t j; - int ncells, nfreevars; + int ncells, nfreevars; if (f == NULL) return; locals = f->f_locals; @@ -788,8 +834,18 @@ if (ncells || nfreevars) { map_to_dict(co->co_cellvars, ncells, locals, fast + co->co_nlocals, 1); - map_to_dict(co->co_freevars, nfreevars, - locals, fast + co->co_nlocals + ncells, 1); + /* If the namespace is unoptimized, then one of the + following cases applies: + 1. It does not contain free variables, because it + uses import * or is a top-level namespace. + 2. It is a class namespace. + We don't want to accidentally copy free variables + into the locals dict used by the class. + */ + if (co->co_flags & CO_OPTIMIZED) { + map_to_dict(co->co_freevars, nfreevars, + locals, fast + co->co_nlocals + ncells, 1); + } } PyErr_Restore(error_type, error_value, error_traceback); } @@ -827,7 +883,7 @@ locals, fast + co->co_nlocals, 1, clear); dict_to_map(co->co_freevars, nfreevars, locals, fast + co->co_nlocals + ncells, 1, - clear); + clear); } PyErr_Restore(error_type, error_value, error_traceback); } Modified: python/branches/bcannon-objcap/Objects/intobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/intobject.c (original) +++ python/branches/bcannon-objcap/Objects/intobject.c Fri May 25 22:13:08 2007 @@ -213,11 +213,10 @@ return -1; } - if (nb->nb_long != 0) { + if (nb->nb_long != 0) io = (PyIntObject*) (*nb->nb_long) (op); - } else { + else io = (PyIntObject*) (*nb->nb_int) (op); - } if (io == NULL) return -1; if (!PyInt_Check(io)) { @@ -394,7 +393,7 @@ char *buffer = (char *)PyMem_MALLOC(length+1); if (buffer == NULL) - return NULL; + return PyErr_NoMemory(); if (PyUnicode_EncodeDecimal(s, length, buffer, NULL)) { PyMem_FREE(buffer); @@ -1138,7 +1137,7 @@ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_INT_SUBCLASS, /* tp_flags */ int_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ Modified: python/branches/bcannon-objcap/Objects/listobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/listobject.c (original) +++ python/branches/bcannon-objcap/Objects/listobject.c Fri May 25 22:13:08 2007 @@ -2672,7 +2672,7 @@ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LIST_SUBCLASS, /* tp_flags */ list_doc, /* tp_doc */ (traverseproc)list_traverse, /* tp_traverse */ (inquiry)list_clear, /* tp_clear */ Modified: python/branches/bcannon-objcap/Objects/longobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/longobject.c (original) +++ python/branches/bcannon-objcap/Objects/longobject.c Fri May 25 22:13:08 2007 @@ -893,7 +893,7 @@ int one = 1; return _PyLong_FromByteArray( (unsigned char *)&bytes, - SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 0); + SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 1); } /* Create a new long int object from a C size_t. */ @@ -1739,6 +1739,8 @@ a->ob_digit[size_a-1] < b->ob_digit[size_b-1])) { /* |a| < |b|. */ *pdiv = _PyLong_New(0); + if (*pdiv == NULL) + return -1; Py_INCREF(a); *prem = (PyLongObject *) a; return 0; @@ -1749,6 +1751,10 @@ if (z == NULL) return -1; *prem = (PyLongObject *) PyLong_FromLong((long)rem); + if (*prem == NULL) { + Py_DECREF(z); + return -1; + } } else { z = x_divrem(a, b, prem); @@ -3204,6 +3210,8 @@ { if (PyInt_Check(*pw)) { *pw = PyLong_FromLong(PyInt_AS_LONG(*pw)); + if (*pw == NULL) + return -1; Py_INCREF(*pv); return 0; } @@ -3287,8 +3295,25 @@ return PyLong_FromLong(0L); if (base == -909) return PyNumber_Long(x); - else if (PyString_Check(x)) + else if (PyString_Check(x)) { + /* Since PyLong_FromString doesn't have a length parameter, + * check here for possible NULs in the string. */ + char *string = PyString_AS_STRING(x); + if (strlen(string) != PyString_Size(x)) { + /* create a repr() of the input string, + * just like PyLong_FromString does. */ + PyObject *srepr; + srepr = PyObject_Repr(x); + if (srepr == NULL) + return NULL; + PyErr_Format(PyExc_ValueError, + "invalid literal for long() with base %d: %s", + base, PyString_AS_STRING(srepr)); + Py_DECREF(srepr); + return NULL; + } return PyLong_FromString(PyString_AS_STRING(x), NULL, base); + } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(x)) return PyLong_FromUnicode(PyUnicode_AS_UNICODE(x), @@ -3418,7 +3443,7 @@ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LONG_SUBCLASS, /* tp_flags */ long_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ Modified: python/branches/bcannon-objcap/Objects/object.c ============================================================================== --- python/branches/bcannon-objcap/Objects/object.c (original) +++ python/branches/bcannon-objcap/Objects/object.c Fri May 25 22:13:08 2007 @@ -29,6 +29,7 @@ #endif /* Py_REF_DEBUG */ int Py_DivisionWarningFlag; +int Py_Py3kWarningFlag; /* Object allocation routines used by NEWOBJ and NEWVAROBJ macros. These are used by the individual routines for object creation. @@ -1566,6 +1567,8 @@ } } +/* ------------------------- PyObject_Dir() helpers ------------------------- */ + /* Helper for PyObject_Dir. Merge the __dict__ of aclass into dict, and recursively also all the __dict__s of aclass's base classes. The order of merging isn't @@ -1662,121 +1665,192 @@ return result; } -/* Like __builtin__.dir(arg). See bltinmodule.c's builtin_dir for the - docstring, which should be kept in synch with this implementation. */ - -PyObject * -PyObject_Dir(PyObject *arg) +/* Helper for PyObject_Dir without arguments: returns the local scope. */ +static PyObject * +_dir_locals(void) { - /* Set exactly one of these non-NULL before the end. */ - PyObject *result = NULL; /* result list */ - PyObject *masterdict = NULL; /* result is masterdict.keys() */ - - /* If NULL arg, return the locals. */ - if (arg == NULL) { - PyObject *locals = PyEval_GetLocals(); - if (locals == NULL) - goto error; - result = PyMapping_Keys(locals); - if (result == NULL) - goto error; - } + PyObject *names; + PyObject *locals = PyEval_GetLocals(); - /* Elif this is some form of module, we only want its dict. */ - else if (PyModule_Check(arg)) { - masterdict = PyObject_GetAttrString(arg, "__dict__"); - if (masterdict == NULL) - goto error; - if (!PyDict_Check(masterdict)) { - PyErr_SetString(PyExc_TypeError, - "module.__dict__ is not a dictionary"); - goto error; - } + if (locals == NULL) { + PyErr_SetString(PyExc_SystemError, "frame does not exist"); + return NULL; } - /* Elif some form of type or class, grab its dict and its bases. - We deliberately don't suck up its __class__, as methods belonging - to the metaclass would probably be more confusing than helpful. */ - else if (PyType_Check(arg) || PyClass_Check(arg)) { - masterdict = PyDict_New(); - if (masterdict == NULL) - goto error; - if (merge_class_dict(masterdict, arg) < 0) - goto error; + names = PyMapping_Keys(locals); + if (!names) + return NULL; + if (!PyList_Check(names)) { + PyErr_Format(PyExc_TypeError, + "dir(): expected keys() of locals to be a list, " + "not '%.200s'", names->ob_type->tp_name); + Py_DECREF(names); + return NULL; } + /* the locals don't need to be DECREF'd */ + return names; +} - /* Else look at its dict, and the attrs reachable from its class. */ - else { - PyObject *itsclass; - /* Create a dict to start with. CAUTION: Not everything - responding to __dict__ returns a dict! */ - masterdict = PyObject_GetAttrString(arg, "__dict__"); - if (masterdict == NULL) { - PyErr_Clear(); - masterdict = PyDict_New(); - } - else if (!PyDict_Check(masterdict)) { - Py_DECREF(masterdict); - masterdict = PyDict_New(); - } - else { - /* The object may have returned a reference to its - dict, so copy it to avoid mutating it. */ - PyObject *temp = PyDict_Copy(masterdict); - Py_DECREF(masterdict); - masterdict = temp; - } - if (masterdict == NULL) - goto error; +/* Helper for PyObject_Dir of type objects: returns __dict__ and __bases__. + We deliberately don't suck up its __class__, as methods belonging to the + metaclass would probably be more confusing than helpful. +*/ +static PyObject * +_specialized_dir_type(PyObject *obj) +{ + PyObject *result = NULL; + PyObject *dict = PyDict_New(); - /* Merge in __members__ and __methods__ (if any). - XXX Would like this to go away someday; for now, it's - XXX needed to get at im_self etc of method objects. */ - if (merge_list_attr(masterdict, arg, "__members__") < 0) - goto error; - if (merge_list_attr(masterdict, arg, "__methods__") < 0) - goto error; + if (dict != NULL && merge_class_dict(dict, obj) == 0) + result = PyDict_Keys(dict); - /* Merge in attrs reachable from its class. - CAUTION: Not all objects have a __class__ attr. */ - itsclass = PyObject_GetAttrString(arg, "__class__"); - if (itsclass == NULL) - PyErr_Clear(); + Py_XDECREF(dict); + return result; +} + +/* Helper for PyObject_Dir of module objects: returns the module's __dict__. */ +static PyObject * +_specialized_dir_module(PyObject *obj) +{ + PyObject *result = NULL; + PyObject *dict = PyObject_GetAttrString(obj, "__dict__"); + + if (dict != NULL) { + if (PyDict_Check(dict)) + result = PyDict_Keys(dict); else { - int status = merge_class_dict(masterdict, itsclass); - Py_DECREF(itsclass); - if (status < 0) - goto error; + PyErr_Format(PyExc_TypeError, + "%.200s.__dict__ is not a dictionary", + PyModule_GetName(obj)); } } - assert((result == NULL) ^ (masterdict == NULL)); - if (masterdict != NULL) { - /* The result comes from its keys. */ - assert(result == NULL); - result = PyDict_Keys(masterdict); - if (result == NULL) - goto error; + Py_XDECREF(dict); + return result; +} + +/* Helper for PyObject_Dir of generic objects: returns __dict__, __class__, + and recursively up the __class__.__bases__ chain. +*/ +static PyObject * +_generic_dir(PyObject *obj) +{ + PyObject *result = NULL; + PyObject *dict = NULL; + PyObject *itsclass = NULL; + + /* Get __dict__ (which may or may not be a real dict...) */ + dict = PyObject_GetAttrString(obj, "__dict__"); + if (dict == NULL) { + PyErr_Clear(); + dict = PyDict_New(); + } + else if (!PyDict_Check(dict)) { + Py_DECREF(dict); + dict = PyDict_New(); + } + else { + /* Copy __dict__ to avoid mutating it. */ + PyObject *temp = PyDict_Copy(dict); + Py_DECREF(dict); + dict = temp; } - assert(result); - if (!PyList_Check(result)) { - PyErr_Format(PyExc_TypeError, - "Expected keys() to be a list, not '%.200s'", - result->ob_type->tp_name); + if (dict == NULL) goto error; - } - if (PyList_Sort(result) != 0) + + /* Merge in __members__ and __methods__ (if any). + * This is removed in Python 3000. */ + if (merge_list_attr(dict, obj, "__members__") < 0) + goto error; + if (merge_list_attr(dict, obj, "__methods__") < 0) goto error; - else - goto normal_return; - error: - Py_XDECREF(result); - result = NULL; + /* Merge in attrs reachable from its class. */ + itsclass = PyObject_GetAttrString(obj, "__class__"); + if (itsclass == NULL) + /* XXX(tomer): Perhaps fall back to obj->ob_type if no + __class__ exists? */ + PyErr_Clear(); + else { + if (merge_class_dict(dict, itsclass) != 0) + goto error; + } + + result = PyDict_Keys(dict); /* fall through */ - normal_return: - Py_XDECREF(masterdict); +error: + Py_XDECREF(itsclass); + Py_XDECREF(dict); + return result; +} + +/* Helper for PyObject_Dir: object introspection. + This calls one of the above specialized versions if no __dir__ method + exists. */ +static PyObject * +_dir_object(PyObject *obj) +{ + PyObject *result = NULL; + PyObject *dirfunc = PyObject_GetAttrString((PyObject *)obj->ob_type, + "__dir__"); + + assert(obj); + if (dirfunc == NULL) { + /* use default implementation */ + PyErr_Clear(); + if (PyModule_Check(obj)) + result = _specialized_dir_module(obj); + else if (PyType_Check(obj) || PyClass_Check(obj)) + result = _specialized_dir_type(obj); + else + result = _generic_dir(obj); + } + else { + /* use __dir__ */ + result = PyObject_CallFunctionObjArgs(dirfunc, obj, NULL); + Py_DECREF(dirfunc); + if (result == NULL) + return NULL; + + /* result must be a list */ + /* XXX(gbrandl): could also check if all items are strings */ + if (!PyList_Check(result)) { + PyErr_Format(PyExc_TypeError, + "__dir__() must return a list, not %.200s", + result->ob_type->tp_name); + Py_DECREF(result); + result = NULL; + } + } + + return result; +} + +/* Implementation of dir() -- if obj is NULL, returns the names in the current + (local) scope. Otherwise, performs introspection of the object: returns a + sorted list of attribute names (supposedly) accessible from the object +*/ +PyObject * +PyObject_Dir(PyObject *obj) +{ + PyObject * result; + + if (obj == NULL) + /* no object -- introspect the locals */ + result = _dir_locals(); + else + /* object -- introspect the object */ + result = _dir_object(obj); + + assert(result == NULL || PyList_Check(result)); + + if (result != NULL && PyList_Sort(result) != 0) { + /* sorting the list failed */ + Py_DECREF(result); + result = NULL; + } + return result; } @@ -2136,4 +2210,3 @@ #ifdef __cplusplus } #endif - Modified: python/branches/bcannon-objcap/Objects/setobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/setobject.c (original) +++ python/branches/bcannon-objcap/Objects/setobject.c Fri May 25 22:13:08 2007 @@ -912,14 +912,31 @@ { PyObject *key, *it; - if (PyAnySet_Check(other)) + if (PyAnySet_CheckExact(other)) return set_merge(so, other); - if (PyDict_Check(other)) { + if (PyDict_CheckExact(other)) { PyObject *value; Py_ssize_t pos = 0; - while (PyDict_Next(other, &pos, &key, &value)) { - if (set_add_key(so, key) == -1) + long hash; + Py_ssize_t dictsize = PyDict_Size(other); + + /* Do one big resize at the start, rather than + * incrementally resizing as we insert new keys. Expect + * that there will be no (or few) overlapping keys. + */ + if (dictsize == -1) + return -1; + if ((so->fill + dictsize)*3 >= (so->mask+1)*2) { + if (set_table_resize(so, (so->used + dictsize)*2) != 0) + return -1; + } + while (_PyDict_Next(other, &pos, &key, &value, &hash)) { + setentry an_entry; + + an_entry.hash = hash; + an_entry.key = key; + if (set_add_entry(so, &an_entry) == -1) return -1; } return 0; @@ -1190,7 +1207,7 @@ if (result == NULL) return NULL; - if (PyAnySet_Check(other)) { + if (PyAnySet_CheckExact(other)) { Py_ssize_t pos = 0; setentry *entry; @@ -1314,7 +1331,7 @@ if ((PyObject *)so == other) return set_clear_internal(so); - if (PyAnySet_Check(other)) { + if (PyAnySet_CheckExact(other)) { setentry *entry; Py_ssize_t pos = 0; @@ -1363,7 +1380,7 @@ setentry *entry; Py_ssize_t pos = 0; - if (!PyAnySet_Check(other) && !PyDict_Check(other)) { + if (!PyAnySet_CheckExact(other) && !PyDict_CheckExact(other)) { result = set_copy(so); if (result == NULL) return NULL; @@ -1377,12 +1394,12 @@ if (result == NULL) return NULL; - if (PyDict_Check(other)) { + if (PyDict_CheckExact(other)) { while (set_next(so, &pos, &entry)) { setentry entrycopy; entrycopy.hash = entry->hash; entrycopy.key = entry->key; - if (!PyDict_Contains(other, entry->key)) { + if (!_PyDict_Contains(other, entry->key, entry->hash)) { if (set_add_entry((PySetObject *)result, &entrycopy) == -1) { Py_DECREF(result); return NULL; @@ -1450,15 +1467,13 @@ if ((PyObject *)so == other) return set_clear(so); - if (PyDict_Check(other)) { + if (PyDict_CheckExact(other)) { PyObject *value; int rv; - while (PyDict_Next(other, &pos, &key, &value)) { + long hash; + while (_PyDict_Next(other, &pos, &key, &value, &hash)) { setentry an_entry; - long hash = PyObject_Hash(key); - if (hash == -1) - return NULL; an_entry.hash = hash; an_entry.key = key; rv = set_discard_entry(so, &an_entry); @@ -1472,7 +1487,7 @@ Py_RETURN_NONE; } - if (PyAnySet_Check(other)) { + if (PyAnySet_CheckExact(other)) { Py_INCREF(other); otherset = (PySetObject *)other; } else { @@ -1555,7 +1570,7 @@ setentry *entry; Py_ssize_t pos = 0; - if (!PyAnySet_Check(other)) { + if (!PyAnySet_CheckExact(other)) { PyObject *tmp, *result; tmp = make_new_set(&PySet_Type, other); if (tmp == NULL) @@ -1584,7 +1599,7 @@ { PyObject *tmp, *result; - if (!PyAnySet_Check(other)) { + if (!PyAnySet_CheckExact(other)) { tmp = make_new_set(&PySet_Type, other); if (tmp == NULL) return NULL; @@ -2122,7 +2137,7 @@ } int -_PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **entry) +_PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **key) { setentry *entry_ptr; @@ -2132,7 +2147,23 @@ } if (set_next((PySetObject *)set, pos, &entry_ptr) == 0) return 0; - *entry = entry_ptr->key; + *key = entry_ptr->key; + return 1; +} + +int +_PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash) +{ + setentry *entry; + + if (!PyAnySet_Check(set)) { + PyErr_BadInternalCall(); + return -1; + } + if (set_next((PySetObject *)set, pos, &entry) == 0) + return 0; + *key = entry->key; + *hash = entry->hash; return 1; } @@ -2174,7 +2205,7 @@ Py_ssize_t count; char *s; Py_ssize_t i; - PyObject *elem, *dup, *t, *f, *dup2; + PyObject *elem=NULL, *dup=NULL, *t, *f, *dup2, *x; PyObject *ob = (PyObject *)so; /* Verify preconditions and exercise type/size checks */ @@ -2220,8 +2251,8 @@ /* Exercise direct iteration */ i = 0, count = 0; - while (_PySet_Next((PyObject *)dup, &i, &elem)) { - s = PyString_AsString(elem); + while (_PySet_Next((PyObject *)dup, &i, &x)) { + s = PyString_AsString(x); assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c')); count++; } Modified: python/branches/bcannon-objcap/Objects/sliceobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/sliceobject.c (original) +++ python/branches/bcannon-objcap/Objects/sliceobject.c Fri May 25 22:13:08 2007 @@ -274,9 +274,19 @@ S. Out of bounds indices are clipped in a manner consistent with the\n\ handling of normal slices."); +static PyObject * +slice_reduce(PySliceObject* self) +{ + return Py_BuildValue("O(OOO)", self->ob_type, self->start, self->stop, self->step); +} + +PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); + static PyMethodDef slice_methods[] = { {"indices", (PyCFunction)slice_indices, METH_O, slice_indices_doc}, + {"__reduce__", (PyCFunction)slice_reduce, + METH_NOARGS, reduce_doc}, {NULL, NULL} }; Modified: python/branches/bcannon-objcap/Objects/stringobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/stringobject.c (original) +++ python/branches/bcannon-objcap/Objects/stringobject.c Fri May 25 22:13:08 2007 @@ -1131,8 +1131,7 @@ much time, since Py_NE is rarely used. */ if (a->ob_size == b->ob_size && (a->ob_sval[0] == b->ob_sval[0] - && memcmp(a->ob_sval, b->ob_sval, - a->ob_size) == 0)) { + && memcmp(a->ob_sval, b->ob_sval, a->ob_size) == 0)) { result = Py_True; } else { result = Py_False; @@ -1145,7 +1144,7 @@ c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval); if (c==0) c = memcmp(a->ob_sval, b->ob_sval, min_len); - }else + } else c = 0; if (c == 0) c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0; @@ -2345,10 +2344,10 @@ string_translate(PyStringObject *self, PyObject *args) { register char *input, *output; - register const char *table; + const char *table; register Py_ssize_t i, c, changed = 0; PyObject *input_obj = (PyObject*)self; - const char *table1, *output_start, *del_table=NULL; + const char *output_start, *del_table=NULL; Py_ssize_t inlen, tablen, dellen = 0; PyObject *result; int trans_table[256]; @@ -2359,9 +2358,13 @@ return NULL; if (PyString_Check(tableobj)) { - table1 = PyString_AS_STRING(tableobj); + table = PyString_AS_STRING(tableobj); tablen = PyString_GET_SIZE(tableobj); } + else if (tableobj == Py_None) { + table = NULL; + tablen = 256; + } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(tableobj)) { /* Unicode .translate() does not support the deletechars @@ -2375,7 +2378,7 @@ return PyUnicode_Translate((PyObject *)self, tableobj, NULL); } #endif - else if (PyObject_AsCharBuffer(tableobj, &table1, &tablen)) + else if (PyObject_AsCharBuffer(tableobj, &table, &tablen)) return NULL; if (tablen != 256) { @@ -2404,7 +2407,6 @@ dellen = 0; } - table = table1; inlen = PyString_GET_SIZE(input_obj); result = PyString_FromStringAndSize((char *)NULL, inlen); if (result == NULL) @@ -2412,7 +2414,7 @@ output_start = output = PyString_AsString(result); input = PyString_AS_STRING(input_obj); - if (dellen == 0) { + if (dellen == 0 && table != NULL) { /* If no deletions are required, use faster code */ for (i = inlen; --i >= 0; ) { c = Py_CHARMASK(*input++); @@ -2426,8 +2428,13 @@ return input_obj; } - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(table[i]); + if (table == NULL) { + for (i = 0; i < 256; i++) + trans_table[i] = Py_CHARMASK(i); + } else { + for (i = 0; i < 256; i++) + trans_table[i] = Py_CHARMASK(table[i]); + } for (i = 0; i < dellen; i++) trans_table[(int) Py_CHARMASK(del_table[i])] = -1; @@ -4018,7 +4025,7 @@ 0, /* tp_setattro */ &string_as_buffer, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_STRING_SUBCLASS, /* tp_flags */ string_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ @@ -4768,10 +4775,13 @@ reslen += rescnt; if (reslen < 0) { Py_DECREF(result); + Py_XDECREF(temp); return PyErr_NoMemory(); } - if (_PyString_Resize(&result, reslen) < 0) + if (_PyString_Resize(&result, reslen) < 0) { + Py_XDECREF(temp); return NULL; + } res = PyString_AS_STRING(result) + reslen - rescnt; } @@ -4822,6 +4832,7 @@ if (dict && (argidx < arglen) && c != '%') { PyErr_SetString(PyExc_TypeError, "not all arguments converted during string formatting"); + Py_XDECREF(temp); goto error; } Py_XDECREF(temp); @@ -4969,6 +4980,7 @@ PyObject *keys; PyStringObject *s; Py_ssize_t i, n; + Py_ssize_t immortal_size = 0, mortal_size = 0; if (interned == NULL || !PyDict_Check(interned)) return; @@ -4983,8 +4995,9 @@ give them their stolen references back, and then clear and DECREF the interned dict. */ - fprintf(stderr, "releasing interned strings\n"); n = PyList_GET_SIZE(keys); + fprintf(stderr, "releasing %" PY_FORMAT_SIZE_T "d interned strings\n", + n); for (i = 0; i < n; i++) { s = (PyStringObject *) PyList_GET_ITEM(keys, i); switch (s->ob_sstate) { @@ -4993,15 +5006,20 @@ break; case SSTATE_INTERNED_IMMORTAL: s->ob_refcnt += 1; + immortal_size += s->ob_size; break; case SSTATE_INTERNED_MORTAL: s->ob_refcnt += 2; + mortal_size += s->ob_size; break; default: Py_FatalError("Inconsistent interned string state."); } s->ob_sstate = SSTATE_NOT_INTERNED; } + fprintf(stderr, "total size of all interned strings: " + "%" PY_FORMAT_SIZE_T "d/%" PY_FORMAT_SIZE_T "d " + "mortal/immortal\n", mortal_size, immortal_size); Py_DECREF(keys); PyDict_Clear(interned); Py_DECREF(interned); Modified: python/branches/bcannon-objcap/Objects/tupleobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/tupleobject.c (original) +++ python/branches/bcannon-objcap/Objects/tupleobject.c Fri May 25 22:13:08 2007 @@ -669,7 +669,7 @@ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TUPLE_SUBCLASS, /* tp_flags */ tuple_doc, /* tp_doc */ (traverseproc)tupletraverse, /* tp_traverse */ 0, /* tp_clear */ Modified: python/branches/bcannon-objcap/Objects/typeobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/typeobject.c (original) +++ python/branches/bcannon-objcap/Objects/typeobject.c Fri May 25 22:13:08 2007 @@ -265,9 +265,10 @@ PyObject* mro; PyArg_UnpackTuple(PyList_GET_ITEM(temp, i), "", 2, 2, &cls, &mro); - Py_DECREF(cls->tp_mro); + Py_INCREF(mro); + ob = cls->tp_mro; cls->tp_mro = mro; - Py_INCREF(cls->tp_mro); + Py_DECREF(ob); } Py_DECREF(temp); goto bail; @@ -531,7 +532,7 @@ if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) /* For a heaptype, the instances count as references - to the type. Traverse the type so the collector + to the type. Traverse the type so the collector can find cycles involving this link. */ Py_VISIT(type); @@ -651,7 +652,7 @@ assert(base); } - /* If we added a weaklist, we clear it. Do this *before* calling + /* If we added a weaklist, we clear it. Do this *before* calling the finalizer (__del__), clearing slots, or clearing the instance dict. */ @@ -722,7 +723,7 @@ A. Read the comment titled "Trashcan mechanism" in object.h. For one, this explains why there must be a call to GC-untrack - before the trashcan begin macro. Without understanding the + before the trashcan begin macro. Without understanding the trashcan code, the answers to the following questions don't make sense. @@ -730,7 +731,7 @@ GC-track again afterward? A. In the case that the base class is GC-aware, the base class - probably GC-untracks the object. If it does that using the + probably GC-untracks the object. If it does that using the UNTRACK macro, this will crash when the object is already untracked. Because we don't know what the base class does, the only safe thing is to make sure the object is tracked when we @@ -738,19 +739,19 @@ requires that the object is *untracked* before it is called. So the dance becomes: - GC untrack + GC untrack trashcan begin GC track - Q. Why did the last question say "immediately GC-track again"? - It's nowhere near immediately. + Q. Why did the last question say "immediately GC-track again"? + It's nowhere near immediately. - A. Because the code *used* to re-track immediately. Bad Idea. - self has a refcount of 0, and if gc ever gets its hands on it - (which can happen if any weakref callback gets invoked), it - looks like trash to gc too, and gc also tries to delete self - then. But we're already deleting self. Double dealloction is - a subtle disaster. + A. Because the code *used* to re-track immediately. Bad Idea. + self has a refcount of 0, and if gc ever gets its hands on it + (which can happen if any weakref callback gets invoked), it + looks like trash to gc too, and gc also tries to delete self + then. But we're already deleting self. Double dealloction is + a subtle disaster. Q. Why the bizarre (net-zero) manipulation of _PyTrash_delete_nesting around the trashcan macros? @@ -763,17 +764,17 @@ - subtype_dealloc() is called - the trashcan limit is not yet reached, so the trashcan level - is incremented and the code between trashcan begin and end is - executed + is incremented and the code between trashcan begin and end is + executed - this destroys much of the object's contents, including its - slots and __dict__ + slots and __dict__ - basedealloc() is called; this is really list_dealloc(), or - some other type which also uses the trashcan macros + some other type which also uses the trashcan macros - the trashcan limit is now reached, so the object is put on the - trashcan's to-be-deleted-later list + trashcan's to-be-deleted-later list - basedealloc() returns @@ -782,13 +783,13 @@ - subtype_dealloc() returns - later, the trashcan code starts deleting the objects from its - to-be-deleted-later list + to-be-deleted-later list - subtype_dealloc() is called *AGAIN* for the same object - at the very least (if the destroyed slots and __dict__ don't - cause problems) the object's type gets decref'ed a second - time, which is *BAD*!!! + cause problems) the object's type gets decref'ed a second + time, which is *BAD*!!! The remedy is to make sure that if the code between trashcan begin and end in subtype_dealloc() is called, the code between @@ -800,7 +801,7 @@ But now it's possible that a chain of objects consisting solely of objects whose deallocator is subtype_dealloc() will defeat the trashcan mechanism completely: the decremented level means - that the effective level never reaches the limit. Therefore, we + that the effective level never reaches the limit. Therefore, we *increment* the level *before* entering the trashcan block, and matchingly decrement it after leaving. This means the trashcan code will trigger a little early, but that's no big deal. @@ -854,7 +855,7 @@ /* Internal routines to do a method lookup in the type without looking in the instance dictionary (so we can't use PyObject_GetAttr) but still binding - it to the instance. The arguments are the object, + it to the instance. The arguments are the object, the method name as a C string, and the address of a static variable used to cache the interned Python string. @@ -897,7 +898,7 @@ } /* A variation of PyObject_CallMethod that uses lookup_method() - instead of PyObject_GetAttrString(). This uses the same convention + instead of PyObject_GetAttrString(). This uses the same convention as lookup_method to cache the interned name string object. */ static PyObject * @@ -1099,7 +1100,7 @@ It's hard to produce a good error message. In the absence of better insight into error reporting, report the classes that were candidates - to be put next into the MRO. There is some conflict between the + to be put next into the MRO. There is some conflict between the order in which they should be put in the MRO, but it's hard to diagnose what constraint can't be satisfied. */ @@ -1171,7 +1172,7 @@ if (remain[i] >= PyList_GET_SIZE(cur_list)) { empty_cnt++; continue; - } + } /* Choose next candidate for MRO. @@ -1252,7 +1253,7 @@ if (parentMRO == NULL) { Py_DECREF(to_merge); return NULL; - } + } PyList_SET_ITEM(to_merge, i, parentMRO); } @@ -1422,10 +1423,12 @@ type->tp_itemsize != base->tp_itemsize; } if (type->tp_weaklistoffset && base->tp_weaklistoffset == 0 && - type->tp_weaklistoffset + sizeof(PyObject *) == t_size) + type->tp_weaklistoffset + sizeof(PyObject *) == t_size && + type->tp_flags & Py_TPFLAGS_HEAPTYPE) t_size -= sizeof(PyObject *); if (type->tp_dictoffset && base->tp_dictoffset == 0 && - type->tp_dictoffset + sizeof(PyObject *) == t_size) + type->tp_dictoffset + sizeof(PyObject *) == t_size && + type->tp_flags & Py_TPFLAGS_HEAPTYPE) t_size -= sizeof(PyObject *); return t_size != b_size; @@ -1451,12 +1454,73 @@ static int update_slot(PyTypeObject *, PyObject *); static void fixup_slot_dispatchers(PyTypeObject *); +/* + * Helpers for __dict__ descriptor. We don't want to expose the dicts + * inherited from various builtin types. The builtin base usually provides + * its own __dict__ descriptor, so we use that when we can. + */ +static PyTypeObject * +get_builtin_base_with_dict(PyTypeObject *type) +{ + while (type->tp_base != NULL) { + if (type->tp_dictoffset != 0 && + !(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) + return type; + type = type->tp_base; + } + return NULL; +} + +static PyObject * +get_dict_descriptor(PyTypeObject *type) +{ + static PyObject *dict_str; + PyObject *descr; + + if (dict_str == NULL) { + dict_str = PyString_InternFromString("__dict__"); + if (dict_str == NULL) + return NULL; + } + descr = _PyType_Lookup(type, dict_str); + if (descr == NULL || !PyDescr_IsData(descr)) + return NULL; + + return descr; +} + +static void +raise_dict_descr_error(PyObject *obj) +{ + PyErr_Format(PyExc_TypeError, + "this __dict__ descriptor does not support " + "'%.200s' objects", obj->ob_type->tp_name); +} + static PyObject * subtype_dict(PyObject *obj, void *context) { - PyObject **dictptr = _PyObject_GetDictPtr(obj); + PyObject **dictptr; PyObject *dict; + PyTypeObject *base; + + base = get_builtin_base_with_dict(obj->ob_type); + if (base != NULL) { + descrgetfunc func; + PyObject *descr = get_dict_descriptor(base); + if (descr == NULL) { + raise_dict_descr_error(obj); + return NULL; + } + func = descr->ob_type->tp_descr_get; + if (func == NULL) { + raise_dict_descr_error(obj); + return NULL; + } + return func(descr, obj, (PyObject *)(obj->ob_type)); + } + dictptr = _PyObject_GetDictPtr(obj); if (dictptr == NULL) { PyErr_SetString(PyExc_AttributeError, "This object has no __dict__"); @@ -1472,9 +1536,27 @@ static int subtype_setdict(PyObject *obj, PyObject *value, void *context) { - PyObject **dictptr = _PyObject_GetDictPtr(obj); + PyObject **dictptr; PyObject *dict; + PyTypeObject *base; + + base = get_builtin_base_with_dict(obj->ob_type); + if (base != NULL) { + descrsetfunc func; + PyObject *descr = get_dict_descriptor(base); + if (descr == NULL) { + raise_dict_descr_error(obj); + return -1; + } + func = descr->ob_type->tp_descr_set; + if (func == NULL) { + raise_dict_descr_error(obj); + return -1; + } + return func(descr, obj, value); + } + dictptr = _PyObject_GetDictPtr(obj); if (dictptr == NULL) { PyErr_SetString(PyExc_AttributeError, "This object has no __dict__"); @@ -1573,32 +1655,69 @@ static PyObject * _unicode_to_string(PyObject *slots, Py_ssize_t nslots) { - PyObject *tmp = slots; - PyObject *o, *o1; + PyObject *tmp = NULL; + PyObject *slot_name, *new_name; Py_ssize_t i; - ssizessizeargfunc copy = slots->ob_type->tp_as_sequence->sq_slice; + for (i = 0; i < nslots; i++) { - if (PyUnicode_Check(o = PyTuple_GET_ITEM(tmp, i))) { - if (tmp == slots) { - tmp = copy(slots, 0, PyTuple_GET_SIZE(slots)); + if (PyUnicode_Check(slot_name = PyTuple_GET_ITEM(slots, i))) { + if (tmp == NULL) { + tmp = PySequence_List(slots); if (tmp == NULL) return NULL; } - o1 = _PyUnicode_AsDefaultEncodedString - (o, NULL); - if (o1 == NULL) { + new_name = _PyUnicode_AsDefaultEncodedString(slot_name, + NULL); + if (new_name == NULL) { Py_DECREF(tmp); - return 0; + return NULL; } - Py_INCREF(o1); - Py_DECREF(o); - PyTuple_SET_ITEM(tmp, i, o1); + Py_INCREF(new_name); + PyList_SET_ITEM(tmp, i, new_name); + Py_DECREF(slot_name); } } - return tmp; + if (tmp != NULL) { + slots = PyList_AsTuple(tmp); + Py_DECREF(tmp); + } + return slots; } #endif +/* Forward */ +static int +object_init(PyObject *self, PyObject *args, PyObject *kwds); + +static int +type_init(PyObject *cls, PyObject *args, PyObject *kwds) +{ + int res; + + assert(args != NULL && PyTuple_Check(args)); + assert(kwds == NULL || PyDict_Check(kwds)); + + if (kwds != NULL && PyDict_Check(kwds) && PyDict_Size(kwds) != 0) { + PyErr_SetString(PyExc_TypeError, + "type.__init__() takes no keyword arguments"); + return -1; + } + + if (args != NULL && PyTuple_Check(args) && + (PyTuple_GET_SIZE(args) != 1 && PyTuple_GET_SIZE(args) != 3)) { + PyErr_SetString(PyExc_TypeError, + "type.__init__() takes 1 or 3 arguments"); + return -1; + } + + /* Call object.__init__(self) now. */ + /* XXX Could call super(type, cls).__init__() but what's the point? */ + args = PyTuple_GetSlice(args, 0, 0); + res = object_init(cls, args, NULL); + Py_DECREF(args); + return res; +} + static PyObject * type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds) { @@ -1717,7 +1836,7 @@ /* Have slots */ /* Make it into a tuple */ - if (PyString_Check(slots)) + if (PyString_Check(slots) || PyUnicode_Check(slots)) slots = PyTuple_Pack(1, slots); else slots = PySequence_Tuple(slots); @@ -1742,12 +1861,12 @@ #ifdef Py_USING_UNICODE tmp = _unicode_to_string(slots, nslots); + if (tmp == NULL) + goto bad_slots; if (tmp != slots) { Py_DECREF(slots); slots = tmp; } - if (!tmp) - return NULL; #endif /* Check for valid slot names and two special cases */ for (i = 0; i < nslots; i++) { @@ -1778,8 +1897,11 @@ } } - /* Copy slots into yet another tuple, demangling names */ - newslots = PyTuple_New(nslots - add_dict - add_weak); + /* Copy slots into a list, mangle names and sort them. + Sorted names are needed for __class__ assignment. + Convert them back to tuple at the end. + */ + newslots = PyList_New(nslots - add_dict - add_weak); if (newslots == NULL) goto bad_slots; for (i = j = 0; i < nslots; i++) { @@ -1790,15 +1912,25 @@ (add_weak && strcmp(s, "__weakref__") == 0)) continue; tmp =_Py_Mangle(name, tmp); - if (!tmp) - goto bad_slots; - PyTuple_SET_ITEM(newslots, j, tmp); + if (!tmp) + goto bad_slots; + PyList_SET_ITEM(newslots, j, tmp); j++; } assert(j == nslots - add_dict - add_weak); nslots = j; Py_DECREF(slots); - slots = newslots; + if (PyList_Sort(newslots) == -1) { + Py_DECREF(bases); + Py_DECREF(newslots); + return NULL; + } + slots = PyList_AsTuple(newslots); + Py_DECREF(newslots); + if (slots == NULL) { + Py_DECREF(bases); + return NULL; + } /* Secondary bases may provide weakrefs or dict */ if (nbases > 1 && @@ -1903,13 +2035,13 @@ PyObject *doc = PyDict_GetItemString(dict, "__doc__"); if (doc != NULL && PyString_Check(doc)) { const size_t n = (size_t)PyString_GET_SIZE(doc); - char *tp_doc = (char *)PyObject_MALLOC(n+1); + char *tp_doc = (char *)PyObject_MALLOC(n+1); if (tp_doc == NULL) { Py_DECREF(type); return NULL; } memcpy(tp_doc, PyString_AS_STRING(doc), n+1); - type->tp_doc = tp_doc; + type->tp_doc = tp_doc; } } @@ -1935,13 +2067,11 @@ PyTuple_GET_ITEM(slots, i)); mp->type = T_OBJECT_EX; mp->offset = slotoffset; - if (base->tp_weaklistoffset == 0 && - strcmp(mp->name, "__weakref__") == 0) { - add_weak++; - mp->type = T_OBJECT; - mp->flags = READONLY; - type->tp_weaklistoffset = slotoffset; - } + + /* __dict__ and __weakref__ are already filtered out */ + assert(strcmp(mp->name, "__dict__") != 0); + assert(strcmp(mp->name, "__weakref__") != 0); + slotoffset += sizeof(PyObject *); } } @@ -2153,9 +2283,9 @@ Py_XDECREF(type->tp_mro); Py_XDECREF(type->tp_cache); Py_XDECREF(type->tp_subclasses); - /* A type's tp_doc is heap allocated, unlike the tp_doc slots - * of most other objects. It's okay to cast it to char *. - */ + /* A type's tp_doc is heap allocated, unlike the tp_doc slots + * of most other objects. It's okay to cast it to char *. + */ PyObject_Free((char *)type->tp_doc); Py_XDECREF(et->ht_name); Py_XDECREF(et->ht_slots); @@ -2245,7 +2375,7 @@ sizeof(PyMemberDef), /* tp_itemsize */ (destructor)type_dealloc, /* tp_dealloc */ 0, /* tp_print */ - 0, /* tp_getattr */ + 0, /* tp_getattr */ 0, /* tp_setattr */ type_compare, /* tp_compare */ (reprfunc)type_repr, /* tp_repr */ @@ -2259,7 +2389,7 @@ (setattrofunc)type_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TYPE_SUBCLASS, /* tp_flags */ type_doc, /* tp_doc */ (traverseproc)type_traverse, /* tp_traverse */ (inquiry)type_clear, /* tp_clear */ @@ -2275,37 +2405,113 @@ 0, /* tp_descr_get */ 0, /* tp_descr_set */ offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */ - 0, /* tp_init */ + type_init, /* tp_init */ 0, /* tp_alloc */ type_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ + PyObject_GC_Del, /* tp_free */ (inquiry)type_is_gc, /* tp_is_gc */ }; /* The base type of all types (eventually)... except itself. */ +/* You may wonder why object.__new__() only complains about arguments + when object.__init__() is not overridden, and vice versa. + + Consider the use cases: + + 1. When neither is overridden, we want to hear complaints about + excess (i.e., any) arguments, since their presence could + indicate there's a bug. + + 2. When defining an Immutable type, we are likely to override only + __new__(), since __init__() is called too late to initialize an + Immutable object. Since __new__() defines the signature for the + type, it would be a pain to have to override __init__() just to + stop it from complaining about excess arguments. + + 3. When defining a Mutable type, we are likely to override only + __init__(). So here the converse reasoning applies: we don't + want to have to override __new__() just to stop it from + complaining. + + 4. When __init__() is overridden, and the subclass __init__() calls + object.__init__(), the latter should complain about excess + arguments; ditto for __new__(). + + Use cases 2 and 3 make it unattractive to unconditionally check for + excess arguments. The best solution that addresses all four use + cases is as follows: __init__() complains about excess arguments + unless __new__() is overridden and __init__() is not overridden + (IOW, if __init__() is overridden or __new__() is not overridden); + symmetrically, __new__() complains about excess arguments unless + __init__() is overridden and __new__() is not overridden + (IOW, if __new__() is overridden or __init__() is not overridden). + + However, for backwards compatibility, this breaks too much code. + Therefore, in 2.6, we'll *warn* about excess arguments when both + methods are overridden; for all other cases we'll use the above + rules. + +*/ + +/* Forward */ +static PyObject * +object_new(PyTypeObject *type, PyObject *args, PyObject *kwds); + +static int +excess_args(PyObject *args, PyObject *kwds) +{ + return PyTuple_GET_SIZE(args) || + (kwds && PyDict_Check(kwds) && PyDict_Size(kwds)); +} + static int object_init(PyObject *self, PyObject *args, PyObject *kwds) { - return 0; + int err = 0; + if (excess_args(args, kwds)) { + PyTypeObject *type = self->ob_type; + if (type->tp_init != object_init && + type->tp_new != object_new) + { + err = PyErr_WarnEx(PyExc_DeprecationWarning, + "object.__init__() takes no parameters", + 1); + } + else if (type->tp_init != object_init || + type->tp_new == object_new) + { + PyErr_SetString(PyExc_TypeError, + "object.__init__() takes no parameters"); + err = -1; + } + } + return err; } -/* If we don't have a tp_new for a new-style class, new will use this one. - Therefore this should take no arguments/keywords. However, this new may - also be inherited by objects that define a tp_init but no tp_new. These - objects WILL pass argumets to tp_new, because it gets the same args as - tp_init. So only allow arguments if we aren't using the default init, in - which case we expect init to handle argument parsing. */ static PyObject * object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - if (type->tp_init == object_init && (PyTuple_GET_SIZE(args) || - (kwds && PyDict_Check(kwds) && PyDict_Size(kwds)))) { - PyErr_SetString(PyExc_TypeError, - "default __new__ takes no parameters"); - return NULL; + int err = 0; + if (excess_args(args, kwds)) { + if (type->tp_new != object_new && + type->tp_init != object_init) + { + err = PyErr_WarnEx(PyExc_DeprecationWarning, + "object.__new__() takes no parameters", + 1); + } + else if (type->tp_new != object_new || + type->tp_init == object_init) + { + PyErr_SetString(PyExc_TypeError, + "object.__new__() takes no parameters"); + err = -1; + } } + if (err < 0) + return NULL; return type->tp_alloc(type, 0); } @@ -2388,6 +2594,7 @@ { PyTypeObject *base = a->tp_base; Py_ssize_t size; + PyObject *slots_a, *slots_b; if (base != b->tp_base) return 0; @@ -2398,6 +2605,15 @@ size += sizeof(PyObject *); if (a->tp_weaklistoffset == size && b->tp_weaklistoffset == size) size += sizeof(PyObject *); + + /* Check slots compliance */ + slots_a = ((PyHeapTypeObject *)a)->ht_slots; + slots_b = ((PyHeapTypeObject *)b)->ht_slots; + if (slots_a && slots_b) { + if (PyObject_Compare(slots_a, slots_b) != 0) + return 0; + size += sizeof(PyObject *) * PyTuple_GET_SIZE(slots_a); + } return size == a->tp_basicsize && size == b->tp_basicsize; } @@ -2677,11 +2893,54 @@ return res; } +/* + * There were two problems when object.__reduce__ and object.__reduce_ex__ + * were implemented in the same function: + * - trying to pickle an object with a custom __reduce__ method that + * fell back to object.__reduce__ in certain circumstances led to + * infinite recursion at Python level and eventual RuntimeError. + * - Pickling objects that lied about their type by overwriting the + * __class__ descriptor could lead to infinite recursion at C level + * and eventual segfault. + * + * Because of backwards compatibility, the two methods still have to + * behave in the same way, even if this is not required by the pickle + * protocol. This common functionality was moved to the _common_reduce + * function. + */ +static PyObject * +_common_reduce(PyObject *self, int proto) +{ + PyObject *copy_reg, *res; + + if (proto >= 2) + return reduce_2(self); + + copy_reg = import_copy_reg(); + if (!copy_reg) + return NULL; + + res = PyEval_CallMethod(copy_reg, "_reduce_ex", "(Oi)", self, proto); + Py_DECREF(copy_reg); + + return res; +} + +static PyObject * +object_reduce(PyObject *self, PyObject *args) +{ + int proto = 0; + + if (!PyArg_ParseTuple(args, "|i:__reduce__", &proto)) + return NULL; + + return _common_reduce(self, proto); +} + static PyObject * object_reduce_ex(PyObject *self, PyObject *args) { - /* Call copy_reg._reduce_ex(self, proto) */ - PyObject *reduce, *copy_reg, *res; + PyObject *reduce, *res; int proto = 0; if (!PyArg_ParseTuple(args, "|i:__reduce_ex__", &proto)) @@ -2717,23 +2976,13 @@ Py_DECREF(reduce); } - if (proto >= 2) - return reduce_2(self); - - copy_reg = import_copy_reg(); - if (!copy_reg) - return NULL; - - res = PyEval_CallMethod(copy_reg, "_reduce_ex", "(Oi)", self, proto); - Py_DECREF(copy_reg); - - return res; + return _common_reduce(self, proto); } static PyMethodDef object_methods[] = { {"__reduce_ex__", object_reduce_ex, METH_VARARGS, PyDoc_STR("helper for pickle")}, - {"__reduce__", object_reduce_ex, METH_VARARGS, + {"__reduce__", object_reduce, METH_VARARGS, PyDoc_STR("helper for pickle")}, {0} }; @@ -2741,13 +2990,13 @@ PyTypeObject PyBaseObject_Type = { PyObject_HEAD_INIT(&PyType_Type) - 0, /* ob_size */ + 0, /* ob_size */ "object", /* tp_name */ sizeof(PyObject), /* tp_basicsize */ 0, /* tp_itemsize */ object_dealloc, /* tp_dealloc */ 0, /* tp_print */ - 0, /* tp_getattr */ + 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ object_repr, /* tp_repr */ @@ -2779,7 +3028,7 @@ object_init, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ object_new, /* tp_new */ - PyObject_Del, /* tp_free */ + PyObject_Del, /* tp_free */ }; @@ -2938,6 +3187,26 @@ if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_CLASS) { COPYVAL(tp_dictoffset); } + + /* Setup fast subclass flags */ + if (PyType_IsSubtype(base, (PyTypeObject*)PyExc_BaseException)) + type->tp_flags |= Py_TPFLAGS_BASE_EXC_SUBCLASS; + else if (PyType_IsSubtype(base, &PyType_Type)) + type->tp_flags |= Py_TPFLAGS_TYPE_SUBCLASS; + else if (PyType_IsSubtype(base, &PyInt_Type)) + type->tp_flags |= Py_TPFLAGS_INT_SUBCLASS; + else if (PyType_IsSubtype(base, &PyLong_Type)) + type->tp_flags |= Py_TPFLAGS_LONG_SUBCLASS; + else if (PyType_IsSubtype(base, &PyString_Type)) + type->tp_flags |= Py_TPFLAGS_STRING_SUBCLASS; + else if (PyType_IsSubtype(base, &PyUnicode_Type)) + type->tp_flags |= Py_TPFLAGS_UNICODE_SUBCLASS; + else if (PyType_IsSubtype(base, &PyTuple_Type)) + type->tp_flags |= Py_TPFLAGS_TUPLE_SUBCLASS; + else if (PyType_IsSubtype(base, &PyList_Type)) + type->tp_flags |= Py_TPFLAGS_LIST_SUBCLASS; + else if (PyType_IsSubtype(base, &PyDict_Type)) + type->tp_flags |= Py_TPFLAGS_DICT_SUBCLASS; } static void @@ -3146,9 +3415,9 @@ Py_INCREF(base); } - /* Now the only way base can still be NULL is if type is - * &PyBaseObject_Type. - */ + /* Now the only way base can still be NULL is if type is + * &PyBaseObject_Type. + */ /* Initialize the base class */ if (base && base->tp_dict == NULL) { @@ -3156,13 +3425,13 @@ goto error; } - /* Initialize ob_type if NULL. This means extensions that want to be + /* Initialize ob_type if NULL. This means extensions that want to be compilable separately on Windows can call PyType_Ready() instead of initializing the ob_type field of their type objects. */ - /* The test for base != NULL is really unnecessary, since base is only - NULL when type is &PyBaseObject_Type, and we know its ob_type is - not NULL (it's initialized to &PyType_Type). But coverity doesn't - know that. */ + /* The test for base != NULL is really unnecessary, since base is only + NULL when type is &PyBaseObject_Type, and we know its ob_type is + not NULL (it's initialized to &PyType_Type). But coverity doesn't + know that. */ if (type->ob_type == NULL && base != NULL) type->ob_type = base->ob_type; @@ -3226,9 +3495,9 @@ /* Sanity check for tp_free. */ if (PyType_IS_GC(type) && (type->tp_flags & Py_TPFLAGS_BASETYPE) && (type->tp_free == NULL || type->tp_free == PyObject_Del)) { - /* This base class needs to call tp_free, but doesn't have - * one, or its tp_free is for non-gc'ed objects. - */ + /* This base class needs to call tp_free, but doesn't have + * one, or its tp_free is for non-gc'ed objects. + */ PyErr_Format(PyExc_TypeError, "type '%.100s' participates in " "gc and is a base type but has inappropriate " "tp_free slot", @@ -3355,7 +3624,7 @@ /* Generic wrappers for overloadable 'operators' such as __getitem__ */ /* There's a wrapper *function* for each distinct function typedef used - for type object slots (e.g. binaryfunc, ternaryfunc, etc.). There's a + for type object slots (e.g. binaryfunc, ternaryfunc, etc.). There's a wrapper *table* for each distinct operation (e.g. __len__, __add__). Most tables have only one entry; the tables for binary operators have two entries, one regular and one with reversed arguments. */ @@ -3724,8 +3993,8 @@ PyTypeObject *type = self->ob_type; while (type && type->tp_flags & Py_TPFLAGS_HEAPTYPE) type = type->tp_base; - /* If type is NULL now, this is a really weird type. - In the spirit of backwards compatibility (?), just shut up. */ + /* If type is NULL now, this is a really weird type. + In the spirit of backwards compatibility (?), just shut up. */ if (type && type->tp_setattro != func) { PyErr_Format(PyExc_TypeError, "can't apply this %s to %s object", @@ -3941,8 +4210,8 @@ staticbase = subtype; while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) staticbase = staticbase->tp_base; - /* If staticbase is NULL now, it is a really weird type. - In the spirit of backwards compatibility (?), just shut up. */ + /* If staticbase is NULL now, it is a really weird type. + In the spirit of backwards compatibility (?), just shut up. */ if (staticbase && staticbase->tp_new != type->tp_new) { PyErr_Format(PyExc_TypeError, "%s.__new__(%s) is not safe, use %s.__new__()", @@ -3961,9 +4230,9 @@ } static struct PyMethodDef tp_new_methoddef[] = { - {"__new__", (PyCFunction)tp_new_wrapper, METH_KEYWORDS, + {"__new__", (PyCFunction)tp_new_wrapper, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("T.__new__(S, ...) -> " - "a new object with type S, a subtype of T")}, + "a new object with type S, a subtype of T")}, {0} }; @@ -4292,7 +4561,7 @@ func = lookup_maybe(self, "__len__", &len_str); if (func == NULL) return PyErr_Occurred() ? -1 : 1; - } + } args = PyTuple_New(0); if (args != NULL) { PyObject *temp = PyObject_Call(func, args, NULL); @@ -4398,7 +4667,13 @@ SLOT1(slot_nb_inplace_multiply, "__imul__", PyObject *, "O") SLOT1(slot_nb_inplace_divide, "__idiv__", PyObject *, "O") SLOT1(slot_nb_inplace_remainder, "__imod__", PyObject *, "O") -SLOT1(slot_nb_inplace_power, "__ipow__", PyObject *, "O") +/* Can't use SLOT1 here, because nb_inplace_power is ternary */ +static PyObject * +slot_nb_inplace_power(PyObject *self, PyObject * arg1, PyObject *arg2) +{ + static PyObject *cache_str; + return call_method(self, "__ipow__", &cache_str, "(" "O" ")", arg1); +} SLOT1(slot_nb_inplace_lshift, "__ilshift__", PyObject *, "O") SLOT1(slot_nb_inplace_rshift, "__irshift__", PyObject *, "O") SLOT1(slot_nb_inplace_and, "__iand__", PyObject *, "O") @@ -4965,17 +5240,17 @@ user-defined methods has unexpected side-effects, as shown by test_descr.notimplemented() */ SQSLOT("__add__", sq_concat, NULL, wrap_binaryfunc, - "x.__add__(y) <==> x+y"), + "x.__add__(y) <==> x+y"), SQSLOT("__mul__", sq_repeat, NULL, wrap_indexargfunc, - "x.__mul__(n) <==> x*n"), + "x.__mul__(n) <==> x*n"), SQSLOT("__rmul__", sq_repeat, NULL, wrap_indexargfunc, - "x.__rmul__(n) <==> n*x"), + "x.__rmul__(n) <==> n*x"), SQSLOT("__getitem__", sq_item, slot_sq_item, wrap_sq_item, "x.__getitem__(y) <==> x[y]"), SQSLOT("__getslice__", sq_slice, slot_sq_slice, wrap_ssizessizeargfunc, "x.__getslice__(i, j) <==> x[i:j]\n\ - \n\ - Use of negative indices is not supported."), + \n\ + Use of negative indices is not supported."), SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem, "x.__setitem__(i, y) <==> x[i]=y"), SQSLOT("__delitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_delitem, @@ -4983,18 +5258,18 @@ SQSLOT("__setslice__", sq_ass_slice, slot_sq_ass_slice, wrap_ssizessizeobjargproc, "x.__setslice__(i, j, y) <==> x[i:j]=y\n\ - \n\ - Use of negative indices is not supported."), + \n\ + Use of negative indices is not supported."), SQSLOT("__delslice__", sq_ass_slice, slot_sq_ass_slice, wrap_delslice, "x.__delslice__(i, j) <==> del x[i:j]\n\ - \n\ - Use of negative indices is not supported."), + \n\ + Use of negative indices is not supported."), SQSLOT("__contains__", sq_contains, slot_sq_contains, wrap_objobjproc, "x.__contains__(y) <==> y in x"), SQSLOT("__iadd__", sq_inplace_concat, NULL, - wrap_binaryfunc, "x.__iadd__(y) <==> x+=y"), + wrap_binaryfunc, "x.__iadd__(y) <==> x+=y"), SQSLOT("__imul__", sq_inplace_repeat, NULL, - wrap_indexargfunc, "x.__imul__(y) <==> x*=y"), + wrap_indexargfunc, "x.__imul__(y) <==> x*=y"), MPSLOT("__len__", mp_length, slot_mp_length, wrap_lenfunc, "x.__len__() <==> len(x)"), @@ -5153,7 +5428,7 @@ }; /* Given a type pointer and an offset gotten from a slotdef entry, return a - pointer to the actual slot. This is not quite the same as simply adding + pointer to the actual slot. This is not quite the same as simply adding the offset to the type pointer, since it takes care to indirect through the proper indirection pointer (as_buffer, etc.); it returns NULL if the indirection pointer is NULL. */ @@ -5217,7 +5492,7 @@ } /* Look in all matching slots of the type; if exactly one of these has - a filled-in slot, return its value. Otherwise return NULL. */ + a filled-in slot, return its value. Otherwise return NULL. */ res = NULL; for (pp = ptrs; *pp; pp++) { ptr = slotptr(type, (*pp)->offset); @@ -5456,13 +5731,13 @@ dictionary with method descriptors for function slots. For each function slot (like tp_repr) that's defined in the type, one or more corresponding descriptors are added in the type's tp_dict dictionary - under the appropriate name (like __repr__). Some function slots + under the appropriate name (like __repr__). Some function slots cause more than one descriptor to be added (for example, the nb_add slot adds both __add__ and __radd__ descriptors) and some function slots compete for the same descriptor (for example both sq_item and mp_subscript generate a __getitem__ descriptor). - In the latter case, the first slotdef entry encoutered wins. Since + In the latter case, the first slotdef entry encoutered wins. Since slotdef entries are sorted by the offset of the slot in the PyHeapTypeObject, this gives us some control over disambiguating between competing slots: the members of PyHeapTypeObject are listed @@ -5636,7 +5911,7 @@ obj can be a new-style class, or an instance of one: - - If it is a class, it must be a subclass of 'type'. This case is + - If it is a class, it must be a subclass of 'type'. This case is used for class methods; the return value is obj. - If it is an instance, it must be an instance of 'type'. This is @@ -5687,7 +5962,7 @@ Py_DECREF(class_attr); } - PyErr_SetString(PyExc_TypeError, + PyErr_SetString(PyExc_TypeError, "super(type, obj): " "obj must be an instance or subtype of type"); return NULL; @@ -5708,7 +5983,7 @@ /* If su is an instance of a (strict) subclass of super, call its type */ return PyObject_CallFunctionObjArgs((PyObject *)su->ob_type, - su->type, obj, NULL); + su->type, obj, NULL); else { /* Inline the common case */ PyTypeObject *obj_type = supercheck(su->type, obj); @@ -5761,7 +6036,7 @@ "Typical use to call a cooperative superclass method:\n" "class C(B):\n" " def meth(self, arg):\n" -" super(C, self).meth(arg)"); +" super(C, self).meth(arg)"); static int super_traverse(PyObject *self, visitproc visit, void *arg) @@ -5782,7 +6057,7 @@ sizeof(superobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ - super_dealloc, /* tp_dealloc */ + super_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ @@ -5790,7 +6065,7 @@ super_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ + 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ @@ -5799,9 +6074,9 @@ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, /* tp_flags */ - super_doc, /* tp_doc */ - super_traverse, /* tp_traverse */ - 0, /* tp_clear */ + super_doc, /* tp_doc */ + super_traverse, /* tp_traverse */ + 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ @@ -5817,5 +6092,5 @@ super_init, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ - PyObject_GC_Del, /* tp_free */ + PyObject_GC_Del, /* tp_free */ }; Modified: python/branches/bcannon-objcap/Objects/unicodeobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/unicodeobject.c (original) +++ python/branches/bcannon-objcap/Objects/unicodeobject.c Fri May 25 22:13:08 2007 @@ -7967,7 +7967,7 @@ 0, /* tp_setattro */ &unicode_as_buffer, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_BASETYPE | Py_TPFLAGS_UNICODE_SUBCLASS, /* tp_flags */ unicode_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ Modified: python/branches/bcannon-objcap/PC/VC6/pcbuild.dsw ============================================================================== --- python/branches/bcannon-objcap/PC/VC6/pcbuild.dsw (original) +++ python/branches/bcannon-objcap/PC/VC6/pcbuild.dsw Fri May 25 22:13:08 2007 @@ -26,6 +26,9 @@ Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name pythoncore + End Project Dependency }}} ############################################################################### Modified: python/branches/bcannon-objcap/PC/_winreg.c ============================================================================== --- python/branches/bcannon-objcap/PC/_winreg.c (original) +++ python/branches/bcannon-objcap/PC/_winreg.c Fri May 25 22:13:08 2007 @@ -699,7 +699,7 @@ case REG_DWORD: if (value != Py_None && !PyInt_Check(value)) return FALSE; - *retDataBuf = (BYTE *)PyMem_NEW(DWORD, sizeof(DWORD)); + *retDataBuf = (BYTE *)PyMem_NEW(DWORD, 1); if (*retDataBuf==NULL){ PyErr_NoMemory(); return FALSE; Modified: python/branches/bcannon-objcap/PC/config.c ============================================================================== --- python/branches/bcannon-objcap/PC/config.c (original) +++ python/branches/bcannon-objcap/PC/config.c Fri May 25 22:13:08 2007 @@ -6,23 +6,20 @@ #include "Python.h" extern void initarray(void); -#ifndef MS_WIN64 +#ifndef MS_WINI64 extern void initaudioop(void); #endif extern void initbinascii(void); extern void initcmath(void); extern void initerrno(void); extern void initgc(void); -#ifndef MS_WIN64 +#ifndef MS_WINI64 extern void initimageop(void); #endif extern void initmath(void); extern void init_md5(void); extern void initnt(void); extern void initoperator(void); -#ifndef MS_WIN64 -extern void initrgbimg(void); -#endif extern void initsignal(void); extern void init_sha(void); extern void init_sha256(void); @@ -43,7 +40,7 @@ extern void initzipimport(void); extern void init_random(void); extern void inititertools(void); -extern void initcollections(void); +extern void init_collections(void); extern void init_heapq(void); extern void init_bisect(void); extern void init_symtable(void); @@ -80,7 +77,7 @@ {"array", initarray}, {"_ast", init_ast}, #ifdef MS_WINDOWS -#ifndef MS_WIN64 +#ifndef MS_WINI64 {"audioop", initaudioop}, #endif #endif @@ -88,16 +85,13 @@ {"cmath", initcmath}, {"errno", initerrno}, {"gc", initgc}, -#ifndef MS_WIN64 +#ifndef MS_WINI64 {"imageop", initimageop}, #endif {"math", initmath}, {"_md5", init_md5}, {"nt", initnt}, /* Use the NT os functions, not posix */ {"operator", initoperator}, -#ifndef MS_WIN64 - {"rgbimg", initrgbimg}, -#endif {"signal", initsignal}, {"_sha", init_sha}, {"_sha256", init_sha256}, @@ -124,7 +118,7 @@ {"_heapq", init_heapq}, {"_lsprof", init_lsprof}, {"itertools", inititertools}, - {"collections", initcollections}, + {"_collections", init_collections}, {"_symtable", init_symtable}, {"mmap", initmmap}, {"_csv", init_csv}, Modified: python/branches/bcannon-objcap/PC/getpathp.c ============================================================================== --- python/branches/bcannon-objcap/PC/getpathp.c (original) +++ python/branches/bcannon-objcap/PC/getpathp.c Fri May 25 22:13:08 2007 @@ -650,7 +650,7 @@ start of the path in question - even if this is one character before the start of the buffer */ - while (*look != DELIM && look >= module_search_path) + while (look >= module_search_path && *look != DELIM) look--; nchars = lookEnd-look; strncpy(lookBuf, look+1, nchars); Modified: python/branches/bcannon-objcap/PC/make_versioninfo.c ============================================================================== --- python/branches/bcannon-objcap/PC/make_versioninfo.c (original) +++ python/branches/bcannon-objcap/PC/make_versioninfo.c Fri May 25 22:13:08 2007 @@ -27,7 +27,12 @@ PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL); printf("#define MS_DLL_ID \"%d.%d\"\n", PY_MAJOR_VERSION, PY_MINOR_VERSION); + printf("#ifndef _DEBUG\n"); printf("#define PYTHON_DLL_NAME \"python%d%d.dll\"\n", PY_MAJOR_VERSION, PY_MINOR_VERSION); + printf("#else\n"); + printf("#define PYTHON_DLL_NAME \"python%d%d_d.dll\"\n", + PY_MAJOR_VERSION, PY_MINOR_VERSION); + printf("#endif\n"); return 0; } Modified: python/branches/bcannon-objcap/PC/pyconfig.h ============================================================================== --- python/branches/bcannon-objcap/PC/pyconfig.h (original) +++ python/branches/bcannon-objcap/PC/pyconfig.h Fri May 25 22:13:08 2007 @@ -128,6 +128,8 @@ defined on Win32 *and* Win64. Win32 only code must therefore be guarded as follows: #if defined(MS_WIN32) && !defined(MS_WIN64) + Some modules are disabled on Itanium processors, therefore we + have MS_WINI64 set for those targets, otherwise MS_WINX64 */ #ifdef _WIN64 #define MS_WIN64 @@ -135,17 +137,28 @@ /* set the COMPILER */ #ifdef MS_WIN64 -#ifdef _M_IX86 -#define COMPILER _Py_PASTE_VERSION("64 bit (Intel)") -#elif defined(_M_IA64) +#if defined(_M_IA64) #define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)") -#elif defined(_M_AMD64) +#define MS_WINI64 +#elif defined(_M_X64) #define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)") +#define MS_WINX64 #else #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") #endif #endif /* MS_WIN64 */ +/* set the version macros for the windows headers */ +#ifdef MS_WINX64 +/* 64 bit only runs on XP or greater */ +#define _WIN32_WINNT 0x0501 +#define WINVER 0x0501 +#else +/* NT 4.0 or greater required otherwise */ +#define _WIN32_WINNT 0x0400 +#define WINVER 0x0400 +#endif + /* _W64 is not defined for VC6 or eVC4 */ #ifndef _W64 #define _W64 @@ -478,22 +491,13 @@ /* Define if you want to have a Unicode type. */ #define Py_USING_UNICODE -/* Define as the integral type used for Unicode representation. */ -#define PY_UNICODE_TYPE unsigned short - /* Define as the size of the unicode type. */ -#define Py_UNICODE_SIZE SIZEOF_SHORT - -/* Define if you have a useable wchar_t type defined in wchar.h; useable - means wchar_t must be 16-bit unsigned type. (see - Include/unicodeobject.h). */ -#if Py_UNICODE_SIZE == 2 -#define HAVE_USABLE_WCHAR_T +/* This is enough for unicodeobject.h to do the "right thing" on Windows. */ +#define Py_UNICODE_SIZE 2 /* Define to indicate that the Python Unicode representation can be passed as-is to Win32 Wide API. */ #define Py_WIN_WIDE_FILENAMES -#endif /* Use Python's own small-block memory-allocator. */ #define WITH_PYMALLOC 1 Modified: python/branches/bcannon-objcap/PCbuild/pythoncore.vcproj ============================================================================== --- python/branches/bcannon-objcap/PCbuild/pythoncore.vcproj (original) +++ python/branches/bcannon-objcap/PCbuild/pythoncore.vcproj Fri May 25 22:13:08 2007 @@ -458,7 +458,7 @@ RelativePath="..\Objects\codeobject.c"> + RelativePath="..\Modules\_collectionsmodule.c"> @@ -713,9 +713,6 @@ RelativePath="..\Objects\rangeobject.c"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/_ctypes.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_ctypes.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,410 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/_ctypes_test.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_ctypes_test.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,370 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/_elementtree.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_elementtree.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,388 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/_msi.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_msi.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,375 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/_socket.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_socket.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,381 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/_sqlite3.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_sqlite3.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,411 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/_ssl.mak ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_ssl.mak Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,21 +0,0 @@ - -!IFDEF DEBUG -MODULE=_ssl_d.pyd -TEMP_DIR=x86-temp-debug/_ssl -CFLAGS=/Od /Zi /MDd /LDd /DDEBUG /D_DEBUG /DWIN32 -SSL_LIB_DIR=$(SSL_DIR)/out32.dbg -!ELSE -MODULE=_ssl.pyd -TEMP_DIR=x86-temp-release/_ssl -CFLAGS=/Ox /MD /LD /DWIN32 -SSL_LIB_DIR=$(SSL_DIR)/out32 -!ENDIF - -INCLUDES=-I ../Include -I ../PC -I $(SSL_DIR)/inc32 -LIBS=gdi32.lib wsock32.lib user32.lib advapi32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib - -SOURCE=../Modules/_ssl.c $(SSL_LIB_DIR)/libeay32.lib $(SSL_LIB_DIR)/ssleay32.lib - -$(MODULE): $(SOURCE) ../PC/*.h ../Include/*.h - @if not exist "$(TEMP_DIR)/." mkdir "$(TEMP_DIR)" - cl /nologo $(SOURCE) $(CFLAGS) /Fo$(TEMP_DIR)\$*.obj $(INCLUDES) /link /out:$(MODULE) $(LIBS) Deleted: /python/branches/bcannon-objcap/PCbuild8/_ssl.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_ssl.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/_testcapi.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_testcapi.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/_tkinter.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/_tkinter.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,389 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/build_ssl.py ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/build_ssl.py Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,163 +0,0 @@ -# Script for building the _ssl module for Windows. -# Uses Perl to setup the OpenSSL environment correctly -# and build OpenSSL, then invokes a simple nmake session -# for _ssl.pyd itself. - -# THEORETICALLY, you can: -# * Unpack the latest SSL release one level above your main Python source -# directory. It is likely you will already find the zlib library and -# any other external packages there. -# * Install ActivePerl and ensure it is somewhere on your path. -# * Run this script from the PCBuild directory. -# -# it should configure and build SSL, then build the ssl Python extension -# without intervention. - -import os, sys, re - -# Find all "foo.exe" files on the PATH. -def find_all_on_path(filename, extras = None): - entries = os.environ["PATH"].split(os.pathsep) - ret = [] - for p in entries: - fname = os.path.abspath(os.path.join(p, filename)) - if os.path.isfile(fname) and fname not in ret: - ret.append(fname) - if extras: - for p in extras: - fname = os.path.abspath(os.path.join(p, filename)) - if os.path.isfile(fname) and fname not in ret: - ret.append(fname) - return ret - -# Find a suitable Perl installation for OpenSSL. -# cygwin perl does *not* work. ActivePerl does. -# Being a Perl dummy, the simplest way I can check is if the "Win32" package -# is available. -def find_working_perl(perls): - for perl in perls: - fh = os.popen(perl + ' -e "use Win32;"') - fh.read() - rc = fh.close() - if rc: - continue - return perl - print "Can not find a suitable PERL:" - if perls: - print " the following perl interpreters were found:" - for p in perls: - print " ", p - print " None of these versions appear suitable for building OpenSSL" - else: - print " NO perl interpreters were found on this machine at all!" - print " Please install ActivePerl and ensure it appears on your path" - print "The Python SSL module was not built" - return None - -# Locate the best SSL directory given a few roots to look into. -def find_best_ssl_dir(sources): - candidates = [] - for s in sources: - try: - s = os.path.abspath(s) - fnames = os.listdir(s) - except os.error: - fnames = [] - for fname in fnames: - fqn = os.path.join(s, fname) - if os.path.isdir(fqn) and fname.startswith("openssl-"): - candidates.append(fqn) - # Now we have all the candidates, locate the best. - best_parts = [] - best_name = None - for c in candidates: - parts = re.split("[.-]", os.path.basename(c))[1:] - # eg - openssl-0.9.7-beta1 - ignore all "beta" or any other qualifiers - if len(parts) >= 4: - continue - if parts > best_parts: - best_parts = parts - best_name = c - if best_name is not None: - print "Found an SSL directory at '%s'" % (best_name,) - else: - print "Could not find an SSL directory in '%s'" % (sources,) - return best_name - -def main(): - debug = "-d" in sys.argv - build_all = "-a" in sys.argv - make_flags = "" - if build_all: - make_flags = "-a" - # perl should be on the path, but we also look in "\perl" and "c:\\perl" - # as "well known" locations - perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"]) - perl = find_working_perl(perls) - if perl is None: - sys.exit(1) - - print "Found a working perl at '%s'" % (perl,) - # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live. - ssl_dir = find_best_ssl_dir(("../..",)) - if ssl_dir is None: - sys.exit(1) - - old_cd = os.getcwd() - try: - os.chdir(ssl_dir) - # If the ssl makefiles do not exist, we invoke Perl to generate them. - if not os.path.isfile(os.path.join(ssl_dir, "32.mak")) or \ - not os.path.isfile(os.path.join(ssl_dir, "d32.mak")): - print "Creating the makefiles..." - # Put our working Perl at the front of our path - os.environ["PATH"] = os.path.split(perl)[0] + \ - os.pathsep + \ - os.environ["PATH"] - # ms\32all.bat will reconfigure OpenSSL and then try to build - # all outputs (debug/nondebug/dll/lib). So we filter the file - # to exclude any "nmake" commands and then execute. - tempname = "ms\\32all_py.bat" - - in_bat = open("ms\\32all.bat") - temp_bat = open(tempname,"w") - while 1: - cmd = in_bat.readline() - print 'cmd', repr(cmd) - if not cmd: break - if cmd.strip()[:5].lower() == "nmake": - continue - temp_bat.write(cmd) - in_bat.close() - temp_bat.close() - os.system(tempname) - try: - os.remove(tempname) - except: - pass - - # Now run make. - print "Executing nmake over the ssl makefiles..." - if debug: - rc = os.system("nmake /nologo -f d32.mak") - if rc: - print "Executing d32.mak failed" - print rc - sys.exit(rc) - else: - rc = os.system("nmake /nologo -f 32.mak") - if rc: - print "Executing 32.mak failed" - print rc - sys.exit(rc) - finally: - os.chdir(old_cd) - # And finally, we can build the _ssl module itself for Python. - defs = "SSL_DIR=%s" % (ssl_dir,) - if debug: - defs = defs + " " + "DEBUG=1" - rc = os.system('nmake /nologo -f _ssl.mak ' + defs + " " + make_flags) - sys.exit(rc) - -if __name__=='__main__': - main() Deleted: /python/branches/bcannon-objcap/PCbuild8/bz2.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/bz2.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,390 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/db.build ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/db.build Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,10 +0,0 @@ - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/field3.py ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/field3.py Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,35 +0,0 @@ -# An absurd workaround for the lack of arithmetic in MS's resource compiler. -# After building Python, run this, then paste the output into the appropriate -# part of PC\python_nt.rc. -# Example output: -# -# * For 2.3a0, -# * PY_MICRO_VERSION = 0 -# * PY_RELEASE_LEVEL = 'alpha' = 0xA -# * PY_RELEASE_SERIAL = 1 -# * -# * and 0*1000 + 10*10 + 1 = 101. -# */ -# #define FIELD3 101 - -import sys - -major, minor, micro, level, serial = sys.version_info -levelnum = {'alpha': 0xA, - 'beta': 0xB, - 'candidate': 0xC, - 'final': 0xF, - }[level] -string = sys.version.split()[0] # like '2.3a0' - -print " * For %s," % string -print " * PY_MICRO_VERSION = %d" % micro -print " * PY_RELEASE_LEVEL = %r = %s" % (level, hex(levelnum)) -print " * PY_RELEASE_SERIAL = %d" % serial -print " *" - -field3 = micro * 1000 + levelnum * 10 + serial - -print " * and %d*1000 + %d*10 + %d = %d" % (micro, levelnum, serial, field3) -print " */" -print "#define FIELD3", field3 Deleted: /python/branches/bcannon-objcap/PCbuild8/make_buildinfo.c ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/make_buildinfo.c Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,81 +0,0 @@ -#include -#include -#include -#include - -/* This file creates the getbuildinfo2.c file, by - invoking subwcrev.exe (if found). - If this isn't a subversion checkout, or subwcrev isn't - found, it copies ..\\Modules\\getbuildinfo.c instead. - - A file, getbuildinfo2.h is then updated to define - SUBWCREV if it was a subversion checkout. - - getbuildinfo2.c is part of the pythoncore project with - getbuildinfo2.h as a forced include. This helps - VisualStudio refrain from unnecessary compiles much of the - time. - - Currently, subwcrev.exe is found from the registry entries - of TortoiseSVN. - - make_buildinfo.exe is called as a pre-build step for pythoncore. - -*/ - -int make_buildinfo2() -{ - struct _stat st; - HKEY hTortoise; - char command[500]; - DWORD type, size; - if (_stat(".svn", &st) < 0) - return 0; - /* Allow suppression of subwcrev.exe invocation if a no_subwcrev file is present. */ - if (_stat("no_subwcrev", &st) == 0) - return 0; - if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS && - RegOpenKey(HKEY_CURRENT_USER, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS) - /* Tortoise not installed */ - return 0; - command[0] = '"'; /* quote the path to the executable */ - size = sizeof(command) - 1; - if (RegQueryValueEx(hTortoise, "Directory", 0, &type, command+1, &size) != ERROR_SUCCESS || - type != REG_SZ) - /* Registry corrupted */ - return 0; - strcat_s(command, sizeof(command), "bin\\subwcrev.exe"); - if (_stat(command+1, &st) < 0) - /* subwcrev.exe not part of the release */ - return 0; - strcat_s(command, sizeof(command), "\" .. ..\\Modules\\getbuildinfo.c getbuildinfo2.c"); - puts(command); fflush(stdout); - if (system(command) < 0) - return 0; - return 1; -} - -int main(int argc, char*argv[]) -{ - char command[500] = ""; - int svn; - FILE *f; - - if (fopen_s(&f, "getbuildinfo2.h", "w")) - return EXIT_FAILURE; - /* Get getbuildinfo.c from svn as getbuildinfo2.c */ - svn = make_buildinfo2(); - if (svn) { - puts("got getbuildinfo2.c from svn. Updating getbuildinfo2.h"); - /* yes. make sure SUBWCREV is defined */ - fprintf(f, "#define SUBWCREV\n"); - } else { - puts("didn't get getbuildinfo2.c from svn. Copying from Modules and clearing getbuildinfo2.h"); - strcat_s(command, sizeof(command), "copy ..\\Modules\\getbuildinfo.c getbuildinfo2.c"); - puts(command); fflush(stdout); - if (system(command) < 0) - return EXIT_FAILURE; - } - fclose(f); - return 0; -} \ No newline at end of file Deleted: /python/branches/bcannon-objcap/PCbuild8/make_buildinfo.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/make_buildinfo.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/make_versioninfo.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/make_versioninfo.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: python/branches/bcannon-objcap/PCbuild8/pcbuild.sln ============================================================================== --- python/branches/bcannon-objcap/PCbuild8/pcbuild.sln (original) +++ python/branches/bcannon-objcap/PCbuild8/pcbuild.sln Fri May 25 22:13:08 2007 @@ -1,304 +1,410 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore\pythoncore.vcproj", "{987306EC-6BAD-4440-B4FB-A699A1EE6A28}" ProjectSection(ProjectDependencies) = postProject - {F0E0541E-F17D-430B-97C4-93ADF0DD284E} = {F0E0541E-F17D-430B-97C4-93ADF0DD284E} - {C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD} + {87AB87DB-B665-4621-A67B-878C15B93FF0} = {87AB87DB-B665-4621-A67B-878C15B93FF0} + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} = {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo\make_versioninfo.vcproj", "{2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo\make_buildinfo.vcproj", "{87AB87DB-B665-4621-A67B-878C15B93FF0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes\_ctypes.vcproj", "{8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcproj", "{97239A56-DBC0-41D2-BC14-C87D9B97D63B}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test\_ctypes_test.vcproj", "{F548A318-960A-4B37-9CD6-86B1B0E33CC8}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unicodedata", "unicodedata.vcproj", "{FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree\_elementtree.vcproj", "{CB025148-F0A1-4B32-A669-19EE0534136D}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen.vcproj", "{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_msi", "_msi\_msi.vcproj", "{A25ADCC5-8DE1-4F88-B842-C287923280B1}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcproj", "{51F35FAE-FB92-4B2C-9187-1542C065AD77}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3\_sqlite3.vcproj", "{D50E5319-41CC-429A-8E81-B1CD391C3A7B}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree.vcproj", "{1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python\python.vcproj", "{AE617428-B823-4B87-BC6D-DC7C12C746D3}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo.vcproj", "{C73F0EC1-358B-4177-940F-0846AC8B04CD}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw\pythonw.vcproj", "{98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_msi", "_msi.vcproj", "{2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select\select.vcproj", "{0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes.vcproj", "{F22F40F4-D318-40DC-96B3-88DC81CE0894}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unicodedata", "unicodedata\unicodedata.vcproj", "{D04B2089-7DA9-4D92-B23F-07453BC46652}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test.vcproj", "{8CF334D9-4F82-42EB-97AF-83592C5AFD2F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound\winsound.vcproj", "{1015E3B4-FD3B-4402-AA6E-7806514156D6}" ProjectSection(ProjectDependencies) = postProject - {F22F40F4-D318-40DC-96B3-88DC81CE0894} = {F22F40F4-D318-40DC-96B3-88DC81CE0894} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3.vcproj", "{2FF0A312-22F9-4C34-B070-842916DE27A9}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket\_socket.vcproj", "{AE31A248-5367-4EB2-A511-8722BC351CB4}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8B172265-1F31-4880-A29C-11A4B7A80172}" - ProjectSection(SolutionItems) = preProject - ..\Modules\getbuildinfo.c = ..\Modules\getbuildinfo.c - readme.txt = readme.txt +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb\_bsddb.vcproj", "{E644B843-F7CA-4888-AA6D-653C77592856}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi\_testcapi.vcproj", "{1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}" ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{F0E0541E-F17D-430B-97C4-93ADF0DD284E}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter\_tkinter.vcproj", "{3A1515AF-3694-4222-91F2-9837BDF60F9A}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bz2", "bz2\bz2.vcproj", "{18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat\pyexpat.vcproj", "{80EBF51A-6018-4589-9A53-5AAF2872E230}" + ProjectSection(ProjectDependencies) = postProject + {987306EC-6BAD-4440-B4FB-A699A1EE6A28} = {987306EC-6BAD-4440-B4FB-A699A1EE6A28} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{310B6D98-CFE1-4215-97C1-E52989488A50}" + ProjectSection(SolutionItems) = preProject + readme.txt = readme.txt + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 - PGIRelease|Win32 = PGIRelease|Win32 - PGIRelease|x64 = PGIRelease|x64 - PGORelease|Win32 = PGORelease|Win32 - PGORelease|x64 = PGORelease|x64 + PGInstrument|Win32 = PGInstrument|Win32 + PGInstrument|x64 = PGInstrument|x64 + PGUpdate|Win32 = PGUpdate|Win32 + PGUpdate|x64 = PGUpdate|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.ActiveCfg = Debug|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.Build.0 = Debug|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.ActiveCfg = Debug|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.Build.0 = Debug|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|Win32.ActiveCfg = PGIRelease|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|Win32.Build.0 = PGIRelease|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|x64.ActiveCfg = PGIRelease|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|x64.Build.0 = PGIRelease|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|Win32.ActiveCfg = PGORelease|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|Win32.Build.0 = PGORelease|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|x64.ActiveCfg = PGORelease|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|x64.Build.0 = PGORelease|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.ActiveCfg = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.Build.0 = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.ActiveCfg = Release|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.Build.0 = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.ActiveCfg = Debug|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.Build.0 = Debug|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.ActiveCfg = Debug|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.Build.0 = Debug|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|Win32.Build.0 = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|x64.ActiveCfg = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|x64.Build.0 = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|Win32.ActiveCfg = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|Win32.Build.0 = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|x64.ActiveCfg = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|x64.Build.0 = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.ActiveCfg = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.Build.0 = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.ActiveCfg = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.Build.0 = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|Win32.ActiveCfg = Debug|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|Win32.Build.0 = Debug|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|x64.ActiveCfg = Debug|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|x64.Build.0 = Debug|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|Win32.Build.0 = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|x64.ActiveCfg = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|x64.Build.0 = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|Win32.ActiveCfg = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|Win32.Build.0 = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|x64.ActiveCfg = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|x64.Build.0 = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|Win32.ActiveCfg = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|Win32.Build.0 = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|x64.ActiveCfg = Release|x64 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|x64.Build.0 = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|Win32.ActiveCfg = Debug|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|Win32.Build.0 = Debug|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|x64.ActiveCfg = Debug|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|x64.Build.0 = Debug|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|Win32.Build.0 = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|x64.ActiveCfg = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|x64.Build.0 = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|Win32.ActiveCfg = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|Win32.Build.0 = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|x64.ActiveCfg = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|x64.Build.0 = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|Win32.ActiveCfg = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|Win32.Build.0 = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|x64.ActiveCfg = Release|x64 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|x64.Build.0 = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.ActiveCfg = Debug|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.Build.0 = Debug|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.ActiveCfg = Debug|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.Build.0 = Debug|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|Win32.Build.0 = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|x64.ActiveCfg = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|x64.Build.0 = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|Win32.ActiveCfg = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|Win32.Build.0 = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|x64.ActiveCfg = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|x64.Build.0 = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.ActiveCfg = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.Build.0 = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.ActiveCfg = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.Build.0 = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|Win32.ActiveCfg = Debug|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|Win32.Build.0 = Debug|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|x64.ActiveCfg = Debug|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|x64.Build.0 = Debug|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|Win32.Build.0 = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|x64.ActiveCfg = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|x64.Build.0 = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|Win32.ActiveCfg = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|Win32.Build.0 = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|x64.ActiveCfg = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|x64.Build.0 = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|Win32.ActiveCfg = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|Win32.Build.0 = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|x64.ActiveCfg = Release|x64 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|x64.Build.0 = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|Win32.ActiveCfg = Debug|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|Win32.Build.0 = Debug|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|x64.ActiveCfg = Debug|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|x64.Build.0 = Debug|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|Win32.Build.0 = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|x64.ActiveCfg = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|x64.Build.0 = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|Win32.ActiveCfg = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|Win32.Build.0 = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|x64.ActiveCfg = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|x64.Build.0 = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|Win32.ActiveCfg = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|Win32.Build.0 = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|x64.ActiveCfg = Release|x64 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|x64.Build.0 = Release|x64 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGIRelease|Win32.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGIRelease|Win32.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGIRelease|x64.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGORelease|Win32.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGORelease|Win32.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGORelease|x64.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.ActiveCfg = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.Build.0 = Debug|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|Win32.ActiveCfg = Debug|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|Win32.Build.0 = Debug|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|x64.ActiveCfg = Debug|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|x64.Build.0 = Debug|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|Win32.Build.0 = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|x64.ActiveCfg = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|x64.Build.0 = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|Win32.ActiveCfg = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|Win32.Build.0 = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|x64.ActiveCfg = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|x64.Build.0 = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|Win32.ActiveCfg = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|Win32.Build.0 = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|x64.ActiveCfg = Release|x64 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|x64.Build.0 = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|Win32.ActiveCfg = Debug|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|Win32.Build.0 = Debug|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|x64.ActiveCfg = Debug|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|x64.Build.0 = Debug|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|Win32.Build.0 = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|x64.ActiveCfg = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|x64.Build.0 = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|Win32.ActiveCfg = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|Win32.Build.0 = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|x64.ActiveCfg = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|x64.Build.0 = Release|x64 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Release|Win32.ActiveCfg = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Release|Win32.Build.0 = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Release|x64.ActiveCfg = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|Win32.ActiveCfg = Debug|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|Win32.Build.0 = Debug|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|x64.ActiveCfg = Debug|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|x64.Build.0 = Debug|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|Win32.Build.0 = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|x64.ActiveCfg = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|x64.Build.0 = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|Win32.ActiveCfg = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|Win32.Build.0 = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|x64.ActiveCfg = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|x64.Build.0 = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|Win32.ActiveCfg = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|Win32.Build.0 = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|x64.ActiveCfg = Release|x64 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|x64.Build.0 = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|Win32.ActiveCfg = Debug|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|Win32.Build.0 = Debug|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|x64.ActiveCfg = Debug|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|x64.Build.0 = Debug|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|Win32.Build.0 = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|x64.ActiveCfg = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|x64.Build.0 = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|Win32.ActiveCfg = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|Win32.Build.0 = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|x64.ActiveCfg = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|x64.Build.0 = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|Win32.ActiveCfg = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|Win32.Build.0 = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|x64.ActiveCfg = Release|x64 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|x64.Build.0 = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.ActiveCfg = Debug|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.Build.0 = Debug|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.ActiveCfg = Debug|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.Build.0 = Debug|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|Win32.Build.0 = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|x64.ActiveCfg = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|x64.Build.0 = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|Win32.ActiveCfg = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|Win32.Build.0 = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|x64.ActiveCfg = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|x64.Build.0 = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.ActiveCfg = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.Build.0 = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.ActiveCfg = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.Build.0 = Release|x64 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGIRelease|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGIRelease|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGIRelease|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGORelease|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGORelease|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGORelease|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.Build.0 = Release|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Debug|Win32.ActiveCfg = Debug|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Debug|Win32.Build.0 = Debug|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Debug|x64.ActiveCfg = Debug|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Debug|x64.Build.0 = Debug|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Release|Win32.ActiveCfg = Release|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Release|Win32.Build.0 = Release|Win32 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Release|x64.ActiveCfg = Release|x64 + {987306EC-6BAD-4440-B4FB-A699A1EE6A28}.Release|x64.Build.0 = Release|x64 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Debug|Win32.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Debug|Win32.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Debug|x64.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Debug|x64.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGInstrument|Win32.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGInstrument|Win32.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGInstrument|x64.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGUpdate|Win32.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGUpdate|Win32.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.PGUpdate|x64.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Release|Win32.ActiveCfg = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Release|Win32.Build.0 = Debug|Win32 + {2AB2AC43-1B73-40B1-8964-95B3FC3F15ED}.Release|x64.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Debug|Win32.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Debug|Win32.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Debug|x64.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Debug|x64.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGInstrument|Win32.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGInstrument|Win32.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGInstrument|x64.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGUpdate|Win32.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGUpdate|Win32.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.PGUpdate|x64.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Release|Win32.ActiveCfg = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Release|Win32.Build.0 = Debug|Win32 + {87AB87DB-B665-4621-A67B-878C15B93FF0}.Release|x64.ActiveCfg = Debug|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Debug|Win32.ActiveCfg = Debug|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Debug|Win32.Build.0 = Debug|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Debug|x64.ActiveCfg = Debug|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Debug|x64.Build.0 = Debug|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Release|Win32.ActiveCfg = Release|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Release|Win32.Build.0 = Release|Win32 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Release|x64.ActiveCfg = Release|x64 + {8D80F68B-F6EC-4E69-9B04-73F632A8A8ED}.Release|x64.Build.0 = Release|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Debug|Win32.ActiveCfg = Debug|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Debug|Win32.Build.0 = Debug|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Debug|x64.ActiveCfg = Debug|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Debug|x64.Build.0 = Debug|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Release|Win32.ActiveCfg = Release|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Release|Win32.Build.0 = Release|Win32 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Release|x64.ActiveCfg = Release|x64 + {F548A318-960A-4B37-9CD6-86B1B0E33CC8}.Release|x64.Build.0 = Release|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Debug|Win32.ActiveCfg = Debug|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Debug|Win32.Build.0 = Debug|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Debug|x64.ActiveCfg = Debug|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Debug|x64.Build.0 = Debug|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Release|Win32.ActiveCfg = Release|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Release|Win32.Build.0 = Release|Win32 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Release|x64.ActiveCfg = Release|x64 + {CB025148-F0A1-4B32-A669-19EE0534136D}.Release|x64.Build.0 = Release|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Debug|Win32.Build.0 = Debug|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Debug|x64.ActiveCfg = Debug|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Debug|x64.Build.0 = Debug|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Release|Win32.ActiveCfg = Release|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Release|Win32.Build.0 = Release|Win32 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Release|x64.ActiveCfg = Release|x64 + {A25ADCC5-8DE1-4F88-B842-C287923280B1}.Release|x64.Build.0 = Release|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Debug|Win32.ActiveCfg = Debug|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Debug|Win32.Build.0 = Debug|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Debug|x64.ActiveCfg = Debug|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Debug|x64.Build.0 = Debug|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Release|Win32.ActiveCfg = Release|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Release|Win32.Build.0 = Release|Win32 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Release|x64.ActiveCfg = Release|x64 + {D50E5319-41CC-429A-8E81-B1CD391C3A7B}.Release|x64.Build.0 = Release|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Debug|Win32.ActiveCfg = Debug|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Debug|Win32.Build.0 = Debug|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Debug|x64.ActiveCfg = Debug|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Debug|x64.Build.0 = Debug|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Release|Win32.ActiveCfg = Release|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Release|Win32.Build.0 = Release|Win32 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Release|x64.ActiveCfg = Release|x64 + {AE617428-B823-4B87-BC6D-DC7C12C746D3}.Release|x64.Build.0 = Release|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Debug|Win32.ActiveCfg = Debug|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Debug|Win32.Build.0 = Debug|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Debug|x64.ActiveCfg = Debug|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Debug|x64.Build.0 = Debug|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Release|Win32.ActiveCfg = Release|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Release|Win32.Build.0 = Release|Win32 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Release|x64.ActiveCfg = Release|x64 + {98C3DB47-DD1F-4A4B-9D3C-1DBB32AC6667}.Release|x64.Build.0 = Release|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Debug|Win32.ActiveCfg = Debug|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Debug|Win32.Build.0 = Debug|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Debug|x64.ActiveCfg = Debug|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Debug|x64.Build.0 = Debug|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Release|Win32.ActiveCfg = Release|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Release|Win32.Build.0 = Release|Win32 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Release|x64.ActiveCfg = Release|x64 + {0BAFC4A4-8DB5-4CC6-9DDB-A1D32C682B2F}.Release|x64.Build.0 = Release|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Debug|Win32.ActiveCfg = Debug|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Debug|Win32.Build.0 = Debug|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Debug|x64.ActiveCfg = Debug|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Debug|x64.Build.0 = Debug|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Release|Win32.ActiveCfg = Release|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Release|Win32.Build.0 = Release|Win32 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Release|x64.ActiveCfg = Release|x64 + {D04B2089-7DA9-4D92-B23F-07453BC46652}.Release|x64.Build.0 = Release|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Debug|Win32.ActiveCfg = Debug|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Debug|Win32.Build.0 = Debug|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Debug|x64.ActiveCfg = Debug|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Debug|x64.Build.0 = Debug|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Release|Win32.ActiveCfg = Release|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Release|Win32.Build.0 = Release|Win32 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Release|x64.ActiveCfg = Release|x64 + {1015E3B4-FD3B-4402-AA6E-7806514156D6}.Release|x64.Build.0 = Release|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Debug|Win32.ActiveCfg = Debug|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Debug|Win32.Build.0 = Debug|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Debug|x64.ActiveCfg = Debug|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Debug|x64.Build.0 = Debug|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Release|Win32.ActiveCfg = Release|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Release|Win32.Build.0 = Release|Win32 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Release|x64.ActiveCfg = Release|x64 + {AE31A248-5367-4EB2-A511-8722BC351CB4}.Release|x64.Build.0 = Release|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.Debug|Win32.ActiveCfg = Debug|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.Debug|Win32.Build.0 = Debug|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.Debug|x64.ActiveCfg = Debug|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.Debug|x64.Build.0 = Debug|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.Release|Win32.ActiveCfg = PGInstrument|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.Release|Win32.Build.0 = PGInstrument|Win32 + {E644B843-F7CA-4888-AA6D-653C77592856}.Release|x64.ActiveCfg = Release|x64 + {E644B843-F7CA-4888-AA6D-653C77592856}.Release|x64.Build.0 = Release|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Debug|Win32.ActiveCfg = Debug|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Debug|Win32.Build.0 = Debug|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Debug|x64.ActiveCfg = Debug|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Debug|x64.Build.0 = Debug|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Release|Win32.ActiveCfg = Release|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Release|Win32.Build.0 = Release|Win32 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Release|x64.ActiveCfg = Release|x64 + {1E8DCFC4-1EF8-4076-8CA2-B08D3C979749}.Release|x64.Build.0 = Release|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Debug|Win32.ActiveCfg = Debug|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Debug|Win32.Build.0 = Debug|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Debug|x64.ActiveCfg = Debug|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Debug|x64.Build.0 = Debug|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Release|Win32.ActiveCfg = Release|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Release|Win32.Build.0 = Release|Win32 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Release|x64.ActiveCfg = Release|x64 + {3A1515AF-3694-4222-91F2-9837BDF60F9A}.Release|x64.Build.0 = Release|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Debug|Win32.ActiveCfg = Debug|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Debug|Win32.Build.0 = Debug|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Debug|x64.ActiveCfg = Debug|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Debug|x64.Build.0 = Debug|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Release|Win32.ActiveCfg = Release|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Release|Win32.Build.0 = Release|Win32 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Release|x64.ActiveCfg = Release|x64 + {18C518FB-33CB-4C16-AA05-8DEA8DE66DF0}.Release|x64.Build.0 = Release|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Debug|Win32.ActiveCfg = Debug|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Debug|Win32.Build.0 = Debug|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Debug|x64.ActiveCfg = Debug|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Debug|x64.Build.0 = Debug|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Release|Win32.ActiveCfg = Release|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Release|Win32.Build.0 = Release|Win32 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Release|x64.ActiveCfg = Release|x64 + {80EBF51A-6018-4589-9A53-5AAF2872E230}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Deleted: /python/branches/bcannon-objcap/PCbuild8/pyexpat.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/pyexpat.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,393 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/python.build ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/python.build Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/python.iss ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/python.iss Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,346 +0,0 @@ -; Script generated by the Inno Setup Script Wizard. -; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! - -; This is the whole ball of wax for an Inno installer for Python. -; To use, download Inno Setup from http://www.jrsoftware.org/isdl.htm/, -; install it, and double-click on this file. That launches the Inno -; script compiler. The GUI is extemely simple, and has only one button -; you may not recognize instantly: click it. You're done. It builds -; the installer into PCBuild/Python-2.2a1.exe. Size and speed of the -; installer are competitive with the Wise installer; Inno uninstall -; seems much quicker than Wise (but also feebler, and the uninstall -; log is in some un(human)readable binary format). -; -; What's Done -; ----------- -; All the usual Windows Python files are installed by this now. -; All the usual Windows Python Start menu entries are created and -; work fine. -; .py, .pyw, .pyc and .pyo extensions are registered. -; PROBLEM: Inno uninstall does not restore their previous registry -; associations (if any). Wise did. This will make life -; difficult for alpha (etc) testers. -; The Python install is fully functional for "typical" uses. -; -; What's Not Done -; --------------- -; None of "Mark Hammond's" registry entries are written. -; No installation of files is done into the system dir: -; The MS DLLs aren't handled at all by this yet. -; Python22.dll is unpacked into the main Python dir. -; -; Inno can't do different things on NT/2000 depending on whether the user -; has Admin privileges, so I don't know how to "solve" either of those, -; short of building two installers (one *requiring* Admin privs, the -; other not doing anything that needs Admin privs). -; -; Inno has no concept of variables, so lots of lines in this file need -; to be fiddled by hand across releases. Simplest way out: stick this -; file in a giant triple-quoted r-string (note that backslashes are -; required all over the place here -- forward slashes DON'T WORK in -; Inno), and use %(yadda)s string interpolation to do substitutions; i.e., -; write a very simple Python program to *produce* this script. - -[Setup] -AppName=Python and combined Win32 Extensions -AppVerName=Python 2.2.2 and combined Win32 Extensions 150 -AppId=Python 2.2.2.150 -AppVersion=2.2.2.150 -AppCopyright=Python is Copyright ? 2001 Python Software Foundation. Win32 Extensions are Copyright ? 1996-2001 Greg Stein and Mark Hammond. - -; Default install dir; value of {app} later (unless user overrides). -; {sd} = system root drive, probably "C:". -DefaultDirName={sd}\Python22 -;DefaultDirName={pf}\Python - -; Start menu folder name; value of {group} later (unless user overrides). -DefaultGroupName=Python 2.2 - -; Point SourceDir to one above PCBuild = src. -; means this script can run unchanged from anyone's CVS tree, no matter -; what they called the top-level directories. -SourceDir=. -OutputDir=.. -OutputBaseFilename=Python-2.2.2-Win32-150-Setup - -AppPublisher=PythonLabs at Digital Creations -AppPublisherURL=http://www.python.org -AppSupportURL=http://www.python.org -AppUpdatesURL=http://www.python.org - -AlwaysCreateUninstallIcon=true -ChangesAssociations=true -UninstallLogMode=new -AllowNoIcons=true -AdminPrivilegesRequired=true -UninstallDisplayIcon={app}\pyc.ico -WizardDebug=false - -; The fewer screens the better; leave these commented. - -Compression=bzip -InfoBeforeFile=LICENSE.txt -;InfoBeforeFile=Misc\NEWS - -; uncomment the following line if you want your installation to run on NT 3.51 too. -; MinVersion=4,3.51 - -[Types] -Name: normal; Description: Select desired components; Flags: iscustom - -[Components] -Name: main; Description: Python and Win32 Extensions; Types: normal -Name: docs; Description: Python documentation (HTML); Types: normal -Name: tk; Description: TCL/TK, tkinter, and Idle; Types: normal -Name: tools; Description: Python utility scripts (Tools\); Types: normal -Name: test; Description: Python test suite (Lib\test\); Types: normal - -[Tasks] -Name: extensions; Description: Register file associations (.py, .pyw, .pyc, .pyo); Components: main; Check: IsAdminLoggedOn - -[Files] -; Caution: Using forward slashes instead screws up in amazing ways. -; Unknown: By the time Components (and other attrs) are added to these lines, they're -; going to get awfully long. But don't see a way to continue logical lines across -; physical lines. - -Source: LICENSE.txt; DestDir: {app}; CopyMode: alwaysoverwrite -Source: README.txt; DestDir: {app}; CopyMode: alwaysoverwrite -Source: News.txt; DestDir: {app}; CopyMode: alwaysoverwrite -Source: *.ico; DestDir: {app}; CopyMode: alwaysoverwrite; Components: main - -Source: python.exe; DestDir: {app}; CopyMode: alwaysoverwrite; Components: main -Source: pythonw.exe; DestDir: {app}; CopyMode: alwaysoverwrite; Components: main -Source: w9xpopen.exe; DestDir: {app}; CopyMode: alwaysoverwrite; Components: main - - -Source: DLLs\tcl83.dll; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: tk -Source: DLLs\tk83.dll; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: tk -Source: tcl\*.*; DestDir: {app}\tcl; CopyMode: alwaysoverwrite; Components: tk; Flags: recursesubdirs - -Source: sysdir\python22.dll; DestDir: {sys}; CopyMode: alwaysskipifsameorolder; Components: main; Flags: sharedfile restartreplace -Source: sysdir\PyWinTypes22.dll; DestDir: {sys}; CopyMode: alwaysskipifsameorolder; Components: main; Flags: restartreplace sharedfile -Source: sysdir\pythoncom22.dll; DestDir: {sys}; CopyMode: alwaysskipifsameorolder; Components: main; Flags: restartreplace sharedfile - -Source: DLLs\_socket.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_socket.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_sre.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_sre.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_symtable.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_symtable.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_testcapi.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_testcapi.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_tkinter.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: tk -Source: libs\_tkinter.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: tk - -Source: DLLs\bsddb.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\bsddb.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\mmap.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\mmap.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\parser.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\parser.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\pyexpat.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\pyexpat.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\select.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\select.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\unicodedata.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\unicodedata.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\_winreg.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\_winreg.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\winsound.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\winsound.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\zlib.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\zlib.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: libs\python22.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - -Source: DLLs\expat.dll; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main - - - -Source: Lib\*.py; DestDir: {app}\Lib; CopyMode: alwaysoverwrite; Components: main -Source: Lib\compiler\*.*; DestDir: {app}\Lib\compiler; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\distutils\*.*; DestDir: {app}\Lib\distutils; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\email\*.*; DestDir: {app}\Lib\email; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\encodings\*.*; DestDir: {app}\Lib\encodings; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\hotshot\*.*; DestDir: {app}\Lib\hotshot; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\lib-old\*.*; DestDir: {app}\Lib\lib-old; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\xml\*.*; DestDir: {app}\Lib\xml; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\hotshot\*.*; DestDir: {app}\Lib\hotshot; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\test\*.*; DestDir: {app}\Lib\test; CopyMode: alwaysoverwrite; Components: test; Flags: recursesubdirs - -Source: Lib\site-packages\README.txt; DestDir: {app}\Lib\site-packages; CopyMode: alwaysoverwrite; Components: main - -Source: Lib\site-packages\PyWin32.chm; DestDir: {app}\Lib\site-packages; CopyMode: alwaysoverwrite; Components: docs -Source: Lib\site-packages\win32\*.*; DestDir: {app}\Lib\site-packages\win32; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\site-packages\win32com\*.*; DestDir: {app}\Lib\site-packages\win32com; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs -Source: Lib\site-packages\win32comext\*.*; DestDir: {app}\Lib\site-packages\win32comext; CopyMode: alwaysoverwrite; Components: main; Flags: recursesubdirs - -Source: Lib\lib-tk\*.py; DestDir: {app}\Lib\lib-tk; CopyMode: alwaysoverwrite; Components: tk; Flags: recursesubdirs - -Source: include\*.h; DestDir: {app}\include; CopyMode: alwaysoverwrite; Components: main - -Source: Tools\idle\*.*; DestDir: {app}\Tools\idle; CopyMode: alwaysoverwrite; Components: tk; Flags: recursesubdirs - -Source: Tools\pynche\*.*; DestDir: {app}\Tools\pynche; CopyMode: alwaysoverwrite; Components: tools; Flags: recursesubdirs -Source: Tools\scripts\*.*; DestDir: {app}\Tools\Scripts; CopyMode: alwaysoverwrite; Components: tools; Flags: recursesubdirs -Source: Tools\webchecker\*.*; DestDir: {app}\Tools\webchecker; CopyMode: alwaysoverwrite; Components: tools; Flags: recursesubdirs -Source: Tools\versioncheck\*.*; DestDir: {app}\Tools\versioncheck; CopyMode: alwaysoverwrite; Components: tools; Flags: recursesubdirs - -Source: Doc\*.*; DestDir: {app}\Doc; CopyMode: alwaysoverwrite; Flags: recursesubdirs; Components: docs - - -[Icons] -Name: {group}\Python (command line); Filename: {app}\python.exe; WorkingDir: {app}; Components: main -Name: {group}\Python Manuals; Filename: {app}\Doc\index.html; WorkingDir: {app}; Components: docs -Name: {group}\Win32 Extensions Help; Filename: {app}\Lib\site-packages\PyWin32.chm; WorkingDir: {app}\Lib\site-packages; Components: docs -Name: {group}\Module Docs; Filename: {app}\pythonw.exe; WorkingDir: {app}; Parameters: """{app}\Tools\Scripts\pydoc.pyw"""; Components: tools -Name: {group}\IDLE (Python GUI); Filename: {app}\pythonw.exe; WorkingDir: {app}; Parameters: """{app}\Tools\idle\idle.pyw"""; Components: tools - -[Registry] -; Register .py -Tasks: extensions; Root: HKCR; Subkey: .py; ValueType: string; ValueName: ; ValueData: Python File; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: .py; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: Python File; ValueType: string; ValueName: ; ValueData: Python File; Flags: uninsdeletekey -Tasks: extensions; Root: HKCR; Subkey: Python File\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\Py.ico -Tasks: extensions; Root: HKCR; Subkey: Python File\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\python.exe"" ""%1"" %*" - -; Register .pyc -Tasks: extensions; Root: HKCR; Subkey: .pyc; ValueType: string; ValueName: ; ValueData: Python CompiledFile; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: Python CompiledFile; ValueType: string; ValueName: ; ValueData: Compiled Python File; Flags: uninsdeletekey -Tasks: extensions; Root: HKCR; Subkey: Python CompiledFile\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\pyc.ico -Tasks: extensions; Root: HKCR; Subkey: Python CompiledFile\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\python.exe"" ""%1"" %*" - -; Register .pyo -Tasks: extensions; Root: HKCR; Subkey: .pyo; ValueType: string; ValueName: ; ValueData: Python CompiledFile; Flags: uninsdeletevalue - -; Register .pyw -Tasks: extensions; Root: HKCR; Subkey: .pyw; ValueType: string; ValueName: ; ValueData: Python NoConFile; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: .pyw; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: uninsdeletevalue -Tasks: extensions; Root: HKCR; Subkey: Python NoConFile; ValueType: string; ValueName: ; ValueData: Python File (no console); Flags: uninsdeletekey -Tasks: extensions; Root: HKCR; Subkey: Python NoConFile\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\Py.ico -Tasks: extensions; Root: HKCR; Subkey: Python NoConFile\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\pythonw.exe"" ""%1"" %*" - - -; Python Registry Keys -Root: HKLM; Subkey: SOFTWARE\Python; Flags: uninsdeletekeyifempty; Check: IsAdminLoggedOn -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\PythonPath; ValueData: "{app}\Lib;{app}\DLLs"; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\PythonPath\tk; ValueData: {app}\Lib\lib-tk; Flags: uninsdeletekey; Components: tk -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\PythonPath\win32; ValueData: "{app}\lib\site-packages\win32;{app}\lib\site-packages\win32\lib"; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\PythonPath\win32com; ValueData: C:\Python\lib\site-packages; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Modules; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Modules\pythoncom; ValueData: {sys}\pythoncom22.dll; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Modules\pywintypes; ValueData: {sys}\PyWinTypes22.dll; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\InstallPath; ValueData: {app}; Flags: uninsdeletekeyifempty; ValueType: string -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\InstallPath\InstallGroup; ValueData: {group}; Flags: uninsdeletekey -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Help; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Help\Main Python Documentation; ValueType: string; ValueData: {app}\Doc\index.html; Flags: uninsdeletekey; Components: docs -Root: HKLM; Subkey: SOFTWARE\Python\PythonCore\2.2\Help\Python Win32 Documentation; ValueType: string; ValueData: {app}\lib\site-packages\PyWin32.chm; Flags: uninsdeletekey; Components: docs - -[_ISTool] -EnableISX=true - - -[Code] -Program Setup; - -Function IsAdminNotLoggedOn(): Boolean; -begin - Result := Not IsAdminLoggedOn(); -end; - -begin -end. - - - - -[UninstallDelete] -Name: {app}\Lib\compiler\*.pyc; Type: files -Name: {app}\Lib\compiler\*.pyo; Type: files -Name: {app}\Lib\compiler; Type: dirifempty -Name: {app}\Lib\distutils\command\*.pyc; Type: files -Name: {app}\Lib\distutils\command\*.pyo; Type: files -Name: {app}\Lib\distutils\command; Type: dirifempty -Name: {app}\Lib\distutils\*.pyc; Type: files -Name: {app}\Lib\distutils\*.pyo; Type: files -Name: {app}\Lib\distutils; Type: dirifempty -Name: {app}\Lib\email\test\*.pyc; Type: files -Name: {app}\Lib\email\test\*.pyo; Type: files -Name: {app}\Lib\email\test; Type: dirifempty -Name: {app}\Lib\email\*.pyc; Type: files -Name: {app}\Lib\email\*.pyo; Type: files -Name: {app}\Lib\email; Type: dirifempty -Name: {app}\Lib\encodings\*.pyc; Type: files -Name: {app}\Lib\encodings\*.pyo; Type: files -Name: {app}\Lib\encodings; Type: dirifempty -Name: {app}\Lib\hotshot\*.pyc; Type: files -Name: {app}\Lib\hotshot\*.pyo; Type: files -Name: {app}\Lib\hotshot; Type: dirifempty -Name: {app}\Lib\lib-old\*.pyc; Type: files -Name: {app}\Lib\lib-old\*.pyo; Type: files -Name: {app}\Lib\lib-old; Type: dirifempty -Name: {app}\Lib\lib-tk\*.pyc; Type: files -Name: {app}\Lib\lib-tk\*.pyo; Type: files -Name: {app}\Lib\lib-tk; Type: dirifempty -Name: {app}\Lib\test\*.pyc; Type: files -Name: {app}\Lib\test\*.pyo; Type: files -Name: {app}\Lib\test; Type: dirifempty -Name: {app}\Lib\xml\dom\*.pyc; Type: files -Name: {app}\Lib\xml\dom\*.pyo; Type: files -Name: {app}\Lib\xml\dom; Type: dirifempty -Name: {app}\Lib\xml\parsers\*.pyc; Type: files -Name: {app}\Lib\xml\parsers\*.pyo; Type: files -Name: {app}\Lib\xml\parsers; Type: dirifempty -Name: {app}\Lib\xml\sax\*.pyc; Type: files -Name: {app}\Lib\xml\sax\*.pyo; Type: files -Name: {app}\Lib\xml\sax; Type: dirifempty -Name: {app}\Lib\xml\*.pyc; Type: files -Name: {app}\Lib\xml\*.pyo; Type: files -Name: {app}\Lib\xml; Type: dirifempty - -Name: {app}\Lib\site-packages\win32; Type: filesandordirs -Name: {app}\Lib\site-packages\win32com; Type: filesandordirs -Name: {app}\Lib\site-packages\win32comext; Type: filesandordirs -Name: {app}\Lib\site-packages\pythoncom.py*; Type: files -Name: {app}\Lib\site-packages; Type: dirifempty - -Name: {app}\Lib\*.pyc; Type: files -Name: {app}\Lib; Type: dirifempty - -Name: {app}\Tools\pynche\*.pyc; Type: files -Name: {app}\Tools\pynche\*.pyo; Type: files -Name: {app}\Tools\pynche; Type: dirifempty - -Name: {app}\Tools\idle\*.pyc; Type: files -Name: {app}\Tools\idle\*.pyo; Type: files -Name: {app}\Tools\idle; Type: dirifempty - -Name: {app}\Tools\scripts\*.pyc; Type: files -Name: {app}\Tools\scripts\*.pyo; Type: files -Name: {app}\Tools\scripts; Type: dirifempty - -Name: {app}\Tools\versioncheck\*.pyc; Type: files -Name: {app}\Tools\versioncheck\*.pyo; Type: files -Name: {app}\Tools\versioncheck; Type: dirifempty - -Name: {app}\Tools\webchecker\*.pyc; Type: files -Name: {app}\Tools\webchecker\*.pyo; Type: files -Name: {app}\Tools\webchecker; Type: dirifempty - -Name: {app}\Tools; Type: dirifempty - Deleted: /python/branches/bcannon-objcap/PCbuild8/python.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/python.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,399 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/python20.wse ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/python20.wse Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,3135 +0,0 @@ -Document Type: WSE -item: Global - Version=9.0 - Title=Python 2.4a1 - Flags=00010100 - Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - Japanese Font Name=MS Gothic - Japanese Font Size=10 - Start Gradient=0 255 0 - End Gradient=0 128 0 - Windows Flags=00000100000011010010010100001010 - Log Pathname=%MAINDIR%\INSTALL.LOG - Message Font=MS Sans Serif - Font Size=8 - Pages Modified=00010000011101000000000100000111 - Extra Pages=00000000000000000000000010110010 - Disk Filename=SETUP - Patch Flags=0000000000001001 - Patch Threshold=85 - Patch Memory=4000 - MIF PDF Version=1.0 - MIF SMS Version=2.0 - EXE Filename=Python-2.4a1.exe - Dialogs Version=8 - Version File=2.4a1 - Version Description=Python Programming Language - Version Copyright=?2001-2007 Python Software Foundation - Version Company=Python Software Foundation - Crystal Format=10111100101100000010001001001001 - Step View=&All - Variable Name1=_WISE_ - Variable Description1=WISE root directory - Variable Default1=C:\Programme\Wise Installation System - Variable Flags1=00001000 - Variable Name2=_TCLDIR_ - Variable Description2=The directory in which the Tcl/Tk installation - Variable Description2=lives. This must be a sibling of the Python - Variable Description2=directory. - Variable Default2=tcl84 - Variable Flags2=00001000 - Variable Name3=_DOC_ - Variable Description3=The unpacked HTML doc directory. - Variable Default3=..\html - Variable Flags3=00001001 - Variable Name4=_SYS_ - Variable Description4=System directory (where to find MSVCRT.DLL) - Variable Default4=C:\Windows\System - Variable Values4=C:\Windows\System - Variable Values4=C:\WINNT\System32 - Variable Values4=C:\Code\MSDLLs - Variable Values4=C:\Windows\System32 - Variable Flags4=00000010 - Variable Name5=_PYMAJOR_ - Variable Description5=Python major version number; the 2 in 2.3. - Variable Default5=2 - Variable Flags5=00001000 - Variable Name6=_PYMINOR_ - Variable Description6=Python minor version number; the 3 in 2.3 - Variable Default6=3 - Variable Flags6=00001000 - Variable Name7=_DOADMIN_ - Variable Description7=The initial value for %DOADMIN%. - Variable Description7=When 0, we never try to write under HKLM, - Variable Description7=and install the Python + MS runtime DLLs in - Variable Description7=the Python directory instead of the system dir. - Variable Default7=1 - Variable Values7=1 - Variable Values7=0 - Variable Flags7=00001010 - Variable Name8=_ALIASNAME_ - Variable Flags8=00001000 - Variable Name9=_ALIASPATH_ - Variable Flags9=00001000 - Variable Name10=_ALIASTYPE_ - Variable Flags10=00001000 -end -item: Set Variable - Variable=PYVER_STRING - Value=2.3 -end -item: Remark -end -item: Remark - Text=When the version number changes, set the compiler -end -item: Remark - Text=vrbls _PYMAJOR_ and _PYMINOR_. -end -item: Remark - Text=Nothing in the script below should need fiddling then. -end -item: Remark - Text=Other things that need fiddling: -end -item: Remark - Text= PYVER_STRING above. -end -item: Remark - Text= The "Title:" in the upper left corner of the GUI. -end -item: Remark - Text= Build Settings and Version Resource on step 6 (Finish) of the Installation Expert -end -item: Remark - Text= Be sure to select Steps->All or you may not see these! -end -item: Remark -end -item: Remark - Text=When the version of Tcl/Tk changes, the compiler vrbl -end -item: Remark - Text=_TCLDIR_ may also need to be changed. -end -item: Remark -end -item: Set Variable - Variable=APPTITLE - Value=Python %PYVER_STRING% -end -item: Remark - Text=PY_VERSION should be major.minor only; used to create the registry key; must match MS_DLL_ID in python_nt.rc -end -item: Set Variable - Variable=PY_VERSION - Value=%_PYMAJOR_%.%_PYMINOR_% -end -item: Remark - Text=GROUP is the Start menu group name; user can override. -end -item: Set Variable - Variable=GROUP - Value=Python %PY_VERSION% - Flags=10000000 -end -item: Remark - Text=MAINDIR is the app directory; user can override. -end -item: Set Variable - Variable=MAINDIR - Value=Python%_PYMAJOR_%%_PYMINOR_% -end -item: Remark -end -item: Set Variable - Variable=DOADMIN - Value=%_DOADMIN_% -end -item: Remark - Text=Give non-admin users a chance to abort. -end -item: Check Configuration - Flags=10011111 -end -item: Set Variable - Variable=DOADMIN - Value=0 -end -item: Display Message - Title=Doing non-admin install - Text=The current login does not have Administrator Privileges on this machine. Python will install its registry information into the per-user area only for the current login, instead of into the per-machine area for every account on this machine. Some advanced uses of Python may not work as a result (for example, running a Python script as a service). - Text= - Text=If this is not what you want, please click Cancel to abort this installation, log on as an Administrator, and start the installation again. - Flags=00001000 -end -item: End Block -end -item: Remark -end -item: Remark - Text=BEGIN WIZARD STUFF ----------------------------------------------------------------------------------------------------------------------------- -end -item: Remark - Text=Note from Tim: the "stop" on the next line is actually "pause". -end -item: Open/Close INSTALL.LOG - Flags=00000001 -end -item: Remark - Text=If the destination system does not have a writable Windows\System directory, system files will be written to the Windows\ directory -end -item: Check if File/Dir Exists - Pathname=%SYS% - Flags=10000100 -end -item: Set Variable - Variable=SYS - Value=%WIN% -end -item: End Block -end -item: Check Configuration - Flags=10111011 -end -item: Get Registry Key Value - Variable=COMMON - Key=SOFTWARE\Microsoft\Windows\CurrentVersion - Default=C:\Program Files\Common Files - Value Name=CommonFilesDir - Flags=00000100 -end -item: Get Registry Key Value - Variable=PROGRAM_FILES - Key=SOFTWARE\Microsoft\Windows\CurrentVersion - Default=C:\Program Files - Value Name=ProgramFilesDir - Flags=00000100 -end -item: Set Variable - Variable=EXPLORER - Value=1 -end -item: End Block -end -item: Remark - Text=Note from Tim: The Wizard hardcod "C:" at the start of the replacement text for MAINDIR. -end -item: Remark - Text=That's not appropriate if the system drive doesn't happen to be C:. -end -item: Remark - Text=I removed the "C:", and that did the right thing for two people who tested it on non-C: machines, -end -item: Remark - Text=but it's unclear whether it will always do the right thing. -end -item: Set Variable - Variable=MAINDIR - Value=\%MAINDIR% - Flags=00001100 -end -item: Remark - Text=BACKUP is the variable that holds the path that all backup files will be copied to when overwritten -end -item: Set Variable - Variable=BACKUP - Value=%MAINDIR%\BACKUP - Flags=10000000 -end -item: Remark - Text=DOBACKUP determines if a backup will be performed. The possible values are A (do backup) or B (do not do backup) -end -item: Set Variable - Variable=DOBACKUP - Value=A -end -item: Remark - Text=BRANDING determines if the installation will be branded with a name and company. By default, this is written to the INST directory (installation media). -end -item: Set Variable - Variable=BRANDING - Value=0 -end -item: If/While Statement - Variable=BRANDING - Value=1 -end -item: Read INI Value - Variable=NAME - Pathname=%INST%\CUSTDATA.INI - Section=Registration - Item=Name -end -item: Read INI Value - Variable=COMPANY - Pathname=%INST%\CUSTDATA.INI - Section=Registration - Item=Company -end -item: If/While Statement - Variable=NAME -end -item: Set Variable - Variable=DOBRAND - Value=1 -end -item: Get System Information - Variable=NAME - Flags=00000110 -end -item: Get System Information - Variable=COMPANY - Flags=00000111 -end -item: End Block -end -item: End Block -end -item: Remark - Text=END WIZARD STUFF ----------------------------------------------------------------------------------------------------------------------------- -end -item: Remark -end -item: Remark - Text=Set vrbls for the "Advanced Options" subdialog of Components. -end -item: Set Variable - Variable=SELECT_ADMIN - Value=A -end -item: If/While Statement - Variable=DOADMIN - Value=0 -end -item: Set Variable - Variable=SELECT_ADMIN - Value=B -end -item: End Block -end -item: Remark -end -item: Remark - Text=TASKS values: -end -item: Remark - Text=A: Register file extensions -end -item: Remark - Text=B: Create Start Menu shortcuts -end -item: Set Variable - Variable=TASKS - Value=AB -end -item: Remark -end -item: Remark - Text=COMPONENTS values: -end -item: Remark - Text=A: interpreter and libraries -end -item: Remark - Text=B: Tcl/Tk -end -item: Remark - Text=C: docs -end -item: Remark - Text=D: tools -end -item: Remark - Text=E: test suite -end -item: Set Variable - Variable=COMPONENTS - Value=ABCDE -end -item: Remark -end -item: Remark - Text=March thru the user GUI. -end -item: Wizard Block - Direction Variable=DIRECTION - Display Variable=DISPLAY - Bitmap Pathname=.\installer.bmp - X Position=9 - Y Position=10 - Filler Color=11173759 - Dialog=Select Destination Directory - Dialog=Backup Replaced Files - Dialog=Select Components - Dialog=Select Program Manager Group - Variable= - Variable= - Variable= - Variable=TASKS - Value= - Value= - Value= - Value=B - Compare=0 - Compare=0 - Compare=0 - Compare=3 - Flags=00000011 -end -item: If/While Statement - Variable=DISPLAY - Value=Start Installation -end -item: Set Variable - Variable=SUMMARY - Value=Install directory: %MAINDIR%%CRLF% -end -item: Remark -end -item: If/While Statement - Variable=SELECT_ADMIN - Value=A -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Doing admin install.%CRLF% - Flags=00000001 -end -item: Else Statement -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Doing non-admin install.%CRLF% - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=DOBACKUP - Value=A -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Make backups, into %BACKUP%%CRLF% - Flags=00000001 -end -item: Else Statement -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Don't make backups.%CRLF% - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Components:%CRLF% - Flags=00000001 -end -item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Python interpreter and libraries%CRLF% - Flags=00000001 -end -item: End Block -end -item: If/While Statement - Variable=COMPONENTS - Value=B - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Tcl/Tk (Tkinter, IDLE, pydoc)%CRLF% - Flags=00000001 -end -item: End Block -end -item: If/While Statement - Variable=COMPONENTS - Value=C - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Python documentation%CRLF% - Flags=00000001 -end -item: End Block -end -item: If/While Statement - Variable=COMPONENTS - Value=D - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Tool and utility scripts%CRLF% - Flags=00000001 -end -item: End Block -end -item: If/While Statement - Variable=COMPONENTS - Value=E - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value= Python test suite%CRLF% - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=TASKS - Value=A - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Register file extensions.%CRLF% - Flags=00000001 -end -item: Else Statement -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Don't register file extensions.%CRLF% - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=TASKS - Value=B - Flags=00000010 -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%Start Menu group: %GROUP%%CRLF% - Flags=00000001 -end -item: Else Statement -end -item: Set Variable - Variable=SUMMARY - Value=%CRLF%No Start Menu shortcuts.%CRLF% - Flags=00000001 -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Custom Dialog Set - Name=Select Destination Directory - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Push Button - Rectangle=264 234 320 253 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 11 323 33 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Select Destination Directory - Text French=S?lectionner le r?pertoire de destination - Text German=Zielverzeichnis w?hlen - Text Spanish=Seleccione el directorio de destino - Text Italian=Selezionare Directory di destinazione - end - item: Listbox - Rectangle=108 58 321 219 - Variable=MAINDIR - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000100000010000000101000001 - Flags=0000110000001010 - Text=%MAINDIR% - Text= - end - item: Static - Rectangle=108 40 313 58 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000000 - Text=Please select a directory for the %APPTITLE% files. - end - end - item: Dialog - Title=Select Destination Directory - Title French=S?lectionner le r?pertoire de destination - Title German=Zielverzeichnis w?hlen - Title Spanish=Seleccione el directorio de destino - Title Italian=Selezionare Directory di destinazione - Width=276 - Height=216 - Font Name=Helv - Font Size=8 - item: Listbox - Rectangle=6 6 204 186 - Variable=MAINDIR - Create Flags=01010000100000010000000101000000 - Flags=0000110000100010 - Text=%MAINDIR% - Text French=%MAINDIR% - Text German=%MAINDIR% - Text Spanish=%MAINDIR% - Text Italian=%MAINDIR% - end - item: Push Button - Rectangle=209 8 265 26 - Create Flags=01010000000000010000000000000001 - Text=OK - Text French=OK - Text German=OK - Text Spanish=Aceptar - Text Italian=OK - end - item: Push Button - Rectangle=209 31 265 50 - Variable=MAINDIR - Value=%MAINDIR_SAVE% - Create Flags=01010000000000010000000000000000 - Flags=0000000000000001 - Text=Cancel - Text French=Annuler - Text German=Abbrechen - Text Spanish=Cancelar - Text Italian=Annulla - end - end -end -item: Custom Dialog Set - Name=Backup Replaced Files - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Fichiers de Sauvegarde Remplac?s - Title German=Sicherungskopie von ersetzten Dateien erstellen - Title Portuguese=Ficheiros substitu?dos de seguran?a - Title Spanish=Copias de seguridad de los archivos reemplazados - Title Italian=Backup file sostituiti - Title Danish=Sikkerhedskopiering af erstattede filer - Title Dutch=Vervangen bestanden kopi?ren - Title Norwegian=Sikkerhetskopiere erstattede filer - Title Swedish=S?kerhetskopiera utbytta filer - Width=350 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 251 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suivant> - Text German=&Weiter> - Text Portuguese=&Pr?ximo> - Text Spanish=&Siguiente > - Text Italian=&Avanti > - Text Danish=&N?ste> - Text Dutch=&Volgende> - Text Norwegian=&Neste> - Text Swedish=&N?sta > - end - item: Push Button - Rectangle=131 234 188 251 - Variable=DIRECTION - Value=B - Create Flags=01010000000000010000000000000000 - Text=< &Back - Text French=<&Retour - Text German=<&Zur?ck - Text Portuguese=<&Retornar - Text Spanish=<&Retroceder - Text Italian=< &Indietro - Text Danish=<&Tilbage - Text Dutch=<&Terug - Text Norwegian=<&Tilbake - Text Swedish=< &Tillbaka - end - item: Push Button - Rectangle=278 234 330 251 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=Cancel - Text French=Annuler - Text German=Abbrechen - Text Portuguese=Cancelar - Text Spanish=Cancelar - Text Italian=Annulla - Text Danish=Annuller - Text Dutch=Annuleren - Text Norwegian=Avbryt - Text Swedish=Avbryt - end - item: Static - Rectangle=11 221 329 223 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 46 320 98 - Create Flags=01010000000000000000000000000000 - Text=This installation program can create backup copies of all files replaced during the installation. These files will be used when the software is uninstalled and a rollback is requested. If backup copies are not created, you will only be able to uninstall the software and not roll the system back to a previous state. - Text= - Text=Do you want to create backups of replaced files? - Text French=Le programme d'installation peut cr?er des copies de sauvegarde de tous les fichiers remplac?s pendant l'installation. Ces fichiers sont utilis?s au cas o? le logiciel est d?sinstall? et que l'on proc?de ? la reprise du syst?me. Si les copies de sauvegarde ne sont pas cr??es, on ne pourra que d?sinstaller le logiciel sans reprendre le syst?me ? un ?tat pr?c?dent. Voulez-vous cr?er une sauvegarde des fichiers remplac?s ? - Text German=Dieses Installationsprogramm kann Sicherungskopien von allen w?hrend der Installation ersetzten Dateien erstellen. Diese Dateien werden zur R?ckg?ngigmachung der Installation und bei Anforderung eines Rollbacks verwendet. Ohne Sicherungskopien ist nur eine R?ckg?ngigmachung der Installation m?glich, nicht aber ein Rollback des Systems. Sicherungskopien der ersetzten Dateien erstellen? - Text Portuguese=Este programa de instala??o pode criar c?pias de seguran?a de todos os ficheiros substitu?dos durante a instala??o. Estes ficheiros ser?o utilizados quando o programa for desinstalado e for requisitada uma retomada. Se as c?pias de seguran?a n?o forem criadas, s? poder? desinstalar o programa e n?o pode retomar um estado anterior do sistema. Deseja criar c?pias de seguran?a dos ficheiros substitu?dos? - Text Spanish=Este programa de instalaci?n puede crear copias de seguridad de todos los archivos reemplazados durante la instalaci?n. Estos archivos se utilizar?n cuando se desinstale el software y se solicite volver al estado anterior. Si no se crean copias de seguridad, ?nicamente podr? desinstalar el software y no podr? devolver el sistema al estado anterior. ?Desea crear archivos de seguridad de los archivos reemplazados? - Text Italian=Questo programma di installazione pu? creare copie di backup di tutti i file sostituiti durante l?installazione. Questi file saranno usati quando il software sar? disinstallato e sar? richiesto un ritorno allo stato precedente. Se non crei le copie di backup, potrai solo disinstallare il software, ma non potrai riportare il sistema allo stato precedente. Vuoi creare i file di backup dei file sostituiti? - Text Danish=Dette installationsprogram kan oprette sikkerhedskopier af alle filer, som erstattes under installationen. Disse filer benyttes, n?r softwaren fjernes, og den tidligere systemkonfiguration genetableres. Hvis der ikke oprettes sikkerhedskopier, kan du kun fjerne den installerede software og ikke genetablere den tidligere systemkonfiguration. Vil du oprette sikkerhedskopier af filer, som erstattes? - Text Dutch=Dit installatieprogramma kan kopie?n maken van alle bestanden die tijdens de installatie worden vervangen. Deze worden dan gebruikt als de software-installatie ongedaan wordt gemaakt en u het systeem wilt laten terugkeren naar de oorspronkelijke staat. Als er geen back-up kopie?n worden gemaakt, kunt u de software enkel verwijderen maar het systeem niet in de oorspronkelijke staat terugbrengen. Wilt u een back-up maken van de vervangen bestanden? - Text Norwegian=Dette installasjonsprogrammet kan lage sikkerhetskopier av alle filer som blir erstattet under installasjonen. Disse filene vil tas i bruk n?r programvaren er avinstallert og det er behov for tilbakestilling. Hvis det ikke er laget sikkerhetskopier, kan du kun avinstallere programvaren og ikke stille systemet tilbake til tidligere status. ?nsker du ? lage sikkerhetskopier av de filene som blir erstattet n?? - Text Swedish=Installationsprogrammet kan skapa s?kerhetskopior av alla filer som byts ut under installationen. Dessa filer kan sedan anv?ndas n?r programvaran avinstalleras och du beg?r rollback. Om du d? inte har n?gra s?kerhetskopior kan du bara avinstallera programvaran, inte ?terskapa systemet i dess tidigare skick. Vill du g?ra s?kerhetskopior av de ersatta filerna? - end - item: Radio Button - Rectangle=141 106 265 136 - Variable=DOBACKUP - Create Flags=01010000000000010000000000001001 - Text=&Yes, make backups - Text=N&o, do not make backups - Text= - Text French=&Oui - Text French=N&on - Text French= - Text German=&Ja - Text German=N&ein - Text German= - Text Portuguese=&Sim - Text Portuguese=N?&o - Text Portuguese= - Text Spanish=&S? - Text Spanish=N&o - Text Spanish= - Text Italian=&S? - Text Italian=N&o - Text Italian= - Text Danish=&Ja - Text Danish=&Nej - Text Danish= - Text Dutch=&Ja - Text Dutch=N&ee - Text Dutch= - Text Norwegian=&Ja - Text Norwegian=&Nei - Text Norwegian= - Text Swedish=&Ja - Text Swedish=N&ej - Text Swedish= - end - item: Static - Control Name=BACK2 - Rectangle=108 173 320 208 - Action=1 - Create Flags=01010000000000000000000000000111 - Text=Backup File Destination Directory - Text French=R?pertoire de destination des fichiers de sauvegarde - Text German=Zielverzeichnis f?r die Sicherungsdatei - Text Portuguese=Direct?rio de destino de ficheiro de seguran?a - Text Spanish=Directorio de Destino de los Archivos de Seguridad - Text Italian=Directory di destinazione dei file di backup - Text Danish=Destinationsbibliotek til sikkerhedskopier - Text Dutch=Doeldirectory backup-bestand - Text Norwegian=M?lkatalog for sikkerhetskopier - Text Swedish=Katalog f?r s?kerhetskopierade filer - end - item: Push Button - Control Name=BACK3 - Rectangle=265 185 318 203 - Variable=BACKUP_SAVE - Value=%BACKUP% - Destination Dialog=1 - Action=2 - Create Flags=01010000000000010000000000000000 - Text=B&rowse... - Text French=P&arcourir - Text German=B&l?ttern... - Text Portuguese=P&rocurar - Text Spanish=V&isualizar... - Text Italian=Sfoglia... - Text Danish=&Gennemse... - Text Dutch=B&laderen... - Text Norwegian=Bla igjennom - Text Swedish=&Bl?ddra - end - item: Static - Control Name=BACK4 - Rectangle=129 188 254 200 - Destination Dialog=2 - Create Flags=01010000000000000000000000000000 - Text=%BACKUP% - Text French=%BACKUP% - Text German=%BACKUP% - Text Portuguese=%BACKUP% - Text Spanish=%BACKUP% - Text Italian=%BACKUP% - Text Danish=%BACKUP% - Text Dutch=%BACKUP% - Text Norwegian=%BACKUP% - Text Swedish=%BACKUP% - end - item: Static - Rectangle=108 11 323 36 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Backup Replaced Files - Text French=S?lectionner les composants - Text German=Komponenten ausw?hlen - Text Spanish=Seleccione componentes - Text Italian=Selezionare i componenti - end - item: If/While Statement - Variable=DOBACKUP - Value=B - end - item: Set Control Attribute - Control Name=BACK3 - Operation=1 - end - item: Set Control Attribute - Control Name=BACK4 - Operation=1 - end - item: Else Statement - end - item: Set Control Attribute - Control Name=BACK3 - end - item: Set Control Attribute - Control Name=BACK4 - end - item: End Block - end - end - item: Dialog - Title=Select Destination Directory - Title French=Choisissez le r?pertoire de destination - Title German=Zielverzeichnis w?hlen - Title Portuguese=Seleccionar Direct?rio de Destino - Title Spanish=Seleccione el Directorio de Destino - Title Italian=Seleziona Directory di destinazione - Title Danish=V?lg Destinationsbibliotek - Title Dutch=Kies Doeldirectory - Title Norwegian=Velg m?lkatalog - Title Swedish=V?lj destinationskalatog - Width=276 - Height=216 - Font Name=Helv - Font Size=8 - item: Listbox - Rectangle=6 3 200 186 - Variable=BACKUP - Create Flags=01010000100000010000000101000000 - Flags=0000110000100010 - Text=%BACKUP% - Text= - Text French=%BACKUP% - Text French= - Text German=%BACKUP% - Text German= - Text Portuguese=%BACKUP% - Text Portuguese= - Text Spanish=%BACKUP% - Text Spanish= - Text Italian=%BACKUP% - Text Italian= - Text Danish=%BACKUP% - Text Danish= - Text Dutch=%BACKUP% - Text Dutch= - Text Norwegian=%BACKUP% - Text Norwegian= - Text Swedish=%BACKUP% - Text Swedish= - end - item: Push Button - Rectangle=209 8 265 26 - Create Flags=01010000000000010000000000000001 - Text=OK - Text French=OK - Text German=OK - Text Portuguese=OK - Text Spanish=ACEPTAR - Text Italian=OK - Text Danish=OK - Text Dutch=OK - Text Norwegian=OK - Text Swedish=OK - end - item: Push Button - Rectangle=209 31 265 50 - Variable=BACKUP - Value=%BACKUP_SAVE% - Create Flags=01010000000000010000000000000000 - Flags=0000000000000001 - Text=Cancel - Text French=Annuler - Text German=Abbrechen - Text Portuguese=Cancelar - Text Spanish=Cancelar - Text Italian=Annulla - Text Danish=Slet - Text Dutch=Annuleren - Text Norwegian=Avbryt - Text Swedish=Avbryt - end - end -end -item: Custom Dialog Set - Name=Select Components - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Push Button - Rectangle=131 234 188 253 - Variable=DIRECTION - Value=B - Create Flags=01010000000000010000000000000000 - Text=< &Back - Text French=< &Retour - Text German=< &Zur?ck - Text Spanish=< &Atr?s - Text Italian=< &Indietro - end - item: Push Button - Rectangle=264 234 320 253 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Checkbox - Rectangle=108 66 313 156 - Variable=COMPONENTS - Create Flags=01010000000000010000000000000011 - Flags=0000000000000110 - Text=Python interpreter and libraries - Text=Tcl/Tk (Tkinter, IDLE, pydoc) - Text=Python HTML docs - Text=Python utility scripts (Tools/) - Text=Python test suite (Lib/test/) - Text= - Text French=Python interpreter, library and IDLE - Text French=Python HTML docs - Text French=Python utility scripts (Tools/) - Text French=Python test suite (Lib/test/) - Text French= - Text German=Python interpreter, library and IDLE - Text German=Python HTML docs - Text German=Python utility scripts (Tools/) - Text German=Python test suite (Lib/test/) - Text German= - Text Spanish=Python interpreter, library and IDLE - Text Spanish=Python HTML docs - Text Spanish=Python utility scripts (Tools/) - Text Spanish=Python test suite (Lib/test/) - Text Spanish= - Text Italian=Python interpreter, library and IDLE - Text Italian=Python HTML docs - Text Italian=Python utility scripts (Tools/) - Text Italian=Python test suite (Lib/test/) - Text Italian= - end - item: Static - Rectangle=108 45 320 63 - Create Flags=01010000000000000000000000000000 - Text=Choose which components to install by checking the boxes below. - Text French=Choisissez les composants que vous voulez installer en cochant les cases ci-dessous. - Text German=W?hlen Sie die zu installierenden Komponenten, indem Sie in die entsprechenden K?stchen klicken. - Text Spanish=Elija los componentes que desee instalar marcando los cuadros de abajo. - Text Italian=Scegliere quali componenti installare selezionando le caselle sottostanti. - end - item: Push Button - Rectangle=188 203 269 220 - Destination Dialog=1 - Action=2 - Enabled Color=00000000000000000000000011111111 - Create Flags=01010000000000010000000000000000 - Text=Advanced Options ... - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 10 323 43 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Select Components - Text French=S?lectionner les composants - Text German=Komponenten ausw?hlen - Text Spanish=Seleccione componentes - Text Italian=Selezionare i componenti - end - item: Static - Rectangle=251 180 311 193 - Variable=COMPONENTS - Value=MAINDIR - Create Flags=01010000000000000000000000000010 - end - item: Static - Rectangle=251 168 311 179 - Variable=COMPONENTS - Create Flags=01010000000000000000000000000010 - end - item: Static - Rectangle=123 168 234 181 - Create Flags=01010000000000000000000000000000 - Text=Disk Space Required: - Text French=Espace disque requis : - Text German=Notwendiger Speicherplatz: - Text Spanish=Espacio requerido en el disco: - Text Italian=Spazio su disco necessario: - end - item: Static - Rectangle=123 180 234 193 - Create Flags=01010000000000000000000000000000 - Text=Disk Space Remaining: - Text French=Espace disque disponible : - Text German=Verbleibender Speicherplatz: - Text Spanish=Espacio en disco disponible: - Text Italian=Spazio su disco disponibile: - end - item: Static - Rectangle=108 158 320 196 - Action=1 - Create Flags=01010000000000000000000000000111 - end - item: If/While Statement - Variable=DLG_EVENT_TYPE - Value=VERIFY - end - item: Remark - Text=If they're installing Tcl/Tk, Tools, or the test suite, doesn't make much sense unless they're installing Python too. - end - item: If/While Statement - Variable=COMPONENTS - Value=BDE - Flags=00001010 - end - item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000011 - end - item: Display Message - Title=Are you sure? - Text=Installing Tcl/Tk, Tools or the test suite doesn't make much sense unless you install the Python interpreter and libraries too. - Text= - Text=Click Yes if that's really what you want. - Flags=00101101 - end - item: Remark - Text=Nothing -- just proceed to the next dialog. - end - item: Else Statement - end - item: Remark - Text=Return to the dialog. - end - item: Set Variable - Variable=DLG_EVENT_TYPE - end - item: End Block - end - item: End Block - end - item: End Block - end - item: End Block - end - end - item: Dialog - Title=Advanced Options - Width=339 - Height=213 - Font Name=Helv - Font Size=8 - item: Radio Button - Control Name=ADMIN2 - Rectangle=11 46 90 76 - Variable=SELECT_ADMIN - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000010000000000001001 - Text=Admin install - Text=Non-Admin installl - Text= - end - item: Push Button - Rectangle=188 170 244 189 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=OK - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Static - Rectangle=5 3 326 83 - Action=1 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000111 - end - item: Static - Control Name=ADMIN1 - Rectangle=11 11 321 45 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000000 - Text=By default, the install records settings in the per-machine area of the registry (HKLM), and installs the Python and C runtime DLLs to %SYS32%. Choose "Non-Admin install" if you would prefer settings made in the per-user registry (HKCU), and DLLs installed in %MAINDIR%. - end - item: Static - Rectangle=5 90 326 157 - Action=1 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000111 - end - item: Checkbox - Rectangle=11 121 243 151 - Variable=TASKS - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000010000000000000011 - Text=Register file extensions (.py, .pyw, .pyc, .pyo) - Text=Create Start Menu shortcuts - Text= - end - item: Static - Rectangle=11 103 320 121 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000000 - Text=Choose tasks to perform by checking the boxes below. - end - item: If/While Statement - Variable=DLG_EVENT_TYPE - Value=INIT - end - item: If/While Statement - Variable=DOADMIN - Value=1 - end - item: Set Control Attribute - Control Name=ADMIN2 - end - item: Else Statement - end - item: Set Control Text - Control Name=ADMIN1 - Control Text=This section is available only if logged in to an account with Administrator privileges. - end - item: Set Control Attribute - Control Name=ADMIN2 - Operation=1 - end - item: End Block - end - item: End Block - end - end -end -item: Custom Dialog Set - Name=Select Program Manager Group - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Push Button - Rectangle=131 234 188 253 - Variable=DIRECTION - Value=B - Create Flags=01010000000000010000000000000000 - Flags=0000000000000001 - Text=< &Back - Text French=< &Retour - Text German=< &Zur?ck - Text Spanish=< &Atr?s - Text Italian=< &Indietro - end - item: Push Button - Rectangle=264 234 320 253 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 10 323 53 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Select Start Menu Group - Text French=S?lectionner le groupe du Gestionnaire de programme - Text German=Bestimmung der Programm-Managergruppe - Text Spanish=Seleccione grupo del Administrador de programas - Text Italian=Selezionare il gruppo ProgMan - end - item: Static - Rectangle=108 35 320 65 - Create Flags=01010000000000000000000000000000 - Text=Enter the name of the Start Menu program group to which to add the %APPTITLE% icons: - Text French=Entrez le nom du groupe du Gestionnaire de programme dans lequel vous souhaitez ajouter les ic?nes de %APPTITLE% : - Text German=Geben Sie den Namen der Programmgruppe ein, der das Symbol %APPTITLE% hinzugef?gt werden soll: - Text Spanish=Escriba el nombre del grupo del Administrador de programas en el que desea agregar los iconos de %APPTITLE%: - Text Italian=Inserire il nome del gruppo Program Manager per aggiungere le icone %APPTITLE% a: - end - item: Combobox - Rectangle=108 56 320 219 - Variable=GROUP - Create Flags=01010000001000010000001100000001 - Flags=0000000000000001 - Text=%GROUP% - Text= - Text French=%GROUP% - Text German=%GROUP% - Text Spanish=%GROUP% - Text Italian=%GROUP% - end - end -end -item: Custom Dialog Set - Name=Start Installation - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Next > - Text French=&Suite > - Text German=&Weiter > - Text Spanish=&Siguiente > - Text Italian=&Avanti > - end - item: Push Button - Rectangle=131 234 188 253 - Variable=DIRECTION - Value=B - Create Flags=01010000000000010000000000000000 - Text=< &Back - Text French=< &Retour - Text German=< &Zur?ck - Text Spanish=< &Atr?s - Text Italian=< &Indietro - end - item: Push Button - Rectangle=264 234 320 253 - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=108 10 323 53 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Ready to Install! - Text French=Pr?t ? installer ! - Text German=Installationsbereit! - Text Spanish=?Preparado para la instalaci?n! - Text Italian=Pronto per l'installazione! - end - item: Static - Rectangle=108 40 320 62 - Create Flags=01010000000000000000000000000000 - Text=Click the Next button to install %APPTITLE%, or the Back button to change choices: - Text French=Vous ?tes maintenant pr?t ? installer les fichiers %APPTITLE%. - Text French= - Text French=Cliquez sur le bouton Suite pour commencer l'installation ou sur le bouton Retour pour entrer les informations d'installation ? nouveau. - Text German=Sie k?nnen %APPTITLE% nun installieren. - Text German= - Text German=Klicken Sie auf "Weiter", um mit der Installation zu beginnen. Klicken Sie auf "Zur?ck", um die Installationsinformationen neu einzugeben. - Text Spanish=Ya est? listo para instalar %APPTITLE%. - Text Spanish= - Text Spanish=Presione el bot?n Siguiente para comenzar la instalaci?n o presione Atr?s para volver a ingresar la informaci?n para la instalaci?n. - Text Italian=Ora ? possibile installare %APPTITLE%. - Text Italian= - Text Italian=Premere il pulsante Avanti per avviare l'installazione o il pulsante Indietro per reinserire le informazioni di installazione. - end - item: Editbox - Rectangle=108 66 324 219 - Help Context=16711681 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000100000000001100011000100 - Text=%SUMMARY% - end - end -end -item: Remark -end -item: If/While Statement - Variable=DISPLAY - Value=Select Destination Directory -end -item: Remark - Text=User may have changed MAINDIR, so reset BACKUP to match. -end -item: Set Variable - Variable=BACKUP - Value=%MAINDIR%\BACKUP -end -item: End Block -end -item: Remark -end -item: End Block -end -item: Remark -end -item: Remark - Text=BEGIN WIZARD STUFF ----------------------------------------------------------------------------------------------------------------------------- -end -item: Remark - Text=When the BACKUP feature is enabled, the BACKUPDIR is initialized -end -item: If/While Statement - Variable=DOBACKUP - Value=A -end -item: Set Variable - Variable=BACKUPDIR - Value=%BACKUP% -end -item: End Block -end -item: Remark - Text=The BRANDING information is written to the INI file on the installation media. -end -item: If/While Statement - Variable=BRANDING - Value=1 -end -item: If/While Statement - Variable=DOBRAND - Value=1 -end -item: Edit INI File - Pathname=%INST%\CUSTDATA.INI - Settings=[Registration] - Settings=NAME=%NAME% - Settings=COMPANY=%COMPANY% - Settings= -end -item: End Block -end -item: End Block -end -item: Remark - Text=Begin writing to the INSTALL.LOG -end -item: Open/Close INSTALL.LOG -end -item: Remark - Text=Check free disk space calculates free disk space as well as component sizes. -end -item: Remark - Text=It should be located before all Install File actions. -end -item: Check Disk Space - Component=COMPONENTS -end -item: Remark - Text=This include script allows uninstall support -end -item: Remark - Text=Note from Tim: this is our own Uninstal.wse, a copy of Wise's except -end -item: Remark - Text=it writes to HKCU (instead of HKLM) if the user doesn't have admin privs. -end -item: Include Script - Pathname=.\Uninstal.wse -end -item: Remark - Text=Note from Tim: these seeming no-ops actually convert to short filenames. -end -item: Set Variable - Variable=COMMON - Value=%COMMON% - Flags=00010100 -end -item: Set Variable - Variable=MAINDIR - Value=%MAINDIR% - Flags=00010100 -end -item: Remark - Text=This IF/THEN/ELSE reads the correct registry entries for shortcut/icon placement -end -item: Check Configuration - Flags=10111011 -end -item: Get Registry Key Value - Variable=STARTUPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%WIN%\Start Menu\Programs\StartUp - Value Name=StartUp - Flags=00000010 -end -item: Get Registry Key Value - Variable=DESKTOPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%WIN%\Desktop - Value Name=Desktop - Flags=00000010 -end -item: Get Registry Key Value - Variable=STARTMENUDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%WIN%\Start Menu - Value Name=Start Menu - Flags=00000010 -end -item: Get Registry Key Value - Variable=GROUPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%WIN%\Start Menu\Programs - Value Name=Programs - Flags=00000010 -end -item: Get Registry Key Value - Variable=CSTARTUPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%STARTUPDIR% - Value Name=Common Startup - Flags=00000100 -end -item: Get Registry Key Value - Variable=CDESKTOPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%DESKTOPDIR% - Value Name=Common Desktop - Flags=00000100 -end -item: Get Registry Key Value - Variable=CSTARTMENUDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%STARTMENUDIR% - Value Name=Common Start Menu - Flags=00000100 -end -item: Get Registry Key Value - Variable=CGROUPDIR - Key=Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - Default=%GROUPDIR% - Value Name=Common Programs - Flags=00000100 -end -item: Else Statement -end -item: Remark - Text=Note from Tim: the Wizard left this block empty! -end -item: Remark - Text=Perhaps it's only relevant on Windows 3.1. -end -item: End Block -end -item: Remark - Text=END WIZARD STUFF ----------------------------------------------------------------------------------------------------------------------------- -end -item: Remark -end -item: If/While Statement - Variable=SELECT_ADMIN - Value=B -end -item: Remark - Text=The user chose a non-admin install in "Advanced Options". -end -item: Remark - Text=This should come after the include of Uninstal.wse above, because -end -item: Remark - Text=writing uninstall info to HKCU is ineffective except under Win2K. -end -item: Set Variable - Variable=DOADMIN - Value=0 -end -item: End Block -end -item: Remark -end -item: Set Variable - Variable=CGROUP_SAVE - Value=%GROUP% -end -item: If/While Statement - Variable=TASKS - Value=B - Flags=00000010 -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Set Variable - Variable=GROUP - Value=%CGROUPDIR%\%GROUP% -end -item: Else Statement -end -item: Set Variable - Variable=GROUP - Value=%GROUPDIR%\%GROUP% -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=Long section to install files. -end -item: Remark -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Set Variable - Variable=DLLDEST - Value=%SYS32% -end -item: Else Statement -end -item: Set Variable - Variable=DLLDEST - Value=%MAINDIR% -end -item: End Block -end -item: Remark -end -item: Remark - Text=Install the license even if they deselect everything . -end -item: Install File - Source=..\license - Destination=%MAINDIR%\LICENSE.txt - Flags=0000000000000010 -end -item: Install File - Source=..\readme - Destination=%MAINDIR%\README.txt - Flags=0000000000000010 -end -item: Install File - Source=..\misc\news - Destination=%MAINDIR%\NEWS.txt - Flags=0000000000000010 -end -item: Remark - Text=Icons -- always install so that the uninstaller can use them for its own display. -end -item: Install File - Source=..\pc\pycon.ico - Destination=%MAINDIR%\pycon.ico - Flags=0000000010000010 -end -item: Install File - Source=..\pc\pyc.ico - Destination=%MAINDIR%\pyc.ico - Flags=0000000010000010 -end -item: Install File - Source=..\pc\py.ico - Destination=%MAINDIR%\py.ico - Flags=0000000010000010 -end -item: Remark -end -item: Remark - Text=These arrange to (recursively!) delete all .pyc and .pyo files at uninstall time. -end -item: Remark - Text=This "does the right thing": any directories left empty at the end are removed. -end -item: Add Text to INSTALL.LOG - Text=File Tree: %MAINDIR%\*.pyc -end -item: Add Text to INSTALL.LOG - Text=File Tree: %MAINDIR%\*.pyo -end -item: Remark -end -item: Remark - Text=A: interpreter and libraries -end -item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000010 -end -item: Remark - Text=Executables -end -item: Install File - Source=.\python.exe - Destination=%MAINDIR%\python.exe - Flags=0000000000000010 -end -item: Install File - Source=.\pythonw.exe - Destination=%MAINDIR%\pythonw.exe - Flags=0000000000000010 -end -item: Install File - Source=.\w9xpopen.exe - Destination=%MAINDIR%\w9xpopen.exe - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Extension module DLLs (.pyd); keep in synch with libs directory next -end -item: Install File - Source=.\_winreg.pyd - Destination=%MAINDIR%\DLLs\_winreg.pyd - Description=Extension modules - Flags=0000000000000010 -end -item: Install File - Source=.\_csv.pyd - Destination=%MAINDIR%\DLLs\_csv.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_sre.pyd - Destination=%MAINDIR%\DLLs\_sre.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_ssl.pyd - Destination=%MAINDIR%\DLLs\_ssl.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_symtable.pyd - Destination=%MAINDIR%\DLLs\_symtable.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_testcapi.pyd - Destination=%MAINDIR%\DLLs\_testcapi.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_tkinter.pyd - Destination=%MAINDIR%\DLLs\_tkinter.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_socket.pyd - Destination=%MAINDIR%\DLLs\_socket.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\_bsddb.pyd - Destination=%MAINDIR%\DLLs\_bsddb.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\bz2.pyd - Destination=%MAINDIR%\DLLs\bz2.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\datetime.pyd - Destination=%MAINDIR%\DLLs\datetime.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\mmap.pyd - Destination=%MAINDIR%\DLLs\mmap.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\parser.pyd - Destination=%MAINDIR%\DLLs\parser.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\pyexpat.pyd - Destination=%MAINDIR%\DLLs\pyexpat.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\select.pyd - Destination=%MAINDIR%\DLLs\select.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\unicodedata.pyd - Destination=%MAINDIR%\DLLs\unicodedata.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\winsound.pyd - Destination=%MAINDIR%\DLLs\winsound.pyd - Flags=0000000000000010 -end -item: Install File - Source=.\zlib.pyd - Destination=%MAINDIR%\DLLs\zlib.pyd - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Link libraries (.lib); keep in synch with DLLs above, except that the Python lib lives here. -end -item: Install File - Source=.\_winreg.lib - Destination=%MAINDIR%\libs\_winreg.lib - Description=Link library files - Flags=0000000000000010 -end -item: Install File - Source=.\_csv.lib - Destination=%MAINDIR%\libs\_csv.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_sre.lib - Destination=%MAINDIR%\libs\_sre.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_ssl.lib - Destination=%MAINDIR%\libs\_ssl.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_symtable.lib - Destination=%MAINDIR%\libs\_symtable.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_testcapi.lib - Destination=%MAINDIR%\libs\_testcapi.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_tkinter.lib - Destination=%MAINDIR%\libs\_tkinter.lib - Description=Extension modules - Flags=0000000000000010 -end -item: Install File - Source=.\_socket.lib - Destination=%MAINDIR%\libs\_socket.lib - Flags=0000000000000010 -end -item: Install File - Source=.\_bsddb.lib - Destination=%MAINDIR%\libs\_bsddb.lib - Flags=0000000000000010 -end -item: Install File - Source=.\bz2.lib - Destination=%MAINDIR%\libs\bz2.lib - Flags=0000000000000010 -end -item: Install File - Source=.\datetime.lib - Destination=%MAINDIR%\libs\datetime.lib - Flags=0000000000000010 -end -item: Install File - Source=.\mmap.lib - Destination=%MAINDIR%\libs\mmap.lib - Flags=0000000000000010 -end -item: Install File - Source=.\parser.lib - Destination=%MAINDIR%\libs\parser.lib - Flags=0000000000000010 -end -item: Install File - Source=.\pyexpat.lib - Destination=%MAINDIR%\libs\pyexpat.lib - Flags=0000000000000010 -end -item: Install File - Source=.\select.lib - Destination=%MAINDIR%\libs\select.lib - Flags=0000000000000010 -end -item: Install File - Source=.\unicodedata.lib - Destination=%MAINDIR%\libs\unicodedata.lib - Flags=0000000000000010 -end -item: Install File - Source=.\winsound.lib - Destination=%MAINDIR%\libs\winsound.lib - Flags=0000000000000010 -end -item: Install File - Source=.\zlib.lib - Destination=%MAINDIR%\libs\zlib.lib - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=.\python%_pymajor_%%_pyminor_%.lib - Destination=%MAINDIR%\libs\python%_PYMAJOR_%%_PYMINOR_%.lib - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Main Python DLL -end -item: Remark - Text=Tell Wise it's OK to delete the Python DLL at uninstall time, -end -item: Remark - Text=despite that we (may) write it into a system directory. -end -item: Add Text to INSTALL.LOG - Text=Non-System File: -end -item: Install File - Source=.\python%_pymajor_%%_pyminor_%.dll - Destination=%DLLDEST%\python%_PYMAJOR_%%_PYMINOR_%.dll - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Libraries (Lib/) -end -item: Install File - Source=..\lib\*.py - Destination=%MAINDIR%\Lib - Description=Library Modules - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\bsddb\*.py - Destination=%MAINDIR%\Lib\bsddb - Description=Berkeley database package - Flags=0000000100000010 -end -item: Remark -end -item: Install File - Source=..\lib\compiler\*.py - Destination=%MAINDIR%\Lib\compiler - Description=Python compiler written in Python - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\distutils\*.py - Destination=%MAINDIR%\Lib\distutils - Description=Distribution utility modules - Flags=0000000000000010 -end -item: Install File - Source=..\lib\distutils\readme - Destination=%MAINDIR%\Lib\distutils\README.txt - Flags=0000000000000010 -end -item: Install File - Source=..\lib\distutils\command\*.py - Destination=%MAINDIR%\Lib\distutils\command - Flags=0000000000000010 -end -item: Install File - Source=..\lib\distutils\command\wininst.exe - Destination=%MAINDIR%\Lib\distutils\command\wininst.exe - Flags=0000000000000010 -end -item: Install File - Source=..\lib\distutils\command\command_template - Destination=%MAINDIR%\Lib\distutils\command\command_template - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\email\*.py - Destination=%MAINDIR%\Lib\email - Description=Library email package - Flags=0000000000000010 -end -item: Install File - Source=..\lib\email\test\*.py - Destination=%MAINDIR%\Lib\email\test - Description=email tests - Flags=0000000000000010 -end -item: Install File - Source=..\lib\email\test\data\*.txt - Destination=%MAINDIR%\Lib\email\test\data - Description=email test data - Flags=0000000000000010 -end -item: Install File - Source=..\lib\email\test\data\*.gif - Destination=%MAINDIR%\Lib\email\test\data - Description=email test data - Flags=0000000000000010 -end -item: Install File - Source=..\lib\email\test\data\*.au - Destination=%MAINDIR%\Lib\email\test\data - Description=email test data - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\encodings\*.py - Destination=%MAINDIR%\Lib\encodings - Description=Unicode encoding tables - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\hotshot\*.py - Destination=%MAINDIR%\Lib\hotshot - Description=Fast Python profiler - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\lib-old\*.py - Destination=%MAINDIR%\Lib\lib-old - Description=Obsolete modules - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\lib-tk\*.py - Destination=%MAINDIR%\Lib\lib-tk - Description=Tkinter related library modules - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\logging\*.py - Destination=%MAINDIR%\Lib\logging - Description=Logging package - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\site-packages\readme - Destination=%MAINDIR%\Lib\site-packages\README.txt - Description=Site packages - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\xml\*.py - Destination=%MAINDIR%\Lib\xml - Description=XML support packages - Flags=0000000000000010 -end -item: Install File - Source=..\lib\xml\dom\*.py - Destination=%MAINDIR%\Lib\xml\dom - Flags=0000000000000010 -end -item: Install File - Source=..\lib\xml\parsers\*.py - Destination=%MAINDIR%\Lib\xml\parsers - Flags=0000000000000010 -end -item: Install File - Source=..\lib\xml\sax\*.py - Destination=%MAINDIR%\Lib\xml\sax - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=C Include files -end -item: Install File - Source=..\include\*.h - Destination=%MAINDIR%\include - Description=Header files - Flags=0000000000000010 -end -item: Install File - Source=..\pc\pyconfig.h - Destination=%MAINDIR%\include\pyconfig.h - Description=Header files (pyconfig.h) - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Microsoft C runtime libraries -end -item: Install File - Source=%_SYS_%\MSVCIRT.DLL - Destination=%DLLDEST%\MSVCIRT.DLL - Description=Visual C++ Runtime DLLs - Flags=0000011000010011 -end -item: Install File - Source=%_SYS_%\MSVCRT.DLL - Destination=%DLLDEST%\MSVCRT.DLL - Description=Visual C++ Runtime DLLs - Flags=0000011000010011 -end -item: End Block -end -item: Remark -end -item: Remark - Text=B: Tcl/Tk (Tkinter, IDLE, pydoc) -end -item: If/While Statement - Variable=COMPONENTS - Value=B - Flags=00000010 -end -item: Remark - Text=Tcl/Tk -end -item: Install File - Source=..\..\%_tcldir_%\bin\*.dll - Destination=%MAINDIR%\DLLs - Description=Tcl/Tk binaries and libraries - Flags=0000000000000010 -end -item: Install File - Source=..\..\%_tcldir_%\lib\*.* - Destination=%MAINDIR%\tcl - Description=Tcl/Tk binaries and libraries - Flags=0000000100000010 -end -item: Remark -end -item: Remark - Text=IDLE -end -item: Install File - Source=..\Lib\idlelib\*.py - Destination=%MAINDIR%\Lib\idlelib - Description=Integrated DeveLopment Environment for Python - Flags=0000000000000010 -end -item: Install File - Source=..\Lib\idlelib\*.txt - Destination=%MAINDIR%\Lib\idlelib - Description=Integrated DeveLopment Environment for Python - Flags=0000000000000010 -end -item: Install File - Source=..\Lib\idlelib\*.def - Destination=%MAINDIR%\Lib\idlelib - Description=Integrated DeveLopment Environment for Python - Flags=0000000000000010 -end -item: Install File - Source=..\Lib\idlelib\Icons\* - Destination=%MAINDIR%\Lib\idlelib\Icons - Description=Integrated DeveLopment Environment for Python - Flags=0000000000000010 -end -item: Install File - Source=..\Tools\scripts\idle - Destination=%MAINDIR%\Lib\idlelib\idle.pyw - Description=IDLE bootstrap script - Flags=0000000000000010 -end -item: Remark -end -item: Remark - Text=Windows pydoc driver -end -item: Install File - Source=..\tools\scripts\*.pyw - Destination=%MAINDIR%\Tools\Scripts - Description=Windows pydoc driver - Flags=0000000000000010 -end -item: End Block -end -item: Remark -end -item: Remark - Text=C: docs -end -item: If/While Statement - Variable=COMPONENTS - Value=C - Flags=00000010 -end -item: Install File - Source=%_DOC_%\*.* - Destination=%MAINDIR%\Doc - Description=Python Documentation (HTML) - Flags=0000000100000010 -end -item: End Block -end -item: Remark -end -item: Remark - Text=D: tools -end -item: If/While Statement - Variable=COMPONENTS - Value=D - Flags=00000010 -end -item: Install File - Source=..\tools\scripts\*.py - Destination=%MAINDIR%\Tools\Scripts - Description=Utility Scripts - Flags=0000000000000010 -end -item: Install File - Source=..\tools\scripts\*.doc - Destination=%MAINDIR%\Tools\Scripts - Description=Utility Scripts - Flags=0000000000000010 -end -item: Install File - Source=..\tools\scripts\readme - Destination=%MAINDIR%\Tools\Scripts\README.txt - Description=Utility Scripts - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\tools\webchecker\*.py - Destination=%MAINDIR%\Tools\webchecker - Description=Web checker tool - Flags=0000000000000010 -end -item: Install File - Source=..\tools\webchecker\readme - Destination=%MAINDIR%\Tools\webchecker\README.txt - Description=Web checker tool - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\tools\versioncheck\*.py - Destination=%MAINDIR%\Tools\versioncheck - Description=Version checker tool - Flags=0000000000000010 -end -item: Install File - Source=..\tools\versioncheck\readme - Destination=%MAINDIR%\Tools\versioncheck\README.txt - Description=Version checker tool - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\tools\pynche\*.py - Destination=%MAINDIR%\Tools\pynche - Description=pynche color editor - Flags=0000000000000010 -end -item: Install File - Source=..\tools\pynche\*.txt - Destination=%MAINDIR%\Tools\pynche - Description=pynche color editor - Flags=0000000000000010 -end -item: Install File - Source=..\tools\pynche\x\*.txt - Destination=%MAINDIR%\Tools\pynche\X - Description=pynche color editor - X files - Flags=0000000000000010 -end -item: Install File - Source=..\tools\pynche\readme - Destination=%MAINDIR%\Tools\pynche\README.txt - Description=pynche color editor - README - Flags=0000000100000010 -end -item: Install File - Source=..\tools\pynche\pynche - Destination=%MAINDIR%\Tools\pynche\pynche.py - Description=pynche color editor - main - Flags=0000000100000010 -end -item: Install File - Source=..\tools\pynche\pynche.pyw - Destination=%MAINDIR%\Tools\pynche\pynche.pyw - Description=pynche color editor - noconsole main - Flags=0000000100000010 -end -item: Remark -end -item: Install File - Source=..\tools\i18n\*.py - Destination=%MAINDIR%\Tools\i18n - Description=Internationalization helpers - Flags=0000000000000010 -end -item: End Block -end -item: Remark -end -item: Remark - Text=E: test suite -end -item: If/While Statement - Variable=COMPONENTS - Value=E - Flags=00000010 -end -item: Install File - Source=..\lib\test\audiotest.au - Destination=%MAINDIR%\Lib\test\audiotest.au - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.uue - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.py - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.xml - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.out - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.bz2 - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.tar - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.gz - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Install File - Source=..\lib\test\*.txt - Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 -end -item: Remark -end -item: Install File - Source=..\lib\test\output\*.* - Destination=%MAINDIR%\Lib\test\output - Description=Python Test output files - Flags=0000000000000010 -end -item: End Block -end -item: Remark -end -item: Remark - Text=DONE with file copying. -end -item: Remark - Text=The rest is registry and Start Menu fiddling. -end -item: Remark -end -item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000010 -end -item: If/While Statement - Variable=TASKS - Value=A - Flags=00000010 -end -item: Remark - Text=Register file extensions. As usual, Admin privs get in the way, but with a twist: -end -item: Remark - Text=You don't need admin privs to write to HKEY_CLASSES_ROOT *except* under Win2K. -end -item: Remark - Text=On Win2K, a user without Admin privs has to register extensions under HKCU\Software\CLASSES instead. -end -item: Remark - Text=But while you can *do* that under other flavors of Windows too, it has no useful effect except in Win2K. -end -item: Set Variable - Variable=USE_HKCR - Value=1 -end -item: Check Configuration - Flags=11110010 -end -item: If/While Statement - Variable=DOADMIN - Value=0 -end -item: Set Variable - Variable=USE_HKCR - Value=0 -end -item: End Block -end -item: End Block -end -item: If/While Statement - Variable=USE_HKCR - Value=1 -end -item: Remark - Text=File types. -end -item: Edit Registry - Total Keys=1 - Key=Python.File - New Value=Python File -end -item: Edit Registry - Total Keys=1 - Key=Python.File\shell\open\command - New Value=%MAINDIR%\python.exe "%%1" %%* -end -item: Edit Registry - Total Keys=1 - Key=Python.File\DefaultIcon - New Value=%MAINDIR%\Py.ico -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Python.NoConFile - New Value=Python File (no console) -end -item: Edit Registry - Total Keys=1 - Key=Python.NoConFile\shell\open\command - New Value=%MAINDIR%\pythonw.exe "%%1" %%* -end -item: Edit Registry - Total Keys=1 - Key=Python.NoConFile\DefaultIcon - New Value=%MAINDIR%\Py.ico -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Python.CompiledFile - New Value=Compiled Python File -end -item: Edit Registry - Total Keys=1 - Key=Python.CompiledFile\shell\open\command - New Value=%MAINDIR%\python.exe "%%1" %%* -end -item: Edit Registry - Total Keys=1 - Key=Python.CompiledFile\DefaultIcon - New Value=%MAINDIR%\pyc.ico -end -item: Remark -end -item: Remark - Text=File extensions. -end -item: Edit Registry - Total Keys=1 - Key=.py - New Value=Python.File -end -item: Edit Registry - Total Keys=1 - Key=.py - New Value=text/plain - Value Name=Content Type -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=.pyw - New Value=Python.NoConFile -end -item: Edit Registry - Total Keys=1 - Key=.pyw - New Value=text/plain - Value Name=Content Type -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=.pyc - New Value=Python.CompiledFile -end -item: Edit Registry - Total Keys=1 - Key=.pyo - New Value=Python.CompiledFile -end -item: Else Statement -end -item: Remark - Text=File types. -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.File - New Value=Python File - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.File\shell\open\command - New Value=%MAINDIR%\python.exe "%%1" %%* - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.File\DefaultIcon - New Value=%MAINDIR%\Py.ico - Root=1 -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.NoConFile - New Value=Python File (no console) - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.NoConFile\shell\open\command - New Value=%MAINDIR%\pythonw.exe "%%1" %%* - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.NoConFile\DefaultIcon - New Value=%MAINDIR%\Py.ico - Root=1 -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.CompiledFile - New Value=Compiled Python File - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.CompiledFile\shell\open\command - New Value=%MAINDIR%\python.exe "%%1" %%* - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.CompiledFile\DefaultIcon - New Value=%MAINDIR%\pyc.ico - Root=1 -end -item: Remark -end -item: Remark - Text=File extensions. -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.py - New Value=Python.File - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.py - New Value=text/plain - Value Name=Content Type - Root=1 -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.pyw - New Value=Python.NoConFile - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.pyw - New Value=text/plain - Value Name=Content Type - Root=1 -end -item: Remark -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.pyc - New Value=Python.CompiledFile - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\.pyo - New Value=Python.CompiledFile - Root=1 -end -item: End Block -end -item: Remark -end -item: Remark - Text=If we're installing IDLE, also set an Edit context menu action to use IDLE, for .py and .pyw files. -end -item: If/While Statement - Variable=COMPONENTS - Value=B - Flags=00000010 -end -item: If/While Statement - Variable=USE_HKCR - Value=1 -end -item: Edit Registry - Total Keys=1 - Key=Python.NoConFile\shell\Edit with IDLE\command - New Value=%MAINDIR%\pythonw.exe %MAINDIR%\Lib\idlelib\idle.pyw -n -e "%%1" -end -item: Edit Registry - Total Keys=1 - Key=Python.File\shell\Edit with IDLE\command - New Value=%MAINDIR%\pythonw.exe %MAINDIR%\Lib\idlelib\idle.pyw -n -e "%%1" -end -item: Else Statement -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.NoConFile\shell\Edit with IDLE\command - New Value=%MAINDIR%\pythonw.exe %MAINDIR%\Lib\idlelib\idle.pyw -n -e "%%1" - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\CLASSES\Python.File\shell\Edit with IDLE\command - New Value=%MAINDIR%\pythonw.exe %MAINDIR%\Lib\idlelib\idle.pyw -n -e "%%1" - Root=1 -end -item: End Block -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=Register Python paths. -end -item: Remark - Text=Write to HKLM for admin, else HKCU. Keep these blocks otherwise identical! -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\CurrentVersion - Root=130 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\InstallPath - New Value=%MAINDIR% - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\InstallPath\InstallGroup - New Value=%CGROUP_SAVE% - New Value= - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\PythonPath - New Value=%MAINDIR%\Lib;%MAINDIR%\DLLs;%MAINDIR%\Lib\lib-tk - New Value= - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\Modules - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe - New Value=%MAINDIR%\Python.exe - Root=2 -end -item: Else Statement -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\CurrentVersion - Root=129 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\InstallPath - New Value=%MAINDIR% - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\InstallPath\InstallGroup - New Value=%CGROUP_SAVE% - New Value= - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\PythonPath - New Value=%MAINDIR%\Lib;%MAINDIR%\DLLs;%MAINDIR%\Lib\lib-tk - New Value= - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\Modules - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe - New Value=%MAINDIR%\Python.exe - Root=1 -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=Registry fiddling for docs. -end -item: Remark - Text=Write to HKLM for admin, else HKCU. Keep these blocks otherwise identical! -end -item: If/While Statement - Variable=COMPONENTS - Value=C - Flags=00000010 -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\Help\Main Python Documentation - New Value=%MAINDIR%\Doc\index.html - Root=2 -end -item: Else Statement -end -item: Edit Registry - Total Keys=1 - Key=Software\Python\PythonCore\%PY_VERSION%\Help\Main Python Documentation - New Value=%MAINDIR%\Doc\index.html - Root=1 -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=Set the app publisher and URL entries for Win2K add/remove. -end -item: Remark - Text=It doesn't hurt on other systems. -end -item: Remark - Text=As usual, write to HKLM or HKCU depending on Admin privs. -end -item: Remark - Text=CAUTION: If you set this info on the "Windows 2000" page (step 6) of the -end -item: Remark - Text=Installation Expert, it only shows up in the "If" block below. Keep in synch! -end -item: If/While Statement - Variable=DOADMIN - Value=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=http://www.python.org/ - Value Name=HelpLink - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=PythonLabs at Zope Corporation - Value Name=Publisher - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=http://www.python.org/ - Value Name=URLInfoAbout - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%PYVER_STRING% - Value Name=DisplayVersion - Root=2 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%MAINDIR%\py.ico,-0 - Value Name=DisplayIcon - Root=2 -end -item: Else Statement -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=http://www.python.org/ - Value Name=HelpLink - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=PythonLabs at Zope Corporation - Value Name=Publisher - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=http://www.python.org/ - Value Name=URLInfoAbout - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%PYVER_STRING% - Value Name=DisplayVersion - Root=1 -end -item: Edit Registry - Total Keys=1 - Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\%APPTITLE% - New Value=%MAINDIR%\py.ico,-0 - Value Name=DisplayIcon - Root=1 -end -item: End Block -end -item: Remark -end -item: Remark - Text=Populate Start Menu group -end -item: If/While Statement - Variable=TASKS - Value=B - Flags=00000010 -end -item: Remark - Text=Shortcut to installer no matter what. -end -item: Create Shortcut - Source=%MAINDIR%\unwise.exe - Destination=%GROUP%\Uninstall Python.lnk - Working Directory=%MAINDIR% - Key Type=1536 - Flags=00000001 -end -item: Remark -end -item: If/While Statement - Variable=COMPONENTS - Value=A - Flags=00000010 -end -item: Create Shortcut - Source=%MAINDIR%\python.exe - Destination=%GROUP%\Python (command line).lnk - Working Directory=%MAINDIR% - Icon Pathname=%MAINDIR%\pycon.ico - Key Type=1536 - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=COMPONENTS - Value=B - Flags=00000010 -end -item: Create Shortcut - Source=%MAINDIR%\pythonw.exe - Destination=%GROUP%\IDLE (Python GUI).lnk - Command Options="%MAINDIR%\Lib\idlelib\idle.pyw" - Working Directory=%MAINDIR% - Key Type=1536 - Flags=00000001 -end -item: Create Shortcut - Source=%MAINDIR%\pythonw.exe - Destination=%GROUP%\Module Docs.lnk - Command Options="%MAINDIR%\Tools\Scripts\pydocgui.pyw" - Working Directory=%MAINDIR% - Key Type=1536 - Flags=00000001 -end -item: End Block -end -item: Remark -end -item: If/While Statement - Variable=COMPONENTS - Value=C - Flags=00000010 -end -item: Create Shortcut - Source=%MAINDIR%\Doc\index.html - Destination=%GROUP%\Python Manuals.lnk - Working Directory=%MAINDIR% - Key Type=1536 - Flags=00000001 -end -item: End Block -end -item: End Block -end -item: Remark -end -item: Remark - Text=I don't think we need this, but have always done it. -end -item: Self-Register OCXs/DLLs - Description=Updating System Configuration, Please Wait... -end -item: Remark -end -remarked item: Remark - Text=Don't enable "Delete in-use files". Here's what happens: -end -remarked item: Remark - Text=Install Python; uninstall Python; install Python again. Reboot the machine. -end -remarked item: Remark - Text=Now UNWISE.EXE is missing. I think this is a Wise bug, but so it goes. -end -remarked item: Add Text to INSTALL.LOG - Text=Delete in-use files: On -end -item: Remark -end -item: Wizard Block - Direction Variable=DIRECTION - Display Variable=DISPLAY - Bitmap Pathname=.\installer.bmp - X Position=9 - Y Position=10 - Filler Color=11173759 - Flags=00000011 -end -item: Custom Dialog Set - Name=Finished - Display Variable=DISPLAY - item: Dialog - Title=%APPTITLE% Installation - Title French=Installation de %APPTITLE% - Title German=Installation von %APPTITLE% - Title Spanish=Instalaci?n de %APPTITLE% - Title Italian=Installazione di %APPTITLE% - Width=339 - Height=280 - Font Name=Helv - Font Size=8 - item: Push Button - Rectangle=188 234 244 253 - Variable=DIRECTION - Value=N - Create Flags=01010000000000010000000000000001 - Text=&Finish - Text French=&Fin - Text German=&Weiter - Text Spanish=&Terminar - Text Italian=&Fine - end - item: Push Button - Rectangle=264 234 320 253 - Variable=DISABLED - Value=! - Action=3 - Create Flags=01010000000000010000000000000000 - Text=&Cancel - Text French=&Annuler - Text German=&Abbrechen - Text Spanish=&Cancelar - Text Italian=&Annulla - end - item: Static - Rectangle=108 10 323 48 - Create Flags=01010000000000000000000000000000 - Flags=0000000000000001 - Name=Times New Roman - Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 - Text=Installation Completed! - Text French=Installation termin?e ! - Text German=Die Installation ist abgeschlossen! - Text Spanish=?Instalaci?n terminada! - Text Italian=Installazione completata! - end - item: Static - Rectangle=108 44 320 82 - Create Flags=01010000000000000000000000000000 - Text=%APPTITLE% has been successfully installed. - Text= - Text=Press the Finish button to exit this installation. - Text French=%APPTITLE% est maintenant install?. - Text French= - Text French=Cliquez sur le bouton Fin pour quitter l'installation. - Text German=%APPTITLE% wurde erfolgreich installiert. - Text German= - Text German=Klicken Sie auf "Weiter", um die Installation zu beenden. - Text Spanish=%APPTITLE% se ha instalado con ?xito. - Text Spanish= - Text Spanish=Presione el bot?n Terminar para salir de esta instalaci?n. - Text Italian=L'installazione %APPTITLE% ? stata portata a termine con successo. - Text Italian= - Text Italian=Premere il pulsante Fine per uscire dall'installazione. - end - item: Static - Rectangle=10 225 320 226 - Action=3 - Create Flags=01010000000000000000000000000111 - end - item: Static - Rectangle=106 105 312 210 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000000000 - Text=Special Windows thanks to: - Text= - Text=Wise Solutions, for the use of InstallMaster 8.1. - Text= http://www.wisesolutions.com/ - Text= - Text= - Text=LettError, Erik van Blokland, for the Python for Windows graphic. - Text= http://www.letterror.com/ - Text= - Text= - Text=Mark Hammond, without whose years of freely shared Windows expertise, Python for Windows would still be Python for DOS. - end - item: Static - Rectangle=106 95 312 96 - Action=3 - Enabled Color=00000000000000001111111111111111 - Create Flags=01010000000000000000000000001001 - end - end -end -item: End Block -end -item: New Event - Name=Cancel -end -item: Remark - Text=This include script supports a rollback to preinstallation state if the user chooses to cancel before the installation is complete. -end -item: Include Script - Pathname=%_WISE_%\INCLUDE\rollback.wse -end Deleted: /python/branches/bcannon-objcap/PCbuild8/pythoncore.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/pythoncore.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,1946 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/pythonw.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/pythonw.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,383 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: python/branches/bcannon-objcap/PCbuild8/readme.txt ============================================================================== --- python/branches/bcannon-objcap/PCbuild8/readme.txt (original) +++ python/branches/bcannon-objcap/PCbuild8/readme.txt Fri May 25 22:13:08 2007 @@ -2,44 +2,66 @@ ------------------------------------- This directory is used to build Python for Win32 platforms, e.g. Windows 95, 98 and NT. It requires Microsoft Visual C++ 8.0 -(a.k.a. Visual Studio 2005). +(a.k.a. Visual Studio 2005). There are two Platforms defined, Win32 +and x64. (For other Windows platforms and compilers, see ../PC/readme.txt.) All you need to do is open the workspace "pcbuild.sln" in MSVC++, select the Debug or Release setting (using "Solution Configuration" from -the "Standard" toolbar"), and build the projects. +the "Standard" toolbar"), and build the solution. -The proper order to build subprojects: +A .bat file, build.bat, is provided to simplify command line builds. -1) pythoncore (this builds the main Python DLL and library files, - python26.{dll, lib} in Release mode) - NOTE: in previous releases, this subproject was - named after the release number, e.g. python20. - -2) python (this builds the main Python executable, - python.exe in Release mode) - -3) the other subprojects, as desired or needed (note: you probably don't - want to build most of the other subprojects, unless you're building an - entire Python distribution from scratch, or specifically making changes - to the subsystems they implement, or are running a Python core buildbot - test slave; see SUBPROJECTS below) +Some of the subprojects rely on external libraries and won't build +unless you have them installed. -Binary files go into PCBuild8\Win32 or \x64 directories and don't -interfere with each other. +Binary files go into PCBuild8\$(PlatformName)($ConfigurationName), +which will be something like Win32Debug, Win32Release, x64Release, etc. When using the Debug setting, the output files have a _d added to their name: python26_d.dll, python_d.exe, parser_d.pyd, and so on. -There are two special configurations for the pythoncore project and -the solution. These are PGIRelease and PGORelease. They are for -createing profile-guided optimized versions of python.dll. -The former creates the instrumented binaries, and the latter -runs python.exe with the instrumented python.dll on the performance -testsuite, and creates a new, optimized, python.dll in -PCBuild8\Win32\PGORelease, or in the x64 folder. Note that although -we can cross-compile x64 binaries on a 32 bit machine, we cannot -create the PGO binaries, since they require actually running the code. +PROFILER GUIDED OPTIMIZATION +---------------------------- +There are two special solution configurations for Profiler Guided +Optimization. Careful use of this has been shown to yield more than +10% extra speed. +1) Build the PGInstrument solution configuration. This will yield +binaries in the win32PGO or x64PGO folders. (You may want do start +by erasing any .pgc files there, present from earlier runs.) +2) Instrument the binaries. Do this by for example running the test +suite: win32PGO\python.exe ..\lib\test\regrtest.py. This will excercise +python thoroughly. +3) Build the PGUpdate solution configuration (You may need to ask it +to rebuild.) This will incorporate the information gathered in step 2 +and produce new binaries in the same win32PGO or x64pPGO folders. +4) (optional) You can continue to build the PGUpdate configuration as +you work on python. It will continue to use the data from step 2, even +if you add or modify files as part of your work. Thus, it makes sense to +run steps 1 and 2 maybe once a week, and then use step 3) for all regular +work. + +A .bat file, build_pgo.bat is included to automate this process + +You can convince yourself of the benefits of the PGO by comparing the +results of the python testsuite with the regular Release build. + + +C RUNTIME +--------- +Visual Studio 2005 uses version 8 of the C runtime. The executables are +linked to a CRT "side by side" assembly which must be present on the target +machine. This is avalible under the VC/Redist folder of your visual studio +distribution. Note that ServicePack1 of Visual Studio 2005 has a different +version than the original. On XP and later operating systems that support +side-by-side assemblies it is not enough to have the msvcrt80.dll present, +it has to be there as a whole assembly, that is, a folder with the .dll +and a .manifest. Also, a check is made for the correct version. +Therefore, one should distribute this assembly with the dlls, and keep +it in the same directory. For compatibility with older systems, one should +also set the PATH to this directory so that the dll can be found. +For more info, see the Readme in the VC/Redist folder. + SUBPROJECTS ----------- @@ -267,164 +289,22 @@ build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do this by hand. -Building for Itanium --------------------- - -The project files support a ReleaseItanium configuration which creates -Win64/Itanium binaries. For this to work, you need to install the Platform -SDK, in particular the 64-bit support. This includes an Itanium compiler -(future releases of the SDK likely include an AMD64 compiler as well). -In addition, you need the Visual Studio plugin for external C compilers, -from http://sf.net/projects/vsextcomp. The plugin will wrap cl.exe, to -locate the proper target compiler, and convert compiler options -accordingly. The project files require atleast version 0.8. Building for AMD64 ------------------ -The build process for the ReleaseAMD64 configuration is very similar -to the Itanium configuration; make sure you use the latest version of -vsextcomp. - -Building Python Using the free MS Toolkit Compiler --------------------------------------------------- - -The build process for Visual C++ can be used almost unchanged with the free MS -Toolkit Compiler. This provides a way of building Python using freely -available software. - -Requirements - - To build Python, the following tools are required: - - * The Visual C++ Toolkit Compiler - from http://msdn.microsoft.com/visualc/vctoolkit2003/ - * A recent Platform SDK - from http://www.microsoft.com/downloads/details.aspx?FamilyID=484269e2-3b89-47e3-8eb7-1f2be6d7123a - * The .NET 1.1 SDK - from http://www.microsoft.com/downloads/details.aspx?FamilyID=9b3a2ca6-3647-4070-9f41-a333c6b9181d - - [Does anyone have better URLs for the last 2 of these?] - - The toolkit compiler is needed as it is an optimising compiler (the - compiler supplied with the .NET SDK is a non-optimising version). The - platform SDK is needed to provide the Windows header files and libraries - (the Windows 2003 Server SP1 edition, typical install, is known to work - - other configurations or versions are probably fine as well). The .NET 1.1 - SDK is needed because it contains a version of msvcrt.dll which links to - the msvcr71.dll CRT. Note that the .NET 2.0 SDK is NOT acceptable, as it - references msvcr80.dll. - - All of the above items should be installed as normal. - - If you intend to build the openssl (needed for the _ssl extension) you - will need the C runtime sources installed as part of the platform SDK. - - In addition, you will need Nant, available from - http://nant.sourceforge.net. The 0.85 release candidate 3 version is known - to work. This is the latest released version at the time of writing. Later - "nightly build" versions are known NOT to work - it is not clear at - present whether future released versions will work. - -Setting up the environment - - Start a platform SDK "build environment window" from the start menu. The - "Windows XP 32-bit retail" version is known to work. - - Add the following directories to your PATH: - * The toolkit compiler directory - * The SDK "Win64" binaries directory - * The Nant directory - Add to your INCLUDE environment variable: - * The toolkit compiler INCLUDE directory - Add to your LIB environment variable: - * The toolkit compiler LIB directory - * The .NET SDK Visual Studio 2003 VC7\lib directory - - The following commands should set things up as you need them: - - rem Set these values according to where you installed the software - set TOOLKIT=C:\Program Files\Microsoft Visual C++ Toolkit 2003 - set SDK=C:\Program Files\Microsoft Platform SDK - set NET=C:\Program Files\Microsoft Visual Studio .NET 2003 - set NANT=C:\Utils\Nant - - set PATH=%TOOLKIT%\bin;%PATH%;%SDK%\Bin\win64;%NANT%\bin - set INCLUDE=%TOOLKIT%\include;%INCLUDE% - set LIB=%TOOLKIT%\lib;%NET%\VC7\lib;%LIB% - - The "win64" directory from the SDK is added to supply executables such as - "cvtres" and "lib", which are not available elsewhere. The versions in the - "win64" directory are 32-bit programs, so they are fine to use here. - - That's it. To build Python (the core only, no binary extensions which - depend on external libraries) you just need to issue the command - - nant -buildfile:python.build all - - from within the PCBuild directory. - -Extension modules - - To build those extension modules which require external libraries - (_tkinter, bz2, _bsddb, _sqlite3, _ssl) you can follow the instructions - for the Visual Studio build above, with a few minor modifications. These - instructions have only been tested using the sources in the Python - subversion repository - building from original sources should work, but - has not been tested. - - For each extension module you wish to build, you should remove the - associated include line from the excludeprojects section of pc.build. - - The changes required are: - - _tkinter - The tix makefile (tix-8.4.0\win\makefile.vc) must be modified to - remove references to TOOLS32. The relevant lines should be changed to - read: - cc32 = cl.exe - link32 = link.exe - include32 = - The remainder of the build instructions will work as given. - - bz2 - No changes are needed - - _bsddb - The file db.build should be copied from the Python PCBuild directory - to the directory db-4.4.20\build_win32. - - The file db_static.vcproj in db-4.4.20\build_win32 should be edited to - remove the string "$(SolutionDir)" - this occurs in 2 places, only - relevant for 64-bit builds. (The edit is required as otherwise, nant - wants to read the solution file, which is not in a suitable form). - - The bsddb library can then be build with the command - nant -buildfile:db.build all - run from the db-4.4.20\build_win32 directory. - - _sqlite3 - No changes are needed. However, in order for the tests to succeed, a - copy of sqlite3.dll must be downloaded, and placed alongside - python.exe. - - _ssl - The documented build process works as written. However, it needs a - copy of the file setargv.obj, which is not supplied in the platform - SDK. However, the sources are available (in the crt source code). To - build setargv.obj, proceed as follows: - - Copy setargv.c, cruntime.h and internal.h from %SDK%\src\crt to a - temporary directory. - Compile using "cl /c /I. /MD /D_CRTBLD setargv.c" - Copy the resulting setargv.obj to somewhere on your LIB environment - (%SDK%\lib is a reasonable place). +Select x64 as the destination platform. - With setargv.obj in place, the standard build process should work - fine. YOUR OWN EXTENSION DLLs ----------------------- If you want to create your own extension module DLL, there's an example with easy-to-follow instructions in ../PC/example/; read the file readme.txt there first. +Also, you can simply use Visual Studio to "Add new project to solution". +Elect to create a win32 project, .dll, empty project. +This will create a subdirectory with a .vcproj file in it. Now, You can +simply copy most of another .vcproj, like _test_capi/_test_capi.vcproj over +(you can't just copy and rename it, since the target will have a unique GUID.) +At some point we want to be able to provide a template for creating a +project. Modified: python/branches/bcannon-objcap/PCbuild8/rmpyc.py ============================================================================== --- python/branches/bcannon-objcap/PCbuild8/rmpyc.py (original) +++ python/branches/bcannon-objcap/PCbuild8/rmpyc.py Fri May 25 22:13:08 2007 @@ -1,4 +1,5 @@ # Remove all the .pyc and .pyo files under ../Lib. +import sys def deltree(root): @@ -21,5 +22,9 @@ return npyc, npyo -npyc, npyo = deltree("../Lib") +path = "../Lib" +if len(sys.argv) > 1: + path = sys.argv[1] + +npyc, npyo = deltree(path) print npyc, ".pyc deleted,", npyo, ".pyo deleted" Modified: python/branches/bcannon-objcap/PCbuild8/rt.bat ============================================================================== --- python/branches/bcannon-objcap/PCbuild8/rt.bat (original) +++ python/branches/bcannon-objcap/PCbuild8/rt.bat Fri May 25 22:13:08 2007 @@ -2,6 +2,8 @@ rem Run Tests. Run the regression test suite. rem Usage: rt [-d] [-O] [-q] regrtest_args rem -d Run Debug build (python_d.exe). Else release build. +rem -pgo Run PGO build, e.g. for instrumentation +rem -x64 Run the x64 version, otherwise win32 rem -O Run python.exe or python_d.exe (see -d) with -O. rem -q "quick" -- normally the tests are run twice, the first time rem after deleting all the .py[co] files reachable from Lib/. @@ -24,16 +26,21 @@ setlocal -set exe=python +set platf=win32 +set exe=python.exe set qmode= set dashO= +set conf=Release PATH %PATH%;..\..\tcltk\bin :CheckOpts if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts -if "%1"=="-d" (set exe=python_d) & shift & goto CheckOpts +if "%1"=="-d" (set exe=python_d.exe) & (set conf=Debug) & shift & goto CheckOpts +if "%1"=="-x64" (set platf=x64) & shift & goto CheckOpts +if "%1"=="-pgo" (set conf=PGO) & shift & goto CheckOpts +set exe=%platf%%conf%\%exe% set cmd=%exe% %dashO% -E -tt ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 if defined qmode goto Qmode Deleted: /python/branches/bcannon-objcap/PCbuild8/select.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/select.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,379 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/unicodedata.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/unicodedata.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,371 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/w9xpopen.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/w9xpopen.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: /python/branches/bcannon-objcap/PCbuild8/winsound.vcproj ============================================================================== --- /python/branches/bcannon-objcap/PCbuild8/winsound.vcproj Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,375 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: python/branches/bcannon-objcap/Parser/Python.asdl ============================================================================== --- python/branches/bcannon-objcap/Parser/Python.asdl (original) +++ python/branches/bcannon-objcap/Parser/Python.asdl Fri May 25 22:13:08 2007 @@ -75,7 +75,7 @@ | Subscript(expr value, slice slice, expr_context ctx) | Name(identifier id, expr_context ctx) | List(expr* elts, expr_context ctx) - | Tuple(expr *elts, expr_context ctx) + | Tuple(expr* elts, expr_context ctx) -- col_offset is the byte offset in the utf8 string the parser uses attributes (int lineno, int col_offset) Modified: python/branches/bcannon-objcap/Parser/asdl_c.py ============================================================================== --- python/branches/bcannon-objcap/Parser/asdl_c.py (original) +++ python/branches/bcannon-objcap/Parser/asdl_c.py Fri May 25 22:13:08 2007 @@ -47,7 +47,7 @@ # XXX this should be fixed for real if i == -1 and 'GeneratorExp' in cur: i = size + 3 - assert i != -1, "Impossible line %d to reflow: %s" % (size, `s`) + assert i != -1, "Impossible line %d to reflow: %r" % (size, s) lines.append(padding + cur[:i]) if len(lines) == 1: # find new size based on brace @@ -299,10 +299,8 @@ emit('}', 1) emit("p = (%s)PyArena_Malloc(arena, sizeof(*p));" % ctype, 1); - emit("if (!p) {", 1) - emit("PyErr_NoMemory();", 2) + emit("if (!p)", 1) emit("return NULL;", 2) - emit("}", 1) if union: self.emit_body_union(name, args, attrs) else: @@ -474,7 +472,7 @@ return PyBool_FromLong(b); } -static PyObject* ast2obj_int(bool b) +static PyObject* ast2obj_int(long b) { return PyInt_FromLong(b); } @@ -525,6 +523,9 @@ (cons.name, cons.name), 1) self.emit("if (!%s_singleton) return 0;" % cons.name, 1) +def parse_version(mod): + return mod.version.value[12:-3] + class ASTModuleVisitor(PickleVisitor): def visitModule(self, mod): @@ -540,7 +541,8 @@ self.emit('if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)', 1) self.emit("return;", 2) # Value of version: "$Revision$" - self.emit('if (PyModule_AddStringConstant(m, "__version__", "%s") < 0)' % mod.version.value[12:-3], 1) + self.emit('if (PyModule_AddStringConstant(m, "__version__", "%s") < 0)' + % parse_version(mod), 1) self.emit("return;", 2) for dfn in mod.dfns: self.visit(dfn) @@ -721,11 +723,23 @@ v.visit(object) v.emit("", 0) +common_msg = "/* File automatically generated by %s. */\n" + +c_file_msg = """ +/* + __version__ %s. + + This module must be committed separately after each AST grammar change; + The __version__ number is set to the revision number of the commit + containing the grammar change. +*/ +""" + def main(srcfile): argv0 = sys.argv[0] components = argv0.split(os.sep) argv0 = os.sep.join(components[-2:]) - auto_gen_msg = '/* File automatically generated by %s */\n' % argv0 + auto_gen_msg = common_msg % argv0 mod = asdl.parse(srcfile) if not asdl.check(mod): sys.exit(1) @@ -746,6 +760,7 @@ p = os.path.join(SRC_DIR, str(mod.name) + "-ast.c") f = open(p, "wb") print >> f, auto_gen_msg + print >> f, c_file_msg % parse_version(mod) print >> f, '#include "Python.h"' print >> f, '#include "%s-ast.h"' % mod.name print >> f Modified: python/branches/bcannon-objcap/Python/Python-ast.c ============================================================================== --- python/branches/bcannon-objcap/Python/Python-ast.c (original) +++ python/branches/bcannon-objcap/Python/Python-ast.c Fri May 25 22:13:08 2007 @@ -1,4 +1,13 @@ -/* File automatically generated by Parser/asdl_c.py */ +/* File automatically generated by Parser/asdl_c.py. */ + + +/* + __version__ 43614. + + This module must be committed separately after each AST grammar change; + The __version__ number is set to the revision number of the commit + containing the grammar change. +*/ #include "Python.h" #include "Python-ast.h" @@ -431,7 +440,7 @@ return PyBool_FromLong(b); } -static PyObject* ast2obj_int(bool b) +static PyObject* ast2obj_int(long b) { return PyInt_FromLong(b); } @@ -731,10 +740,8 @@ { mod_ty p; p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Module_kind; p->v.Module.body = body; return p; @@ -745,10 +752,8 @@ { mod_ty p; p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Interactive_kind; p->v.Interactive.body = body; return p; @@ -764,10 +769,8 @@ return NULL; } p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Expression_kind; p->v.Expression.body = body; return p; @@ -778,10 +781,8 @@ { mod_ty p; p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Suite_kind; p->v.Suite.body = body; return p; @@ -803,10 +804,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = FunctionDef_kind; p->v.FunctionDef.name = name; p->v.FunctionDef.args = args; @@ -828,10 +827,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = ClassDef_kind; p->v.ClassDef.name = name; p->v.ClassDef.bases = bases; @@ -846,10 +843,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Return_kind; p->v.Return.value = value; p->lineno = lineno; @@ -862,10 +857,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Delete_kind; p->v.Delete.targets = targets; p->lineno = lineno; @@ -884,10 +877,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Assign_kind; p->v.Assign.targets = targets; p->v.Assign.value = value; @@ -917,10 +908,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = AugAssign_kind; p->v.AugAssign.target = target; p->v.AugAssign.op = op; @@ -936,10 +925,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Print_kind; p->v.Print.dest = dest; p->v.Print.values = values; @@ -965,10 +952,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = For_kind; p->v.For.target = target; p->v.For.iter = iter; @@ -990,10 +975,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = While_kind; p->v.While.test = test; p->v.While.body = body; @@ -1014,10 +997,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = If_kind; p->v.If.test = test; p->v.If.body = body; @@ -1038,10 +1019,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = With_kind; p->v.With.context_expr = context_expr; p->v.With.optional_vars = optional_vars; @@ -1057,10 +1036,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Raise_kind; p->v.Raise.type = type; p->v.Raise.inst = inst; @@ -1076,10 +1053,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = TryExcept_kind; p->v.TryExcept.body = body; p->v.TryExcept.handlers = handlers; @@ -1095,10 +1070,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = TryFinally_kind; p->v.TryFinally.body = body; p->v.TryFinally.finalbody = finalbody; @@ -1117,10 +1090,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Assert_kind; p->v.Assert.test = test; p->v.Assert.msg = msg; @@ -1134,10 +1105,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Import_kind; p->v.Import.names = names; p->lineno = lineno; @@ -1156,10 +1125,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = ImportFrom_kind; p->v.ImportFrom.module = module; p->v.ImportFrom.names = names; @@ -1180,10 +1147,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Exec_kind; p->v.Exec.body = body; p->v.Exec.globals = globals; @@ -1198,10 +1163,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Global_kind; p->v.Global.names = names; p->lineno = lineno; @@ -1219,10 +1182,8 @@ return NULL; } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Expr_kind; p->v.Expr.value = value; p->lineno = lineno; @@ -1235,10 +1196,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Pass_kind; p->lineno = lineno; p->col_offset = col_offset; @@ -1250,10 +1209,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Break_kind; p->lineno = lineno; p->col_offset = col_offset; @@ -1265,10 +1222,8 @@ { stmt_ty p; p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Continue_kind; p->lineno = lineno; p->col_offset = col_offset; @@ -1286,10 +1241,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = BoolOp_kind; p->v.BoolOp.op = op; p->v.BoolOp.values = values; @@ -1319,10 +1272,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = BinOp_kind; p->v.BinOp.left = left; p->v.BinOp.op = op; @@ -1348,10 +1299,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = UnaryOp_kind; p->v.UnaryOp.op = op; p->v.UnaryOp.operand = operand; @@ -1376,10 +1325,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Lambda_kind; p->v.Lambda.args = args; p->v.Lambda.body = body; @@ -1409,10 +1356,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = IfExp_kind; p->v.IfExp.test = test; p->v.IfExp.body = body; @@ -1428,10 +1373,8 @@ { expr_ty p; p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Dict_kind; p->v.Dict.keys = keys; p->v.Dict.values = values; @@ -1451,10 +1394,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = ListComp_kind; p->v.ListComp.elt = elt; p->v.ListComp.generators = generators; @@ -1474,10 +1415,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = GeneratorExp_kind; p->v.GeneratorExp.elt = elt; p->v.GeneratorExp.generators = generators; @@ -1491,10 +1430,8 @@ { expr_ty p; p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Yield_kind; p->v.Yield.value = value; p->lineno = lineno; @@ -1513,10 +1450,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Compare_kind; p->v.Compare.left = left; p->v.Compare.ops = ops; @@ -1537,10 +1472,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Call_kind; p->v.Call.func = func; p->v.Call.args = args; @@ -1562,10 +1495,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Repr_kind; p->v.Repr.value = value; p->lineno = lineno; @@ -1583,10 +1514,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Num_kind; p->v.Num.n = n; p->lineno = lineno; @@ -1604,10 +1533,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Str_kind; p->v.Str.s = s; p->lineno = lineno; @@ -1636,10 +1563,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Attribute_kind; p->v.Attribute.value = value; p->v.Attribute.attr = attr; @@ -1670,10 +1595,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Subscript_kind; p->v.Subscript.value = value; p->v.Subscript.slice = slice; @@ -1699,10 +1622,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Name_kind; p->v.Name.id = id; p->v.Name.ctx = ctx; @@ -1722,10 +1643,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = List_kind; p->v.List.elts = elts; p->v.List.ctx = ctx; @@ -1745,10 +1664,8 @@ return NULL; } p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Tuple_kind; p->v.Tuple.elts = elts; p->v.Tuple.ctx = ctx; @@ -1762,10 +1679,8 @@ { slice_ty p; p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Ellipsis_kind; return p; } @@ -1775,10 +1690,8 @@ { slice_ty p; p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Slice_kind; p->v.Slice.lower = lower; p->v.Slice.upper = upper; @@ -1791,10 +1704,8 @@ { slice_ty p; p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = ExtSlice_kind; p->v.ExtSlice.dims = dims; return p; @@ -1810,10 +1721,8 @@ return NULL; } p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->kind = Index_kind; p->v.Index.value = value; return p; @@ -1834,10 +1743,8 @@ return NULL; } p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->target = target; p->iter = iter; p->ifs = ifs; @@ -1850,10 +1757,8 @@ { excepthandler_ty p; p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->type = type; p->name = name; p->body = body; @@ -1868,10 +1773,8 @@ { arguments_ty p; p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->args = args; p->vararg = vararg; p->kwarg = kwarg; @@ -1894,10 +1797,8 @@ return NULL; } p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->arg = arg; p->value = value; return p; @@ -1913,10 +1814,8 @@ return NULL; } p = (alias_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); + if (!p) return NULL; - } p->name = name; p->asname = asname; return p; Modified: python/branches/bcannon-objcap/Python/ast.c ============================================================================== --- python/branches/bcannon-objcap/Python/ast.c (original) +++ python/branches/bcannon-objcap/Python/ast.c Fri May 25 22:13:08 2007 @@ -25,7 +25,8 @@ static expr_ty ast_for_expr(struct compiling *, const node *); static stmt_ty ast_for_stmt(struct compiling *, const node *); static asdl_seq *ast_for_suite(struct compiling *, const node *); -static asdl_seq *ast_for_exprlist(struct compiling *, const node *, expr_context_ty); +static asdl_seq *ast_for_exprlist(struct compiling *, const node *, + expr_context_ty); static expr_ty ast_for_testlist(struct compiling *, const node *); static expr_ty ast_for_testlist_gexp(struct compiling *, const node *); @@ -186,8 +187,8 @@ if (flags && flags->cf_flags & PyCF_SOURCE_IS_UTF8) { c.c_encoding = "utf-8"; if (TYPE(n) == encoding_decl) { - ast_error(n, "encoding declaration in Unicode string"); - goto error; + ast_error(n, "encoding declaration in Unicode string"); + goto error; } } else if (TYPE(n) == encoding_decl) { c.c_encoding = STR(n); @@ -202,7 +203,7 @@ case file_input: stmts = asdl_seq_new(num_stmts(n), arena); if (!stmts) - return NULL; + return NULL; for (i = 0; i < NCH(n) - 1; i++) { ch = CHILD(n, i); if (TYPE(ch) == NEWLINE) @@ -243,6 +244,8 @@ goto error; asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset, arena)); + if (!asdl_seq_GET(stmts, 0)) + goto error; return Interactive(stmts, arena); } else { @@ -273,6 +276,8 @@ return Interactive(stmts, arena); } default: + PyErr_Format(PyExc_SystemError, + "invalid node %d for PyAST_FromNode", TYPE(n)); goto error; } error: @@ -342,8 +347,8 @@ switch (e->kind) { case Attribute_kind: if (ctx == Store && - !strcmp(PyString_AS_STRING(e->v.Attribute.attr), "None")) { - return ast_error(n, "assignment to None"); + !strcmp(PyString_AS_STRING(e->v.Attribute.attr), "None")) { + return ast_error(n, "assignment to None"); } e->v.Attribute.ctx = ctx; break; @@ -528,12 +533,11 @@ asdl_seq *seq; expr_ty expression; int i; - assert(TYPE(n) == testlist - || TYPE(n) == listmaker - || TYPE(n) == testlist_gexp - || TYPE(n) == testlist_safe - || TYPE(n) == testlist1 - ); + assert(TYPE(n) == testlist || + TYPE(n) == listmaker || + TYPE(n) == testlist_gexp || + TYPE(n) == testlist_safe || + TYPE(n) == testlist1); seq = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena); if (!seq) @@ -573,16 +577,16 @@ /* fpdef_node is either a NAME or an fplist */ child = CHILD(fpdef_node, 0); if (TYPE(child) == NAME) { - if (!strcmp(STR(child), "None")) { - ast_error(child, "assignment to None"); - return NULL; - } + if (!strcmp(STR(child), "None")) { + ast_error(child, "assignment to None"); + return NULL; + } arg = Name(NEW_IDENTIFIER(child), Store, LINENO(child), child->n_col_offset, c->c_arena); - } + } else { assert(TYPE(fpdef_node) == fpdef); - /* fpdef_node[0] is not a name, so it must be a '(', get CHILD[1] */ + /* fpdef_node[0] is not a name, so it must be '(', get CHILD[1] */ child = CHILD(fpdef_node, 1); assert(TYPE(child) == fplist); /* NCH == 1 means we have (x), we need to elide the extra parens */ @@ -656,7 +660,7 @@ if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) { expr_ty expression = ast_for_expr(c, CHILD(n, i + 2)); if (!expression) - goto error; + goto error; assert(defaults != NULL); asdl_seq_SET(defaults, j++, expression); i += 2; @@ -673,6 +677,8 @@ if (NCH(ch) != 1) { /* We have complex arguments, setup for unpacking. */ asdl_seq_SET(args, k++, compiler_complex_args(c, ch)); + if (!asdl_seq_GET(args, k-1)) + goto error; } else { /* def foo((x)): setup for checking NAME below. */ /* Loop because there can be many parens and tuple @@ -685,8 +691,8 @@ if (TYPE(CHILD(ch, 0)) == NAME) { expr_ty name; if (!strcmp(STR(CHILD(ch, 0)), "None")) { - ast_error(CHILD(ch, 0), "assignment to None"); - goto error; + ast_error(CHILD(ch, 0), "assignment to None"); + goto error; } name = Name(NEW_IDENTIFIER(CHILD(ch, 0)), Param, LINENO(ch), ch->n_col_offset, @@ -700,16 +706,16 @@ break; case STAR: if (!strcmp(STR(CHILD(n, i+1)), "None")) { - ast_error(CHILD(n, i+1), "assignment to None"); - goto error; + ast_error(CHILD(n, i+1), "assignment to None"); + goto error; } vararg = NEW_IDENTIFIER(CHILD(n, i+1)); i += 3; break; case DOUBLESTAR: if (!strcmp(STR(CHILD(n, i+1)), "None")) { - ast_error(CHILD(n, i+1), "assignment to None"); - goto error; + ast_error(CHILD(n, i+1), "assignment to None"); + goto error; } kwarg = NEW_IDENTIFIER(CHILD(n, i+1)); i += 3; @@ -1006,9 +1012,9 @@ asdl_seq *t; expr_ty expression; node *for_ch; - + REQ(ch, list_for); - + for_ch = CHILD(ch, 1); t = ast_for_exprlist(c, for_ch, Store); if (!t) @@ -1016,9 +1022,10 @@ expression = ast_for_testlist(c, CHILD(ch, 3)); if (!expression) return NULL; - + /* Check the # of children rather than the length of t, since - [x for x, in ... ] has 1 element in t, but still requires a Tuple. */ + [x for x, in ... ] has 1 element in t, but still requires a Tuple. + */ if (NCH(for_ch) == 1) lc = comprehension((expr_ty)asdl_seq_GET(t, 0), expression, NULL, c->c_arena); @@ -1032,6 +1039,7 @@ if (NCH(ch) == 5) { int j, n_ifs; asdl_seq *ifs; + expr_ty list_for_expr; ch = CHILD(ch, 4); n_ifs = count_list_ifs(ch); @@ -1043,27 +1051,30 @@ return NULL; for (j = 0; j < n_ifs; j++) { - REQ(ch, list_iter); - ch = CHILD(ch, 0); - REQ(ch, list_if); - - asdl_seq_SET(ifs, j, ast_for_expr(c, CHILD(ch, 1))); + REQ(ch, list_iter); + ch = CHILD(ch, 0); + REQ(ch, list_if); + + list_for_expr = ast_for_expr(c, CHILD(ch, 1)); + if (!list_for_expr) + return NULL; + + asdl_seq_SET(ifs, j, list_for_expr); if (NCH(ch) == 3) ch = CHILD(ch, 2); - } - /* on exit, must guarantee that ch is a list_for */ - if (TYPE(ch) == list_iter) - ch = CHILD(ch, 0); - lc->ifs = ifs; } - asdl_seq_SET(listcomps, i, lc); + /* on exit, must guarantee that ch is a list_for */ + if (TYPE(ch) == list_iter) + ch = CHILD(ch, 0); + lc->ifs = ifs; + } + asdl_seq_SET(listcomps, i, lc); } return ListComp(elt, listcomps, LINENO(n), n->n_col_offset, c->c_arena); } -/* - Count the number of 'for' loops in a generator expression. +/* Count the number of 'for' loops in a generator expression. Helper for ast_for_genexp(). */ @@ -1071,34 +1082,34 @@ static int count_gen_fors(const node *n) { - int n_fors = 0; - node *ch = CHILD(n, 1); + int n_fors = 0; + node *ch = CHILD(n, 1); count_gen_for: - n_fors++; - REQ(ch, gen_for); - if (NCH(ch) == 5) - ch = CHILD(ch, 4); - else - return n_fors; + n_fors++; + REQ(ch, gen_for); + if (NCH(ch) == 5) + ch = CHILD(ch, 4); + else + return n_fors; count_gen_iter: - REQ(ch, gen_iter); - ch = CHILD(ch, 0); - if (TYPE(ch) == gen_for) - goto count_gen_for; - else if (TYPE(ch) == gen_if) { - if (NCH(ch) == 3) { - ch = CHILD(ch, 2); - goto count_gen_iter; - } - else - return n_fors; + REQ(ch, gen_iter); + ch = CHILD(ch, 0); + if (TYPE(ch) == gen_for) + goto count_gen_for; + else if (TYPE(ch) == gen_if) { + if (NCH(ch) == 3) { + ch = CHILD(ch, 2); + goto count_gen_iter; } - - /* Should never be reached */ - PyErr_SetString(PyExc_SystemError, - "logic error in count_gen_fors"); - return -1; + else + return n_fors; + } + + /* Should never be reached */ + PyErr_SetString(PyExc_SystemError, + "logic error in count_gen_fors"); + return -1; } /* Count the number of 'if' statements in a generator expression. @@ -1109,19 +1120,19 @@ static int count_gen_ifs(const node *n) { - int n_ifs = 0; + int n_ifs = 0; - while (1) { - REQ(n, gen_iter); - if (TYPE(CHILD(n, 0)) == gen_for) - return n_ifs; - n = CHILD(n, 0); - REQ(n, gen_if); - n_ifs++; - if (NCH(n) == 2) - return n_ifs; - n = CHILD(n, 2); - } + while (1) { + REQ(n, gen_iter); + if (TYPE(CHILD(n, 0)) == gen_for) + return n_ifs; + n = CHILD(n, 0); + REQ(n, gen_if); + n_ifs++; + if (NCH(n) == 2) + return n_ifs; + n = CHILD(n, 2); + } } /* TODO(jhylton): Combine with list comprehension code? */ @@ -1228,7 +1239,8 @@ case NAME: /* All names start in Load context, but may later be changed. */ - return Name(NEW_IDENTIFIER(ch), Load, LINENO(n), n->n_col_offset, c->c_arena); + return Name(NEW_IDENTIFIER(ch), Load, LINENO(n), n->n_col_offset, + c->c_arena); case STRING: { PyObject *str = parsestrplus(c, n); if (!str) @@ -1532,14 +1544,14 @@ (sys.maxint - 1). In that case, we want a PyIntObject, not a PyLongObject. */ - if (TYPE(CHILD(n, 0)) == MINUS - && NCH(n) == 2 - && TYPE((pfactor = CHILD(n, 1))) == factor - && NCH(pfactor) == 1 - && TYPE((ppower = CHILD(pfactor, 0))) == power - && NCH(ppower) == 1 - && TYPE((patom = CHILD(ppower, 0))) == atom - && TYPE((pnum = CHILD(patom, 0))) == NUMBER) { + if (TYPE(CHILD(n, 0)) == MINUS && + NCH(n) == 2 && + TYPE((pfactor = CHILD(n, 1))) == factor && + NCH(pfactor) == 1 && + TYPE((ppower = CHILD(pfactor, 0))) == power && + NCH(ppower) == 1 && + TYPE((patom = CHILD(ppower, 0))) == atom && + TYPE((pnum = CHILD(patom, 0))) == NUMBER) { char *s = PyObject_MALLOC(strlen(STR(pnum)) + 2); if (s == NULL) return NULL; @@ -1849,11 +1861,12 @@ * then is very confusing. */ if (e->kind == Lambda_kind) { - ast_error(CHILD(ch, 0), "lambda cannot contain assignment"); - return NULL; + ast_error(CHILD(ch, 0), + "lambda cannot contain assignment"); + return NULL; } else if (e->kind != Name_kind) { - ast_error(CHILD(ch, 0), "keyword can't be an expression"); - return NULL; + ast_error(CHILD(ch, 0), "keyword can't be an expression"); + return NULL; } key = e->v.Name.id; e = ast_for_expr(c, CHILD(ch, 2)); @@ -1875,7 +1888,8 @@ } } - return Call(func, args, keywords, vararg, kwarg, func->lineno, func->col_offset, c->c_arena); + return Call(func, args, keywords, vararg, kwarg, func->lineno, + func->col_offset, c->c_arena); } static expr_ty @@ -1991,7 +2005,8 @@ "assignment"); return NULL; } - set_context(expr1, Store, ch); + if(!set_context(expr1, Store, ch)) + return NULL; ch = CHILD(n, 2); if (TYPE(ch) == testlist) @@ -2005,7 +2020,8 @@ if (!newoperator) return NULL; - return AugAssign(expr1, newoperator, expr2, LINENO(n), n->n_col_offset, c->c_arena); + return AugAssign(expr1, newoperator, expr2, LINENO(n), n->n_col_offset, + c->c_arena); } else { int i; @@ -2029,10 +2045,10 @@ /* set context to assign */ if (!e) - return NULL; + return NULL; if (!set_context(e, Store, CHILD(n, i))) - return NULL; + return NULL; asdl_seq_SET(targets, i / 2, e); } @@ -2043,7 +2059,8 @@ expression = ast_for_expr(c, value); if (!expression) return NULL; - return Assign(targets, expression, LINENO(n), n->n_col_offset, c->c_arena); + return Assign(targets, expression, LINENO(n), n->n_col_offset, + c->c_arena); } } @@ -2150,16 +2167,19 @@ expr_ty expression = ast_for_testlist(c, CHILD(ch, 1)); if (!expression) return NULL; - return Return(expression, LINENO(n), n->n_col_offset, c->c_arena); + return Return(expression, LINENO(n), n->n_col_offset, + c->c_arena); } case raise_stmt: if (NCH(ch) == 1) - return Raise(NULL, NULL, NULL, LINENO(n), n->n_col_offset, c->c_arena); + return Raise(NULL, NULL, NULL, LINENO(n), n->n_col_offset, + c->c_arena); else if (NCH(ch) == 2) { expr_ty expression = ast_for_expr(c, CHILD(ch, 1)); if (!expression) return NULL; - return Raise(expression, NULL, NULL, LINENO(n), n->n_col_offset, c->c_arena); + return Raise(expression, NULL, NULL, LINENO(n), + n->n_col_offset, c->c_arena); } else if (NCH(ch) == 4) { expr_ty expr1, expr2; @@ -2171,7 +2191,8 @@ if (!expr2) return NULL; - return Raise(expr1, expr2, NULL, LINENO(n), n->n_col_offset, c->c_arena); + return Raise(expr1, expr2, NULL, LINENO(n), n->n_col_offset, + c->c_arena); } else if (NCH(ch) == 6) { expr_ty expr1, expr2, expr3; @@ -2186,7 +2207,8 @@ if (!expr3) return NULL; - return Raise(expr1, expr2, expr3, LINENO(n), n->n_col_offset, c->c_arena); + return Raise(expr1, expr2, expr3, LINENO(n), n->n_col_offset, + c->c_arena); } default: PyErr_Format(PyExc_SystemError, @@ -2300,7 +2322,7 @@ REQ(n, dotted_as_names); aliases = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena); if (!aliases) - return NULL; + return NULL; for (i = 0; i < NCH(n); i += 2) { alias_ty import_alias = alias_for_import_name(c, CHILD(n, i)); if (!import_alias) @@ -2439,7 +2461,8 @@ return NULL; } - return Exec(expr1, globals, locals, LINENO(n), n->n_col_offset, c->c_arena); + return Exec(expr1, globals, locals, LINENO(n), n->n_col_offset, + c->c_arena); } static stmt_ty @@ -2451,7 +2474,8 @@ expr_ty expression = ast_for_expr(c, CHILD(n, 1)); if (!expression) return NULL; - return Assert(expression, NULL, LINENO(n), n->n_col_offset, c->c_arena); + return Assert(expression, NULL, LINENO(n), n->n_col_offset, + c->c_arena); } else if (NCH(n) == 4) { expr_ty expr1, expr2; @@ -2558,7 +2582,8 @@ if (!suite_seq) return NULL; - return If(expression, suite_seq, NULL, LINENO(n), n->n_col_offset, c->c_arena); + return If(expression, suite_seq, NULL, LINENO(n), n->n_col_offset, + c->c_arena); } s = STR(CHILD(n, 4)); @@ -2580,10 +2605,13 @@ if (!seq2) return NULL; - return If(expression, seq1, seq2, LINENO(n), n->n_col_offset, c->c_arena); + return If(expression, seq1, seq2, LINENO(n), n->n_col_offset, + c->c_arena); } else if (s[2] == 'i') { int i, n_elif, has_else = 0; + expr_ty expression; + asdl_seq *suite_seq; asdl_seq *orelse = NULL; n_elif = NCH(n) - 4; /* must reference the child n_elif+1 since 'else' token is third, @@ -2596,8 +2624,7 @@ n_elif /= 4; if (has_else) { - expr_ty expression; - asdl_seq *seq1, *seq2; + asdl_seq *suite_seq2; orelse = asdl_seq_new(1, c->c_arena); if (!orelse) @@ -2605,24 +2632,24 @@ expression = ast_for_expr(c, CHILD(n, NCH(n) - 6)); if (!expression) return NULL; - seq1 = ast_for_suite(c, CHILD(n, NCH(n) - 4)); - if (!seq1) + suite_seq = ast_for_suite(c, CHILD(n, NCH(n) - 4)); + if (!suite_seq) return NULL; - seq2 = ast_for_suite(c, CHILD(n, NCH(n) - 1)); - if (!seq2) + suite_seq2 = ast_for_suite(c, CHILD(n, NCH(n) - 1)); + if (!suite_seq2) return NULL; - asdl_seq_SET(orelse, 0, If(expression, seq1, seq2, - LINENO(CHILD(n, NCH(n) - 6)), CHILD(n, NCH(n) - 6)->n_col_offset, - c->c_arena)); + asdl_seq_SET(orelse, 0, + If(expression, suite_seq, suite_seq2, + LINENO(CHILD(n, NCH(n) - 6)), + CHILD(n, NCH(n) - 6)->n_col_offset, + c->c_arena)); /* the just-created orelse handled the last elif */ n_elif--; } for (i = 0; i < n_elif; i++) { int off = 5 + (n_elif - i - 1) * 4; - expr_ty expression; - asdl_seq *suite_seq; asdl_seq *newobj = asdl_seq_new(1, c->c_arena); if (!newobj) return NULL; @@ -2635,12 +2662,18 @@ asdl_seq_SET(newobj, 0, If(expression, suite_seq, orelse, - LINENO(CHILD(n, off)), CHILD(n, off)->n_col_offset, c->c_arena)); + LINENO(CHILD(n, off)), + CHILD(n, off)->n_col_offset, c->c_arena)); orelse = newobj; } - return If(ast_for_expr(c, CHILD(n, 1)), - ast_for_suite(c, CHILD(n, 3)), - orelse, LINENO(n), n->n_col_offset, c->c_arena); + expression = ast_for_expr(c, CHILD(n, 1)); + if (!expression) + return NULL; + suite_seq = ast_for_suite(c, CHILD(n, 3)); + if (!suite_seq) + return NULL; + return If(expression, suite_seq, orelse, + LINENO(n), n->n_col_offset, c->c_arena); } PyErr_Format(PyExc_SystemError, @@ -2664,7 +2697,8 @@ suite_seq = ast_for_suite(c, CHILD(n, 3)); if (!suite_seq) return NULL; - return While(expression, suite_seq, NULL, LINENO(n), n->n_col_offset, c->c_arena); + return While(expression, suite_seq, NULL, LINENO(n), n->n_col_offset, + c->c_arena); } else if (NCH(n) == 7) { expr_ty expression; @@ -2680,7 +2714,8 @@ if (!seq2) return NULL; - return While(expression, seq1, seq2, LINENO(n), n->n_col_offset, c->c_arena); + return While(expression, seq1, seq2, LINENO(n), n->n_col_offset, + c->c_arena); } PyErr_Format(PyExc_SystemError, @@ -2730,7 +2765,7 @@ static excepthandler_ty ast_for_except_clause(struct compiling *c, const node *exc, node *body) { - /* except_clause: 'except' [test [',' test]] */ + /* except_clause: 'except' [test [(',' | 'as') test]] */ REQ(exc, except_clause); REQ(body, suite); @@ -2876,6 +2911,8 @@ assert(TYPE(n) == with_stmt); context_expr = ast_for_expr(c, CHILD(n, 1)); + if (!context_expr) + return NULL; if (TYPE(CHILD(n, 2)) == with_var) { optional_vars = ast_for_with_var(c, CHILD(n, 2)); Modified: python/branches/bcannon-objcap/Python/bltinmodule.c ============================================================================== --- python/branches/bcannon-objcap/Python/bltinmodule.c (original) +++ python/branches/bcannon-objcap/Python/bltinmodule.c Fri May 25 22:13:08 2007 @@ -144,6 +144,11 @@ PyObject *func, *alist = NULL, *kwdict = NULL; PyObject *t = NULL, *retval = NULL; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "apply() not supported in 3.x") < 0) + return NULL; + if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict)) return NULL; if (alist != NULL) { @@ -186,6 +191,10 @@ static PyObject * builtin_callable(PyObject *self, PyObject *v) { + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "callable() not supported in 3.x") < 0) + return NULL; return PyBool_FromLong((long)PyCallable_Check(v)); } @@ -384,6 +393,11 @@ PyObject *v, *w; PyObject *res; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "coerce() not supported in 3.x") < 0) + return NULL; + if (!PyArg_UnpackTuple(args, "coerce", 2, 2, &v, &w)) return NULL; if (PyNumber_Coerce(&v, &w) < 0) @@ -402,7 +416,7 @@ If coercion is not possible, raise TypeError."); static PyObject * -builtin_compile(PyObject *self, PyObject *args) +builtin_compile(PyObject *self, PyObject *args, PyObject *kwds) { char *str; char *filename; @@ -413,9 +427,12 @@ PyCompilerFlags cf; PyObject *result = NULL, *cmd, *tmp = NULL; Py_ssize_t length; + static char *kwlist[] = {"source", "filename", "mode", "flags", + "dont_inherit", NULL}; - if (!PyArg_ParseTuple(args, "Oss|ii:compile", &cmd, &filename, - &startstr, &supplied_flags, &dont_inherit)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "Oss|ii:compile", + kwlist, &cmd, &filename, &startstr, + &supplied_flags, &dont_inherit)) return NULL; cf.cf_flags = supplied_flags; @@ -495,15 +512,16 @@ PyDoc_STRVAR(dir_doc, "dir([object]) -> list of strings\n" "\n" -"Return an alphabetized list of names comprising (some of) the attributes\n" -"of the given object, and of attributes reachable from it:\n" -"\n" -"No argument: the names in the current scope.\n" -"Module object: the module attributes.\n" -"Type or class object: its attributes, and recursively the attributes of\n" -" its bases.\n" -"Otherwise: its attributes, its class's attributes, and recursively the\n" -" attributes of its class's base classes."); +"If called without an argument, return the names in the current scope.\n" +"Else, return an alphabetized list of names comprising (some of) the attributes\n" +"of the given object, and of attributes reachable from it.\n" +"If the object supplies a method named __dir__, it will be used; otherwise\n" +"the default dir() logic is used and returns:\n" +" for a module object: the module's attributes.\n" +" for a class object: its attributes, and recursively the attributes\n" +" of its bases.\n" +" for any other object: its attributes, its class's attributes, and\n" +" recursively the attributes of its class's base classes."); static PyObject * builtin_divmod(PyObject *self, PyObject *args) @@ -622,6 +640,11 @@ PyCompilerFlags cf; int exists; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "execfile() not supported in 3.x") < 0) + return NULL; + if (!PyArg_ParseTuple(args, "s|O!O:execfile", &filename, &PyDict_Type, &globals, @@ -1798,6 +1821,11 @@ { PyObject *seq, *func, *result = NULL, *it; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "reduce() not supported in 3.x") < 0) + return NULL; + if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result)) return NULL; if (result != NULL) @@ -1870,6 +1898,11 @@ static PyObject * builtin_reload(PyObject *self, PyObject *v) { + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "reload() not supported in 3.x") < 0) + return NULL; + return PyImport_ReloadModule(v); } @@ -2243,7 +2276,7 @@ {"chr", builtin_chr, METH_VARARGS, chr_doc}, {"cmp", builtin_cmp, METH_VARARGS, cmp_doc}, {"coerce", builtin_coerce, METH_VARARGS, coerce_doc}, - {"compile", builtin_compile, METH_VARARGS, compile_doc}, + {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, {"dir", builtin_dir, METH_VARARGS, dir_doc}, {"divmod", builtin_divmod, METH_VARARGS, divmod_doc}, Modified: python/branches/bcannon-objcap/Python/ceval.c ============================================================================== --- python/branches/bcannon-objcap/Python/ceval.c (original) +++ python/branches/bcannon-objcap/Python/ceval.c Fri May 25 22:13:08 2007 @@ -490,7 +490,6 @@ PyObject * PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals) { - /* XXX raise SystemError if globals is NULL */ return PyEval_EvalCodeEx(co, globals, locals, (PyObject **)NULL, 0, @@ -662,7 +661,7 @@ #define STACKADJ(n) { (void)(BASIC_STACKADJ(n), \ lltrace && prtrace(TOP(), "stackadj")); \ assert(STACK_LEVEL() <= co->co_stacksize); } -#define EXT_POP(STACK_POINTER) (lltrace && prtrace(*(STACK_POINTER), "ext_pop"), *--(STACK_POINTER)) +#define EXT_POP(STACK_POINTER) (lltrace && prtrace((STACK_POINTER)[-1], "ext_pop"), *--(STACK_POINTER)) #else #define PUSH(v) BASIC_PUSH(v) #define POP() BASIC_POP() @@ -1774,12 +1773,10 @@ PUSH(w); } } else if (unpack_iterable(v, oparg, - stack_pointer + oparg)) + stack_pointer + oparg)) { stack_pointer += oparg; - else { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_SetString(PyExc_TypeError, - "unpack non-sequence"); + } else { + /* unpack_iterable() raised an exception */ why = WHY_EXCEPTION; } Py_DECREF(v); @@ -3793,13 +3790,31 @@ if (flags & CALL_FLAG_KW) { kwdict = EXT_POP(*pp_stack); - if (!(kwdict && PyDict_Check(kwdict))) { - PyErr_Format(PyExc_TypeError, - "%s%s argument after ** " - "must be a dictionary", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func)); - goto ext_call_fail; + if (!PyDict_Check(kwdict)) { + PyObject *d; + d = PyDict_New(); + if (d == NULL) + goto ext_call_fail; + if (PyDict_Update(d, kwdict) != 0) { + Py_DECREF(d); + /* PyDict_Update raises attribute + * error (percolated from an attempt + * to get 'keys' attribute) instead of + * a type error if its second argument + * is not a mapping. + */ + if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_TypeError, + "%.200s%.200s argument after ** " + "must be a mapping, not %.200s", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func), + kwdict->ob_type->tp_name); + } + goto ext_call_fail; + } + Py_DECREF(kwdict); + kwdict = d; } } if (flags & CALL_FLAG_VAR) { @@ -3810,10 +3825,11 @@ if (t == NULL) { if (PyErr_ExceptionMatches(PyExc_TypeError)) { PyErr_Format(PyExc_TypeError, - "%s%s argument after * " - "must be a sequence", + "%.200s%.200s argument after * " + "must be a sequence, not %200s", PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func)); + PyEval_GetFuncDesc(func), + stararg->ob_type->tp_name); } goto ext_call_fail; } @@ -3927,7 +3943,7 @@ PyTypeObject *tp = u->ob_type; PySequenceMethods *sq = tp->tp_as_sequence; - if (sq && sq->sq_slice && ISINDEX(v) && ISINDEX(w)) { + if (sq && sq->sq_ass_slice && ISINDEX(v) && ISINDEX(w)) { Py_ssize_t ilow = 0, ihigh = PY_SSIZE_T_MAX; if (!_PyEval_SliceIndex(v, &ilow)) return -1; @@ -4115,7 +4131,8 @@ metaclass = (PyObject *) &PyClass_Type; Py_INCREF(metaclass); } - result = PyObject_CallFunctionObjArgs(metaclass, name, bases, methods, NULL); + result = PyObject_CallFunctionObjArgs(metaclass, name, bases, methods, + NULL); Py_DECREF(metaclass); if (result == NULL && PyErr_ExceptionMatches(PyExc_TypeError)) { /* A type error here likely means that the user passed @@ -4129,7 +4146,8 @@ if (PyString_Check(pvalue)) { PyObject *newmsg; newmsg = PyString_FromFormat( - "Error when calling the metaclass bases\n %s", + "Error when calling the metaclass bases\n" + " %s", PyString_AS_STRING(pvalue)); if (newmsg != NULL) { Py_DECREF(pvalue); @@ -4203,6 +4221,8 @@ FILE *fp = PyFile_AsFile(prog); char *name = PyString_AsString(PyFile_Name(prog)); PyCompilerFlags cf; + if (name == NULL) + return -1; cf.cf_flags = 0; if (PyEval_MergeCompilerFlags(&cf)) v = PyRun_FileFlags(fp, name, Py_file_input, globals, Modified: python/branches/bcannon-objcap/Python/compile.c ============================================================================== --- python/branches/bcannon-objcap/Python/compile.c (original) +++ python/branches/bcannon-objcap/Python/compile.c Fri May 25 22:13:08 2007 @@ -8,7 +8,7 @@ * 2. Builds a symbol table. See symtable.c. * 3. Generate code for basic blocks. See compiler_mod() in this file. * 4. Assemble the basic blocks into final code. See assemble() in - * this file. + * this file. * 5. Optimize the byte code (peephole optimizations). See peephole.c * * Note that compiler_mod() suggests module, but the module ast type @@ -194,7 +194,17 @@ } p = PyString_AsString(privateobj); nlen = strlen(name); - if (name[nlen-1] == '_' && name[nlen-2] == '_') { + /* Don't mangle __id__ or names with dots. + + The only time a name with a dot can occur is when + we are compiling an import statement that has a + package name. + + TODO(jhylton): Decide whether we want to support + mangling of the module name, e.g. __M.X. + */ + if ((name[nlen-1] == '_' && name[nlen-2] == '_') + || strchr(name, '.')) { Py_INCREF(ident); return ident; /* Don't mangle __whatever__ */ } @@ -429,7 +439,7 @@ struct compiler_unit *u; u = (struct compiler_unit *)PyObject_Malloc(sizeof( - struct compiler_unit)); + struct compiler_unit)); if (!u) { PyErr_NoMemory(); return 0; @@ -597,7 +607,7 @@ assert(b != NULL); if (b->b_instr == NULL) { b->b_instr = (struct instr *)PyObject_Malloc( - sizeof(struct instr) * DEFAULT_BLOCK_SIZE); + sizeof(struct instr) * DEFAULT_BLOCK_SIZE); if (b->b_instr == NULL) { PyErr_NoMemory(); return -1; @@ -617,7 +627,7 @@ } b->b_ialloc <<= 1; tmp = (struct instr *)PyObject_Realloc( - (void *)b->b_instr, newsize); + (void *)b->b_instr, newsize); if (tmp == NULL) { PyErr_NoMemory(); return -1; @@ -1144,7 +1154,7 @@ case Interactive_kind: c->c_interactive = 1; VISIT_SEQ_IN_SCOPE(c, stmt, - mod->v.Interactive.body); + mod->v.Interactive.body); break; case Expression_kind: VISIT_IN_SCOPE(c, expr, mod->v.Expression.body); @@ -1528,7 +1538,7 @@ compiler_use_next_block(c, next); ADDOP(c, POP_TOP); if (s->v.If.orelse) - VISIT_SEQ(c, stmt, s->v.If.orelse); + VISIT_SEQ(c, stmt, s->v.If.orelse); } compiler_use_next_block(c, end); return 1; @@ -1776,8 +1786,8 @@ s->v.TryExcept.handlers, i); if (!handler->type && i < n-1) return compiler_error(c, "default 'except:' must be last"); - c->u->u_lineno_set = false; - c->u->u_lineno = handler->lineno; + c->u->u_lineno_set = false; + c->u->u_lineno = handler->lineno; except = compiler_new_block(c); if (except == NULL) return 0; @@ -2099,7 +2109,7 @@ case Pass_kind: break; case Break_kind: - if (!compiler_in_loop(c)) + if (!compiler_in_loop(c)) return compiler_error(c, "'break' outside loop"); ADDOP(c, BREAK_LOOP); break; @@ -2243,7 +2253,7 @@ return compiler_error(c, "can not assign to __debug__"); } - mangled = _Py_Mangle(c->u->u_private, name); +mangled = _Py_Mangle(c->u->u_private, name); if (!mangled) return 0; @@ -2429,20 +2439,20 @@ if (cleanup == NULL) return 0; VISIT(c, expr, - (expr_ty)asdl_seq_GET(e->v.Compare.comparators, 0)); + (expr_ty)asdl_seq_GET(e->v.Compare.comparators, 0)); } for (i = 1; i < n; i++) { ADDOP(c, DUP_TOP); ADDOP(c, ROT_THREE); ADDOP_I(c, COMPARE_OP, cmpop((cmpop_ty)(asdl_seq_GET( - e->v.Compare.ops, i - 1)))); + e->v.Compare.ops, i - 1)))); ADDOP_JREL(c, JUMP_IF_FALSE, cleanup); NEXT_BLOCK(c); ADDOP(c, POP_TOP); if (i < (n - 1)) VISIT(c, expr, - (expr_ty)asdl_seq_GET(e->v.Compare.comparators, i)); + (expr_ty)asdl_seq_GET(e->v.Compare.comparators, i)); } VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n - 1)); ADDOP_I(c, COMPARE_OP, @@ -2726,7 +2736,7 @@ /* __debug__ is not assignable, so we can optimize * it away in if and while statements */ if (strcmp(PyString_AS_STRING(e->v.Name.id), - "__debug__") == 0) + "__debug__") == 0) return ! Py_OptimizeFlag; /* fall through */ default: @@ -2873,8 +2883,8 @@ int i, n; /* If expr e has a different line number than the last expr/stmt, - set a new line number for the next instruction. - */ + set a new line number for the next instruction. + */ if (e->lineno > c->u->u_lineno) { c->u->u_lineno = e->lineno; c->u->u_lineno_set = false; @@ -2904,10 +2914,10 @@ for (i = 0; i < n; i++) { ADDOP(c, DUP_TOP); VISIT(c, expr, - (expr_ty)asdl_seq_GET(e->v.Dict.values, i)); + (expr_ty)asdl_seq_GET(e->v.Dict.values, i)); ADDOP(c, ROT_TWO); VISIT(c, expr, - (expr_ty)asdl_seq_GET(e->v.Dict.keys, i)); + (expr_ty)asdl_seq_GET(e->v.Dict.keys, i)); ADDOP(c, STORE_SUBSCR); } break; @@ -3079,13 +3089,13 @@ static int compiler_in_loop(struct compiler *c) { - int i; - struct compiler_unit *u = c->u; - for (i = 0; i < u->u_nfblocks; ++i) { - if (u->u_fblock[i].fb_type == LOOP) - return 1; - } - return 0; + int i; + struct compiler_unit *u = c->u; + for (i = 0; i < u->u_nfblocks; ++i) { + if (u->u_fblock[i].fb_type == LOOP) + return 1; + } + return 0; } /* Raises a SyntaxError and returns 0. If something goes wrong, a different exception may be raised. @@ -3280,7 +3290,7 @@ int i, n = asdl_seq_LEN(s->v.ExtSlice.dims); for (i = 0; i < n; i++) { slice_ty sub = (slice_ty)asdl_seq_GET( - s->v.ExtSlice.dims, i); + s->v.ExtSlice.dims, i); if (!compiler_visit_nested_slice(c, sub, ctx)) return 0; } @@ -3478,7 +3488,7 @@ increment is < 256. So, in the example above, assemble_lnotab (it used to be called com_set_lineno) should not (as was actually done until 2.2) expand 300, 300 to 255, 255, 45, 45, - but to 255, 0, 45, 255, 0, 45. + but to 255, 0, 45, 255, 0, 45. */ static int Modified: python/branches/bcannon-objcap/Python/dynload_win.c ============================================================================== --- python/branches/bcannon-objcap/Python/dynload_win.c (original) +++ python/branches/bcannon-objcap/Python/dynload_win.c Fri May 25 22:13:08 2007 @@ -13,16 +13,8 @@ const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef _DEBUG {"_d.pyd", "rb", C_EXTENSION}, - /* Temporarily disable .dll, to avoid conflicts between sqlite3.dll - and the sqlite3 package. If this needs to be reverted for 2.5, - some other solution for the naming conflict must be found. - {"_d.dll", "rb", C_EXTENSION}, - */ #else {".pyd", "rb", C_EXTENSION}, - /* Likewise - {".dll", "rb", C_EXTENSION}, - */ #endif {0, 0} }; Modified: python/branches/bcannon-objcap/Python/errors.c ============================================================================== --- python/branches/bcannon-objcap/Python/errors.c (original) +++ python/branches/bcannon-objcap/Python/errors.c Fri May 25 22:13:08 2007 @@ -590,8 +590,9 @@ PyFile_WriteString("Exception ", f); if (t) { PyObject* moduleName; - char* className = PyExceptionClass_Name(t); - + char* className; + assert(PyExceptionClass_Check(t)); + className = PyExceptionClass_Name(t); if (className != NULL) { char *dot = strrchr(className, '.'); if (dot != NULL) @@ -603,7 +604,8 @@ PyFile_WriteString("", f); else { char* modstr = PyString_AsString(moduleName); - if (modstr) + if (modstr && + strcmp(modstr, "exceptions") != 0) { PyFile_WriteString(modstr, f); PyFile_WriteString(".", f); Deleted: /python/branches/bcannon-objcap/Python/fmod.c ============================================================================== --- /python/branches/bcannon-objcap/Python/fmod.c Fri May 25 22:13:08 2007 +++ (empty file) @@ -1,27 +0,0 @@ - -/* Portable fmod(x, y) implementation for systems that don't have it */ - -#include "pyconfig.h" - -#include "pyport.h" -#include - -double -fmod(double x, double y) -{ - double i, f; - - if (y == 0.0) { - errno = EDOM; - return 0.0; - } - - /* return f such that x = i*y + f for some integer i - such that |f| < |y| and f has the same sign as x */ - - i = floor(x/y); - f = x - i*y; - if ((x < 0.0) != (y < 0.0)) - f = f-y; - return f; -} Modified: python/branches/bcannon-objcap/Python/graminit.c ============================================================================== --- python/branches/bcannon-objcap/Python/graminit.c (original) +++ python/branches/bcannon-objcap/Python/graminit.c Fri May 25 22:13:08 2007 @@ -931,7 +931,8 @@ {26, 2}, {0, 1}, }; -static arc arcs_42_2[2] = { +static arc arcs_42_2[3] = { + {78, 3}, {27, 3}, {0, 2}, }; @@ -944,7 +945,7 @@ static state states_42[5] = { {1, arcs_42_0}, {2, arcs_42_1}, - {2, arcs_42_2}, + {3, arcs_42_2}, {1, arcs_42_3}, {1, arcs_42_4}, }; Modified: python/branches/bcannon-objcap/Python/import.c ============================================================================== --- python/branches/bcannon-objcap/Python/import.c (original) +++ python/branches/bcannon-objcap/Python/import.c Fri May 25 22:13:08 2007 @@ -4,6 +4,7 @@ #include "Python.h" #include "Python-ast.h" +#undef Yield /* undefine macro conflicting with winbase.h */ #include "pyarena.h" #include "pythonrun.h" #include "errcode.h" @@ -340,6 +341,14 @@ return Py_None; } +static void +imp_modules_reloading_clear(void) +{ + PyInterpreterState *interp = PyThreadState_Get()->interp; + if (interp->modules_reloading != NULL) + PyDict_Clear(interp->modules_reloading); +} + /* Helper for sys */ PyObject * @@ -499,6 +508,7 @@ PyDict_Clear(modules); interp->modules = NULL; Py_DECREF(modules); + Py_CLEAR(interp->modules_reloading); } @@ -2410,13 +2420,21 @@ PyObject * PyImport_ReloadModule(PyObject *m) { + PyInterpreterState *interp = PyThreadState_Get()->interp; + PyObject *modules_reloading = interp->modules_reloading; PyObject *modules = PyImport_GetModuleDict(); - PyObject *path = NULL, *loader = NULL; + PyObject *path = NULL, *loader = NULL, *existing_m = NULL; char *name, *subname; char buf[MAXPATHLEN+1]; struct filedescr *fdp; FILE *fp = NULL; PyObject *newm; + + if (modules_reloading == NULL) { + Py_FatalError("PyImport_ReloadModule: " + "no modules_reloading dictionary!"); + return NULL; + } if (m == NULL || !PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, @@ -2432,20 +2450,33 @@ name); return NULL; } + existing_m = PyDict_GetItemString(modules_reloading, name); + if (existing_m != NULL) { + /* Due to a recursive reload, this module is already + being reloaded. */ + Py_INCREF(existing_m); + return existing_m; + } + if (PyDict_SetItemString(modules_reloading, name, m) < 0) + return NULL; + subname = strrchr(name, '.'); if (subname == NULL) subname = name; else { PyObject *parentname, *parent; parentname = PyString_FromStringAndSize(name, (subname-name)); - if (parentname == NULL) + if (parentname == NULL) { + imp_modules_reloading_clear(); return NULL; + } parent = PyDict_GetItem(modules, parentname); if (parent == NULL) { PyErr_Format(PyExc_ImportError, "reload(): parent %.200s not in sys.modules", PyString_AS_STRING(parentname)); Py_DECREF(parentname); + imp_modules_reloading_clear(); return NULL; } Py_DECREF(parentname); @@ -2460,6 +2491,7 @@ if (fdp == NULL) { Py_XDECREF(loader); + imp_modules_reloading_clear(); return NULL; } @@ -2476,6 +2508,7 @@ */ PyDict_SetItemString(modules, name, m); } + imp_modules_reloading_clear(); return newm; } @@ -2545,7 +2578,7 @@ if (import == NULL) goto err; - /* Call the _import__ function with the proper argument list */ + /* Call the __import__ function with the proper argument list */ r = PyObject_CallFunctionObjArgs(import, module_name, globals, globals, silly_list, NULL); Modified: python/branches/bcannon-objcap/Python/marshal.c ============================================================================== --- python/branches/bcannon-objcap/Python/marshal.c (original) +++ python/branches/bcannon-objcap/Python/marshal.c Fri May 25 22:13:08 2007 @@ -15,7 +15,7 @@ * and risks coring the interpreter. When the object stack gets this deep, * raise an exception instead of continuing. */ -#define MAX_MARSHAL_STACK_DEPTH 5000 +#define MAX_MARSHAL_STACK_DEPTH 2000 #define TYPE_NULL '0' #define TYPE_NONE 'N' @@ -246,9 +246,16 @@ goto exit; } else { + int ok; o = PyInt_FromSsize_t(PyDict_Size(p->strings)); - PyDict_SetItem(p->strings, v, o); - Py_DECREF(o); + ok = o && + PyDict_SetItem(p->strings, v, o) >= 0; + Py_XDECREF(o); + if (!ok) { + p->depth--; + p->error = 1; + return; + } w_byte(TYPE_INTERNED, p); } } @@ -413,7 +420,7 @@ typedef WFILE RFILE; /* Same struct with different invariants */ -#define rs_byte(p) (((p)->ptr != (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) +#define rs_byte(p) (((p)->ptr < (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) #define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p)) @@ -504,42 +511,60 @@ PyObject *v, *v2, *v3; long i, n; int type = r_byte(p); + PyObject *retval; + + p->depth++; + + if (p->depth > MAX_MARSHAL_STACK_DEPTH) { + p->depth--; + PyErr_SetString(PyExc_ValueError, "recursion limit exceeded"); + return NULL; + } switch (type) { case EOF: PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; case TYPE_NULL: - return NULL; + retval = NULL; + break; case TYPE_NONE: Py_INCREF(Py_None); - return Py_None; + retval = Py_None; + break; case TYPE_STOPITER: Py_INCREF(PyExc_StopIteration); - return PyExc_StopIteration; + retval = PyExc_StopIteration; + break; case TYPE_ELLIPSIS: Py_INCREF(Py_Ellipsis); - return Py_Ellipsis; + retval = Py_Ellipsis; + break; case TYPE_FALSE: Py_INCREF(Py_False); - return Py_False; + retval = Py_False; + break; case TYPE_TRUE: Py_INCREF(Py_True); - return Py_True; + retval = Py_True; + break; case TYPE_INT: - return PyInt_FromLong(r_long(p)); + retval = PyInt_FromLong(r_long(p)); + break; case TYPE_INT64: - return r_long64(p); + retval = r_long64(p); + break; case TYPE_LONG: { @@ -549,12 +574,15 @@ if (n < -INT_MAX || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } size = n<0 ? -n : n; ob = _PyLong_New(size); - if (ob == NULL) - return NULL; + if (ob == NULL) { + retval = NULL; + break; + } ob->ob_size = n; for (i = 0; i < size; i++) { int digit = r_short(p); @@ -562,11 +590,14 @@ Py_DECREF(ob); PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + ob = NULL; + break; } - ob->ob_digit[i] = digit; + if (ob != NULL) + ob->ob_digit[i] = digit; } - return (PyObject *)ob; + retval = (PyObject *)ob; + break; } case TYPE_FLOAT: @@ -577,13 +608,16 @@ if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } buf[n] = '\0'; - PyFPE_START_PROTECT("atof", return 0) + retval = NULL; + PyFPE_START_PROTECT("atof", break) dx = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(dx) - return PyFloat_FromDouble(dx); + retval = PyFloat_FromDouble(dx); + break; } case TYPE_BINARY_FLOAT: @@ -593,13 +627,16 @@ if (r_string((char*)buf, 8, p) != 8) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } x = _PyFloat_Unpack8(buf, 1); if (x == -1.0 && PyErr_Occurred()) { - return NULL; + retval = NULL; + break; } - return PyFloat_FromDouble(x); + retval = PyFloat_FromDouble(x); + break; } #ifndef WITHOUT_COMPLEX @@ -611,23 +648,27 @@ if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } buf[n] = '\0'; - PyFPE_START_PROTECT("atof", return 0) + retval = NULL; + PyFPE_START_PROTECT("atof", break;) c.real = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(c) n = r_byte(p); if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } buf[n] = '\0'; - PyFPE_START_PROTECT("atof", return 0) + PyFPE_START_PROTECT("atof", break) c.imag = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(c) - return PyComplex_FromCComplex(c); + retval = PyComplex_FromCComplex(c); + break; } case TYPE_BINARY_COMPLEX: @@ -637,22 +678,27 @@ if (r_string((char*)buf, 8, p) != 8) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } c.real = _PyFloat_Unpack8(buf, 1); if (c.real == -1.0 && PyErr_Occurred()) { - return NULL; + retval = NULL; + break; } if (r_string((char*)buf, 8, p) != 8) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } c.imag = _PyFloat_Unpack8(buf, 1); if (c.imag == -1.0 && PyErr_Occurred()) { - return NULL; + retval = NULL; + break; } - return PyComplex_FromCComplex(c); + retval = PyComplex_FromCComplex(c); + break; } #endif @@ -661,32 +707,42 @@ n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyString_FromStringAndSize((char *)NULL, n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { Py_DECREF(v); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } if (type == TYPE_INTERNED) { PyString_InternInPlace(&v); - PyList_Append(p->strings, v); + if (PyList_Append(p->strings, v) < 0) { + retval = NULL; + break; + } } - return v; + retval = v; + break; case TYPE_STRINGREF: n = r_long(p); if (n < 0 || n >= PyList_GET_SIZE(p->strings)) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyList_GET_ITEM(p->strings, n); Py_INCREF(v); - return v; + retval = v; + break; #ifdef Py_USING_UNICODE case TYPE_UNICODE: @@ -696,20 +752,25 @@ n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } buffer = PyMem_NEW(char, n); - if (buffer == NULL) - return PyErr_NoMemory(); + if (buffer == NULL) { + retval = PyErr_NoMemory(); + break; + } if (r_string(buffer, (int)n, p) != n) { PyMem_DEL(buffer); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); - return NULL; + retval = NULL; + break; } v = PyUnicode_DecodeUTF8(buffer, n, NULL); PyMem_DEL(buffer); - return v; + retval = v; + break; } #endif @@ -717,11 +778,14 @@ n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyTuple_New((int)n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } for (i = 0; i < n; i++) { v2 = r_object(p); if ( v2 == NULL ) { @@ -734,17 +798,21 @@ } PyTuple_SET_ITEM(v, (int)i, v2); } - return v; + retval = v; + break; case TYPE_LIST: n = r_long(p); if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyList_New((int)n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } for (i = 0; i < n; i++) { v2 = r_object(p); if ( v2 == NULL ) { @@ -755,14 +823,17 @@ v = NULL; break; } - PyList_SetItem(v, (int)i, v2); + PyList_SET_ITEM(v, (int)i, v2); } - return v; + retval = v; + break; case TYPE_DICT: v = PyDict_New(); - if (v == NULL) - return NULL; + if (v == NULL) { + retval = NULL; + break; + } for (;;) { PyObject *key, *val; key = r_object(p); @@ -778,18 +849,22 @@ Py_DECREF(v); v = NULL; } - return v; + retval = v; + break; case TYPE_SET: case TYPE_FROZENSET: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } v = PyTuple_New((int)n); - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } for (i = 0; i < n; i++) { v2 = r_object(p); if ( v2 == NULL ) { @@ -802,21 +877,25 @@ } PyTuple_SET_ITEM(v, (int)i, v2); } - if (v == NULL) - return v; + if (v == NULL) { + retval = NULL; + break; + } if (type == TYPE_SET) v3 = PySet_New(v); else v3 = PyFrozenSet_New(v); Py_DECREF(v); - return v3; + retval = v3; + break; case TYPE_CODE: if (PyEval_GetRestricted()) { PyErr_SetString(PyExc_RuntimeError, "cannot unmarshal code objects in " "restricted execution mode"); - return NULL; + retval = NULL; + break; } else { int argcount; @@ -888,15 +967,19 @@ Py_XDECREF(lnotab); } - return v; + retval = v; + break; default: /* Bogus data got written, which isn't ideal. This will let you keep working and recover. */ PyErr_SetString(PyExc_ValueError, "bad marshal data"); - return NULL; + retval = NULL; + break; } + p->depth--; + return retval; } static PyObject * @@ -1002,6 +1085,7 @@ PyObject *result; rf.fp = fp; rf.strings = PyList_New(0); + rf.depth = 0; result = r_object(&rf); Py_DECREF(rf.strings); return result; @@ -1016,6 +1100,7 @@ rf.ptr = str; rf.end = str + len; rf.strings = PyList_New(0); + rf.depth = 0; result = r_object(&rf); Py_DECREF(rf.strings); return result; @@ -1104,6 +1189,7 @@ } rf.fp = PyFile_AsFile(f); rf.strings = PyList_New(0); + rf.depth = 0; result = read_object(&rf); Py_DECREF(rf.strings); return result; @@ -1132,6 +1218,7 @@ rf.ptr = s; rf.end = s + n; rf.strings = PyList_New(0); + rf.depth = 0; result = read_object(&rf); Py_DECREF(rf.strings); return result; Modified: python/branches/bcannon-objcap/Python/peephole.c ============================================================================== --- python/branches/bcannon-objcap/Python/peephole.c (original) +++ python/branches/bcannon-objcap/Python/peephole.c Fri May 25 22:13:08 2007 @@ -1,4 +1,4 @@ -/* Peehole optimizations for bytecode compiler. */ +/* Peephole optimizations for bytecode compiler. */ #include "Python.h" @@ -386,13 +386,17 @@ if (name == NULL || strcmp(name, "None") != 0) continue; for (j=0 ; j < PyList_GET_SIZE(consts) ; j++) { - if (PyList_GET_ITEM(consts, j) == Py_None) { - codestr[i] = LOAD_CONST; - SETARG(codestr, i, j); - cumlc = lastlc + 1; + if (PyList_GET_ITEM(consts, j) == Py_None) break; - } } + if (j == PyList_GET_SIZE(consts)) { + if (PyList_Append(consts, Py_None) == -1) + goto exitUnchanged; + } + assert(PyList_GET_ITEM(consts, j) == Py_None); + codestr[i] = LOAD_CONST; + SETARG(codestr, i, j); + cumlc = lastlc + 1; break; /* Skip over LOAD_CONST trueconst Modified: python/branches/bcannon-objcap/Python/pystate.c ============================================================================== --- python/branches/bcannon-objcap/Python/pystate.c (original) +++ python/branches/bcannon-objcap/Python/pystate.c Fri May 25 22:13:08 2007 @@ -68,6 +68,7 @@ Py_FatalError("Can't initialize threads for interpreter"); #endif interp->modules = NULL; + interp->modules_reloading = NULL; interp->sysdict = NULL; interp->builtins = NULL; interp->tstate_head = NULL; @@ -107,6 +108,7 @@ Py_CLEAR(interp->codec_search_cache); Py_CLEAR(interp->codec_error_registry); Py_CLEAR(interp->modules); + Py_CLEAR(interp->modules_reloading); Py_CLEAR(interp->sysdict); Py_CLEAR(interp->builtins); } Modified: python/branches/bcannon-objcap/Python/pythonrun.c ============================================================================== --- python/branches/bcannon-objcap/Python/pythonrun.c (original) +++ python/branches/bcannon-objcap/Python/pythonrun.c Fri May 25 22:13:08 2007 @@ -4,6 +4,7 @@ #include "Python.h" #include "Python-ast.h" +#undef Yield /* undefine macro conflicting with winbase.h */ #include "grammar.h" #include "node.h" #include "token.h" @@ -69,6 +70,7 @@ int Py_DebugFlag; /* Needed by parser.c */ int Py_VerboseFlag; /* Needed by import.c */ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ +int Py_InspectFlag; /* Needed to determine whether to exit at SystemError */ int Py_NoSiteFlag; /* Suppress 'import site' */ int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */ int Py_FrozenFlag; /* Needed by getpath.c */ @@ -199,6 +201,9 @@ interp->modules = PyDict_New(); if (interp->modules == NULL) Py_FatalError("Py_Initialize: can't make modules dictionary"); + interp->modules_reloading = PyDict_New(); + if (interp->modules_reloading == NULL) + Py_FatalError("Py_Initialize: can't make modules_reloading dictionary"); #ifdef Py_USING_UNICODE /* Init Unicode implementation; relies on the codec registry */ @@ -546,6 +551,7 @@ /* XXX The following is lax in error checking */ interp->modules = PyDict_New(); + interp->modules_reloading = PyDict_New(); bimod = _PyImport_FindExtension("__builtin__", "__builtin__"); if (bimod != NULL) { @@ -864,6 +870,7 @@ { PyObject *m, *d, *v; const char *ext; + int set_file_name = 0, ret; m = PyImport_AddModule("__main__"); if (m == NULL) @@ -877,6 +884,7 @@ Py_DECREF(f); return -1; } + set_file_name = 1; Py_DECREF(f); } ext = filename + strlen(filename) - 4; @@ -886,7 +894,8 @@ fclose(fp); if ((fp = fopen(filename, "rb")) == NULL) { fprintf(stderr, "python: Can't reopen .pyc file\n"); - return -1; + ret = -1; + goto done; } /* Turn on optimization if a .pyo file is given */ if (strcmp(ext, ".pyo") == 0) @@ -898,12 +907,17 @@ } if (v == NULL) { PyErr_Print(); - return -1; + ret = -1; + goto done; } Py_DECREF(v); if (Py_FlushLine()) PyErr_Clear(); - return 0; + ret = 0; + done: + if (set_file_name && PyDict_DelItemString(d, "__file__")) + PyErr_Clear(); + return ret; } int @@ -1035,6 +1049,11 @@ PyObject *exception, *value, *tb; int exitcode = 0; + if (Py_InspectFlag) + /* Don't exit if -i flag was given. This flag is set to 0 + * when entering interactive mode for inspecting. */ + return; + PyErr_Fetch(&exception, &value, &tb); if (Py_FlushLine()) PyErr_Clear(); @@ -1228,8 +1247,8 @@ err = PyFile_WriteObject(s, f, Py_PRINT_RAW); Py_XDECREF(s); } - if (err == 0) - err = PyFile_WriteString("\n", f); + /* try to write a newline in any case */ + err += PyFile_WriteString("\n", f); } Py_DECREF(value); /* If an error happened here, don't show it. @@ -1267,12 +1286,12 @@ mod = PyParser_ASTFromFile(fp, filename, start, 0, 0, flags, NULL, arena); + if (closeit) + fclose(fp); if (mod == NULL) { PyArena_Free(arena); return NULL; } - if (closeit) - fclose(fp); ret = run_mod(mod, filename, globals, locals, flags, arena); PyArena_Free(arena); return ret; Modified: python/branches/bcannon-objcap/Python/sysmodule.c ============================================================================== --- python/branches/bcannon-objcap/Python/sysmodule.c (original) +++ python/branches/bcannon-objcap/Python/sysmodule.c Fri May 25 22:13:08 2007 @@ -1012,8 +1012,6 @@ } else if (istag || strncmp(br_start, "branches", 8) == 0) { len = br_end2 - br_start; - assert(len >= 13); - assert(len < (sizeof(patchlevel_revision) - 13)); strncpy(branch, br_start, len); branch[len] = '\0'; @@ -1032,6 +1030,8 @@ svn_revision = svnversion; else if (istag) { len = strlen(_patchlevel_revision); + assert(len >= 13); + assert(len < (sizeof(patchlevel_revision) + 13)); strncpy(patchlevel_revision, _patchlevel_revision + 11, len - 13); patchlevel_revision[len - 13] = '\0'; Modified: python/branches/bcannon-objcap/Python/thread_nt.h ============================================================================== --- python/branches/bcannon-objcap/Python/thread_nt.h (original) +++ python/branches/bcannon-objcap/Python/thread_nt.h Fri May 25 22:13:08 2007 @@ -15,72 +15,16 @@ HANDLE hevent ; } NRMUTEX, *PNRMUTEX ; -typedef PVOID WINAPI interlocked_cmp_xchg_t(PVOID *dest, PVOID exc, PVOID comperand) ; - -/* Sorry mate, but we haven't got InterlockedCompareExchange in Win95! */ -static PVOID WINAPI -interlocked_cmp_xchg(PVOID *dest, PVOID exc, PVOID comperand) -{ - static LONG spinlock = 0 ; - PVOID result ; - DWORD dwSleep = 0; - - /* Acqire spinlock (yielding control to other threads if cant aquire for the moment) */ - while(InterlockedExchange(&spinlock, 1)) - { - // Using Sleep(0) can cause a priority inversion. - // Sleep(0) only yields the processor if there's - // another thread of the same priority that's - // ready to run. If a high-priority thread is - // trying to acquire the lock, which is held by - // a low-priority thread, then the low-priority - // thread may never get scheduled and hence never - // free the lock. NT attempts to avoid priority - // inversions by temporarily boosting the priority - // of low-priority runnable threads, but the problem - // can still occur if there's a medium-priority - // thread that's always runnable. If Sleep(1) is used, - // then the thread unconditionally yields the CPU. We - // only do this for the second and subsequent even - // iterations, since a millisecond is a long time to wait - // if the thread can be scheduled in again sooner - // (~100,000 instructions). - // Avoid priority inversion: 0, 1, 0, 1,... - Sleep(dwSleep); - dwSleep = !dwSleep; - } - result = *dest ; - if (result == comperand) - *dest = exc ; - /* Release spinlock */ - spinlock = 0 ; - return result ; -} ; - -static interlocked_cmp_xchg_t *ixchg; BOOL InitializeNonRecursiveMutex(PNRMUTEX mutex) { - if (!ixchg) - { - /* Sorely, Win95 has no InterlockedCompareExchange API (Win98 has), so we have to use emulation */ - HANDLE kernel = GetModuleHandle("kernel32.dll") ; - if (!kernel || (ixchg = (interlocked_cmp_xchg_t *)GetProcAddress(kernel, "InterlockedCompareExchange")) == NULL) - ixchg = interlocked_cmp_xchg ; - } - mutex->owned = -1 ; /* No threads have entered NonRecursiveMutex */ mutex->thread_id = 0 ; mutex->hevent = CreateEvent(NULL, FALSE, FALSE, NULL) ; return mutex->hevent != NULL ; /* TRUE if the mutex is created */ } -#ifdef InterlockedCompareExchange -#undef InterlockedCompareExchange -#endif -#define InterlockedCompareExchange(dest,exchange,comperand) (ixchg((dest), (exchange), (comperand))) - VOID DeleteNonRecursiveMutex(PNRMUTEX mutex) { @@ -98,7 +42,7 @@ /* InterlockedIncrement(&mutex->owned) == 0 means that no thread currently owns the mutex */ if (!wait) { - if (InterlockedCompareExchange((PVOID *)&mutex->owned, (PVOID)0, (PVOID)-1) != (PVOID)-1) + if (InterlockedCompareExchange(&mutex->owned, 0, -1) != -1) return WAIT_TIMEOUT ; ret = WAIT_OBJECT_0 ; } @@ -196,18 +140,21 @@ if (obj.done == NULL) return -1; - rv = _beginthread(bootstrap, _pythread_stacksize, &obj); + rv = _beginthread(bootstrap, + Py_SAFE_DOWNCAST(_pythread_stacksize, + Py_ssize_t, int), + &obj); if (rv == (Py_uintptr_t)-1) { /* I've seen errno == EAGAIN here, which means "there are * too many threads". */ dprintf(("%ld: PyThread_start_new_thread failed: %p errno %d\n", - PyThread_get_thread_ident(), rv, errno)); + PyThread_get_thread_ident(), (void*)rv, errno)); obj.id = -1; } else { dprintf(("%ld: PyThread_start_new_thread succeeded: %p\n", - PyThread_get_thread_ident(), rv)); + PyThread_get_thread_ident(), (void*)rv)); /* wait for thread to initialize, so we can get its id */ WaitForSingleObject(obj.done, INFINITE); assert(obj.id != -1); @@ -333,7 +280,7 @@ dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock)); if (!(aLock && LeaveNonRecursiveMutex((PNRMUTEX) aLock))) - dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n", PyThread_get_thread_ident(), aLock, GetLastError())); + dprintf(("%ld: Could not PyThread_release_lock(%p) error: %ld\n", PyThread_get_thread_ident(), aLock, GetLastError())); } /* minimum/maximum thread stack sizes supported */ Modified: python/branches/bcannon-objcap/README ============================================================================== --- python/branches/bcannon-objcap/README (original) +++ python/branches/bcannon-objcap/README Fri May 25 22:13:08 2007 @@ -294,7 +294,7 @@ XXX I think this next bit is out of date: -64-bit platforms: The modules audioop, imageop and rgbimg don't work. +64-bit platforms: The modules audioop, and imageop don't work. The setup.py script disables them on 64-bit installations. Don't try to enable them in the Modules/Setup file. They contain code that is quite wordsize sensitive. (If you have a @@ -466,9 +466,9 @@ array, audioop, binascii, cPickle, cStringIO, cmath, crypt, curses, errno, fcntl, gdbm, grp, imageop, _locale, math, md5, new, operator, parser, pcre, - posix, pwd, readline, regex, reop, rgbimg, rotor, + posix, pwd, readline, regex, reop, select, signal, socket, soundex, strop, struct, - syslog, termios, time, timing, zlib, audioop, imageop, rgbimg + syslog, termios, time, timing, zlib, audioop, imageop 3) make SHELL=/usr/local/bin/bash @@ -570,9 +570,9 @@ MacOSX: The tests will crash on both 10.1 and 10.2 with SEGV in test_re and test_sre due to the small default stack size. If you set the stack size to 2048 before doing a "make test" the - failure can be avoided. If you're using the tcsh (the default - on OSX), or csh shells use "limit stacksize 2048" and for the - bash shell, use "ulimit -s 2048". + failure can be avoided. If you're using the tcsh or csh shells, + use "limit stacksize 2048" and for the bash shell (the default + as of OSX 10.3), use "ulimit -s 2048". On naked Darwin you may want to add the configure option "--disable-toolbox-glue" to disable the glue code for the Carbon @@ -1237,7 +1237,6 @@ Most subdirectories have their own README files. Most files have comments. -BeOS/ Files specific to the BeOS port Demo/ Demonstration scripts, modules and programs Doc/ Documentation sources (LaTeX) Grammar/ Input for the parser generator @@ -1254,6 +1253,7 @@ Parser/ The parser and tokenizer and their input handling Python/ The byte-compiler and interpreter README The file you're reading now +RISCOS/ Files specific to RISC OS port Tools/ Some useful programs written in Python pyconfig.h.in Source from which pyconfig.h is created (GNU autoheader output) configure Configuration shell script (GNU autoconf output) @@ -1274,6 +1274,7 @@ getbuildinfo.o Object file from Modules/getbuildinfo.c libpython.a The library archive python The executable interpreter +reflog.txt Output from running the regression suite with the -R flag tags, TAGS Tags files for vi and Emacs Modified: python/branches/bcannon-objcap/Tools/msi/msilib.py ============================================================================== --- python/branches/bcannon-objcap/Tools/msi/msilib.py (original) +++ python/branches/bcannon-objcap/Tools/msi/msilib.py Fri May 25 22:13:08 2007 @@ -5,7 +5,7 @@ import win32com.client import pythoncom, pywintypes from win32com.client import constants -import re, string, os, sets, glob, popen2, sys, _winreg, struct +import re, string, os, sets, glob, subprocess, sys, _winreg, struct try: basestring @@ -388,8 +388,10 @@ else: print "WARNING: cabarc.exe not found in registry" cabarc = "cabarc.exe" - f = popen2.popen4(r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name))[0] - for line in f: + cmd = r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name) + p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT)[0] + for line in (p.stdout, p.stdin): if line.startswith(" -- adding "): sys.stdout.write(".") else: Modified: python/branches/bcannon-objcap/Tools/pybench/pybench.py ============================================================================== --- python/branches/bcannon-objcap/Tools/pybench/pybench.py (original) +++ python/branches/bcannon-objcap/Tools/pybench/pybench.py Fri May 25 22:13:08 2007 @@ -167,7 +167,7 @@ call of .run(). If you change a test in some way, don't forget to increase - it's version number. + its version number. """ Modified: python/branches/bcannon-objcap/configure ============================================================================== --- python/branches/bcannon-objcap/configure (original) +++ python/branches/bcannon-objcap/configure Fri May 25 22:13:08 2007 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52843 . +# From configure.in Revision: 53826 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.6. # @@ -11623,9 +11623,11 @@ then case $ac_sys_system/$ac_sys_release in SunOS*) if test "$GCC" = yes; - then CCSHARED="-fPIC"; - else CCSHARED="-xcode=pic32"; - fi;; + then CCSHARED="-fPIC"; + elif test `uname -p` = sparc; + then CCSHARED="-xcode=pic32"; + else CCSHARED="-Kpic"; + fi;; hp*|HP*) if test "$GCC" = yes; then CCSHARED="-fPIC"; else CCSHARED="+z"; @@ -14718,11 +14720,13 @@ -for ac_func in alarm bind_textdomain_codeset chown clock confstr ctermid \ - execv fork fpathconf ftime ftruncate \ + + +for ac_func in alarm bind_textdomain_codeset chflags chown clock confstr \ + ctermid execv fork fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getpwent getspnam getspent getsid getwd \ - kill killpg lchown lstat mkfifo mknod mktime \ + kill killpg lchflags lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink realpath \ select setegid seteuid setgid \ Modified: python/branches/bcannon-objcap/configure.in ============================================================================== --- python/branches/bcannon-objcap/configure.in (original) +++ python/branches/bcannon-objcap/configure.in Fri May 25 22:13:08 2007 @@ -1571,9 +1571,11 @@ then case $ac_sys_system/$ac_sys_release in SunOS*) if test "$GCC" = yes; - then CCSHARED="-fPIC"; - else CCSHARED="-xcode=pic32"; - fi;; + then CCSHARED="-fPIC"; + elif test `uname -p` = sparc; + then CCSHARED="-xcode=pic32"; + else CCSHARED="-Kpic"; + fi;; hp*|HP*) if test "$GCC" = yes; then CCSHARED="-fPIC"; else CCSHARED="+z"; @@ -2282,11 +2284,11 @@ AC_MSG_RESULT(MACHDEP_OBJS) # checks for library functions -AC_CHECK_FUNCS(alarm bind_textdomain_codeset chown clock confstr ctermid \ - execv fork fpathconf ftime ftruncate \ +AC_CHECK_FUNCS(alarm bind_textdomain_codeset chflags chown clock confstr \ + ctermid execv fork fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getpwent getspnam getspent getsid getwd \ - kill killpg lchown lstat mkfifo mknod mktime \ + kill killpg lchflags lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink realpath \ select setegid seteuid setgid \ Modified: python/branches/bcannon-objcap/pyconfig.h.in ============================================================================== --- python/branches/bcannon-objcap/pyconfig.h.in (original) +++ python/branches/bcannon-objcap/pyconfig.h.in Fri May 25 22:13:08 2007 @@ -67,6 +67,9 @@ /* Define this if you have the type _Bool. */ #undef HAVE_C99_BOOL +/* Define to 1 if you have the `chflags' function. */ +#undef HAVE_CHFLAGS + /* Define to 1 if you have the `chown' function. */ #undef HAVE_CHOWN @@ -290,6 +293,9 @@ Solaris and Linux, the necessary defines are already defined.) */ #undef HAVE_LARGEFILE_SUPPORT +/* Define to 1 if you have the `lchflags' function. */ +#undef HAVE_LCHFLAGS + /* Define to 1 if you have the `lchown' function. */ #undef HAVE_LCHOWN Modified: python/branches/bcannon-objcap/setup.py ============================================================================== --- python/branches/bcannon-objcap/setup.py (original) +++ python/branches/bcannon-objcap/setup.py Fri May 25 22:13:08 2007 @@ -91,10 +91,14 @@ class PyBuildExt(build_ext): + def __init__(self, dist): + build_ext.__init__(self, dist) + self.failed = [] + def build_extensions(self): # Detect which modules should be compiled - self.detect_modules() + missing = self.detect_modules() # Remove modules that are present on the disabled list self.extensions = [ext for ext in self.extensions @@ -178,6 +182,31 @@ build_ext.build_extensions(self) + longest = max([len(e.name) for e in self.extensions]) + if self.failed: + longest = max(longest, max([len(name) for name in self.failed])) + + def print_three_column(lst): + lst.sort(key=str.lower) + # guarantee zip() doesn't drop anything + while len(lst) % 3: + lst.append("") + for e, f, g in zip(lst[::3], lst[1::3], lst[2::3]): + print "%-*s %-*s %-*s" % (longest, e, longest, f, + longest, g) + print + + if missing: + print + print "Failed to find the necessary bits to build these modules:" + print_three_column(missing) + + if self.failed: + failed = self.failed[:] + print + print "Failed to build these modules:" + print_three_column(failed) + def build_extension(self, ext): if ext.name == '_ctypes': @@ -189,6 +218,7 @@ except (CCompilerError, DistutilsError), why: self.announce('WARNING: building of extension "%s" failed: %s' % (ext.name, sys.exc_info()[1])) + self.failed.append(ext.name) return # Workaround for Mac OS X: The Carbon-based modules cannot be # reliably imported into a command-line Python @@ -209,6 +239,7 @@ try: imp.load_dynamic(ext.name, ext_filename) except ImportError, why: + self.failed.append(ext.name) self.announce('*** WARNING: renaming "%s" since importing it' ' failed: %s' % (ext.name, why), level=3) assert not self.inplace @@ -234,6 +265,7 @@ self.announce('*** WARNING: importing extension "%s" ' 'failed with %s: %s' % (ext.name, exc_type, why), level=3) + self.failed.append(ext.name) def get_platform(self): # Get value of sys.platform @@ -299,6 +331,7 @@ ] inc_dirs = self.compiler.include_dirs + ['/usr/include'] exts = [] + missing = [] config_h = sysconfig.get_config_h_filename() config_h_vars = sysconfig.parse_config_h(open(config_h)) @@ -374,7 +407,7 @@ # fast iterator tools implemented in C exts.append( Extension("itertools", ["itertoolsmodule.c"]) ) # high-performance collections - exts.append( Extension("collections", ["collectionsmodule.c"]) ) + exts.append( Extension("_collections", ["_collectionsmodule.c"]) ) # bisect exts.append( Extension("_bisect", ["_bisectmodule.c"]) ) # heapq @@ -391,6 +424,8 @@ # static Unicode character database if have_unicode: exts.append( Extension('unicodedata', ['unicodedata.c']) ) + else: + missing.append('unicodedata') # access to ISO C locale support data = open('pyconfig.h').read() m = re.search(r"#s*define\s+WITH_LIBINTL\s+1\s*", data) @@ -423,6 +458,11 @@ if (config_h_vars.get('HAVE_GETSPNAM', False) or config_h_vars.get('HAVE_GETSPENT', False)): exts.append( Extension('spwd', ['spwdmodule.c']) ) + else: + missing.append('spwd') + else: + missing.extend(['pwd', 'grp', 'spwd']) + # select(2); not on ancient System V exts.append( Extension('select', ['selectmodule.c']) ) @@ -439,11 +479,15 @@ # Memory-mapped files (also works on Win32). if platform not in ['atheos', 'mac']: exts.append( Extension('mmap', ['mmapmodule.c']) ) + else: + missing.append('mmap') # Lance Ellinghaus's syslog module if platform not in ['mac']: # syslog daemon interface exts.append( Extension('syslog', ['syslogmodule.c']) ) + else: + missing.append('syslog') # George Neville-Neil's timing module: # Deprecated in PEP 4 http://www.python.org/peps/pep-0004.html @@ -468,8 +512,8 @@ if sys.maxint != 9223372036854775807L: # Operations on images exts.append( Extension('imageop', ['imageop.c']) ) - # Read SGI RGB image files (but coded portably) - exts.append( Extension('rgbimg', ['rgbimgmodule.c']) ) + else: + missing.extend(['imageop']) # readline do_readline = self.compiler.find_library_file(lib_dirs, 'readline') @@ -507,6 +551,9 @@ library_dirs=['/usr/lib/termcap'], extra_link_args=readline_extra_link_args, libraries=readline_libs) ) + else: + missing.append('readline') + if platform not in ['mac']: # crypt module. @@ -515,6 +562,8 @@ else: libs = [] exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) ) + else: + missing.append('crypt') # CSV files exts.append( Extension('_csv', ['_csv.c']) ) @@ -547,6 +596,8 @@ library_dirs = ssl_libs, libraries = ['ssl', 'crypto'], depends = ['socketmodule.h']), ) + else: + missing.append('_ssl') # find out which version of OpenSSL we have openssl_ver = 0 @@ -580,6 +631,7 @@ include_dirs = ssl_incs, library_dirs = ssl_libs, libraries = ['ssl', 'crypto']) ) + missing.extend(['_sha', '_md5']) else: # The _sha module implements the SHA1 hash algorithm. exts.append( Extension('_sha', ['shamodule.c']) ) @@ -589,12 +641,14 @@ exts.append( Extension('_md5', sources = ['md5module.c', 'md5.c'], depends = ['md5.h']) ) + missing.append('_hashlib') if (openssl_ver < 0x00908000): # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash exts.append( Extension('_sha256', ['sha256module.c']) ) exts.append( Extension('_sha512', ['sha512module.c']) ) - + else: + missing.extend(['_sha256', '_sha512']) # Modules that provide persistent dictionary-like semantics. You will # probably want to arrange for at least one of them to be available on @@ -620,10 +674,11 @@ '/usr/include/db4', '/usr/local/include/db4', '/opt/sfw/include/db4', - '/sw/include/db4', '/usr/include/db3', '/usr/local/include/db3', '/opt/sfw/include/db3', + # Fink defaults (http://fink.sourceforge.net/) + '/sw/include/db4', '/sw/include/db3', ] # 4.x minor number specific paths @@ -634,6 +689,8 @@ db_inc_paths.append('/usr/local/include/db4%d' % x) db_inc_paths.append('/pkg/db-4.%d/include' % x) db_inc_paths.append('/opt/db-4.%d/include' % x) + # MacPorts default (http://www.macports.org/) + db_inc_paths.append('/opt/local/include/db4%d' % x) # 3.x minor number specific paths for x in (3,): db_inc_paths.append('/usr/include/db3%d' % x) @@ -658,7 +715,7 @@ std_variants.append(os.path.join(dn, "db3.%d"%x)) db_inc_paths = std_variants + db_inc_paths - + db_inc_paths = [p for p in db_inc_paths if os.path.exists(p)] db_ver_inc_map = {} @@ -681,7 +738,7 @@ if ( (not db_ver_inc_map.has_key(db_ver)) and (db_ver <= max_db_ver and db_ver >= min_db_ver) ): # save the include directory with the db.h version - # (first occurrance only) + # (first occurrence only) db_ver_inc_map[db_ver] = d if db_setup_debug: print "db.h: found", db_ver, "in", d @@ -690,7 +747,8 @@ if db_setup_debug: print "db.h: ignoring", d else: # ignore this header, it didn't contain a version number - if db_setup_debug: print "db.h: unsupported version", db_ver, "in", d + if db_setup_debug: + print "db.h: no version number version in", d db_found_vers = db_ver_inc_map.keys() db_found_vers.sort() @@ -701,10 +759,8 @@ # check lib directories parallel to the location of the header db_dirs_to_check = [ - os.path.join(db_incdir, '..', 'lib64'), - os.path.join(db_incdir, '..', 'lib'), - os.path.join(db_incdir, '..', '..', 'lib64'), - os.path.join(db_incdir, '..', '..', 'lib'), + db_incdir.replace("include", 'lib64'), + db_incdir.replace("include", 'lib'), ] db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check) @@ -745,6 +801,7 @@ db_incs = None dblibs = [] dblib_dir = None + missing.append('_bsddb') # The sqlite interface sqlite_setup_debug = False # verbose debug prints from this script? @@ -837,6 +894,8 @@ runtime_library_dirs=sqlite_libdir, extra_link_args=sqlite_extra_link_args, libraries=["sqlite3",])) + else: + missing.append('_sqlite3') # Look for Berkeley db 1.85. Note that it is built as a different # module name so it can be included even when later versions are @@ -859,6 +918,10 @@ libraries=libraries)) else: exts.append(Extension('bsddb185', ['bsddbmodule.c'])) + else: + missing.append('bsddb185') + else: + missing.append('bsddb185') # The standard Unix dbm module: if platform not in ['cygwin']: @@ -884,11 +947,15 @@ define_macros=[('HAVE_BERKDB_H',None), ('DB_DBM_HSEARCH',None)], libraries=dblibs)) + else: + missing.append('dbm') # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: if (self.compiler.find_library_file(lib_dirs, 'gdbm')): exts.append( Extension('gdbm', ['gdbmmodule.c'], libraries = ['gdbm'] ) ) + else: + missing.append('gdbm') # Unix-only modules if platform not in ['mac', 'win32']: @@ -897,6 +964,8 @@ # Jeremy Hylton's rlimit interface if platform not in ['atheos']: exts.append( Extension('resource', ['resource.c']) ) + else: + missing.append('resource') # Sun yellow pages. Some systems have the functions in libc. if platform not in ['cygwin', 'atheos']: @@ -906,6 +975,10 @@ libs = [] exts.append( Extension('nis', ['nismodule.c'], libraries = libs) ) + else: + missing.append('nis') + else: + missing.extend(['nis', 'resource', 'termios']) # Curses support, requiring the System V version of curses, often # provided by the ncurses library. @@ -934,13 +1007,16 @@ exts.append( Extension('_curses', ['_cursesmodule.c'], libraries = curses_libs) ) + else: + missing.append('_curses') # If the curses module is enabled, check for the panel module if (module_enabled(exts, '_curses') and self.compiler.find_library_file(lib_dirs, panel_library)): exts.append( Extension('_curses_panel', ['_curses_panel.c'], libraries = [panel_library] + curses_libs) ) - + else: + missing.append('_curses_panel') # Andrew Kuchling's zlib module. Note that some versions of zlib # 1.1.3 have security problems. See CERT Advisory CA-2002-07: @@ -976,6 +1052,12 @@ exts.append( Extension('zlib', ['zlibmodule.c'], libraries = ['z'], extra_link_args = zlib_extra_link_args)) + else: + missing.append('zlib') + else: + missing.append('zlib') + else: + missing.append('zlib') # Gustavo Niemeyer's bz2 module. if (self.compiler.find_library_file(lib_dirs, 'bz2')): @@ -986,6 +1068,8 @@ exts.append( Extension('bz2', ['bz2module.c'], libraries = ['bz2'], extra_link_args = bz2_extra_link_args) ) + else: + missing.append('bz2') # Interface to the Expat XML parser # @@ -1023,14 +1107,20 @@ include_dirs = [expatinc], sources = ['_elementtree.c'], )) + else: + missing.append('_elementtree') # Hye-Shik Chang's CJKCodecs modules. if have_unicode: exts.append(Extension('_multibytecodec', ['cjkcodecs/multibytecodec.c'])) for loc in ('kr', 'jp', 'cn', 'tw', 'hk', 'iso2022'): - exts.append(Extension('_codecs_' + loc, + exts.append(Extension('_codecs_%s' % loc, ['cjkcodecs/_codecs_%s.c' % loc])) + else: + missing.append('_multibytecodec') + for loc in ('kr', 'jp', 'cn', 'tw', 'hk', 'iso2022'): + missing.append('_codecs_%s' % loc) # Dynamic loading module if sys.maxint == 0x7fffffff: @@ -1038,6 +1128,10 @@ dl_inc = find_file('dlfcn.h', [], inc_dirs) if (dl_inc is not None) and (platform not in ['atheos']): exts.append( Extension('dl', ['dlmodule.c']) ) + else: + missing.append('dl') + else: + missing.append('dl') # Thomas Heller's _ctypes module self.detect_ctypes(inc_dirs, lib_dirs) @@ -1046,14 +1140,20 @@ if platform == 'linux2': # Linux-specific modules exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) ) + else: + missing.append('linuxaudiodev') if platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', 'freebsd7'): exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) + else: + missing.append('ossaudiodev') if platform == 'sunos5': # SunOS specific modules exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) ) + else: + missing.append('sunaudiodev') if platform == 'darwin' and ("--disable-toolbox-glue" not in sysconfig.get_config_var("CONFIG_ARGS")): @@ -1142,6 +1242,11 @@ # Call the method for detecting whether _tkinter can be compiled self.detect_tkinter(inc_dirs, lib_dirs) + if '_tkinter' not in [e.name for e in self.extensions]: + missing.append('_tkinter') + + return missing + def detect_tkinter_darwin(self, inc_dirs, lib_dirs): # The _tkinter module, using frameworks. Since frameworks are quite # different the UNIX search logic is not sharable. @@ -1323,7 +1428,8 @@ from distutils.dep_util import newer_group config_sources = [os.path.join(ffi_srcdir, fname) - for fname in os.listdir(ffi_srcdir)] + for fname in os.listdir(ffi_srcdir) + if os.path.isfile(os.path.join(ffi_srcdir, fname))] if self.force or newer_group(config_sources, ffi_configfile): from distutils.dir_util import mkpath From buildbot at python.org Fri May 25 22:42:30 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 20:42:30 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-2 trunk Message-ID: <20070525204230.7D6C81E400F@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%2520trunk/builds/14 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket_ssl sincerely, -The Buildbot From buildbot at python.org Fri May 25 22:43:10 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 20:43:10 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070525204310.DA0871E4007@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/567 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket_ssl make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri May 25 23:00:31 2007 From: buildbot at python.org (buildbot at python.org) Date: Fri, 25 May 2007 21:00:31 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070525210032.0CBD91E4012@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2046 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver sincerely, -The Buildbot From python-checkins at python.org Fri May 25 23:04:49 2007 From: python-checkins at python.org (brett.cannon) Date: Fri, 25 May 2007 23:04:49 +0200 (CEST) Subject: [Python-checkins] r55593 - python/branches/bcannon-objcap/BRANCH_NOTES Message-ID: <20070525210449.7B4CC1E4007@bag.python.org> Author: brett.cannon Date: Fri May 25 23:04:46 2007 New Revision: 55593 Modified: python/branches/bcannon-objcap/BRANCH_NOTES Log: Update some notes. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Fri May 25 23:04:46 2007 @@ -12,8 +12,6 @@ ====== Status ====== -* Fix failing tests. - - test_xmlrpc * Turn on whitelisting. - Verify injecting 'open' into importlib works. * Write tests. @@ -28,7 +26,7 @@ - Types crippled. + file + code -* Fix 'sys' module. +* Fix 'sys' module reloading. - test_xmlrpc relies on reloading sys to get setdefaultencoding, but hack to allow re-import of sys doesn't let this work. From python-checkins at python.org Sat May 26 01:29:03 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 26 May 2007 01:29:03 +0200 (CEST) Subject: [Python-checkins] r55594 - sandbox/trunk/import_in_py/controlled_importlib.py Message-ID: <20070525232903.695B21E4007@bag.python.org> Author: brett.cannon Date: Sat May 26 01:28:57 2007 New Revision: 55594 Modified: sandbox/trunk/import_in_py/controlled_importlib.py Log: Make it so that the loss of open() from the built-in namespace does not prevent importlib from being able to open Python source and bytecode files. Modified: sandbox/trunk/import_in_py/controlled_importlib.py ============================================================================== --- sandbox/trunk/import_in_py/controlled_importlib.py (original) +++ sandbox/trunk/import_in_py/controlled_importlib.py Sat May 26 01:28:57 2007 @@ -14,6 +14,11 @@ import importlib import sys +# Need to inject 'open' into importlib as it will most likely be removed from +# the built-in namespace. +importlib.open = open + + class Whitelister(object): """Whitelist the finding and/or loading of modules.""" @@ -58,6 +63,7 @@ pass + class WhitelistExtHandler(importlib.ExtensionFileHandler): """Add whitelisting to the extension module handler.""" From python-checkins at python.org Sat May 26 01:32:12 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 26 May 2007 01:32:12 +0200 (CEST) Subject: [Python-checkins] r55595 - sandbox/trunk/import_in_py/controlled_importlib.py Message-ID: <20070525233212.CA7611E4007@bag.python.org> Author: brett.cannon Date: Sat May 26 01:32:07 2007 New Revision: 55595 Modified: sandbox/trunk/import_in_py/controlled_importlib.py Log: Whitespace normalization. Modified: sandbox/trunk/import_in_py/controlled_importlib.py ============================================================================== --- sandbox/trunk/import_in_py/controlled_importlib.py (original) +++ sandbox/trunk/import_in_py/controlled_importlib.py Sat May 26 01:32:07 2007 @@ -55,7 +55,7 @@ """Whitelisting importer/loader for built-in modules.""" pass - + class WhitelistFrozen(Whitelister, importlib.FrozenImporter): From python-checkins at python.org Sat May 26 01:54:08 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 26 May 2007 01:54:08 +0200 (CEST) Subject: [Python-checkins] r55596 - python/branches/bcannon-objcap/build_secure_py.sh Message-ID: <20070525235408.E99A11E4007@bag.python.org> Author: brett.cannon Date: Sat May 26 01:54:04 2007 New Revision: 55596 Modified: python/branches/bcannon-objcap/build_secure_py.sh Log: Echo info out about what is being compiled. Also add warnings and debugging symbols. Modified: python/branches/bcannon-objcap/build_secure_py.sh ============================================================================== --- python/branches/bcannon-objcap/build_secure_py.sh (original) +++ python/branches/bcannon-objcap/build_secure_py.sh Sat May 26 01:54:04 2007 @@ -1,2 +1,4 @@ -gcc -c -IInclude -I. secure_python.c +echo "Build secure_python.o ..." +gcc -Wall -g -c -IInclude -I. secure_python.c +echo "Build executable ..." gcc -o secure_python.exe secure_python.o libpython2.6.a From python-checkins at python.org Sat May 26 01:54:44 2007 From: python-checkins at python.org (brett.cannon) Date: Sat, 26 May 2007 01:54:44 +0200 (CEST) Subject: [Python-checkins] r55597 - in python/branches/bcannon-objcap/tests: README __init__.py fail fail/__init__.py fail/builtin_execfile--NameError.py fail/builtin_open--NameError.py fail/file_constructor--TypeError.py fail/import_unsafe_builtin--ImportError.py fail/import_unsafe_extension--ImportError.py succeed succeed/__init__.py succeed/import_py.py succeed/import_safe_builtin.py succeed/import_safe_extension.py Message-ID: <20070525235444.1A13B1E4007@bag.python.org> Author: brett.cannon Date: Sat May 26 01:54:43 2007 New Revision: 55597 Added: python/branches/bcannon-objcap/tests/ python/branches/bcannon-objcap/tests/README (contents, props changed) python/branches/bcannon-objcap/tests/__init__.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/ python/branches/bcannon-objcap/tests/fail/__init__.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py (contents, props changed) python/branches/bcannon-objcap/tests/succeed/ python/branches/bcannon-objcap/tests/succeed/__init__.py (contents, props changed) python/branches/bcannon-objcap/tests/succeed/import_py.py (contents, props changed) python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py (contents, props changed) python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py (contents, props changed) Log: Start adding security-specific tests. Added: python/branches/bcannon-objcap/tests/README ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/README Sat May 26 01:54:43 2007 @@ -0,0 +1,5 @@ +The 'succeed' directory contains files that when run should always run to +conclusion without failure. + +The 'fail' directory has files that should always raise the exception specified +in the file's name. Added: python/branches/bcannon-objcap/tests/__init__.py ============================================================================== Added: python/branches/bcannon-objcap/tests/fail/__init__.py ============================================================================== Added: python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py Sat May 26 01:54:43 2007 @@ -0,0 +1 @@ +_ = execfile Added: python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py Sat May 26 01:54:43 2007 @@ -0,0 +1 @@ +_ = open Added: python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py Sat May 26 01:54:43 2007 @@ -0,0 +1 @@ +_ = file('README', 'r') Added: python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py Sat May 26 01:54:43 2007 @@ -0,0 +1 @@ +import sys Added: python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py Sat May 26 01:54:43 2007 @@ -0,0 +1 @@ +import termios Added: python/branches/bcannon-objcap/tests/succeed/__init__.py ============================================================================== Added: python/branches/bcannon-objcap/tests/succeed/import_py.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/succeed/import_py.py Sat May 26 01:54:43 2007 @@ -0,0 +1 @@ +import token Added: python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py Sat May 26 01:54:43 2007 @@ -0,0 +1 @@ +import errno Added: python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py Sat May 26 01:54:43 2007 @@ -0,0 +1 @@ +import time From ipsi2006 at 3dnet.co.yu Sat May 26 09:21:44 2007 From: ipsi2006 at 3dnet.co.yu (IPSI Conferences) Date: Sat, 26 May 2007 09:21:44 +0200 (CEST) Subject: [Python-checkins] Invitation to Montenegro, Japan, Croatia, and Italy; c/bb Message-ID: <20070526072144.DDC737AC780@mejl.3dnet.co.yu> Dear potential speaker: We are pleased to invite you to submit a paper to one of the following multi, inter, and trans disciplinary conferences dedicated to advances in computer/internet science and engineering (papers with impacts on other scientific fields are given advantage): Montenegro Mountain Safari, September 6 to 9, 2007, Villa Bianca, Kolasin (Podgorica), see James Bond movie Casino Royale, Keynote: Prof. H. Fujii, The 100000km Space Elevator Project, Japan; Last deadline for abstracts: 01 May 2007 Papers: 01 June 2007 Montenegro Seaside Safari, September 9 to 15, 2007 Hotel Sveti Stefan (Tivat), see James Bond movie Casino Royale, Keynotes: Rectors. L. Stankovic, Montenegro, + B. Kovacevic, Serbia; Last deadline for abstracts: 01 May 2007 Papers: 01 June 2007 ... also we remind you to submit papers to these five popular conferences: _____________________________________________________________________ VIPSI-2007 TOKYO UNIVERSITY of TOKYO (Keynote, Nobel Laureate Martin Perl, Stanford) Arrival: 31 May 2007 / departure: 3 Juni 2007 Last Deadline for abstracts: 1 February 2007, Papers: 31 March 2007 VIPSI-2007 CROATIA - OPATIJA (ABBAZIA) Hotel Ariston Arrival: 7 Juni 2007 / departure: 10 Juni 2007 Last deadline for abstracts: 15 February 2007 Papers: 15 April 2007 IPSI-2007 CROATIA - ROVINJ (ROVIGNO) Hotel Angelo D'Oro Arrival: 10 Juni 2007 / departure: 13 Juni 2007 Last deadline for abstracts: 15 February 2007 Papers: 15 April 2007 VIPSI-2007 FLORENCE Villa Patricia, Montecatini Terme (between Florence and Pisa), Arrival: 20 August 2007 / departure: 23 August 2007 Last deadline for abstracts: 30 April 2007 Papers: 31 May 2007 Keynote: Prof. Antonio Prete, University of Pisa, Italy; VIPSI-2007 ITALY - PESCARA Castello Chiola (medieval castle from century IX), Loreto Aprutino (Pescara, relatively near Rome), Arrival: 23 August 2007 / departure: 26 August 2007 Last deadline for abstracts: 30 April 2007 Papers: 31 May 2007 Keynote: Prof. Veljko Milutinovic, Fellow of the IEEE; * * * We promote the concept of small family style conferences, with the stress on discussions and elaborations of joint future activities (cooperation, research proposals, outsourcing). All those who attended our conferences once, love to come back. For more information, reply to this email, or contact us via our web page, and the conference management will write to you. Sincerely Yours, Program Committee PS - If you like to submit a paper to one of our journals, rather than attending a conference, please let us know. If you reply (with SUBSCRIBE in the subject), we will be informing you about our future conferences, 4 times per year. If you do not reply, we will not be contacting you again after the current academic year is over. * * * CONTROLLING OUR E-MAILS TO YOU * * * If you like to obtain more information about a conference from this call, please reply with the conference CITY and COUNTRY in the subject. From nnorwitz at gmail.com Sat May 26 11:23:15 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 26 May 2007 05:23:15 -0400 Subject: [Python-checkins] Python Regression Test Failures all (1) Message-ID: <20070526092315.GA25769@python.psfb.org> test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 Exception in thread reader 0: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/tmp/python-test/local/lib/python2.6/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Exception in thread reader 3: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/tmp/python-test/local/lib/python2.6/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Exception in thread reader 2: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/tmp/python-test/local/lib/python2.6/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Exception in thread reader 1: Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/threading.py", line 460, in __bootstrap self.run() File "/tmp/python-test/local/lib/python2.6/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/tmp/python-test/local/lib/python2.6/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/tmp/python-test/local/lib/python2.6/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_ftplib test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_list test_locale test_logging test_long test_long_future test_longexp test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7304 refs] [7304 refs] [7304 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7679 refs] [7679 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_smtplib test_socket test_socket_ssl test test_socket_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_socket_ssl.py", line 30, in testBasic f = urllib.urlopen('https://sf.net') File "/tmp/python-test/local/lib/python2.6/urllib.py", line 82, in urlopen return opener.open(url) File "/tmp/python-test/local/lib/python2.6/urllib.py", line 190, in open return getattr(self, name)(url) File "/tmp/python-test/local/lib/python2.6/urllib.py", line 426, in open_https 'got a bad status line', None) IOError: ('http protocol error', 0, 'got a bad status line', None) test_socketserver test_softspace test_sort test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7299 refs] [7297 refs] [7299 refs] [7299 refs] [7299 refs] [7299 refs] [7299 refs] [7299 refs] [7299 refs] [7299 refs] [7297 refs] [8845 refs] [7515 refs] [7300 refs] [7299 refs] [7299 refs] [7299 refs] [7299 refs] [7299 refs] . [7299 refs] [7299 refs] this bit of output is from a test of stdout in a different process ... [7299 refs] [7299 refs] [7515 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7299 refs] [7299 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [7303 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 300 tests OK. 1 test failed: test_socket_ssl 21 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_gl test_imageop test_imgfile test_ioctl test_macostools test_pep277 test_plistlib test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl warning: DBTxn aborted in destructor. No prior commit() or abort(). [491161 refs] From python-checkins at python.org Sat May 26 21:19:54 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 26 May 2007 21:19:54 +0200 (CEST) Subject: [Python-checkins] r55601 - python/trunk/PCbuild8/pythoncore/pythoncore.vcproj Message-ID: <20070526191954.C3F8E1E4008@bag.python.org> Author: kristjan.jonsson Date: Sat May 26 21:19:50 2007 New Revision: 55601 Modified: python/trunk/PCbuild8/pythoncore/pythoncore.vcproj Log: Remove the rgbimgmodule from PCBuild8 Modified: python/trunk/PCbuild8/pythoncore/pythoncore.vcproj ============================================================================== --- python/trunk/PCbuild8/pythoncore/pythoncore.vcproj (original) +++ python/trunk/PCbuild8/pythoncore/pythoncore.vcproj Sat May 26 21:19:50 2007 @@ -1518,10 +1518,6 @@ > - - From python-checkins at python.org Sat May 26 21:31:47 2007 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 26 May 2007 21:31:47 +0200 (CEST) Subject: [Python-checkins] r55602 - in python/trunk: PC/WinMain.c PC/_winreg.c PC/dl_nt.c PC/winsound.c Python/dynload_win.c Message-ID: <20070526193147.009A11E401C@bag.python.org> Author: kristjan.jonsson Date: Sat May 26 21:31:39 2007 New Revision: 55602 Modified: python/trunk/PC/WinMain.c python/trunk/PC/_winreg.c python/trunk/PC/dl_nt.c python/trunk/PC/winsound.c python/trunk/Python/dynload_win.c Log: Include after python.h, so that WINNT is properly set before windows.h is included. Fixes warnings in PC builds. Modified: python/trunk/PC/WinMain.c ============================================================================== --- python/trunk/PC/WinMain.c (original) +++ python/trunk/PC/WinMain.c Sat May 26 21:31:39 2007 @@ -1,10 +1,10 @@ /* Minimal main program -- everything is loaded from the library. */ +#include "Python.h" + #define WIN32_LEAN_AND_MEAN #include -#include "Python.h" - int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */ HINSTANCE hPrevInstance, /* handle to previous instance */ Modified: python/trunk/PC/_winreg.c ============================================================================== --- python/trunk/PC/_winreg.c (original) +++ python/trunk/PC/_winreg.c Sat May 26 21:31:39 2007 @@ -12,10 +12,10 @@ */ -#include "windows.h" #include "Python.h" #include "structmember.h" #include "malloc.h" /* for alloca */ +#include "windows.h" static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK); static PyObject *PyHKEY_FromHKEY(HKEY h); Modified: python/trunk/PC/dl_nt.c ============================================================================== --- python/trunk/PC/dl_nt.c (original) +++ python/trunk/PC/dl_nt.c Sat May 26 21:31:39 2007 @@ -7,11 +7,9 @@ forgotten) from the programmer. */ -#include "windows.h" -/* NT and Python share these */ -#include "pyconfig.h" #include "Python.h" +#include "windows.h" char dllVersionBuffer[16] = ""; // a private buffer Modified: python/trunk/PC/winsound.c ============================================================================== --- python/trunk/PC/winsound.c (original) +++ python/trunk/PC/winsound.c Sat May 26 21:31:39 2007 @@ -35,9 +35,9 @@ winsound.PlaySound(None, 0) */ +#include #include #include -#include #ifdef HAVE_CONIO_H #include /* port functions on Win9x */ #endif Modified: python/trunk/Python/dynload_win.c ============================================================================== --- python/trunk/Python/dynload_win.c (original) +++ python/trunk/Python/dynload_win.c Sat May 26 21:31:39 2007 @@ -1,7 +1,6 @@ /* Support for dynamic loading of extension modules */ -#include #ifdef HAVE_DIRECT_H #include #endif @@ -9,6 +8,7 @@ #include "Python.h" #include "importdl.h" +#include const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef _DEBUG From buildbot at python.org Sat May 26 22:05:26 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 26 May 2007 20:05:26 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20070526200526.8BDC01E400E@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/569 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: kristjan.jonsson Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket_ssl make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat May 26 23:04:16 2007 From: python-checkins at python.org (walter.doerwald) Date: Sat, 26 May 2007 23:04:16 +0200 (CEST) Subject: [Python-checkins] r55603 - python/trunk/Doc/lib/libcodecs.tex Message-ID: <20070526210416.2A63C1E4013@bag.python.org> Author: walter.doerwald Date: Sat May 26 23:04:13 2007 New Revision: 55603 Modified: python/trunk/Doc/lib/libcodecs.tex Log: Fix typo. Modified: python/trunk/Doc/lib/libcodecs.tex ============================================================================== --- python/trunk/Doc/lib/libcodecs.tex (original) +++ python/trunk/Doc/lib/libcodecs.tex Sat May 26 23:04:13 2007 @@ -237,7 +237,7 @@ \begin{funcdesc}{iterdecode}{iterable, encoding\optional{, errors}} Uses an incremental decoder to iteratively decode the input provided by \var{iterable}. This function is a generator. \var{errors} (as well as -any other keyword argument) is passed through to the incremental encoder. +any other keyword argument) is passed through to the incremental decoder. \versionadded{2.5} \end{funcdesc} From python-checkins at python.org Sun May 27 00:18:26 2007 From: python-checkins at python.org (peter.astrand) Date: Sun, 27 May 2007 00:18:26 +0200 (CEST) Subject: [Python-checkins] r55604 - in python/trunk: Doc/lib/libsubprocess.tex Lib/subprocess.py Lib/test/test_subprocess.py Message-ID: <20070526221826.EE1931E4009@bag.python.org> Author: peter.astrand Date: Sun May 27 00:18:20 2007 New Revision: 55604 Modified: python/trunk/Doc/lib/libsubprocess.tex python/trunk/Lib/subprocess.py python/trunk/Lib/test/test_subprocess.py Log: Applied patch 1669481, slightly modified: Support close_fds on Win32 Modified: python/trunk/Doc/lib/libsubprocess.tex ============================================================================== --- python/trunk/Doc/lib/libsubprocess.tex (original) +++ python/trunk/Doc/lib/libsubprocess.tex Sun May 27 00:18:20 2007 @@ -89,7 +89,10 @@ If \var{close_fds} is true, all file descriptors except \constant{0}, \constant{1} and \constant{2} will be closed before the child process is -executed. (\UNIX{} only) +executed. (\UNIX{} only). Or, on Windows, if \var{close_fds} is true +then no handles will be inherited by the child process. Note that on +Windows, you cannot set \var{close_fds} to true and also redirect the +standard handles by setting \var{stdin}, \var{stdout} or \var{stderr}. If \var{shell} is \constant{True}, the specified command will be executed through the shell. Modified: python/trunk/Lib/subprocess.py ============================================================================== --- python/trunk/Lib/subprocess.py (original) +++ python/trunk/Lib/subprocess.py Sun May 27 00:18:20 2007 @@ -545,9 +545,10 @@ if preexec_fn is not None: raise ValueError("preexec_fn is not supported on Windows " "platforms") - if close_fds: + if close_fds and (stdin is not None or stdout is not None or + stderr is not None): raise ValueError("close_fds is not supported on Windows " - "platforms") + "platforms if you redirect stdin/stdout/stderr") else: # POSIX if startupinfo is not None: @@ -804,9 +805,7 @@ hp, ht, pid, tid = CreateProcess(executable, args, # no special security None, None, - # must inherit handles to pass std - # handles - 1, + int(not close_fds), creationflags, env, cwd, Modified: python/trunk/Lib/test/test_subprocess.py ============================================================================== --- python/trunk/Lib/test/test_subprocess.py (original) +++ python/trunk/Lib/test/test_subprocess.py Sun May 27 00:18:20 2007 @@ -617,8 +617,16 @@ self.assertRaises(ValueError, subprocess.call, [sys.executable, "-c", "import sys; sys.exit(47)"], + stdout=subprocess.PIPE, close_fds=True) + def test_close_fds(self): + # close file descriptors + rc = subprocess.call([sys.executable, "-c", + "import sys; sys.exit(47)"], + close_fds=True) + self.assertEqual(rc, 47) + def test_shell_sequence(self): # Run command through the shell (sequence) newenv = os.environ.copy() From buildbot at python.org Sun May 27 01:11:17 2007 From: buildbot at python.org (buildbot at python.org) Date: Sat, 26 May 2007 23:11:17 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20070526231117.28CFD1E4009@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/687 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: peter.astrand,walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket_ssl ====================================================================== ERROR: testBasic (test.test_socket_ssl.ConnectedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_socket_ssl.py", line 30, in testBasic f = urllib.urlopen('https://sf.net') File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/urllib.py", line 82, in urlopen return opener.open(url) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/urllib.py", line 190, in open return getattr(self, name)(url) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/urllib.py", line 426, in open_https 'got a bad status line', None) IOError: ('http protocol error', 0, 'got a bad status line', None) make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun May 27 03:16:24 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 27 May 2007 03:16:24 +0200 (CEST) Subject: [Python-checkins] r55605 - python/branches/bcannon-objcap/run_security_tests.py Message-ID: <20070527011624.D998C1E400B@bag.python.org> Author: brett.cannon Date: Sun May 27 03:16:22 2007 New Revision: 55605 Added: python/branches/bcannon-objcap/run_security_tests.py (contents, props changed) Log: Add a test driver for security tests. Added: python/branches/bcannon-objcap/run_security_tests.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/run_security_tests.py Sun May 27 03:16:22 2007 @@ -0,0 +1,47 @@ +import subprocess +import os + +def run_tests(type_, test_verifier): + failures = [] + print "Running '%s' tests ..." % type_ + for file_name in (x for x in os.listdir(os.path.join('tests', type_)) + if x.endswith('.py') and not x.startswith('_')): + test_name = file_name[:-3] + print '\t%s ...' % test_name, + + exec_ = './secure_python.exe ' + os.path.join('tests', type_, file_name) + proc = subprocess.Popen(exec_, stderr=subprocess.PIPE, shell=True, + universal_newlines=True) + proc.wait() + stderr_output = proc.stderr.read() + if not test_verifier(test_name, stderr_output): + print 'failed' + failures.append(test_name) + else: + print 'passed' + return failures + + +def verify_succeed_test(test_name, stderr): + if stderr.count('\n') > 1: + return False + else: + return True + + +def verify_fail_test(test_name, stderr): + if stderr.count('\n') <= 1: + return False + exc_name = test_name.split('--')[1] + if exc_name not in stderr: + return False + return True + +for type_, verifier in (('succeed', verify_succeed_test), + ('fail', verify_fail_test)): + failures = run_tests(type_, verifier) + if failures: + print '%s failures: %s' % (len(failures), ', '.join(failures)) + else: + print 'All tests passed' + print From python-checkins at python.org Sun May 27 06:09:03 2007 From: python-checkins at python.org (neal.norwitz) Date: Sun, 27 May 2007 06:09:03 +0200 (CEST) Subject: [Python-checkins] r55606 - in python/trunk: Misc/NEWS Objects/funcobject.c Message-ID: <20070527040903.A5A091E4009@bag.python.org> Author: neal.norwitz Date: Sun May 27 06:08:54 2007 New Revision: 55606 Modified: python/trunk/Misc/NEWS python/trunk/Objects/funcobject.c Log: Add the new function object attribute names from py3k. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun May 27 06:08:54 2007 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Add new attribute names for function objects. All the func_* become + __*__ attributes. (Some already existed, e.g., __doc__ and __name__.) + - Add -3 option to the interpreter to warn about features that are deprecated and will be changed/removed in Python 3.0. Modified: python/trunk/Objects/funcobject.c ============================================================================== --- python/trunk/Objects/funcobject.c (original) +++ python/trunk/Objects/funcobject.c Sun May 27 06:08:54 2007 @@ -161,10 +161,14 @@ static PyMemberDef func_memberlist[] = { {"func_closure", T_OBJECT, OFF(func_closure), RESTRICTED|READONLY}, + {"__closure__", T_OBJECT, OFF(func_closure), + RESTRICTED|READONLY}, {"func_doc", T_OBJECT, OFF(func_doc), WRITE_RESTRICTED}, {"__doc__", T_OBJECT, OFF(func_doc), WRITE_RESTRICTED}, {"func_globals", T_OBJECT, OFF(func_globals), RESTRICTED|READONLY}, + {"__globals__", T_OBJECT, OFF(func_globals), + RESTRICTED|READONLY}, {"__module__", T_OBJECT, OFF(func_module), WRITE_RESTRICTED}, {NULL} /* Sentinel */ }; @@ -240,7 +244,7 @@ * other than a code object. */ if (value == NULL || !PyCode_Check(value)) { PyErr_SetString(PyExc_TypeError, - "func_code must be set to a code object"); + "__code__ must be set to a code object"); return -1; } nfree = PyCode_GetNumFree((PyCodeObject *)value); @@ -279,7 +283,7 @@ * other than a string object. */ if (value == NULL || !PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, - "func_name must be set to a string object"); + "__name__ must be set to a string object"); return -1; } tmp = op->func_name; @@ -315,7 +319,7 @@ value = NULL; if (value != NULL && !PyTuple_Check(value)) { PyErr_SetString(PyExc_TypeError, - "func_defaults must be set to a tuple object"); + "__defaults__ must be set to a tuple object"); return -1; } tmp = op->func_defaults; @@ -327,8 +331,11 @@ static PyGetSetDef func_getsetlist[] = { {"func_code", (getter)func_get_code, (setter)func_set_code}, + {"__code__", (getter)func_get_code, (setter)func_set_code}, {"func_defaults", (getter)func_get_defaults, (setter)func_set_defaults}, + {"__defaults__", (getter)func_get_defaults, + (setter)func_set_defaults}, {"func_dict", (getter)func_get_dict, (setter)func_set_dict}, {"__dict__", (getter)func_get_dict, (setter)func_set_dict}, {"func_name", (getter)func_get_name, (setter)func_set_name}, From python-checkins at python.org Sun May 27 07:03:04 2007 From: python-checkins at python.org (brett.cannon) Date: Sun, 27 May 2007 07:03:04 +0200 (CEST) Subject: [Python-checkins] r55607 - python/branches/bcannon-objcap/run_security_tests.py Message-ID: <20070527050304.1632B1E4009@bag.python.org> Author: brett.cannon Date: Sun May 27 07:03:03 2007 New Revision: 55607 Modified: python/branches/bcannon-objcap/run_security_tests.py Log: Fix result detection for 'fail' tests. Modified: python/branches/bcannon-objcap/run_security_tests.py ============================================================================== --- python/branches/bcannon-objcap/run_security_tests.py (original) +++ python/branches/bcannon-objcap/run_security_tests.py Sun May 27 07:03:03 2007 @@ -1,5 +1,6 @@ import subprocess import os +import re def run_tests(type_, test_verifier): failures = [] @@ -22,18 +23,23 @@ return failures +debug_refs_regex = re.compile(r"^\[\d+ refs\]$") + def verify_succeed_test(test_name, stderr): - if stderr.count('\n') > 1: + """Should only have debug build output. + + Does not work for non-debug builds! + + """ + if not debug_refs_regex.match(stderr): return False - else: - return True + return True def verify_fail_test(test_name, stderr): - if stderr.count('\n') <= 1: - return False + """Should have an exception line with the proper exception raised.""" exc_name = test_name.split('--')[1] - if exc_name not in stderr: + if not re.search('^'+exc_name, stderr, re.MULTILINE): return False return True From buildbot at python.org Sun May 27 07:09:06 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 27 May 2007 05:09:06 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20070527050906.492221E4009@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%2520trunk/builds/974 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_socket_ssl make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun May 27 21:49:32 2007 From: python-checkins at python.org (lars.gustaebel) Date: Sun, 27 May 2007 21:49:32 +0200 (CEST) Subject: [Python-checkins] r55617 - in python/trunk: Doc/lib/libtarfile.tex Lib/tarfile.py Lib/test/test_tarfile.py Lib/test/testtar.tar Misc/NEWS Message-ID: <20070527194932.D7CC81E400B@bag.python.org> Author: lars.gustaebel Date: Sun May 27 21:49:30 2007 New Revision: 55617 Modified: python/trunk/Doc/lib/libtarfile.tex python/trunk/Lib/tarfile.py python/trunk/Lib/test/test_tarfile.py python/trunk/Lib/test/testtar.tar python/trunk/Misc/NEWS Log: Added errors argument to TarFile class that allows the user to specify an error handling scheme for character conversion. Additional scheme "utf-8" in read mode. Unicode input filenames are now supported by design. The values of the pax_headers dictionary are now limited to unicode objects. Fixed: The prefix field is no longer used in PAX_FORMAT (in conformance with POSIX). Fixed: In read mode use a possible pax header size field. Fixed: Strip trailing slashes from pax header name values. Fixed: Give values in user-specified pax_headers precedence when writing. Added unicode tests. Added pax/regtype4 member to testtar.tar all possible number fields in a pax header. Added two chapters to the documentation about the different formats tarfile.py supports and how unicode issues are handled. Modified: python/trunk/Doc/lib/libtarfile.tex ============================================================================== --- python/trunk/Doc/lib/libtarfile.tex (original) +++ python/trunk/Doc/lib/libtarfile.tex Sun May 27 21:49:30 2007 @@ -133,24 +133,20 @@ \versionadded{2.6} \end{excdesc} +Each of the following constants defines a tar archive format that the +\module{tarfile} module is able to create. See section \ref{tar-formats} for +details. + \begin{datadesc}{USTAR_FORMAT} - \POSIX{}.1-1988 (ustar) format. It supports filenames up to a length of - at best 256 characters and linknames up to 100 characters. The maximum - file size is 8 gigabytes. This is an old and limited but widely - supported format. + \POSIX{}.1-1988 (ustar) format. \end{datadesc} \begin{datadesc}{GNU_FORMAT} - GNU tar format. It supports arbitrarily long filenames and linknames and - files bigger than 8 gigabytes. It is the defacto standard on GNU/Linux - systems. + GNU tar format. \end{datadesc} \begin{datadesc}{PAX_FORMAT} - \POSIX{}.1-2001 (pax) format. It is the most flexible format with - virtually no limits. It supports long filenames and linknames, large files - and stores pathnames in a portable way. However, not all tar - implementations today are able to handle pax archives properly. + \POSIX{}.1-2001 (pax) format. \end{datadesc} \begin{datadesc}{DEFAULT_FORMAT} @@ -175,15 +171,15 @@ The \class{TarFile} object provides an interface to a tar archive. A tar archive is a sequence of blocks. An archive member (a stored file) is made up -of a header block followed by data blocks. It is possible, to store a file in a +of a header block followed by data blocks. It is possible to store a file in a tar archive several times. Each archive member is represented by a \class{TarInfo} object, see \citetitle{TarInfo Objects} (section \ref{tarinfo-objects}) for details. \begin{classdesc}{TarFile}{name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, - ignore_zeros=False, encoding=None, pax_headers=None, debug=0, - errorlevel=0} + ignore_zeros=False, encoding=None, errors=None, pax_headers=None, + debug=0, errorlevel=0} All following arguments are optional and can be accessed as instance attributes as well. @@ -231,18 +227,14 @@ If \code{2}, all \emph{non-fatal} errors are raised as \exception{TarError} exceptions as well. - The \var{encoding} argument defines the local character encoding. It - defaults to the value from \function{sys.getfilesystemencoding()} or if - that is \code{None} to \code{"ascii"}. \var{encoding} is used only in - connection with the pax format which stores text data in \emph{UTF-8}. If - it is not set correctly, character conversion will fail with a - \exception{UnicodeError}. + The \var{encoding} and \var{errors} arguments control the way strings are + converted to unicode objects and vice versa. The default settings will work + for most users. See section \ref{tar-unicode} for in-depth information. \versionadded{2.6} - The \var{pax_headers} argument must be a dictionary whose elements are - either unicode objects, numbers or strings that can be decoded to unicode - using \var{encoding}. This information will be added to the archive as a - pax global header. + The \var{pax_headers} argument is an optional dictionary of unicode strings + which will be added as a pax global header if \var{format} is + \constant{PAX_FORMAT}. \versionadded{2.6} \end{classdesc} @@ -287,7 +279,7 @@ Extract all members from the archive to the current working directory or directory \var{path}. If optional \var{members} is given, it must be a subset of the list returned by \method{getmembers()}. - Directory informations like owner, modification time and permissions are + Directory information like owner, modification time and permissions are set after all members have been extracted. This is done to work around two problems: A directory's modification time is reset each time a file is created in it. And, if a directory's permissions do not allow writing, @@ -365,6 +357,11 @@ \deprecated{2.6}{Use the \member{format} attribute instead.} \end{memberdesc} +\begin{memberdesc}{pax_headers} + A dictionary containing key-value pairs of pax global headers. + \versionadded{2.6} +\end{memberdesc} + %----------------- % TarInfo Objects %----------------- @@ -384,8 +381,8 @@ Create a \class{TarInfo} object. \end{classdesc} -\begin{methoddesc}{frombuf}{} - Create and return a \class{TarInfo} object from a string buffer. +\begin{methoddesc}{frombuf}{buf} + Create and return a \class{TarInfo} object from string buffer \var{buf}. \versionadded[Raises \exception{HeaderError} if the buffer is invalid.]{2.6} \end{methoddesc} @@ -396,10 +393,11 @@ \versionadded{2.6} \end{methoddesc} -\begin{methoddesc}{tobuf}{\optional{format}} - Create a string buffer from a \class{TarInfo} object. See - \class{TarFile}'s \member{format} argument for information. - \versionchanged[The \var{format} parameter]{2.6} +\begin{methoddesc}{tobuf}{\optional{format\optional{, encoding + \optional{, errors}}}} + Create a string buffer from a \class{TarInfo} object. For information + on the arguments see the constructor of the \class{TarFile} class. + \versionchanged[The arguments were added]{2.6} \end{methoddesc} A \code{TarInfo} object has the following public data attributes: @@ -452,6 +450,12 @@ Group name. \end{memberdesc} +\begin{memberdesc}{pax_headers} + A dictionary containing key-value pairs of an associated pax + extended header. + \versionadded{2.6} +\end{memberdesc} + A \class{TarInfo} object also provides some convenient query methods: \begin{methoddesc}{isfile}{} @@ -554,3 +558,103 @@ tar.extract(tarinfo) tar.close() \end{verbatim} + +%------------ +% Tar format +%------------ + +\subsection{Supported tar formats \label{tar-formats}} + +There are three tar formats that can be created with the \module{tarfile} +module: + +\begin{itemize} + +\item +The \POSIX{}.1-1988 ustar format (\constant{USTAR_FORMAT}). It supports +filenames up to a length of at best 256 characters and linknames up to 100 +characters. The maximum file size is 8 gigabytes. This is an old and limited +but widely supported format. + +\item +The GNU tar format (\constant{GNU_FORMAT}). It supports long filenames and +linknames, files bigger than 8 gigabytes and sparse files. It is the de facto +standard on GNU/Linux systems. \module{tarfile} fully supports the GNU tar +extensions for long names, sparse file support is read-only. + +\item +The \POSIX{}.1-2001 pax format (\constant{PAX_FORMAT}). It is the most +flexible format with virtually no limits. It supports long filenames and +linknames, large files and stores pathnames in a portable way. However, not +all tar implementations today are able to handle pax archives properly. + +The \emph{pax} format is an extension to the existing \emph{ustar} format. It +uses extra headers for information that cannot be stored otherwise. There are +two flavours of pax headers: Extended headers only affect the subsequent file +header, global headers are valid for the complete archive and affect all +following files. All the data in a pax header is encoded in \emph{UTF-8} for +portability reasons. + +\end{itemize} + +There are some more variants of the tar format which can be read, but not +created: + +\begin{itemize} + +\item +The ancient V7 format. This is the first tar format from \UNIX{} Seventh +Edition, storing only regular files and directories. Names must not be longer +than 100 characters, there is no user/group name information. Some archives +have miscalculated header checksums in case of fields with non-\ASCII{} +characters. + +\item +The SunOS tar extended format. This format is a variant of the \POSIX{}.1-2001 +pax format, but is not compatible. + +\end{itemize} + +%---------------- +% Unicode issues +%---------------- + +\subsection{Unicode issues \label{tar-unicode}} + +The tar format was originally conceived to make backups on tape drives with the +main focus on preserving file system information. Nowadays tar archives are +commonly used for file distribution and exchanging archives over networks. One +problem of the original format (that all other formats are merely variants of) +is that there is no concept of supporting different character encodings. +For example, an ordinary tar archive created on a \emph{UTF-8} system cannot be +read correctly on a \emph{Latin-1} system if it contains non-\ASCII{} +characters. Names (i.e. filenames, linknames, user/group names) containing +these characters will appear damaged. Unfortunately, there is no way to +autodetect the encoding of an archive. + +The pax format was designed to solve this problem. It stores non-\ASCII{} names +using the universal character encoding \emph{UTF-8}. When a pax archive is +read, these \emph{UTF-8} names are converted to the encoding of the local +file system. + +The details of unicode conversion are controlled by the \var{encoding} and +\var{errors} keyword arguments of the \class{TarFile} class. + +The default value for \var{encoding} is the local character encoding. It is +deduced from \function{sys.getfilesystemencoding()} and +\function{sys.getdefaultencoding()}. In read mode, \var{encoding} is used +exclusively to convert unicode names from a pax archive to strings in the local +character encoding. In write mode, the use of \var{encoding} depends on the +chosen archive format. In case of \constant{PAX_FORMAT}, input names that +contain non-\ASCII{} characters need to be decoded before being stored as +\emph{UTF-8} strings. The other formats do not make use of \var{encoding} +unless unicode objects are used as input names. These are converted to +8-bit character strings before they are added to the archive. + +The \var{errors} argument defines how characters are treated that cannot be +converted to or from \var{encoding}. Possible values are listed in section +\ref{codec-base-classes}. In read mode, there is an additional scheme +\code{'utf-8'} which means that bad characters are replaced by their +\emph{UTF-8} representation. This is the default scheme. In write mode the +default value for \var{errors} is \code{'strict'} to ensure that name +information is not altered unnoticed. Modified: python/trunk/Lib/tarfile.py ============================================================================== --- python/trunk/Lib/tarfile.py (original) +++ python/trunk/Lib/tarfile.py Sun May 27 21:49:30 2007 @@ -125,6 +125,17 @@ PAX_FIELDS = ("path", "linkpath", "size", "mtime", "uid", "gid", "uname", "gname") +# Fields in a pax header that are numbers, all other fields +# are treated as strings. +PAX_NUMBER_FIELDS = { + "atime": float, + "ctime": float, + "mtime": float, + "uid": int, + "gid": int, + "size": int +} + #--------------------------------------------------------- # Bits used in the mode field, values in octal. #--------------------------------------------------------- @@ -154,7 +165,7 @@ #--------------------------------------------------------- ENCODING = sys.getfilesystemencoding() if ENCODING is None: - ENCODING = "ascii" + ENCODING = sys.getdefaultencoding() #--------------------------------------------------------- # Some useful functions @@ -218,6 +229,26 @@ s = chr(0200) + s return s +def uts(s, encoding, errors): + """Convert a unicode object to a string. + """ + if errors == "utf-8": + # An extra error handler similar to the -o invalid=UTF-8 option + # in POSIX.1-2001. Replace untranslatable characters with their + # UTF-8 representation. + try: + return s.encode(encoding, "strict") + except UnicodeEncodeError: + x = [] + for c in s: + try: + x.append(c.encode(encoding, "strict")) + except UnicodeEncodeError: + x.append(c.encode("utf8")) + return "".join(x) + else: + return s.encode(encoding, errors) + def calc_chksums(buf): """Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if @@ -922,7 +953,7 @@ def __repr__(self): return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self)) - def get_info(self): + def get_info(self, encoding, errors): """Return the TarInfo's attributes as a dictionary. """ info = { @@ -944,24 +975,29 @@ if info["type"] == DIRTYPE and not info["name"].endswith("/"): info["name"] += "/" + for key in ("name", "linkname", "uname", "gname"): + if type(info[key]) is unicode: + info[key] = info[key].encode(encoding, errors) + return info - def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING): + def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="strict"): """Return a tar header as a string of 512 byte blocks. """ + info = self.get_info(encoding, errors) + if format == USTAR_FORMAT: - return self.create_ustar_header() + return self.create_ustar_header(info) elif format == GNU_FORMAT: - return self.create_gnu_header() + return self.create_gnu_header(info) elif format == PAX_FORMAT: - return self.create_pax_header(encoding) + return self.create_pax_header(info, encoding, errors) else: raise ValueError("invalid format") - def create_ustar_header(self): + def create_ustar_header(self, info): """Return the object as a ustar header block. """ - info = self.get_info() info["magic"] = POSIX_MAGIC if len(info["linkname"]) > LENGTH_LINK: @@ -972,10 +1008,9 @@ return self._create_header(info, USTAR_FORMAT) - def create_gnu_header(self): + def create_gnu_header(self, info): """Return the object as a GNU header block sequence. """ - info = self.get_info() info["magic"] = GNU_MAGIC buf = "" @@ -987,12 +1022,11 @@ return buf + self._create_header(info, GNU_FORMAT) - def create_pax_header(self, encoding): + def create_pax_header(self, info, encoding, errors): """Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information. """ - info = self.get_info() info["magic"] = POSIX_MAGIC pax_headers = self.pax_headers.copy() @@ -1002,7 +1036,11 @@ ("name", "path", LENGTH_NAME), ("linkname", "linkpath", LENGTH_LINK), ("uname", "uname", 32), ("gname", "gname", 32)): - val = info[name].decode(encoding) + if hname in pax_headers: + # The pax header has priority. + continue + + val = info[name].decode(encoding, errors) # Try to encode the string as ASCII. try: @@ -1011,27 +1049,23 @@ pax_headers[hname] = val continue - if len(val) > length: - if name == "name": - # Try to squeeze a longname in the prefix and name fields as in - # ustar format. - try: - info["prefix"], info["name"] = self._posix_split_name(info["name"]) - except ValueError: - pax_headers[hname] = val - else: - continue - else: - pax_headers[hname] = val + if len(info[name]) > length: + pax_headers[hname] = val # Test number fields for values that exceed the field limit or values # that like to be stored as float. for name, digits in (("uid", 8), ("gid", 8), ("size", 12), ("mtime", 12)): + if name in pax_headers: + # The pax header has priority. Avoid overflow. + info[name] = 0 + continue + val = info[name] if not 0 <= val < 8 ** (digits - 1) or isinstance(val, float): pax_headers[name] = unicode(val) info[name] = 0 + # Create a pax extended header if necessary. if pax_headers: buf = self._create_pax_generic_header(pax_headers) else: @@ -1040,26 +1074,10 @@ return buf + self._create_header(info, USTAR_FORMAT) @classmethod - def create_pax_global_header(cls, pax_headers, encoding): + def create_pax_global_header(cls, pax_headers): """Return the object as a pax global header block sequence. """ - new_headers = {} - for key, val in pax_headers.iteritems(): - key = cls._to_unicode(key, encoding) - val = cls._to_unicode(val, encoding) - new_headers[key] = val - return cls._create_pax_generic_header(new_headers, type=XGLTYPE) - - @staticmethod - def _to_unicode(value, encoding): - if isinstance(value, unicode): - return value - elif isinstance(value, (int, long, float)): - return unicode(value) - elif isinstance(value, str): - return unicode(value, encoding) - else: - raise ValueError("unable to convert to unicode: %r" % value) + return cls._create_pax_generic_header(pax_headers, type=XGLTYPE) def _posix_split_name(self, name): """Split a name longer than 100 chars into a prefix @@ -1091,9 +1109,9 @@ " ", # checksum field info.get("type", REGTYPE), stn(info.get("linkname", ""), 100), - stn(info.get("magic", ""), 8), - stn(info.get("uname", ""), 32), - stn(info.get("gname", ""), 32), + stn(info.get("magic", POSIX_MAGIC), 8), + stn(info.get("uname", "root"), 32), + stn(info.get("gname", "root"), 32), itn(info.get("devmajor", 0), 8, format), itn(info.get("devminor", 0), 8, format), stn(info.get("prefix", ""), 155) @@ -1254,12 +1272,9 @@ offset += self._block(self.size) tarfile.offset = offset - # Patch the TarInfo object with saved extended + # Patch the TarInfo object with saved global # header information. - for keyword, value in tarfile.pax_headers.iteritems(): - if keyword in PAX_FIELDS: - setattr(self, keyword, value) - self.pax_headers[keyword] = value + self._apply_pax_info(tarfile.pax_headers, tarfile.encoding, tarfile.errors) return self @@ -1270,18 +1285,17 @@ buf = tarfile.fileobj.read(self._block(self.size)) # Fetch the next header and process it. - b = tarfile.fileobj.read(BLOCKSIZE) - t = self.frombuf(b) - t.offset = self.offset - next = t._proc_member(tarfile) + next = self.fromtarfile(tarfile) + if next is None: + raise HeaderError("missing subsequent header") # Patch the TarInfo object from the next header with # the longname information. next.offset = self.offset if self.type == GNUTYPE_LONGNAME: - next.name = buf.rstrip(NUL) + next.name = nts(buf) elif self.type == GNUTYPE_LONGLINK: - next.linkname = buf.rstrip(NUL) + next.linkname = nts(buf) return next @@ -1356,21 +1370,10 @@ else: pax_headers = tarfile.pax_headers.copy() - # Fields in POSIX.1-2001 that are numbers, all other fields - # are treated as UTF-8 strings. - type_mapping = { - "atime": float, - "ctime": float, - "mtime": float, - "uid": int, - "gid": int, - "size": int - } - # Parse pax header information. A record looks like that: # "%d %s=%s\n" % (length, keyword, value). length is the size # of the complete record including the length field itself and - # the newline. + # the newline. keyword and value are both UTF-8 encoded strings. regex = re.compile(r"(\d+) ([^=]+)=", re.U) pos = 0 while True: @@ -1383,35 +1386,55 @@ value = buf[match.end(2) + 1:match.start(1) + length - 1] keyword = keyword.decode("utf8") - keyword = keyword.encode(tarfile.encoding) - value = value.decode("utf8") - if keyword in type_mapping: + + pax_headers[keyword] = value + pos += length + + # Fetch the next header. + next = self.fromtarfile(tarfile) + + if self.type in (XHDTYPE, SOLARIS_XHDTYPE): + if next is None: + raise HeaderError("missing subsequent header") + + # Patch the TarInfo object with the extended header info. + next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors) + next.offset = self.offset + + if pax_headers.has_key("size"): + # If the extended header replaces the size field, + # we need to recalculate the offset where the next + # header starts. + offset = next.offset_data + if next.isreg() or next.type not in SUPPORTED_TYPES: + offset += next._block(next.size) + tarfile.offset = offset + + return next + + def _apply_pax_info(self, pax_headers, encoding, errors): + """Replace fields with supplemental information from a previous + pax extended or global header. + """ + for keyword, value in pax_headers.iteritems(): + if keyword not in PAX_FIELDS: + continue + + if keyword == "path": + value = value.rstrip("/") + + if keyword in PAX_NUMBER_FIELDS: try: - value = type_mapping[keyword](value) + value = PAX_NUMBER_FIELDS[keyword](value) except ValueError: value = 0 else: - value = value.encode(tarfile.encoding) - - pax_headers[keyword] = value - pos += length + value = uts(value, encoding, errors) - # Fetch the next header that will be patched with the - # supplement information from the pax header (extended - # only). - t = self.fromtarfile(tarfile) - - if self.type != XGLTYPE and t is not None: - # Patch the TarInfo object from the next header with - # the pax header's information. - for keyword, value in pax_headers.items(): - if keyword in PAX_FIELDS: - setattr(t, keyword, value) - pax_headers[keyword] = value - t.pax_headers = pax_headers.copy() + setattr(self, keyword, value) - return t + self.pax_headers = pax_headers.copy() def _block(self, count): """Round up a byte count by BLOCKSIZE and return it, @@ -1462,8 +1485,9 @@ format = DEFAULT_FORMAT # The format to use when creating an archive. - encoding = ENCODING # Transfer UTF-8 strings from POSIX.1-2001 - # headers to this encoding. + encoding = ENCODING # Encoding for 8-bit character strings. + + errors = None # Error handler for unicode conversion. tarinfo = TarInfo # The default TarInfo class to use. @@ -1471,7 +1495,7 @@ def __init__(self, name=None, mode="r", fileobj=None, format=None, tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, - pax_headers=None, debug=None, errorlevel=None): + errors=None, pax_headers=None, debug=None, errorlevel=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' @@ -1512,6 +1536,19 @@ self.ignore_zeros = ignore_zeros if encoding is not None: self.encoding = encoding + + if errors is not None: + self.errors = errors + elif mode == "r": + self.errors = "utf-8" + else: + self.errors = "strict" + + if pax_headers is not None and self.format == PAX_FORMAT: + self.pax_headers = pax_headers + else: + self.pax_headers = {} + if debug is not None: self.debug = debug if errorlevel is not None: @@ -1524,7 +1561,6 @@ self.offset = 0L # current position in the archive file self.inodes = {} # dictionary caching the inodes of # archive members already added - self.pax_headers = {} # save contents of global pax headers if self.mode == "r": self.firstmember = None @@ -1543,9 +1579,8 @@ if self.mode in "aw": self._loaded = True - if pax_headers: - buf = self.tarinfo.create_pax_global_header( - pax_headers.copy(), self.encoding) + if self.pax_headers: + buf = self.tarinfo.create_pax_global_header(self.pax_headers.copy()) self.fileobj.write(buf) self.offset += len(buf) @@ -1817,8 +1852,6 @@ self.inodes[inode] = arcname elif stat.S_ISDIR(stmd): type = DIRTYPE - if arcname[-1:] != "/": - arcname += "/" elif stat.S_ISFIFO(stmd): type = FIFOTYPE elif stat.S_ISLNK(stmd): @@ -1952,7 +1985,7 @@ tarinfo = copy.copy(tarinfo) - buf = tarinfo.tobuf(self.format, self.encoding) + buf = tarinfo.tobuf(self.format, self.encoding, self.errors) self.fileobj.write(buf) self.offset += len(buf) Modified: python/trunk/Lib/test/test_tarfile.py ============================================================================== --- python/trunk/Lib/test/test_tarfile.py (original) +++ python/trunk/Lib/test/test_tarfile.py Sun May 27 21:49:30 2007 @@ -1,4 +1,4 @@ -# encoding: iso8859-1 +# -*- coding: iso-8859-15 -*- import sys import os @@ -372,9 +372,9 @@ def test_read_longname(self): # Test reading of longname (bug #1471427). - name = self.subdir + "/" + "123/" * 125 + "longname" + longname = self.subdir + "/" + "123/" * 125 + "longname" try: - tarinfo = self.tar.getmember(name) + tarinfo = self.tar.getmember(longname) except KeyError: self.fail("longname not found") self.assert_(tarinfo.type != tarfile.DIRTYPE, "read longname as dirtype") @@ -393,13 +393,24 @@ tarinfo = self.tar.getmember(longname) offset = tarinfo.offset self.tar.fileobj.seek(offset) - fobj = StringIO.StringIO(self.tar.fileobj.read(1536)) + fobj = StringIO.StringIO(self.tar.fileobj.read(3 * 512)) self.assertRaises(tarfile.ReadError, tarfile.open, name="foo.tar", fileobj=fobj) + def test_header_offset(self): + # Test if the start offset of the TarInfo object includes + # the preceding extended header. + longname = self.subdir + "/" + "123/" * 125 + "longname" + offset = self.tar.getmember(longname).offset + fobj = open(tarname) + fobj.seek(offset) + tarinfo = tarfile.TarInfo.frombuf(fobj.read(512)) + self.assertEqual(tarinfo.type, self.longnametype) + class GNUReadTest(LongnameTest): subdir = "gnu" + longnametype = tarfile.GNUTYPE_LONGNAME def test_sparse_file(self): tarinfo1 = self.tar.getmember("ustar/sparse") @@ -410,26 +421,40 @@ "sparse file extraction failed") -class PaxReadTest(ReadTest): +class PaxReadTest(LongnameTest): subdir = "pax" + longnametype = tarfile.XHDTYPE - def test_pax_globheaders(self): + def test_pax_global_headers(self): tar = tarfile.open(tarname, encoding="iso8859-1") + tarinfo = tar.getmember("pax/regtype1") self.assertEqual(tarinfo.uname, "foo") self.assertEqual(tarinfo.gname, "bar") - self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "???????") + self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), u"???????") tarinfo = tar.getmember("pax/regtype2") self.assertEqual(tarinfo.uname, "") self.assertEqual(tarinfo.gname, "bar") - self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "???????") + self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), u"???????") tarinfo = tar.getmember("pax/regtype3") self.assertEqual(tarinfo.uname, "tarfile") self.assertEqual(tarinfo.gname, "tarfile") - self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "???????") + self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), u"???????") + + def test_pax_number_fields(self): + # All following number fields are read from the pax header. + tar = tarfile.open(tarname, encoding="iso8859-1") + tarinfo = tar.getmember("pax/regtype4") + self.assertEqual(tarinfo.size, 7011) + self.assertEqual(tarinfo.uid, 123) + self.assertEqual(tarinfo.gid, 123) + self.assertEqual(tarinfo.mtime, 1041808783.0) + self.assertEqual(type(tarinfo.mtime), float) + self.assertEqual(float(tarinfo.pax_headers["atime"]), 1041808783.0) + self.assertEqual(float(tarinfo.pax_headers["ctime"]), 1041808783.0) class WriteTest(unittest.TestCase): @@ -700,68 +725,161 @@ n = tar.getmembers()[0].name self.assert_(name == n, "PAX longname creation failed") - def test_iso8859_15_filename(self): - self._test_unicode_filename("iso8859-15") + def test_pax_global_header(self): + pax_headers = { + u"foo": u"bar", + u"uid": u"0", + u"mtime": u"1.23", + u"test": u"???", + u"???": u"test"} + + tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, \ + pax_headers=pax_headers) + tar.addfile(tarfile.TarInfo("test")) + tar.close() + + # Test if the global header was written correctly. + tar = tarfile.open(tmpname, encoding="iso8859-1") + self.assertEqual(tar.pax_headers, pax_headers) + self.assertEqual(tar.getmembers()[0].pax_headers, pax_headers) + + # Test if all the fields are unicode. + for key, val in tar.pax_headers.iteritems(): + self.assert_(type(key) is unicode) + self.assert_(type(val) is unicode) + if key in tarfile.PAX_NUMBER_FIELDS: + try: + tarfile.PAX_NUMBER_FIELDS[key](val) + except (TypeError, ValueError): + self.fail("unable to convert pax header field") + + def test_pax_extended_header(self): + # The fields from the pax header have priority over the + # TarInfo. + pax_headers = {u"path": u"foo", u"uid": u"123"} + + tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, encoding="iso8859-1") + t = tarfile.TarInfo() + t.name = u"???" # non-ASCII + t.uid = 8**8 # too large + t.pax_headers = pax_headers + tar.addfile(t) + tar.close() + + tar = tarfile.open(tmpname, encoding="iso8859-1") + t = tar.getmembers()[0] + self.assertEqual(t.pax_headers, pax_headers) + self.assertEqual(t.name, "foo") + self.assertEqual(t.uid, 123) + + +class UstarUnicodeTest(unittest.TestCase): + # All *UnicodeTests FIXME + + format = tarfile.USTAR_FORMAT + + def test_iso8859_1_filename(self): + self._test_unicode_filename("iso8859-1") + + def test_utf7_filename(self): + self._test_unicode_filename("utf7") def test_utf8_filename(self): self._test_unicode_filename("utf8") - def test_utf16_filename(self): - self._test_unicode_filename("utf16") - def _test_unicode_filename(self, encoding): - tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT) - name = u"\u20ac".encode(encoding) # Euro sign - tar.encoding = encoding + tar = tarfile.open(tmpname, "w", format=self.format, encoding=encoding, errors="strict") + name = u"???" tar.addfile(tarfile.TarInfo(name)) tar.close() tar = tarfile.open(tmpname, encoding=encoding) - self.assertEqual(tar.getmembers()[0].name, name) + self.assert_(type(tar.getnames()[0]) is not unicode) + self.assertEqual(tar.getmembers()[0].name, name.encode(encoding)) tar.close() def test_unicode_filename_error(self): - # The euro sign filename cannot be translated to iso8859-1 encoding. - tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, encoding="utf8") - name = u"\u20ac".encode("utf8") # Euro sign - tar.addfile(tarfile.TarInfo(name)) + tar = tarfile.open(tmpname, "w", format=self.format, encoding="ascii", errors="strict") + tarinfo = tarfile.TarInfo() + + tarinfo.name = "???" + if self.format == tarfile.PAX_FORMAT: + self.assertRaises(UnicodeError, tar.addfile, tarinfo) + else: + tar.addfile(tarinfo) + + tarinfo.name = u"???" + self.assertRaises(UnicodeError, tar.addfile, tarinfo) + + tarinfo.name = "foo" + tarinfo.uname = u"???" + self.assertRaises(UnicodeError, tar.addfile, tarinfo) + + def test_unicode_argument(self): + tar = tarfile.open(tarname, "r", encoding="iso8859-1", errors="strict") + for t in tar: + self.assert_(type(t.name) is str) + self.assert_(type(t.linkname) is str) + self.assert_(type(t.uname) is str) + self.assert_(type(t.gname) is str) tar.close() - self.assertRaises(UnicodeError, tarfile.open, tmpname, encoding="iso8859-1") + def test_uname_unicode(self): + for name in (u"???", "???"): + t = tarfile.TarInfo("foo") + t.uname = name + t.gname = name - def test_pax_headers(self): - self._test_pax_headers({"foo": "bar", "uid": 0, "mtime": 1.23}) + fobj = StringIO.StringIO() + tar = tarfile.open("foo.tar", mode="w", fileobj=fobj, format=self.format, encoding="iso8859-1") + tar.addfile(t) + tar.close() + fobj.seek(0) - self._test_pax_headers({"euro": u"\u20ac".encode("utf8")}) + tar = tarfile.open("foo.tar", fileobj=fobj, encoding="iso8859-1") + t = tar.getmember("foo") + self.assertEqual(t.uname, "???") + self.assertEqual(t.gname, "???") - self._test_pax_headers({"euro": u"\u20ac"}, - {"euro": u"\u20ac".encode("utf8")}) - self._test_pax_headers({u"\u20ac": "euro"}, - {u"\u20ac".encode("utf8"): "euro"}) +class GNUUnicodeTest(UstarUnicodeTest): - def _test_pax_headers(self, pax_headers, cmp_headers=None): - if cmp_headers is None: - cmp_headers = pax_headers + format = tarfile.GNU_FORMAT - tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, \ - pax_headers=pax_headers, encoding="utf8") - tar.addfile(tarfile.TarInfo("test")) - tar.close() - tar = tarfile.open(tmpname, encoding="utf8") - self.assertEqual(tar.pax_headers, cmp_headers) +class PaxUnicodeTest(UstarUnicodeTest): - def test_truncated_header(self): - tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT) - tarinfo = tarfile.TarInfo("123/" * 126 + "longname") - tar.addfile(tarinfo) + format = tarfile.PAX_FORMAT + + def _create_unicode_name(self, name): + tar = tarfile.open(tmpname, "w", format=self.format) + t = tarfile.TarInfo() + t.pax_headers["path"] = name + tar.addfile(t) tar.close() - # Simulate a premature EOF. - open(tmpname, "rb+").truncate(1536) - tar = tarfile.open(tmpname) - self.assertEqual(tar.getmembers(), []) + def test_error_handlers(self): + # Test if the unicode error handlers work correctly for characters + # that cannot be expressed in a given encoding. + self._create_unicode_name(u"???") + + for handler, name in (("utf-8", u"???".encode("utf8")), + ("replace", "???"), ("ignore", "")): + tar = tarfile.open(tmpname, format=self.format, encoding="ascii", + errors=handler) + self.assertEqual(tar.getnames()[0], name) + + self.assertRaises(UnicodeError, tarfile.open, tmpname, + encoding="ascii", errors="strict") + + def test_error_handler_utf8(self): + # Create a pathname that has one component representable using + # iso8859-1 and the other only in iso8859-15. + self._create_unicode_name(u"???/?") + + tar = tarfile.open(tmpname, format=self.format, encoding="iso8859-1", + errors="utf-8") + self.assertEqual(tar.getnames()[0], "???/" + u"?".encode("utf8")) class AppendTest(unittest.TestCase): @@ -836,63 +954,58 @@ def test_ustar_limits(self): # 100 char name tarinfo = tarfile.TarInfo("0123456789" * 10) - tarinfo.create_ustar_header() + tarinfo.tobuf(tarfile.USTAR_FORMAT) # 101 char name that cannot be stored tarinfo = tarfile.TarInfo("0123456789" * 10 + "0") - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) # 256 char name with a slash at pos 156 tarinfo = tarfile.TarInfo("123/" * 62 + "longname") - tarinfo.create_ustar_header() + tarinfo.tobuf(tarfile.USTAR_FORMAT) # 256 char name that cannot be stored tarinfo = tarfile.TarInfo("1234567/" * 31 + "longname") - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) # 512 char name tarinfo = tarfile.TarInfo("123/" * 126 + "longname") - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) # 512 char linkname tarinfo = tarfile.TarInfo("longlink") tarinfo.linkname = "123/" * 126 + "longname" - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) # uid > 8 digits tarinfo = tarfile.TarInfo("name") tarinfo.uid = 010000000 - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) def test_gnu_limits(self): tarinfo = tarfile.TarInfo("123/" * 126 + "longname") - tarinfo.create_gnu_header() + tarinfo.tobuf(tarfile.GNU_FORMAT) tarinfo = tarfile.TarInfo("longlink") tarinfo.linkname = "123/" * 126 + "longname" - tarinfo.create_gnu_header() + tarinfo.tobuf(tarfile.GNU_FORMAT) # uid >= 256 ** 7 tarinfo = tarfile.TarInfo("name") tarinfo.uid = 04000000000000000000L - self.assertRaises(ValueError, tarinfo.create_gnu_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.GNU_FORMAT) def test_pax_limits(self): - # A 256 char name that can be stored without an extended header. - tarinfo = tarfile.TarInfo("123/" * 62 + "longname") - self.assert_(len(tarinfo.create_pax_header("utf8")) == 512, - "create_pax_header attached superfluous extended header") - tarinfo = tarfile.TarInfo("123/" * 126 + "longname") - tarinfo.create_pax_header("utf8") + tarinfo.tobuf(tarfile.PAX_FORMAT) tarinfo = tarfile.TarInfo("longlink") tarinfo.linkname = "123/" * 126 + "longname" - tarinfo.create_pax_header("utf8") + tarinfo.tobuf(tarfile.PAX_FORMAT) tarinfo = tarfile.TarInfo("name") tarinfo.uid = 04000000000000000000L - tarinfo.create_pax_header("utf8") + tarinfo.tobuf(tarfile.PAX_FORMAT) class GzipMiscReadTest(MiscReadTest): @@ -940,6 +1053,9 @@ StreamWriteTest, GNUWriteTest, PaxWriteTest, + UstarUnicodeTest, + GNUUnicodeTest, + PaxUnicodeTest, AppendTest, LimitsTest, ] Modified: python/trunk/Lib/test/testtar.tar ============================================================================== Binary files. No diff available. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun May 27 21:49:30 2007 @@ -220,6 +220,9 @@ Library ------- +- tarfile.py: Improved unicode support. Unicode input names are now + officially supported. Added "errors" argument to the TarFile class. + - urllib.ftpwrapper class now accepts an optional timeout. - shlex.split() now has an optional "posix" parameter. From buildbot at python.org Sun May 27 22:33:25 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 27 May 2007 20:33:25 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070527203325.F0FE21E400F@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2051 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: lars.gustaebel Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver sincerely, -The Buildbot From buildbot at python.org Sun May 27 23:23:00 2007 From: buildbot at python.org (buildbot at python.org) Date: Sun, 27 May 2007 21:23:00 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-2 trunk Message-ID: <20070527212300.BC32F1E4009@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%2520trunk/builds/17 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: lars.gustaebel,neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket_ssl sincerely, -The Buildbot From python-checkins at python.org Mon May 28 07:23:25 2007 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 28 May 2007 07:23:25 +0200 (CEST) Subject: [Python-checkins] r55618 - python/trunk/Doc/lib/libitertools.tex Message-ID: <20070528052325.0FD731E4015@bag.python.org> Author: raymond.hettinger Date: Mon May 28 07:23:22 2007 New Revision: 55618 Modified: python/trunk/Doc/lib/libitertools.tex Log: Explain when groupby() issues a new group. Modified: python/trunk/Doc/lib/libitertools.tex ============================================================================== --- python/trunk/Doc/lib/libitertools.tex (original) +++ python/trunk/Doc/lib/libitertools.tex Mon May 28 07:23:22 2007 @@ -138,6 +138,13 @@ identity function and returns the element unchanged. Generally, the iterable needs to already be sorted on the same key function. + The operation of \function{groupby()} is similar to the \code{uniq} filter + in \UNIX{}. It generates a break or new group every time the value + of the key function changes (which is why it is usually necessary + to have sorted the data using the same key function). That behavior + differs from SQL's GROUP BY which aggregates common elements regardless + of their input order. + The returned group is itself an iterator that shares the underlying iterable with \function{groupby()}. Because the source is shared, when the \function{groupby} object is advanced, the previous group is no @@ -147,6 +154,7 @@ \begin{verbatim} groups = [] uniquekeys = [] + data = sorted(data, key=keyfunc) for k, g in groupby(data, keyfunc): groups.append(list(g)) # Store group iterator as a list uniquekeys.append(k) From nnorwitz at gmail.com Mon May 28 11:07:52 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 28 May 2007 05:07:52 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20070528090752.GA24672@python.psfb.org> test_popen2 leaked [0, 0, 26] references, sum=26 From python-checkins at python.org Mon May 28 17:14:28 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Mon, 28 May 2007 17:14:28 +0200 (CEST) Subject: [Python-checkins] r55619 - in python/branches/cpy_merge/Lib: StringIO.py test/test_StringIO.py Message-ID: <20070528151428.5EDED1E4009@bag.python.org> Author: alexandre.vassalotti Date: Mon May 28 17:14:23 2007 New Revision: 55619 Modified: python/branches/cpy_merge/Lib/StringIO.py python/branches/cpy_merge/Lib/test/test_StringIO.py Log: Raise a ValueError when .getvalue() is invoked after .close() Added a test to check this new behavior. Modified: python/branches/cpy_merge/Lib/StringIO.py ============================================================================== --- python/branches/cpy_merge/Lib/StringIO.py (original) +++ python/branches/cpy_merge/Lib/StringIO.py Mon May 28 17:14:23 2007 @@ -267,6 +267,7 @@ 8th bit) will cause a UnicodeError to be raised when getvalue() is called. """ + _complain_ifclosed(self.closed) if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] Modified: python/branches/cpy_merge/Lib/test/test_StringIO.py ============================================================================== --- python/branches/cpy_merge/Lib/test/test_StringIO.py (original) +++ python/branches/cpy_merge/Lib/test/test_StringIO.py Mon May 28 17:14:23 2007 @@ -98,6 +98,11 @@ self._fp.close() self.assertRaises(ValueError, next, self._fp) + def test_getvalue(self): + f = self.MODULE.StringIO() + f.close() + self.assertRaises(ValueError, f.getvalue) + class TestStringIO(TestGenericStringIO): MODULE = StringIO From python-checkins at python.org Mon May 28 17:19:27 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Mon, 28 May 2007 17:19:27 +0200 (CEST) Subject: [Python-checkins] r55620 - python/branches/cpy_merge/Modules/_bytes_iomodule.c Message-ID: <20070528151927.1A1461E4009@bag.python.org> Author: alexandre.vassalotti Date: Mon May 28 17:19:23 2007 New Revision: 55620 Added: python/branches/cpy_merge/Modules/_bytes_iomodule.c (contents, props changed) Log: Checkpoint. Added: python/branches/cpy_merge/Modules/_bytes_iomodule.c ============================================================================== --- (empty file) +++ python/branches/cpy_merge/Modules/_bytes_iomodule.c Mon May 28 17:19:23 2007 @@ -0,0 +1,701 @@ +#include "Python.h" + +typedef struct { + PyObject_HEAD + char *buf; + Py_ssize_t pos, string_size; + Py_ssize_t buf_size; +} BytesIOObject; + +static PyTypeObject BytesIO_Type; + + +static PyObject * +err_closed(void) +{ + PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); + return NULL; +} + +static PyObject * +bytes_io_get_closed(BytesIOObject *self) +{ + PyObject *result = Py_False; + + if (self->buf == NULL) + result = Py_True; + Py_INCREF(result); + return result; +} + +static PyObject * +bytes_io_flush(BytesIOObject *self) +{ + if (self->buf == NULL) + return err_closed(); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +bytes_io_getvalue(BytesIOObject *self) +{ + if (self->buf == NULL) + return err_closed(); + + return PyString_FromStringAndSize(self->buf, self->string_size); +} + +static PyObject * +bytes_io_isatty(BytesIOObject *self) +{ + if (self->buf == NULL) + return err_closed(); + + Py_INCREF(Py_False); + return Py_False; +} + +static PyObject * +bytes_io_read(BytesIOObject *self, PyObject *args) +{ + Py_ssize_t l, n = -1; + char *output = NULL; + + if (self->buf == NULL) + return err_closed(); + if (!PyArg_ParseTuple(args, "|n:read", &n)) + return NULL; + + /* adjust invalid sizes */ + l = self->string_size - self->pos; + if (n < 0 || n > l) { + n = l; + if (n < 0) + n = 0; + } + + output = self->buf + self->pos; + self->pos += n; + + return PyString_FromStringAndSize(output, n); +} + +static PyObject * +bytes_io_readline(BytesIOobject *self, PyObject *args) +{ + char *n, *s; + int m = -1; + Py_ssize_t l; + char *output; + + if (self->buf == NULL) + return err_closed(); + + if (args) { + if (!PyArg_ParseTuple(args, "|i:readline", &m)) + return NULL; + } + + /* move to the end of the line, upto the end of the string, s */ + for (n = self->buf + self->pos, + s = self->buf + self->string_size; + n < s && *n != '\n'; n++); + + /* skip the newline character */ + if (n < s) + n++; + + /* get the length from the current position to the end of the line */ + l = n - (self->buf + self->pos); + output = self->buf + self->pos; + + assert(self->pos + l < INT_MAX); /* XXX: Is this really needed? */ + self->pos += l; + + if (m >= 0 && m < l) { + m = l - m; + l -= m; + self->pos -= m; + } + + return PyString_FromStringAndSize(output, l); +} + +static PyObject * +IO_readlines(IOobject *self, PyObject *args) +{ + int n; + char *output; + PyObject *result, *line; + int hint = 0, length = 0; + + if (!PyArg_ParseTuple(args, "|i:readlines", &hint)) + return NULL; + + result = PyList_New(0); + if (!result) + return NULL; + + while (1) { + if ((n = IO_creadline((PyObject *) self, &output)) < 0) + goto err; + if (n == 0) + break; + line = PyString_FromStringAndSize(output, n); + if (!line) + goto err; + if (PyList_Append(result, line) == -1) { + Py_DECREF(line); + goto err; + } + Py_DECREF(line); + length += n; + if (hint > 0 && length >= hint) + break; + } + return result; + err: + Py_DECREF(result); + return NULL; +} + +PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); + +static PyObject * +IO_reset(IOobject *self, PyObject *unused) +{ + + if (!IO__opencheck(self)) + return NULL; + + self->pos = 0; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(IO_reset__doc__, +"reset() -- Reset the file position to the beginning"); + +static PyObject * +IO_tell(IOobject *self, PyObject *unused) +{ + + if (!IO__opencheck(self)) + return NULL; + + return PyInt_FromSsize_t(self->pos); +} + +PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position."); + +static PyObject * +IO_truncate(IOobject *self, PyObject *args) +{ + Py_ssize_t pos = -1; + + if (!IO__opencheck(self)) + return NULL; + if (!PyArg_ParseTuple(args, "|n:truncate", &pos)) + return NULL; + + if (PyTuple_Size(args) == 0) { + /* No argument passed, truncate to current position */ + pos = self->pos; + } + + if (pos < 0) { + errno = EINVAL; + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + + if (self->string_size > pos) + self->string_size = pos; + self->pos = self->string_size; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(IO_truncate__doc__, +"truncate(): truncate the file at the current position."); + +static PyObject * +IO_iternext(Iobject *self) +{ + PyObject *next; + next = IO_readline((IOobject *) self, NULL); + if (!next) + return NULL; + if (!PyString_GET_SIZE(next)) { + Py_DECREF(next); + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + return next; +} + + +/* Read-write object methods */ + +static PyObject * +O_seek(Oobject *self, PyObject *args) +{ + Py_ssize_t position; + int mode = 0; + + if (!IO__opencheck(IOOOBJECT(self))) + return NULL; + if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) + return NULL; + + if (mode == 2) { + position += self->string_size; + } + else if (mode == 1) { + position += self->pos; + } + + if (position > self->buf_size) { + char *newbuf; + self->buf_size *= 2; + if (self->buf_size <= position) + self->buf_size = position + 1; + newbuf = (char *) realloc(self->buf, self->buf_size); + if (!newbuf) { + free(self->buf); + self->buf = 0; + self->buf_size = self->pos = 0; + return PyErr_NoMemory(); + } + self->buf = newbuf; + } + else if (position < 0) + position = 0; + + self->pos = position; + + while (--position >= self->string_size) + self->buf[position] = 0; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(O_seek__doc__, +"seek(position) -- set the current position\n" +"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"); + +static int +O_cwrite(PyObject *self, const char *c, Py_ssize_t l) +{ + Py_ssize_t newl; + Oobject *oself; + char *newbuf; + + if (!IO__opencheck(IOOOBJECT(self))) + return -1; + oself = (Oobject *) self; + + newl = oself->pos + l; + if (newl >= oself->buf_size) { + oself->buf_size *= 2; + if (oself->buf_size <= newl) { + assert(newl + 1 < INT_MAX); + oself->buf_size = (int) (newl + 1); + } + newbuf = (char *) realloc(oself->buf, oself->buf_size); + if (!newbuf) { + PyErr_SetString(PyExc_MemoryError, "out of memory"); + free(oself->buf); + oself->buf = 0; + oself->buf_size = oself->pos = 0; + return -1; + } + oself->buf = newbuf; + } + + memcpy(oself->buf + oself->pos, c, l); + + assert(oself->pos + l < INT_MAX); + oself->pos += (int) l; + + if (oself->string_size < oself->pos) { + oself->string_size = oself->pos; + } + + return (int) l; +} + +static PyObject * +O_write(Oobject *self, PyObject *args) +{ + char *c; + int l; + + if (!PyArg_ParseTuple(args, "t#:write", &c, &l)) + return NULL; + + if (O_cwrite((PyObject *) self, c, l) < 0) + return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(O_write__doc__, +"write(s) -- Write a string to the file" +"\n\nNote (hack:) writing None resets the buffer"); + +static PyObject * +O_close(Oobject *self, PyObject *unused) +{ + if (self->buf != NULL) + free(self->buf); + self->buf = NULL; + + self->pos = self->string_size = self->buf_size = 0; + + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held."); + +static PyObject * +O_writelines(Oobject *self, PyObject *args) +{ + PyObject *it, *s; + + it = PyObject_GetIter(args); + if (it == NULL) + return NULL; + while ((s = PyIter_Next(it)) != NULL) { + Py_ssize_t n; + char *c; + if (PyString_AsStringAndSize(s, &c, &n) == -1) { + Py_DECREF(it); + Py_DECREF(s); + return NULL; + } + if (O_cwrite((PyObject *) self, c, n) == -1) { + Py_DECREF(it); + Py_DECREF(s); + return NULL; + } + Py_DECREF(s); + } + + Py_DECREF(it); + + /* See if PyIter_Next failed */ + if (PyErr_Occurred()) + return NULL; + + Py_RETURN_NONE; +} + +PyDoc_STRVAR(O_writelines__doc__, +"writelines(sequence_of_strings) -> None. Write the strings to the file.\n" +"\n" +"Note that newlines are not added. The sequence can be any iterable object\n" +"producing strings. This is equivalent to calling write() for each string."); + + +static struct PyMethodDef O_methods[] = { + /* Common methods: */ + {"flush", (PyCFunction) IO_flush, METH_NOARGS, IO_flush__doc__}, + {"getvalue", (PyCFunction) IO_getval, METH_VARARGS, IO_getval__doc__}, + {"isatty", (PyCFunction) IO_isatty, METH_NOARGS, IO_isatty__doc__}, + {"read", (PyCFunction) IO_read, METH_VARARGS, IO_read__doc__}, + {"readline", (PyCFunction) IO_readline, METH_VARARGS, + IO_readline__doc__}, + {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, + IO_readlines__doc__}, + {"reset", (PyCFunction) IO_reset, METH_NOARGS, IO_reset__doc__}, + {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, + {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, + IO_truncate__doc__}, + + /* Read-write BytesIO specific methods: */ + {"close", (PyCFunction) O_close, METH_NOARGS, O_close__doc__}, + {"seek", (PyCFunction) O_seek, METH_VARARGS, O_seek__doc__}, + {"write", (PyCFunction) O_write, METH_VARARGS, O_write__doc__}, + {"writelines", (PyCFunction) O_writelines, METH_O, + O_writelines__doc__}, + {NULL, NULL} /* sentinel */ +}; + +static void +O_dealloc(Oobject *self) +{ + if (self->buf != NULL) + free(self->buf); + PyObject_Del(self); +} + + +PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); + +static PyTypeObject Otype = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size */ + "_bytes_io.StringO", /*tp_name */ + sizeof(Oobject), /*tp_basicsize */ + 0, /*tp_itemsize */ + /* methods */ + (destructor) O_dealloc, /*tp_dealloc */ + 0, /*tp_print */ + 0, /*tp_getattr */ + 0, /*tp_setattr */ + 0, /*tp_compare */ + 0, /*tp_repr */ + 0, /*tp_as_number */ + 0, /*tp_as_sequence */ + 0, /*tp_as_mapping */ + 0, /*tp_hash */ + 0, /*tp_call */ + 0, /*tp_str */ + 0, /*tp_getattro */ + 0, /*tp_setattro */ + 0, /*tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /*tp_flags */ + Otype__doc__, /*tp_doc */ + 0, /*tp_traverse */ + 0, /*tp_clear */ + 0, /*tp_richcompare */ + 0, /*tp_weaklistoffset */ + PyObject_SelfIter, /*tp_iter */ + (iternextfunc) IO_iternext, /*tp_iternext */ + O_methods, /*tp_methods */ + 0, /*tp_members */ + file_getsetlist, /*tp_getset */ +}; + +static PyObject * +newOobject(int size) +{ + Oobject *self; + + self = PyObject_New(Oobject, &Otype); + if (self == NULL) + return NULL; + self->pos = 0; + self->string_size = 0; + + self->buf = (char *) malloc(size); + if (!self->buf) { + PyErr_SetString(PyExc_MemoryError, "out of memory"); + self->buf_size = 0; + Py_DECREF(self); + return NULL; + } + + self->buf_size = size; + return (PyObject *) self; +} + +/* End of code for StringO objects */ +/* -------------------------------------------------------- */ + +static PyObject * +I_close(Iobject *self, PyObject *unused) +{ + Py_XDECREF(self->pbuf); + self->pbuf = NULL; + self->buf = NULL; + + self->pos = self->string_size = 0; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +I_seek(Iobject *self, PyObject *args) +{ + Py_ssize_t position; + int mode = 0; + + if (!IO__opencheck(IOOOBJECT(self))) + return NULL; + if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) + return NULL; + + if (mode == 2) + position += self->string_size; + else if (mode == 1) + position += self->pos; + + if (position < 0) + position = 0; + + self->pos = position; + + Py_INCREF(Py_None); + return Py_None; +} + +static struct PyMethodDef I_methods[] = { + /* Common methods: */ + {"flush", (PyCFunction) IO_flush, METH_NOARGS, IO_flush__doc__}, + {"getvalue", (PyCFunction) IO_getval, METH_VARARGS, IO_getval__doc__}, + {"isatty", (PyCFunction) IO_isatty, METH_NOARGS, IO_isatty__doc__}, + {"read", (PyCFunction) IO_read, METH_VARARGS, IO_read__doc__}, + {"readline", (PyCFunction) IO_readline, METH_VARARGS, + IO_readline__doc__}, + {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, + IO_readlines__doc__}, + {"reset", (PyCFunction) IO_reset, METH_NOARGS, IO_reset__doc__}, + {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, + {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, + IO_truncate__doc__}, + + /* Read-only BytesIO specific methods: */ + {"close", (PyCFunction) I_close, METH_NOARGS, O_close__doc__}, + {"seek", (PyCFunction) I_seek, METH_VARARGS, O_seek__doc__}, + {NULL, NULL} +}; + +static void +I_dealloc(Iobject *self) +{ + Py_XDECREF(self->pbuf); + PyObject_Del(self); +} + +PyDoc_STRVAR(Itype__doc__, + "Simple type for treating strings as input file streams"); + +static PyTypeObject Itype = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size */ + "_bytes_io.StringI", /*tp_name */ + sizeof(Iobject), /*tp_basicsize */ + 0, /*tp_itemsize */ + /* methods */ + (destructor) I_dealloc, /*tp_dealloc */ + 0, /*tp_print */ + 0, /* tp_getattr */ + 0, /*tp_setattr */ + 0, /*tp_compare */ + 0, /*tp_repr */ + 0, /*tp_as_number */ + 0, /*tp_as_sequence */ + 0, /*tp_as_mapping */ + 0, /*tp_hash */ + 0, /*tp_call */ + 0, /*tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + Itype__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc) IO_iternext, /* tp_iternext */ + I_methods, /* tp_methods */ + 0, /* tp_members */ + file_getsetlist, /* tp_getset */ +}; + +static PyObject * +newIobject(PyObject *s) +{ + Iobject *self; + char *buf; + Py_ssize_t size; + + if (PyObject_AsCharBuffer(s, (const char **) &buf, &size) != 0) + return NULL; + + self = PyObject_New(Iobject, &Itype); + if (!self) + return NULL; + Py_INCREF(s); + self->buf = buf; + self->string_size = size; + self->pbuf = s; + self->pos = 0; + + return (PyObject *) self; +} + +/* End of code for StringI objects */ +/* -------------------------------------------------------- */ + +static PyObject * +IO_BytesIO(PyObject *self, PyObject *args) +{ + PyObject *s = 0; + + if (!PyArg_UnpackTuple(args, "BytesIO", 0, 1, &s)) + return NULL; + + if (s) + return newIobject(s); + return newOobject(128); +} + +PyDoc_STRVAR(BytesIO_BytesIO_doc, +"BytesIO([s]) -> Return a BytesIO stream for reading or writing"); + +PyDoc_STRVAR(BytesIO_flush_doc, +"flush() -> None. Does nothing."); + +PyDoc_STRVAR(BytesIO_getval_doc, +"getvalue() -> string.\n" +"\n" +"Retrieve the entire contents of the BytesIO object. Raise an\n" +"exception if the object is closed."); + +PyDoc_STRVAR(BytesIO_isatty_doc, +"isatty() -> False.\n" +"\n" +"Always returns False since BytesIO objects are not connected\n" +"to a tty-like device."); + +PyDoc_STRVAR(BytesIO_read_doc, +"read([size]) -> read at most size bytes, returned as a string.\n" +"\n" +"If the size argument is negative or omitted, read until EOF is reached.\n" +"Return an empty string at EOF.\n"); + +PyDoc_STRVAR(BytesIO_readline_doc, +"readline([size]) -> next line from the file, as a string.\n" +"\n" +"Retain newline. A non-negative size argument limits the maximum\n" +"number of bytes to return (an incomplete line may be returned then).\n" +"Return an empty string at EOF.\n"); + +/* List of methods defined in the module */ +static struct PyMethodDef IO_methods[] = { + {"BytesIO", IO_BytesIO, METH_VARARGS, IO_BytesIO_doc}, + {NULL, NULL} /* sentinel */ +}; + +static PyGetSetDef bytes_io_getsetlist[] = { + {"closed", (getter) IO_get_closed, NULL, "True if the file is closed"}, + {0}, +}; + +PyMODINIT_FUNC +init_bytes_io(void) +{ + + PyObject *m; + + if (PyType_Ready(&BytesIO_Type) < 0) + return; + m = Py_InitModule3("_bytes_io", NULL, module_doc); + if (m == NULL) + return; + Py_INCREF(&BytesIO_Type); + PyModule_AddObject(m, "BytesIO", (PyObject *)&BytesIO_Type); +} From python-checkins at python.org Mon May 28 17:39:10 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Mon, 28 May 2007 17:39:10 +0200 (CEST) Subject: [Python-checkins] r55621 - python/branches/cpy_merge Message-ID: <20070528153910.C72D31E4009@bag.python.org> Author: alexandre.vassalotti Date: Mon May 28 17:39:06 2007 New Revision: 55621 Modified: python/branches/cpy_merge/ (props changed) Log: Ignore TAGS/tags files. From python-checkins at python.org Mon May 28 17:44:01 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Mon, 28 May 2007 17:44:01 +0200 (CEST) Subject: [Python-checkins] r55622 - python/branches/cpy_merge Message-ID: <20070528154401.324D11E4009@bag.python.org> Author: alexandre.vassalotti Date: Mon May 28 17:43:59 2007 New Revision: 55622 Modified: python/branches/cpy_merge/ (props changed) Log: Initialized the branch for svnmerge. From python-checkins at python.org Mon May 28 19:08:27 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Mon, 28 May 2007 19:08:27 +0200 (CEST) Subject: [Python-checkins] r55623 - in python/branches/cpy_merge: Lib/test/test_inspect.py Lib/test/test_typechecks.py Misc/NEWS Objects/abstract.c Message-ID: <20070528170827.3C6F31E400D@bag.python.org> Author: alexandre.vassalotti Date: Mon May 28 19:08:21 2007 New Revision: 55623 Added: python/branches/cpy_merge/Lib/test/test_typechecks.py - copied unchanged from r55599, python/branches/p3yk/Lib/test/test_typechecks.py Modified: python/branches/cpy_merge/ (props changed) python/branches/cpy_merge/Lib/test/test_inspect.py python/branches/cpy_merge/Misc/NEWS python/branches/cpy_merge/Objects/abstract.c Log: Merged revisions 55529-55622 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/p3yk ........ r55544 | guido.van.rossum | 2007-05-23 22:23:53 -0400 (Wed, 23 May 2007) | 2 lines Fix test_inspect. It seems my previous "fix" was due to a stale .pyc file. ........ r55587 | guido.van.rossum | 2007-05-25 13:37:01 -0400 (Fri, 25 May 2007) | 2 lines Implement isinstance and issubclass overriding, a la PEP 3119. ........ r55598 | neal.norwitz | 2007-05-25 22:44:02 -0400 (Fri, 25 May 2007) | 1 line Fix refleak on infinite recursion ........ r55599 | neal.norwitz | 2007-05-25 22:47:45 -0400 (Fri, 25 May 2007) | 1 line Add news entry about overidding isinstance/issubclass (PEP 3119) ........ Modified: python/branches/cpy_merge/Lib/test/test_inspect.py ============================================================================== --- python/branches/cpy_merge/Lib/test/test_inspect.py (original) +++ python/branches/cpy_merge/Lib/test/test_inspect.py Mon May 28 19:08:21 2007 @@ -218,7 +218,7 @@ fodderFile = mod2 def test_wrapped_decorator(self): - self.assertSourceEqual(mod2.wrapped, 14, 17) + self.assertSourceEqual(mod2.wrapped, 16, 17) def test_replacing_decorator(self): self.assertSourceEqual(mod2.gone, 9, 10) Modified: python/branches/cpy_merge/Misc/NEWS ============================================================================== --- python/branches/cpy_merge/Misc/NEWS (original) +++ python/branches/cpy_merge/Misc/NEWS Mon May 28 19:08:21 2007 @@ -26,6 +26,8 @@ Core and Builtins ----------------- +- PEP 3119: isinstance() and issubclass() can be overridden. + - Remove BaseException.message. - Remove tuple parameter unpacking (PEP 3113). Modified: python/branches/cpy_merge/Objects/abstract.c ============================================================================== --- python/branches/cpy_merge/Objects/abstract.c (original) +++ python/branches/cpy_merge/Objects/abstract.c Mon May 28 19:08:21 2007 @@ -2132,7 +2132,27 @@ int PyObject_IsInstance(PyObject *inst, PyObject *cls) { - return recursive_isinstance(inst, cls, Py_GetRecursionLimit()); + PyObject *t, *v, *tb; + PyErr_Fetch(&t, &v, &tb); + PyObject *checker = PyObject_GetAttrString(cls, "__instancecheck__"); + PyErr_Restore(t, v, tb); + if (checker != NULL) { + PyObject *res; + int ok = -1; + if (Py_EnterRecursiveCall(" in __instancecheck__")) { + Py_DECREF(checker); + return ok; + } + res = PyObject_CallFunctionObjArgs(checker, inst, NULL); + Py_LeaveRecursiveCall(); + Py_DECREF(checker); + if (res != NULL) { + ok = PyObject_IsTrue(res); + Py_DECREF(res); + } + return ok; + } + return recursive_isinstance(inst, cls, Py_GetRecursionLimit()); } static int @@ -2182,7 +2202,25 @@ int PyObject_IsSubclass(PyObject *derived, PyObject *cls) { - return recursive_issubclass(derived, cls, Py_GetRecursionLimit()); + PyObject *t, *v, *tb; + PyErr_Fetch(&t, &v, &tb); + PyObject *checker = PyObject_GetAttrString(cls, "__subclasscheck__"); + PyErr_Restore(t, v, tb); + if (checker != NULL) { + PyObject *res; + int ok = -1; + if (Py_EnterRecursiveCall(" in __subclasscheck__")) + return ok; + res = PyObject_CallFunctionObjArgs(checker, derived, NULL); + Py_LeaveRecursiveCall(); + Py_DECREF(checker); + if (res != NULL) { + ok = PyObject_IsTrue(res); + Py_DECREF(res); + } + return ok; + } + return recursive_issubclass(derived, cls, Py_GetRecursionLimit()); } From python-checkins at python.org Mon May 28 22:54:52 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Mon, 28 May 2007 22:54:52 +0200 (CEST) Subject: [Python-checkins] r55624 - python/branches/cpy_merge/Modules/_bytes_iomodule.c Message-ID: <20070528205452.4EFFC1E4009@bag.python.org> Author: alexandre.vassalotti Date: Mon May 28 22:54:48 2007 New Revision: 55624 Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c Log: Checkpoint. Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_bytes_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_bytes_iomodule.c Mon May 28 22:54:48 2007 @@ -63,8 +63,6 @@ Py_ssize_t l, n = -1; char *output = NULL; - if (self->buf == NULL) - return err_closed(); if (!PyArg_ParseTuple(args, "|n:read", &n)) return NULL; @@ -82,65 +80,83 @@ return PyString_FromStringAndSize(output, n); } -static PyObject * -bytes_io_readline(BytesIOobject *self, PyObject *args) +/* Internal routine to get a line. Return the number of bytes read. */ +static Py_ssize_t +get_line(BytesIOObject *self, char **output) { char *n, *s; - int m = -1; Py_ssize_t l; - char *output; - if (self->buf == NULL) - return err_closed(); + /* XXX: Should we ckeck here if the object is closed, + for thread-safety? */ + assert(self->buf != NULL); - if (args) { - if (!PyArg_ParseTuple(args, "|i:readline", &m)) - return NULL; - } - - /* move to the end of the line, upto the end of the string, s */ + /* Move to the end of the line, upto the end of the string, s */ for (n = self->buf + self->pos, s = self->buf + self->string_size; n < s && *n != '\n'; n++); - /* skip the newline character */ + /* Skip the newline character */ if (n < s) n++; - /* get the length from the current position to the end of the line */ + /* Get the length from the current position to the end of the line */ l = n - (self->buf + self->pos); - output = self->buf + self->pos; + *output = self->buf + self->pos; - assert(self->pos + l < INT_MAX); /* XXX: Is this really needed? */ + /* XXX: Is this really needed? */ + assert(self->pos + l < PY_SSIZE_T_MAX); self->pos += l; - if (m >= 0 && m < l) { - m = l - m; - l -= m; + return l; +} + +static PyObject * +bytes_io_readline(BytesIOobject *self, PyObject *args) +{ + Py_ssize_t n, m = -1; + char *output; + + if (self->buf == NULL) + return err_closed(); + + if (args) /* XXX: Why this is required? */ + if (!PyArg_ParseTuple(args, "|i:readline", &m)) + return NULL; + + n = get_line(self, &output); + + if (m >= 0 && m < n) { + m = n - m; + n -= m; self->pos -= m; } - return PyString_FromStringAndSize(output, l); + return PyString_FromStringAndSize(output, n); } static PyObject * -IO_readlines(IOobject *self, PyObject *args) +bytes_io_readlines(BytesIOObject *self, PyObject *args) { int n; char *output; PyObject *result, *line; int hint = 0, length = 0; - if (!PyArg_ParseTuple(args, "|i:readlines", &hint)) - return NULL; + if (self->buf == NULL) + return err_closed(); + + if (args) + if (!PyArg_ParseTuple(args, "|i:readlines", &hint)) + return NULL; result = PyList_New(0); if (!result) return NULL; while (1) { - if ((n = IO_creadline((PyObject *) self, &output)) < 0) - goto err; + n = get_line(self, &output); + if (n == 0) break; line = PyString_FromStringAndSize(output, n); @@ -161,7 +177,7 @@ return NULL; } -PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); + static PyObject * IO_reset(IOobject *self, PyObject *unused) @@ -674,6 +690,13 @@ "number of bytes to return (an incomplete line may be returned then).\n" "Return an empty string at EOF.\n"); +PyDoc_STRVAR(BytesIO_readlines_doc, +"readlines([size]) -> list of strings, each a line from the object.\n" +"\n" +"Call readline() repeatedly and return a list of the lines so read.\n" +"The optional size argument, if given, is an approximate bound on the\n" +"total number of bytes in the lines returned.\n"); + /* List of methods defined in the module */ static struct PyMethodDef IO_methods[] = { {"BytesIO", IO_BytesIO, METH_VARARGS, IO_BytesIO_doc}, From python-checkins at python.org Mon May 28 23:19:40 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Mon, 28 May 2007 23:19:40 +0200 (CEST) Subject: [Python-checkins] r55625 - python/branches/cpy_merge/Modules/cStringIO.c Message-ID: <20070528211940.700411E4009@bag.python.org> Author: alexandre.vassalotti Date: Mon May 28 23:19:39 2007 New Revision: 55625 Modified: python/branches/cpy_merge/Modules/cStringIO.c Log: Removed cStringIO.reset() Modified: python/branches/cpy_merge/Modules/cStringIO.c ============================================================================== --- python/branches/cpy_merge/Modules/cStringIO.c (original) +++ python/branches/cpy_merge/Modules/cStringIO.c Mon May 28 23:19:39 2007 @@ -262,22 +262,6 @@ PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); static PyObject * -IO_reset(IOobject *self, PyObject *unused) -{ - - if (!IO__opencheck(self)) - return NULL; - - self->pos = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(IO_reset__doc__, -"reset() -- Reset the file position to the beginning"); - -static PyObject * IO_tell(IOobject *self, PyObject *unused) { @@ -513,7 +497,6 @@ IO_readline__doc__}, {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, IO_readlines__doc__}, - {"reset", (PyCFunction) IO_reset, METH_NOARGS, IO_reset__doc__}, {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, IO_truncate__doc__}, @@ -647,7 +630,6 @@ IO_readline__doc__}, {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, IO_readlines__doc__}, - {"reset", (PyCFunction) IO_reset, METH_NOARGS, IO_reset__doc__}, {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, IO_truncate__doc__}, From python-checkins at python.org Tue May 29 01:18:19 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Tue, 29 May 2007 01:18:19 +0200 (CEST) Subject: [Python-checkins] r55626 - python/branches/cpy_merge/Modules/_bytes_iomodule.c Message-ID: <20070528231819.939DF1E4009@bag.python.org> Author: alexandre.vassalotti Date: Tue May 29 01:18:15 2007 New Revision: 55626 Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c Log: Checkpoint. All methods common to the InputObject and OutputObject are done. Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_bytes_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_bytes_iomodule.c Tue May 29 01:18:15 2007 @@ -106,6 +106,7 @@ /* XXX: Is this really needed? */ assert(self->pos + l < PY_SSIZE_T_MAX); + fprintf(stderr, "line length: %i\n", l); self->pos += l; return l; @@ -177,52 +178,29 @@ return NULL; } - - -static PyObject * -IO_reset(IOobject *self, PyObject *unused) -{ - - if (!IO__opencheck(self)) - return NULL; - - self->pos = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(IO_reset__doc__, -"reset() -- Reset the file position to the beginning"); - static PyObject * -IO_tell(IOobject *self, PyObject *unused) +bytes_io_tell(BytesIOObject *self) { - - if (!IO__opencheck(self)) - return NULL; + if (self->buf == NULL) + return err_closed(); return PyInt_FromSsize_t(self->pos); } -PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position."); - static PyObject * -IO_truncate(IOobject *self, PyObject *args) +bytes_io_truncate(IOobject *self, PyObject *args) { - Py_ssize_t pos = -1; + Py_ssize_t size; - if (!IO__opencheck(self)) - return NULL; - if (!PyArg_ParseTuple(args, "|n:truncate", &pos)) - return NULL; + /* No argument passed, truncate to current position */ + size = self->pos; - if (PyTuple_Size(args) == 0) { - /* No argument passed, truncate to current position */ - pos = self->pos; - } + if (self->buf == NULL) + return err_closed(); + if (!PyArg_ParseTuple(args, "|n:truncate", &size)) + return NULL; - if (pos < 0) { + if (size < 0) { errno = EINVAL; PyErr_SetFromErrno(PyExc_IOError); return NULL; @@ -236,22 +214,23 @@ return Py_None; } -PyDoc_STRVAR(IO_truncate__doc__, -"truncate(): truncate the file at the current position."); - static PyObject * -IO_iternext(Iobject *self) +bytes_io_iternext(IOobject *self) { - PyObject *next; - next = IO_readline((IOobject *) self, NULL); + char *next; + Py_ssize_t n; + + if (self->buf == NULL) + return err_closed(); + + n = get_line(self, &next); + if (!next) return NULL; - if (!PyString_GET_SIZE(next)) { - Py_DECREF(next); - PyErr_SetNone(PyExc_StopIteration); + if (n == 0) return NULL; - } - return next; + + return PyString_FromStringAndSize(next, n); } @@ -431,7 +410,6 @@ IO_readline__doc__}, {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, IO_readlines__doc__}, - {"reset", (PyCFunction) IO_reset, METH_NOARGS, IO_reset__doc__}, {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, IO_truncate__doc__}, @@ -565,7 +543,6 @@ IO_readline__doc__}, {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, IO_readlines__doc__}, - {"reset", (PyCFunction) IO_reset, METH_NOARGS, IO_reset__doc__}, {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, IO_truncate__doc__}, @@ -691,12 +668,22 @@ "Return an empty string at EOF.\n"); PyDoc_STRVAR(BytesIO_readlines_doc, -"readlines([size]) -> list of strings, each a line from the object.\n" +"readlines([size]) -> list of strings, each a line from the file.\n" "\n" "Call readline() repeatedly and return a list of the lines so read.\n" "The optional size argument, if given, is an approximate bound on the\n" "total number of bytes in the lines returned.\n"); +PyDoc_STRVAR(BytesIO_tell_doc, +"tell() -> current file position, an integer\n"); + +PyDoc_STRVAR(IO_truncate__doc__, +"truncate([size]) -> None. Truncate the file to at most size bytes.\n" +"\n" +"Size defaults to the current file position, as returned by tell().\n" +"If the specified size exceeds the file's current size, the file\n" +"remains unchanged."); + /* List of methods defined in the module */ static struct PyMethodDef IO_methods[] = { {"BytesIO", IO_BytesIO, METH_VARARGS, IO_BytesIO_doc}, From python-checkins at python.org Tue May 29 01:48:56 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 01:48:56 +0200 (CEST) Subject: [Python-checkins] r55627 - python/branches/bcannon-objcap/secure_python.c Message-ID: <20070528234856.606101E400B@bag.python.org> Author: brett.cannon Date: Tue May 29 01:48:50 2007 New Revision: 55627 Modified: python/branches/bcannon-objcap/secure_python.c Log: Add support for whitelisting. Support not fully in Subversion as controlled_importlib does not have a symlink into Lib because of a pre-commit issue. Modified: python/branches/bcannon-objcap/secure_python.c ============================================================================== --- python/branches/bcannon-objcap/secure_python.c (original) +++ python/branches/bcannon-objcap/secure_python.c Tue May 29 01:48:50 2007 @@ -6,6 +6,16 @@ */ #include "Python.h" +#define CREATE_SAFE_LIST(kind) \ + safe_##kind##_seq = PyTuple_New(safe_##kind##_count); \ + for (x = 0; x < safe_##kind##_count; x += 1) { \ + PyObject *module_name = \ + PyString_FromString(safe_##kind##_names[x]); \ + PyTuple_SetItem(safe_##kind##_seq, x, module_name); \ + } + +extern PyObject *PyModule_GetWarningsModule(void); + int main(int argc, char *argv[]) { @@ -16,26 +26,43 @@ PyObject *hidden_modules; PyObject *import_module; PyObject *import_callable; + Py_ssize_t safe_builtins_count = 7; + const char *safe_builtins_names[] = {"_ast", "_codecs", "_sre", + "_symtable", "_types", "errno", + "exceptions"}; + Py_ssize_t safe_frozen_count = 0; + const char *safe_frozen_names[] = {}; + PyObject *safe_builtins_seq; + PyObject *safe_frozen_seq; + Py_ssize_t safe_extensions_count = 5; + const char *safe_extensions_names[] = {"binascii", "cmath", "math", + "operator", "time"}; + PyObject *safe_extensions_seq; - /* Initialize interpreter. */ + /* Initialize interpreter. */ Py_Initialize(); + /* Create lists of modules safe to import. */ + CREATE_SAFE_LIST(builtins); + CREATE_SAFE_LIST(frozen); + CREATE_SAFE_LIST(extensions); - /* Secure it. */ interp = PyThreadState_GET()->interp; - import_module = PyImport_ImportModule("importlib"); - - /* XXX Hack to make importlib work w/o 'open' in the built-in namespace. - Fixed in controlled_importlib. */ - PyDict_SetItemString(PyModule_GetDict(import_module), "open", - PyDict_GetItemString(interp->builtins, "open")); - - import_callable = PyObject_CallMethod(import_module, "Import", ""); + /* Get importer from importlib. */ + import_module = PyImport_ImportModule("controlled_importlib"); + if (!import_module) + return 1; + + import_callable = PyObject_CallMethod(import_module, + "ControlledImport", "(O, O, O)", + safe_builtins_seq, safe_frozen_seq, safe_extensions_seq); + if (!import_callable) + return 1; - /* Store import machinery somewhere so that a reference is held as - needed. */ + /* Store importlib importer somewhere. */ PyDict_SetItemString(interp->sysdict, "import_", import_callable); + /* Set __import__ to the import delegate defined in 'sys'. */ PyDict_SetItemString(interp->builtins, "__import__", PyDict_GetItemString(interp->sysdict, "import_delegate")); From python-checkins at python.org Tue May 29 01:54:03 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 01:54:03 +0200 (CEST) Subject: [Python-checkins] r55628 - python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py Message-ID: <20070528235403.B44631E4009@bag.python.org> Author: brett.cannon Date: Tue May 29 01:54:03 2007 New Revision: 55628 Added: python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py (contents, props changed) Log: Add tests for trying to reach 'open' and 'execfile' through __builtin__ and __builtins__. Added: python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py Tue May 29 01:54:03 2007 @@ -0,0 +1,2 @@ +import __builtin__ +__builtin__.execfile Added: python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py Tue May 29 01:54:03 2007 @@ -0,0 +1 @@ +__builtins__.execfile Added: python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py Tue May 29 01:54:03 2007 @@ -0,0 +1,2 @@ +import __builtin__ +__builtin__.open Added: python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py Tue May 29 01:54:03 2007 @@ -0,0 +1 @@ +__builtins__.open From python-checkins at python.org Tue May 29 02:25:43 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Tue, 29 May 2007 02:25:43 +0200 (CEST) Subject: [Python-checkins] r55630 - python/branches/cpy_merge/Modules/_bytes_iomodule.c Message-ID: <20070529002543.0D6731E4009@bag.python.org> Author: alexandre.vassalotti Date: Tue May 29 02:25:42 2007 New Revision: 55630 Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c Log: Remove the fprintf() call I introduced by error. Add an assertion. Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_bytes_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_bytes_iomodule.c Tue May 29 02:25:42 2007 @@ -104,9 +104,8 @@ l = n - (self->buf + self->pos); *output = self->buf + self->pos; - /* XXX: Is this really needed? */ assert(self->pos + l < PY_SSIZE_T_MAX); - fprintf(stderr, "line length: %i\n", l); + assert(l >= 0); self->pos += l; return l; From python-checkins at python.org Tue May 29 03:31:38 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 03:31:38 +0200 (CEST) Subject: [Python-checkins] r55632 - in python/branches/bcannon-objcap: BRANCH_NOTES secure_python.c tests/fail/builtin_execfile--NameError.py tests/fail/builtin_open--NameError.py tests/fail/execfile__builtin__--AttributeError.py tests/fail/execfile__builtins__--AttributeError.py tests/fail/file_constructor--TypeError.py tests/fail/import_unsafe_builtin--ImportError.py tests/fail/import_unsafe_extension--ImportError.py tests/fail/open__builtin__--AttributeError.py tests/fail/open__builtins__--AttributeError.py tests/succeed/import_py.py tests/succeed/import_safe_builtin.py tests/succeed/import_safe_extension.py Message-ID: <20070529013138.B18ED1E4009@bag.python.org> Author: brett.cannon Date: Tue May 29 03:31:34 2007 New Revision: 55632 Modified: python/branches/bcannon-objcap/BRANCH_NOTES python/branches/bcannon-objcap/secure_python.c python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py python/branches/bcannon-objcap/tests/succeed/import_py.py python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py Log: Flesh out import tests along with built-in object access. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Tue May 29 03:31:34 2007 @@ -3,17 +3,35 @@ ======= Attempt to develop some form of security model for Python. -===== -Usage -===== + +================== +Build instructions +================== 1. Build Python as normal. 2. Run ``build_secure_py.sh`` to build ``secure_python.exe``. -====== -Status -====== -* Turn on whitelisting. - - Verify injecting 'open' into importlib works. + +======= +Testing +======= +Execute ``run_security_tests.py`` with ``secure_python.exe`` to run security +tests. Do not expect normal tests to pass as critical modules might be blocked +from being imported. + + +============= +Failing Tests +============= +* Lib/tests/test_xmlrpc.py + + Fails with insecure Python. + + Requires sys.setdefaultencoding() which is deleted by site.py . + + reload(sys) normally adds it, but hack to do a fresh import on sys is + preventing that from happening somehow. + + +===== +To Do +===== * Write tests. - Import + Delegate protects importlib. @@ -21,14 +39,10 @@ * Name fall-through to alternate implementation. + '.hidden' cannot be imported. + Removed modules cannot be imported (unless whitelisted). - - Built-in namespace properly cleansed. - + Nothing exposed through __builtin__ or __builtins__. + + 'sys' not exposed on any modules needed for interpreter. - Types crippled. - + file + code -* Fix 'sys' module reloading. - - test_xmlrpc relies on reloading sys to get setdefaultencoding, but hack - to allow re-import of sys doesn't let this work. + ========== References Modified: python/branches/bcannon-objcap/secure_python.c ============================================================================== --- python/branches/bcannon-objcap/secure_python.c (original) +++ python/branches/bcannon-objcap/secure_python.c Tue May 29 03:31:34 2007 @@ -27,6 +27,7 @@ PyObject *import_module; PyObject *import_callable; Py_ssize_t safe_builtins_count = 7; + /* All whitelisted modules should be imported in the proper test file. */ const char *safe_builtins_names[] = {"_ast", "_codecs", "_sre", "_symtable", "_types", "errno", "exceptions"}; @@ -34,9 +35,18 @@ const char *safe_frozen_names[] = {}; PyObject *safe_builtins_seq; PyObject *safe_frozen_seq; - Py_ssize_t safe_extensions_count = 5; - const char *safe_extensions_names[] = {"binascii", "cmath", "math", - "operator", "time"}; + Py_ssize_t safe_extensions_count = 18; + /* All whitelisted modules should be imported in the proper test file. */ + const char *safe_extensions_names[] = {"_bisect", "_collections", "_csv", + "_functools", "_hashlib", + "_heapq", "_random", + "_struct", "_weakref", + "array", + "binascii", "cmath", + "itertools", + "math", + "operator", + "time", "unicodedata", "zlib"}; PyObject *safe_extensions_seq; /* Initialize interpreter. */ Modified: python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py (original) +++ python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py Tue May 29 03:31:34 2007 @@ -1 +1,2 @@ +"""'execfile' should not be in the built-in namespace.""" _ = execfile Modified: python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py (original) +++ python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py Tue May 29 03:31:34 2007 @@ -1 +1,2 @@ +"""'open' should not be in the built-in namespace.""" _ = open Modified: python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py (original) +++ python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py Tue May 29 03:31:34 2007 @@ -1,2 +1,3 @@ +"""'execfile' should not be accessible from __builtin__.""" import __builtin__ __builtin__.execfile Modified: python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py (original) +++ python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py Tue May 29 03:31:34 2007 @@ -1 +1,2 @@ +"""'execfile' should not be accessible from __builtins__.""" __builtins__.execfile Modified: python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py (original) +++ python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py Tue May 29 03:31:34 2007 @@ -1 +1,2 @@ +"""The constructor for 'file' should not work to open a file.""" _ = file('README', 'r') Modified: python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py (original) +++ python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py Tue May 29 03:31:34 2007 @@ -1 +1,2 @@ +"""You should not be able to import non-whitelisted modules, especially sys.""" import sys Modified: python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py (original) +++ python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py Tue May 29 03:31:34 2007 @@ -1 +1,2 @@ -import termios +"""Importing non-whitelisted extension modules should fail.""" +import thread Modified: python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py (original) +++ python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py Tue May 29 03:31:34 2007 @@ -1,2 +1,3 @@ +"""'open' should not exist in __builtin__.""" import __builtin__ __builtin__.open Modified: python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py (original) +++ python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py Tue May 29 03:31:34 2007 @@ -1 +1,2 @@ +"""'open' should not be in __builtins__.""" __builtins__.open Modified: python/branches/bcannon-objcap/tests/succeed/import_py.py ============================================================================== --- python/branches/bcannon-objcap/tests/succeed/import_py.py (original) +++ python/branches/bcannon-objcap/tests/succeed/import_py.py Tue May 29 03:31:34 2007 @@ -1 +1,2 @@ +"""Make sure a Python source code file can be imported.""" import token Modified: python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py ============================================================================== --- python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py (original) +++ python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py Tue May 29 03:31:34 2007 @@ -1 +1,7 @@ +"""Make sure that all whitelisted built-in modules can be imported.""" +import _ast +import _codecs +import _sre +import _types import errno +import exceptions Modified: python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py ============================================================================== --- python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py (original) +++ python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py Tue May 29 03:31:34 2007 @@ -1 +1,19 @@ +"""All whitelisted extension modules should be able to be imported.""" +import _bisect +import _collections +import _csv +import _functools +import _hashlib +import _heapq +import _random +import _struct +import _weakref +import array +import binascii +import cmath +import itertools +import math +import operator import time +import unicodedata +import zlib From python-checkins at python.org Tue May 29 03:51:05 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 03:51:05 +0200 (CEST) Subject: [Python-checkins] r55633 - in python/branches/bcannon-objcap: run_security_tests.py tests/README tests/fail/builtin_execfile--NameError.py tests/fail/builtin_execfile.py tests/fail/builtin_open--NameError.py tests/fail/builtin_open.py tests/fail/execfile__builtin__--AttributeError.py tests/fail/execfile__builtins__--AttributeError.py tests/fail/file_constructor--TypeError.py tests/fail/file_constructor.py tests/fail/import_unsafe_builtin--ImportError.py tests/fail/import_unsafe_builtin.py tests/fail/import_unsafe_extension--ImportError.py tests/fail/import_unsafe_extension.py tests/fail/open__builtin__--AttributeError.py tests/fail/open__builtins__--AttributeError.py Message-ID: <20070529015105.D98911E4009@bag.python.org> Author: brett.cannon Date: Tue May 29 03:51:00 2007 New Revision: 55633 Added: python/branches/bcannon-objcap/tests/fail/builtin_execfile.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/builtin_open.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/file_constructor.py - copied, changed from r55632, python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin.py (contents, props changed) python/branches/bcannon-objcap/tests/fail/import_unsafe_extension.py - copied, changed from r55632, python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py Removed: python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py Modified: python/branches/bcannon-objcap/run_security_tests.py python/branches/bcannon-objcap/tests/README Log: Rework tests such that 'fail' tests actually output nothing to the terminal and isntead use try/except statements to verify that the proper thing occurred. This led to consolidating several tests into single files. Modified: python/branches/bcannon-objcap/run_security_tests.py ============================================================================== --- python/branches/bcannon-objcap/run_security_tests.py (original) +++ python/branches/bcannon-objcap/run_security_tests.py Tue May 29 03:51:00 2007 @@ -25,7 +25,7 @@ debug_refs_regex = re.compile(r"^\[\d+ refs\]$") -def verify_succeed_test(test_name, stderr): +def verify_no_output(test_name, stderr): """Should only have debug build output. Does not work for non-debug builds! @@ -36,15 +36,15 @@ return True -def verify_fail_test(test_name, stderr): +def verify_exception(test_name, stderr): """Should have an exception line with the proper exception raised.""" exc_name = test_name.split('--')[1] if not re.search('^'+exc_name, stderr, re.MULTILINE): return False return True -for type_, verifier in (('succeed', verify_succeed_test), - ('fail', verify_fail_test)): +for type_, verifier in (('succeed', verify_no_output), + ('fail', verify_no_output)): failures = run_tests(type_, verifier) if failures: print '%s failures: %s' % (len(failures), ', '.join(failures)) Modified: python/branches/bcannon-objcap/tests/README ============================================================================== --- python/branches/bcannon-objcap/tests/README (original) +++ python/branches/bcannon-objcap/tests/README Tue May 29 03:51:00 2007 @@ -1,5 +1,23 @@ -The 'succeed' directory contains files that when run should always run to -conclusion without failure. +========== +How to Use +========== -The 'fail' directory has files that should always raise the exception specified -in the file's name. +Run the test driver ``../run_security_tests.py`` with a standard Python +interpreter. The driver will execute the scripts using 'subprocess' and the +``../secure_python.exe`` interpreter. + + +============== +Types of Tests +============== + +* succeed + All tests in this directory represent code that should always work in a + secured interpreter. + +* fail + Tests that contain code that should not work in a secured interpreter. All + insecure code should be contained with in proper try/except statements. + The smallest amount of code required to test a security feature should be + within each try/except statement (of which there may be several within a + single file). Deleted: /python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/builtin_execfile--NameError.py Tue May 29 03:51:00 2007 +++ (empty file) @@ -1,2 +0,0 @@ -"""'execfile' should not be in the built-in namespace.""" -_ = execfile Added: python/branches/bcannon-objcap/tests/fail/builtin_execfile.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/builtin_execfile.py Tue May 29 03:51:00 2007 @@ -0,0 +1,16 @@ +"""The built-in execfile should not be reachable.""" +try: + _ = execfile +except NameError: + pass + +try: + import __builtin__ + __builtin__.execfile +except AttributeError: + pass + +try: + __builtins__.execfile +except AttributeError: + pass Deleted: /python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/builtin_open--NameError.py Tue May 29 03:51:00 2007 +++ (empty file) @@ -1,2 +0,0 @@ -"""'open' should not be in the built-in namespace.""" -_ = open Added: python/branches/bcannon-objcap/tests/fail/builtin_open.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/builtin_open.py Tue May 29 03:51:00 2007 @@ -0,0 +1,16 @@ +"""The built-in 'open' should not be accessible.""" +try: + _ = open +except NameError: + pass + +try: + import __builtin__ + __builtin__.open +except AttributeError: + pass + +try: + __builtins__.open +except AttributeError: + pass Deleted: /python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/execfile__builtin__--AttributeError.py Tue May 29 03:51:00 2007 +++ (empty file) @@ -1,3 +0,0 @@ -"""'execfile' should not be accessible from __builtin__.""" -import __builtin__ -__builtin__.execfile Deleted: /python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/execfile__builtins__--AttributeError.py Tue May 29 03:51:00 2007 +++ (empty file) @@ -1,2 +0,0 @@ -"""'execfile' should not be accessible from __builtins__.""" -__builtins__.execfile Deleted: /python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py Tue May 29 03:51:00 2007 +++ (empty file) @@ -1,2 +0,0 @@ -"""The constructor for 'file' should not work to open a file.""" -_ = file('README', 'r') Copied: python/branches/bcannon-objcap/tests/fail/file_constructor.py (from r55632, python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py) ============================================================================== --- python/branches/bcannon-objcap/tests/fail/file_constructor--TypeError.py (original) +++ python/branches/bcannon-objcap/tests/fail/file_constructor.py Tue May 29 03:51:00 2007 @@ -1,2 +1,5 @@ """The constructor for 'file' should not work to open a file.""" -_ = file('README', 'r') +try: + _ = file('README', 'r') +except TypeError: + pass Deleted: /python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin--ImportError.py Tue May 29 03:51:00 2007 +++ (empty file) @@ -1,2 +0,0 @@ -"""You should not be able to import non-whitelisted modules, especially sys.""" -import sys Added: python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin.py Tue May 29 03:51:00 2007 @@ -0,0 +1,5 @@ +"""You should not be able to import non-whitelisted modules, especially sys.""" +try: + import sys +except ImportError: + pass Deleted: /python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py Tue May 29 03:51:00 2007 +++ (empty file) @@ -1,2 +0,0 @@ -"""Importing non-whitelisted extension modules should fail.""" -import thread Copied: python/branches/bcannon-objcap/tests/fail/import_unsafe_extension.py (from r55632, python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py) ============================================================================== --- python/branches/bcannon-objcap/tests/fail/import_unsafe_extension--ImportError.py (original) +++ python/branches/bcannon-objcap/tests/fail/import_unsafe_extension.py Tue May 29 03:51:00 2007 @@ -1,2 +1,5 @@ """Importing non-whitelisted extension modules should fail.""" -import thread +try: + import thread +except ImportError: + pass Deleted: /python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/open__builtin__--AttributeError.py Tue May 29 03:51:00 2007 +++ (empty file) @@ -1,3 +0,0 @@ -"""'open' should not exist in __builtin__.""" -import __builtin__ -__builtin__.open Deleted: /python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/open__builtins__--AttributeError.py Tue May 29 03:51:00 2007 +++ (empty file) @@ -1,2 +0,0 @@ -"""'open' should not be in __builtins__.""" -__builtins__.open From python-checkins at python.org Tue May 29 06:01:35 2007 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 29 May 2007 06:01:35 +0200 (CEST) Subject: [Python-checkins] r55634 - python/trunk/Lib/a.py Message-ID: <20070529040135.37E781E4009@bag.python.org> Author: martin.v.loewis Date: Tue May 29 06:01:29 2007 New Revision: 55634 Added: python/trunk/Lib/a.py (contents, props changed) Log: Test pre-commit hook for a link to a .py file. Added: python/trunk/Lib/a.py ============================================================================== --- (empty file) +++ python/trunk/Lib/a.py Tue May 29 06:01:29 2007 @@ -0,0 +1 @@ +link urllib.py \ No newline at end of file From python-checkins at python.org Tue May 29 06:02:05 2007 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 29 May 2007 06:02:05 +0200 (CEST) Subject: [Python-checkins] r55635 - python/trunk/Lib/a.py Message-ID: <20070529040205.776F71E4009@bag.python.org> Author: martin.v.loewis Date: Tue May 29 06:02:03 2007 New Revision: 55635 Removed: python/trunk/Lib/a.py Log: Revert 55634. Deleted: /python/trunk/Lib/a.py ============================================================================== --- /python/trunk/Lib/a.py Tue May 29 06:02:03 2007 +++ (empty file) @@ -1 +0,0 @@ -link urllib.py \ No newline at end of file From python-checkins at python.org Tue May 29 09:16:51 2007 From: python-checkins at python.org (georg.brandl) Date: Tue, 29 May 2007 09:16:51 +0200 (CEST) Subject: [Python-checkins] r55637 - python/trunk/Doc/howto/functional.rst Message-ID: <20070529071651.B44571E4009@bag.python.org> Author: georg.brandl Date: Tue May 29 09:16:47 2007 New Revision: 55637 Modified: python/trunk/Doc/howto/functional.rst Log: Fix rst markup. Modified: python/trunk/Doc/howto/functional.rst ============================================================================== --- python/trunk/Doc/howto/functional.rst (original) +++ python/trunk/Doc/howto/functional.rst Tue May 29 09:16:47 2007 @@ -978,7 +978,7 @@ that's a slice of the iterator. With a single ``stop`` argument, it will return the first ``stop`` elements. If you supply a starting index, you'll get ``stop-start`` -elements, and if you supply a value for ``step`, elements will be +elements, and if you supply a value for ``step``, elements will be skipped accordingly. Unlike Python's string and list slicing, you can't use negative values for ``start``, ``stop``, or ``step``. From buildbot at python.org Tue May 29 09:45:55 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 29 May 2007 07:45:55 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20070529074556.814DF1E4009@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-3%2520trunk/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Tue May 29 09:51:41 2007 From: python-checkins at python.org (neal.norwitz) Date: Tue, 29 May 2007 09:51:41 +0200 (CEST) Subject: [Python-checkins] r55638 - python/trunk/Misc/cheatsheet Message-ID: <20070529075141.12C121E4009@bag.python.org> Author: neal.norwitz Date: Tue May 29 09:51:39 2007 New Revision: 55638 Modified: python/trunk/Misc/cheatsheet Log: Fix typo in doc Modified: python/trunk/Misc/cheatsheet ============================================================================== --- python/trunk/Misc/cheatsheet (original) +++ python/trunk/Misc/cheatsheet Tue May 29 09:51:39 2007 @@ -1370,7 +1370,7 @@ setprofile(func) Sets a profile function for performance profiling. Info on exception currently being handled; this is atuple (exc_type, exc_value, exc_traceback).Warning: assigning the -exc_info() traceback return value to a loca variable in a +exc_info() traceback return value to a local variable in a function handling an exception will cause a circular reference. setdefaultencoding Change default Unicode encoding - defaults to 7-bit ASCII. From python-checkins at python.org Tue May 29 09:59:46 2007 From: python-checkins at python.org (neal.norwitz) Date: Tue, 29 May 2007 09:59:46 +0200 (CEST) Subject: [Python-checkins] r55640 - peps/trunk/pep-3100.txt Message-ID: <20070529075946.021321E4009@bag.python.org> Author: neal.norwitz Date: Tue May 29 09:59:42 2007 New Revision: 55640 Modified: peps/trunk/pep-3100.txt Log: sys exc attrs removed Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Tue May 29 09:59:42 2007 @@ -235,7 +235,7 @@ [#exitfunc-patch]_ [done] * ``sys.exc_type``, ``sys.exc_values``, ``sys.exc_traceback``: not thread-safe; use ``sys.exc_info()`` or an attribute - of the exception [2]_ [11]_ [#sys-module]_ + of the exception [2]_ [11]_ [#sys-module]_ [done] * ``sys.exc_clear``: Python 3's except statements provide the same functionality [24]_ [#pep3110]_ [#sys-module]_ * ``array.read``, ``array.write`` [#array-module]_ From python-checkins at python.org Tue May 29 10:18:44 2007 From: python-checkins at python.org (neal.norwitz) Date: Tue, 29 May 2007 10:18:44 +0200 (CEST) Subject: [Python-checkins] r55644 - peps/trunk/pep-3100.txt Message-ID: <20070529081844.5AEDA1E4009@bag.python.org> Author: neal.norwitz Date: Tue May 29 10:18:41 2007 New Revision: 55644 Modified: peps/trunk/pep-3100.txt Log: Remove sys.exc_clear() Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Tue May 29 10:18:41 2007 @@ -237,7 +237,7 @@ not thread-safe; use ``sys.exc_info()`` or an attribute of the exception [2]_ [11]_ [#sys-module]_ [done] * ``sys.exc_clear``: Python 3's except statements provide the same - functionality [24]_ [#pep3110]_ [#sys-module]_ + functionality [24]_ [#pep3110]_ [#sys-module]_ [done] * ``array.read``, ``array.write`` [#array-module]_ * ``operator.isCallable`` : ``callable()`` built-in is being removed [#operator-module]_ [#remove-operator-funcs]_ [done] From buildbot at python.org Tue May 29 11:07:15 2007 From: buildbot at python.org (buildbot at python.org) Date: Tue, 29 May 2007 09:07:15 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-3 trunk Message-ID: <20070529090715.56A5D1E4009@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-3%2520trunk/builds/2 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: The web-page 'force build' button was pressed by 'theller': try build with perl installed Build Source Stamp: [branch trunk] HEAD Blamelist: Build had warnings: warnings test Excerpt from the test logfile: 2 tests failed: test_largefile test_timeout Traceback (most recent call last): File "../lib/test/regrtest.py", line 549, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_largefile.py", line 77, in f.flush() IOError: [Errno 28] No space left on device ====================================================================== FAIL: testConnectTimeout (test.test_timeout.TimeoutTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_timeout.py", line 128, in testConnectTimeout %(_delta, self.fuzz, _timeout)) AssertionError: timeout (2.266) is more than 2 seconds more than expected (0.001) sincerely, -The Buildbot From python-checkins at python.org Tue May 29 19:37:01 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 19:37:01 +0200 (CEST) Subject: [Python-checkins] r55645 - python/branches/bcannon-objcap/Lib/controlled_importlib.py Message-ID: <20070529173701.9F2B11E4010@bag.python.org> Author: brett.cannon Date: Tue May 29 19:36:56 2007 New Revision: 55645 Added: python/branches/bcannon-objcap/Lib/controlled_importlib.py (contents, props changed) Log: Add whitelisting to imports. Added: python/branches/bcannon-objcap/Lib/controlled_importlib.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/Lib/controlled_importlib.py Tue May 29 19:36:56 2007 @@ -0,0 +1 @@ +link ../importlib/controlled_importlib.py \ No newline at end of file From python-checkins at python.org Tue May 29 19:41:18 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 19:41:18 +0200 (CEST) Subject: [Python-checkins] r55646 - in python/branches/bcannon-objcap: secure_python.c tests/succeed/import_safe_extension.py Message-ID: <20070529174118.80CBC1E4014@bag.python.org> Author: brett.cannon Date: Tue May 29 19:41:14 2007 New Revision: 55646 Modified: python/branches/bcannon-objcap/secure_python.c python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py Log: Allow for importing datetime. Modified: python/branches/bcannon-objcap/secure_python.c ============================================================================== --- python/branches/bcannon-objcap/secure_python.c (original) +++ python/branches/bcannon-objcap/secure_python.c Tue May 29 19:41:14 2007 @@ -35,7 +35,7 @@ const char *safe_frozen_names[] = {}; PyObject *safe_builtins_seq; PyObject *safe_frozen_seq; - Py_ssize_t safe_extensions_count = 18; + Py_ssize_t safe_extensions_count = 19; /* All whitelisted modules should be imported in the proper test file. */ const char *safe_extensions_names[] = {"_bisect", "_collections", "_csv", "_functools", "_hashlib", @@ -43,6 +43,7 @@ "_struct", "_weakref", "array", "binascii", "cmath", + "datetime", "itertools", "math", "operator", Modified: python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py ============================================================================== --- python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py (original) +++ python/branches/bcannon-objcap/tests/succeed/import_safe_extension.py Tue May 29 19:41:14 2007 @@ -11,6 +11,7 @@ import array import binascii import cmath +import datetime import itertools import math import operator From python-checkins at python.org Tue May 29 20:35:15 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 20:35:15 +0200 (CEST) Subject: [Python-checkins] r55647 - in python/branches/bcannon-objcap: Doc/howto/functional.rst Doc/lib/libcodecs.tex Doc/lib/libitertools.tex Doc/lib/liblogging.tex Doc/lib/libsubprocess.tex Doc/lib/libtarfile.tex Lib/logging/handlers.py Lib/subprocess.py Lib/tarfile.py Lib/test/test_subprocess.py Lib/test/test_tarfile.py Lib/test/test_urllib.py Lib/test/testtar.tar Misc/NEWS Misc/cheatsheet Objects/funcobject.c PC/WinMain.c PC/_winreg.c PC/dl_nt.c PC/winsound.c PCbuild8/pythoncore/pythoncore.vcproj Python/dynload_win.c Message-ID: <20070529183515.F1E491E4002@bag.python.org> Author: brett.cannon Date: Tue May 29 20:35:08 2007 New Revision: 55647 Modified: python/branches/bcannon-objcap/ (props changed) python/branches/bcannon-objcap/Doc/howto/functional.rst python/branches/bcannon-objcap/Doc/lib/libcodecs.tex python/branches/bcannon-objcap/Doc/lib/libitertools.tex python/branches/bcannon-objcap/Doc/lib/liblogging.tex python/branches/bcannon-objcap/Doc/lib/libsubprocess.tex python/branches/bcannon-objcap/Doc/lib/libtarfile.tex python/branches/bcannon-objcap/Lib/logging/handlers.py python/branches/bcannon-objcap/Lib/subprocess.py python/branches/bcannon-objcap/Lib/tarfile.py python/branches/bcannon-objcap/Lib/test/test_subprocess.py python/branches/bcannon-objcap/Lib/test/test_tarfile.py python/branches/bcannon-objcap/Lib/test/test_urllib.py python/branches/bcannon-objcap/Lib/test/testtar.tar python/branches/bcannon-objcap/Misc/NEWS python/branches/bcannon-objcap/Misc/cheatsheet python/branches/bcannon-objcap/Objects/funcobject.c python/branches/bcannon-objcap/PC/WinMain.c python/branches/bcannon-objcap/PC/_winreg.c python/branches/bcannon-objcap/PC/dl_nt.c python/branches/bcannon-objcap/PC/winsound.c python/branches/bcannon-objcap/PCbuild8/pythoncore/pythoncore.vcproj python/branches/bcannon-objcap/Python/dynload_win.c Log: Merged revisions 55564-55646 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk Modified: python/branches/bcannon-objcap/Doc/howto/functional.rst ============================================================================== --- python/branches/bcannon-objcap/Doc/howto/functional.rst (original) +++ python/branches/bcannon-objcap/Doc/howto/functional.rst Tue May 29 20:35:08 2007 @@ -978,7 +978,7 @@ that's a slice of the iterator. With a single ``stop`` argument, it will return the first ``stop`` elements. If you supply a starting index, you'll get ``stop-start`` -elements, and if you supply a value for ``step`, elements will be +elements, and if you supply a value for ``step``, elements will be skipped accordingly. Unlike Python's string and list slicing, you can't use negative values for ``start``, ``stop``, or ``step``. Modified: python/branches/bcannon-objcap/Doc/lib/libcodecs.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libcodecs.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libcodecs.tex Tue May 29 20:35:08 2007 @@ -237,7 +237,7 @@ \begin{funcdesc}{iterdecode}{iterable, encoding\optional{, errors}} Uses an incremental decoder to iteratively decode the input provided by \var{iterable}. This function is a generator. \var{errors} (as well as -any other keyword argument) is passed through to the incremental encoder. +any other keyword argument) is passed through to the incremental decoder. \versionadded{2.5} \end{funcdesc} Modified: python/branches/bcannon-objcap/Doc/lib/libitertools.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libitertools.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libitertools.tex Tue May 29 20:35:08 2007 @@ -138,6 +138,13 @@ identity function and returns the element unchanged. Generally, the iterable needs to already be sorted on the same key function. + The operation of \function{groupby()} is similar to the \code{uniq} filter + in \UNIX{}. It generates a break or new group every time the value + of the key function changes (which is why it is usually necessary + to have sorted the data using the same key function). That behavior + differs from SQL's GROUP BY which aggregates common elements regardless + of their input order. + The returned group is itself an iterator that shares the underlying iterable with \function{groupby()}. Because the source is shared, when the \function{groupby} object is advanced, the previous group is no @@ -147,6 +154,7 @@ \begin{verbatim} groups = [] uniquekeys = [] + data = sorted(data, key=keyfunc) for k, g in groupby(data, keyfunc): groups.append(list(g)) # Store group iterator as a list uniquekeys.append(k) Modified: python/branches/bcannon-objcap/Doc/lib/liblogging.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/liblogging.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/liblogging.tex Tue May 29 20:35:08 2007 @@ -1208,8 +1208,11 @@ communicate with a remote \UNIX{} machine whose address is given by \var{address} in the form of a \code{(\var{host}, \var{port})} tuple. If \var{address} is not specified, \code{('localhost', 514)} is -used. The address is used to open a UDP socket. If \var{facility} is -not specified, \constant{LOG_USER} is used. +used. The address is used to open a UDP socket. An alternative to providing +a \code{(\var{host}, \var{port})} tuple is providing an address as a string, +for example "/dev/log". In this case, a Unix domain socket is used to send +the message to the syslog. If \var{facility} is not specified, +\constant{LOG_USER} is used. \end{classdesc} \begin{methoddesc}{close}{} Modified: python/branches/bcannon-objcap/Doc/lib/libsubprocess.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libsubprocess.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libsubprocess.tex Tue May 29 20:35:08 2007 @@ -89,7 +89,10 @@ If \var{close_fds} is true, all file descriptors except \constant{0}, \constant{1} and \constant{2} will be closed before the child process is -executed. (\UNIX{} only) +executed. (\UNIX{} only). Or, on Windows, if \var{close_fds} is true +then no handles will be inherited by the child process. Note that on +Windows, you cannot set \var{close_fds} to true and also redirect the +standard handles by setting \var{stdin}, \var{stdout} or \var{stderr}. If \var{shell} is \constant{True}, the specified command will be executed through the shell. Modified: python/branches/bcannon-objcap/Doc/lib/libtarfile.tex ============================================================================== --- python/branches/bcannon-objcap/Doc/lib/libtarfile.tex (original) +++ python/branches/bcannon-objcap/Doc/lib/libtarfile.tex Tue May 29 20:35:08 2007 @@ -133,24 +133,20 @@ \versionadded{2.6} \end{excdesc} +Each of the following constants defines a tar archive format that the +\module{tarfile} module is able to create. See section \ref{tar-formats} for +details. + \begin{datadesc}{USTAR_FORMAT} - \POSIX{}.1-1988 (ustar) format. It supports filenames up to a length of - at best 256 characters and linknames up to 100 characters. The maximum - file size is 8 gigabytes. This is an old and limited but widely - supported format. + \POSIX{}.1-1988 (ustar) format. \end{datadesc} \begin{datadesc}{GNU_FORMAT} - GNU tar format. It supports arbitrarily long filenames and linknames and - files bigger than 8 gigabytes. It is the defacto standard on GNU/Linux - systems. + GNU tar format. \end{datadesc} \begin{datadesc}{PAX_FORMAT} - \POSIX{}.1-2001 (pax) format. It is the most flexible format with - virtually no limits. It supports long filenames and linknames, large files - and stores pathnames in a portable way. However, not all tar - implementations today are able to handle pax archives properly. + \POSIX{}.1-2001 (pax) format. \end{datadesc} \begin{datadesc}{DEFAULT_FORMAT} @@ -175,15 +171,15 @@ The \class{TarFile} object provides an interface to a tar archive. A tar archive is a sequence of blocks. An archive member (a stored file) is made up -of a header block followed by data blocks. It is possible, to store a file in a +of a header block followed by data blocks. It is possible to store a file in a tar archive several times. Each archive member is represented by a \class{TarInfo} object, see \citetitle{TarInfo Objects} (section \ref{tarinfo-objects}) for details. \begin{classdesc}{TarFile}{name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, - ignore_zeros=False, encoding=None, pax_headers=None, debug=0, - errorlevel=0} + ignore_zeros=False, encoding=None, errors=None, pax_headers=None, + debug=0, errorlevel=0} All following arguments are optional and can be accessed as instance attributes as well. @@ -231,18 +227,14 @@ If \code{2}, all \emph{non-fatal} errors are raised as \exception{TarError} exceptions as well. - The \var{encoding} argument defines the local character encoding. It - defaults to the value from \function{sys.getfilesystemencoding()} or if - that is \code{None} to \code{"ascii"}. \var{encoding} is used only in - connection with the pax format which stores text data in \emph{UTF-8}. If - it is not set correctly, character conversion will fail with a - \exception{UnicodeError}. + The \var{encoding} and \var{errors} arguments control the way strings are + converted to unicode objects and vice versa. The default settings will work + for most users. See section \ref{tar-unicode} for in-depth information. \versionadded{2.6} - The \var{pax_headers} argument must be a dictionary whose elements are - either unicode objects, numbers or strings that can be decoded to unicode - using \var{encoding}. This information will be added to the archive as a - pax global header. + The \var{pax_headers} argument is an optional dictionary of unicode strings + which will be added as a pax global header if \var{format} is + \constant{PAX_FORMAT}. \versionadded{2.6} \end{classdesc} @@ -287,7 +279,7 @@ Extract all members from the archive to the current working directory or directory \var{path}. If optional \var{members} is given, it must be a subset of the list returned by \method{getmembers()}. - Directory informations like owner, modification time and permissions are + Directory information like owner, modification time and permissions are set after all members have been extracted. This is done to work around two problems: A directory's modification time is reset each time a file is created in it. And, if a directory's permissions do not allow writing, @@ -365,6 +357,11 @@ \deprecated{2.6}{Use the \member{format} attribute instead.} \end{memberdesc} +\begin{memberdesc}{pax_headers} + A dictionary containing key-value pairs of pax global headers. + \versionadded{2.6} +\end{memberdesc} + %----------------- % TarInfo Objects %----------------- @@ -384,8 +381,8 @@ Create a \class{TarInfo} object. \end{classdesc} -\begin{methoddesc}{frombuf}{} - Create and return a \class{TarInfo} object from a string buffer. +\begin{methoddesc}{frombuf}{buf} + Create and return a \class{TarInfo} object from string buffer \var{buf}. \versionadded[Raises \exception{HeaderError} if the buffer is invalid.]{2.6} \end{methoddesc} @@ -396,10 +393,11 @@ \versionadded{2.6} \end{methoddesc} -\begin{methoddesc}{tobuf}{\optional{format}} - Create a string buffer from a \class{TarInfo} object. See - \class{TarFile}'s \member{format} argument for information. - \versionchanged[The \var{format} parameter]{2.6} +\begin{methoddesc}{tobuf}{\optional{format\optional{, encoding + \optional{, errors}}}} + Create a string buffer from a \class{TarInfo} object. For information + on the arguments see the constructor of the \class{TarFile} class. + \versionchanged[The arguments were added]{2.6} \end{methoddesc} A \code{TarInfo} object has the following public data attributes: @@ -452,6 +450,12 @@ Group name. \end{memberdesc} +\begin{memberdesc}{pax_headers} + A dictionary containing key-value pairs of an associated pax + extended header. + \versionadded{2.6} +\end{memberdesc} + A \class{TarInfo} object also provides some convenient query methods: \begin{methoddesc}{isfile}{} @@ -554,3 +558,103 @@ tar.extract(tarinfo) tar.close() \end{verbatim} + +%------------ +% Tar format +%------------ + +\subsection{Supported tar formats \label{tar-formats}} + +There are three tar formats that can be created with the \module{tarfile} +module: + +\begin{itemize} + +\item +The \POSIX{}.1-1988 ustar format (\constant{USTAR_FORMAT}). It supports +filenames up to a length of at best 256 characters and linknames up to 100 +characters. The maximum file size is 8 gigabytes. This is an old and limited +but widely supported format. + +\item +The GNU tar format (\constant{GNU_FORMAT}). It supports long filenames and +linknames, files bigger than 8 gigabytes and sparse files. It is the de facto +standard on GNU/Linux systems. \module{tarfile} fully supports the GNU tar +extensions for long names, sparse file support is read-only. + +\item +The \POSIX{}.1-2001 pax format (\constant{PAX_FORMAT}). It is the most +flexible format with virtually no limits. It supports long filenames and +linknames, large files and stores pathnames in a portable way. However, not +all tar implementations today are able to handle pax archives properly. + +The \emph{pax} format is an extension to the existing \emph{ustar} format. It +uses extra headers for information that cannot be stored otherwise. There are +two flavours of pax headers: Extended headers only affect the subsequent file +header, global headers are valid for the complete archive and affect all +following files. All the data in a pax header is encoded in \emph{UTF-8} for +portability reasons. + +\end{itemize} + +There are some more variants of the tar format which can be read, but not +created: + +\begin{itemize} + +\item +The ancient V7 format. This is the first tar format from \UNIX{} Seventh +Edition, storing only regular files and directories. Names must not be longer +than 100 characters, there is no user/group name information. Some archives +have miscalculated header checksums in case of fields with non-\ASCII{} +characters. + +\item +The SunOS tar extended format. This format is a variant of the \POSIX{}.1-2001 +pax format, but is not compatible. + +\end{itemize} + +%---------------- +% Unicode issues +%---------------- + +\subsection{Unicode issues \label{tar-unicode}} + +The tar format was originally conceived to make backups on tape drives with the +main focus on preserving file system information. Nowadays tar archives are +commonly used for file distribution and exchanging archives over networks. One +problem of the original format (that all other formats are merely variants of) +is that there is no concept of supporting different character encodings. +For example, an ordinary tar archive created on a \emph{UTF-8} system cannot be +read correctly on a \emph{Latin-1} system if it contains non-\ASCII{} +characters. Names (i.e. filenames, linknames, user/group names) containing +these characters will appear damaged. Unfortunately, there is no way to +autodetect the encoding of an archive. + +The pax format was designed to solve this problem. It stores non-\ASCII{} names +using the universal character encoding \emph{UTF-8}. When a pax archive is +read, these \emph{UTF-8} names are converted to the encoding of the local +file system. + +The details of unicode conversion are controlled by the \var{encoding} and +\var{errors} keyword arguments of the \class{TarFile} class. + +The default value for \var{encoding} is the local character encoding. It is +deduced from \function{sys.getfilesystemencoding()} and +\function{sys.getdefaultencoding()}. In read mode, \var{encoding} is used +exclusively to convert unicode names from a pax archive to strings in the local +character encoding. In write mode, the use of \var{encoding} depends on the +chosen archive format. In case of \constant{PAX_FORMAT}, input names that +contain non-\ASCII{} characters need to be decoded before being stored as +\emph{UTF-8} strings. The other formats do not make use of \var{encoding} +unless unicode objects are used as input names. These are converted to +8-bit character strings before they are added to the archive. + +The \var{errors} argument defines how characters are treated that cannot be +converted to or from \var{encoding}. Possible values are listed in section +\ref{codec-base-classes}. In read mode, there is an additional scheme +\code{'utf-8'} which means that bad characters are replaced by their +\emph{UTF-8} representation. This is the default scheme. In write mode the +default value for \var{errors} is \code{'strict'} to ensure that name +information is not altered unnoticed. Modified: python/branches/bcannon-objcap/Lib/logging/handlers.py ============================================================================== --- python/branches/bcannon-objcap/Lib/logging/handlers.py (original) +++ python/branches/bcannon-objcap/Lib/logging/handlers.py Tue May 29 20:35:08 2007 @@ -625,7 +625,8 @@ """ Initialize a handler. - If address is specified as a string, UNIX socket is used. + If address is specified as a string, a UNIX socket is used. To log to a + local syslogd, "SysLogHandler(address="/dev/log")" can be used. If facility is not specified, LOG_USER is used. """ logging.Handler.__init__(self) Modified: python/branches/bcannon-objcap/Lib/subprocess.py ============================================================================== --- python/branches/bcannon-objcap/Lib/subprocess.py (original) +++ python/branches/bcannon-objcap/Lib/subprocess.py Tue May 29 20:35:08 2007 @@ -545,9 +545,10 @@ if preexec_fn is not None: raise ValueError("preexec_fn is not supported on Windows " "platforms") - if close_fds: + if close_fds and (stdin is not None or stdout is not None or + stderr is not None): raise ValueError("close_fds is not supported on Windows " - "platforms") + "platforms if you redirect stdin/stdout/stderr") else: # POSIX if startupinfo is not None: @@ -804,9 +805,7 @@ hp, ht, pid, tid = CreateProcess(executable, args, # no special security None, None, - # must inherit handles to pass std - # handles - 1, + int(not close_fds), creationflags, env, cwd, Modified: python/branches/bcannon-objcap/Lib/tarfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/tarfile.py (original) +++ python/branches/bcannon-objcap/Lib/tarfile.py Tue May 29 20:35:08 2007 @@ -52,7 +52,6 @@ import copy import re -builtin_open = open if sys.platform == 'mac': # This module needs work for MacOS9, especially in the area of pathname @@ -127,6 +126,17 @@ PAX_FIELDS = ("path", "linkpath", "size", "mtime", "uid", "gid", "uname", "gname") +# Fields in a pax header that are numbers, all other fields +# are treated as strings. +PAX_NUMBER_FIELDS = { + "atime": float, + "ctime": float, + "mtime": float, + "uid": int, + "gid": int, + "size": int +} + #--------------------------------------------------------- # Bits used in the mode field, values in octal. #--------------------------------------------------------- @@ -156,7 +166,7 @@ #--------------------------------------------------------- ENCODING = sys.getfilesystemencoding() if ENCODING is None: - ENCODING = "ascii" + ENCODING = sys.getdefaultencoding() #--------------------------------------------------------- # Some useful functions @@ -220,6 +230,26 @@ s = chr(0200) + s return s +def uts(s, encoding, errors): + """Convert a unicode object to a string. + """ + if errors == "utf-8": + # An extra error handler similar to the -o invalid=UTF-8 option + # in POSIX.1-2001. Replace untranslatable characters with their + # UTF-8 representation. + try: + return s.encode(encoding, "strict") + except UnicodeEncodeError: + x = [] + for c in s: + try: + x.append(c.encode(encoding, "strict")) + except UnicodeEncodeError: + x.append(c.encode("utf8")) + return "".join(x) + else: + return s.encode(encoding, errors) + def calc_chksums(buf): """Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if @@ -924,7 +954,7 @@ def __repr__(self): return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self)) - def get_info(self): + def get_info(self, encoding, errors): """Return the TarInfo's attributes as a dictionary. """ info = { @@ -946,24 +976,29 @@ if info["type"] == DIRTYPE and not info["name"].endswith("/"): info["name"] += "/" + for key in ("name", "linkname", "uname", "gname"): + if type(info[key]) is unicode: + info[key] = info[key].encode(encoding, errors) + return info - def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING): + def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="strict"): """Return a tar header as a string of 512 byte blocks. """ + info = self.get_info(encoding, errors) + if format == USTAR_FORMAT: - return self.create_ustar_header() + return self.create_ustar_header(info) elif format == GNU_FORMAT: - return self.create_gnu_header() + return self.create_gnu_header(info) elif format == PAX_FORMAT: - return self.create_pax_header(encoding) + return self.create_pax_header(info, encoding, errors) else: raise ValueError("invalid format") - def create_ustar_header(self): + def create_ustar_header(self, info): """Return the object as a ustar header block. """ - info = self.get_info() info["magic"] = POSIX_MAGIC if len(info["linkname"]) > LENGTH_LINK: @@ -974,10 +1009,9 @@ return self._create_header(info, USTAR_FORMAT) - def create_gnu_header(self): + def create_gnu_header(self, info): """Return the object as a GNU header block sequence. """ - info = self.get_info() info["magic"] = GNU_MAGIC buf = "" @@ -989,12 +1023,11 @@ return buf + self._create_header(info, GNU_FORMAT) - def create_pax_header(self, encoding): + def create_pax_header(self, info, encoding, errors): """Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information. """ - info = self.get_info() info["magic"] = POSIX_MAGIC pax_headers = self.pax_headers.copy() @@ -1004,7 +1037,11 @@ ("name", "path", LENGTH_NAME), ("linkname", "linkpath", LENGTH_LINK), ("uname", "uname", 32), ("gname", "gname", 32)): - val = info[name].decode(encoding) + if hname in pax_headers: + # The pax header has priority. + continue + + val = info[name].decode(encoding, errors) # Try to encode the string as ASCII. try: @@ -1013,27 +1050,23 @@ pax_headers[hname] = val continue - if len(val) > length: - if name == "name": - # Try to squeeze a longname in the prefix and name fields as in - # ustar format. - try: - info["prefix"], info["name"] = self._posix_split_name(info["name"]) - except ValueError: - pax_headers[hname] = val - else: - continue - else: - pax_headers[hname] = val + if len(info[name]) > length: + pax_headers[hname] = val # Test number fields for values that exceed the field limit or values # that like to be stored as float. for name, digits in (("uid", 8), ("gid", 8), ("size", 12), ("mtime", 12)): + if name in pax_headers: + # The pax header has priority. Avoid overflow. + info[name] = 0 + continue + val = info[name] if not 0 <= val < 8 ** (digits - 1) or isinstance(val, float): pax_headers[name] = unicode(val) info[name] = 0 + # Create a pax extended header if necessary. if pax_headers: buf = self._create_pax_generic_header(pax_headers) else: @@ -1042,26 +1075,10 @@ return buf + self._create_header(info, USTAR_FORMAT) @classmethod - def create_pax_global_header(cls, pax_headers, encoding): + def create_pax_global_header(cls, pax_headers): """Return the object as a pax global header block sequence. """ - new_headers = {} - for key, val in pax_headers.iteritems(): - key = cls._to_unicode(key, encoding) - val = cls._to_unicode(val, encoding) - new_headers[key] = val - return cls._create_pax_generic_header(new_headers, type=XGLTYPE) - - @staticmethod - def _to_unicode(value, encoding): - if isinstance(value, unicode): - return value - elif isinstance(value, (int, long, float)): - return unicode(value) - elif isinstance(value, str): - return unicode(value, encoding) - else: - raise ValueError("unable to convert to unicode: %r" % value) + return cls._create_pax_generic_header(pax_headers, type=XGLTYPE) def _posix_split_name(self, name): """Split a name longer than 100 chars into a prefix @@ -1093,9 +1110,9 @@ " ", # checksum field info.get("type", REGTYPE), stn(info.get("linkname", ""), 100), - stn(info.get("magic", ""), 8), - stn(info.get("uname", ""), 32), - stn(info.get("gname", ""), 32), + stn(info.get("magic", POSIX_MAGIC), 8), + stn(info.get("uname", "root"), 32), + stn(info.get("gname", "root"), 32), itn(info.get("devmajor", 0), 8, format), itn(info.get("devminor", 0), 8, format), stn(info.get("prefix", ""), 155) @@ -1256,12 +1273,9 @@ offset += self._block(self.size) tarfile.offset = offset - # Patch the TarInfo object with saved extended + # Patch the TarInfo object with saved global # header information. - for keyword, value in tarfile.pax_headers.iteritems(): - if keyword in PAX_FIELDS: - setattr(self, keyword, value) - self.pax_headers[keyword] = value + self._apply_pax_info(tarfile.pax_headers, tarfile.encoding, tarfile.errors) return self @@ -1272,18 +1286,17 @@ buf = tarfile.fileobj.read(self._block(self.size)) # Fetch the next header and process it. - b = tarfile.fileobj.read(BLOCKSIZE) - t = self.frombuf(b) - t.offset = self.offset - next = t._proc_member(tarfile) + next = self.fromtarfile(tarfile) + if next is None: + raise HeaderError("missing subsequent header") # Patch the TarInfo object from the next header with # the longname information. next.offset = self.offset if self.type == GNUTYPE_LONGNAME: - next.name = buf.rstrip(NUL) + next.name = nts(buf) elif self.type == GNUTYPE_LONGLINK: - next.linkname = buf.rstrip(NUL) + next.linkname = nts(buf) return next @@ -1358,21 +1371,10 @@ else: pax_headers = tarfile.pax_headers.copy() - # Fields in POSIX.1-2001 that are numbers, all other fields - # are treated as UTF-8 strings. - type_mapping = { - "atime": float, - "ctime": float, - "mtime": float, - "uid": int, - "gid": int, - "size": int - } - # Parse pax header information. A record looks like that: # "%d %s=%s\n" % (length, keyword, value). length is the size # of the complete record including the length field itself and - # the newline. + # the newline. keyword and value are both UTF-8 encoded strings. regex = re.compile(r"(\d+) ([^=]+)=", re.U) pos = 0 while True: @@ -1385,35 +1387,55 @@ value = buf[match.end(2) + 1:match.start(1) + length - 1] keyword = keyword.decode("utf8") - keyword = keyword.encode(tarfile.encoding) - value = value.decode("utf8") - if keyword in type_mapping: + + pax_headers[keyword] = value + pos += length + + # Fetch the next header. + next = self.fromtarfile(tarfile) + + if self.type in (XHDTYPE, SOLARIS_XHDTYPE): + if next is None: + raise HeaderError("missing subsequent header") + + # Patch the TarInfo object with the extended header info. + next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors) + next.offset = self.offset + + if pax_headers.has_key("size"): + # If the extended header replaces the size field, + # we need to recalculate the offset where the next + # header starts. + offset = next.offset_data + if next.isreg() or next.type not in SUPPORTED_TYPES: + offset += next._block(next.size) + tarfile.offset = offset + + return next + + def _apply_pax_info(self, pax_headers, encoding, errors): + """Replace fields with supplemental information from a previous + pax extended or global header. + """ + for keyword, value in pax_headers.iteritems(): + if keyword not in PAX_FIELDS: + continue + + if keyword == "path": + value = value.rstrip("/") + + if keyword in PAX_NUMBER_FIELDS: try: - value = type_mapping[keyword](value) + value = PAX_NUMBER_FIELDS[keyword](value) except ValueError: value = 0 else: - value = value.encode(tarfile.encoding) - - pax_headers[keyword] = value - pos += length + value = uts(value, encoding, errors) - # Fetch the next header that will be patched with the - # supplement information from the pax header (extended - # only). - t = self.fromtarfile(tarfile) - - if self.type != XGLTYPE and t is not None: - # Patch the TarInfo object from the next header with - # the pax header's information. - for keyword, value in pax_headers.items(): - if keyword in PAX_FIELDS: - setattr(t, keyword, value) - pax_headers[keyword] = value - t.pax_headers = pax_headers.copy() + setattr(self, keyword, value) - return t + self.pax_headers = pax_headers.copy() def _block(self, count): """Round up a byte count by BLOCKSIZE and return it, @@ -1464,8 +1486,9 @@ format = DEFAULT_FORMAT # The format to use when creating an archive. - encoding = ENCODING # Transfer UTF-8 strings from POSIX.1-2001 - # headers to this encoding. + encoding = ENCODING # Encoding for 8-bit character strings. + + errors = None # Error handler for unicode conversion. tarinfo = TarInfo # The default TarInfo class to use. @@ -1473,7 +1496,7 @@ def __init__(self, name=None, mode="r", fileobj=None, format=None, tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, - pax_headers=None, debug=None, errorlevel=None): + errors=None, pax_headers=None, debug=None, errorlevel=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' @@ -1492,7 +1515,7 @@ # Create nonexistent files in append mode. self.mode = "w" self._mode = "wb" - fileobj = builtin_open(name, self._mode) + fileobj = bltn_open(name, self._mode) self._extfileobj = False else: if name is None and hasattr(fileobj, "name"): @@ -1514,6 +1537,19 @@ self.ignore_zeros = ignore_zeros if encoding is not None: self.encoding = encoding + + if errors is not None: + self.errors = errors + elif mode == "r": + self.errors = "utf-8" + else: + self.errors = "strict" + + if pax_headers is not None and self.format == PAX_FORMAT: + self.pax_headers = pax_headers + else: + self.pax_headers = {} + if debug is not None: self.debug = debug if errorlevel is not None: @@ -1526,7 +1562,6 @@ self.offset = 0L # current position in the archive file self.inodes = {} # dictionary caching the inodes of # archive members already added - self.pax_headers = {} # save contents of global pax headers if self.mode == "r": self.firstmember = None @@ -1545,9 +1580,8 @@ if self.mode in "aw": self._loaded = True - if pax_headers: - buf = self.tarinfo.create_pax_global_header( - pax_headers.copy(), self.encoding) + if self.pax_headers: + buf = self.tarinfo.create_pax_global_header(self.pax_headers.copy()) self.fileobj.write(buf) self.offset += len(buf) @@ -1669,7 +1703,7 @@ raise CompressionError("gzip module is not available") if fileobj is None: - fileobj = builtin_open(name, mode + "b") + fileobj = bltn_open(name, mode + "b") try: t = cls.taropen(name, mode, @@ -1819,8 +1853,6 @@ self.inodes[inode] = arcname elif stat.S_ISDIR(stmd): type = DIRTYPE - if arcname[-1:] != "/": - arcname += "/" elif stat.S_ISFIFO(stmd): type = FIFOTYPE elif stat.S_ISLNK(stmd): @@ -1930,7 +1962,7 @@ # Append the tar header and data to the archive. if tarinfo.isreg(): - f = builtin_open(name, "rb") + f = bltn_open(name, "rb") self.addfile(tarinfo, f) f.close() @@ -1954,7 +1986,7 @@ tarinfo = copy.copy(tarinfo) - buf = tarinfo.tobuf(self.format, self.encoding) + buf = tarinfo.tobuf(self.format, self.encoding, self.errors) self.fileobj.write(buf) self.offset += len(buf) @@ -2141,7 +2173,7 @@ """Make a file called targetpath. """ source = self.extractfile(tarinfo) - target = builtin_open(targetpath, "wb") + target = bltn_open(targetpath, "wb") copyfileobj(source, target) source.close() target.close() @@ -2486,4 +2518,5 @@ except TarError: return False +bltn_open = open open = TarFile.open Modified: python/branches/bcannon-objcap/Lib/test/test_subprocess.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_subprocess.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_subprocess.py Tue May 29 20:35:08 2007 @@ -617,8 +617,16 @@ self.assertRaises(ValueError, subprocess.call, [sys.executable, "-c", "import sys; sys.exit(47)"], + stdout=subprocess.PIPE, close_fds=True) + def test_close_fds(self): + # close file descriptors + rc = subprocess.call([sys.executable, "-c", + "import sys; sys.exit(47)"], + close_fds=True) + self.assertEqual(rc, 47) + def test_shell_sequence(self): # Run command through the shell (sequence) newenv = os.environ.copy() Modified: python/branches/bcannon-objcap/Lib/test/test_tarfile.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_tarfile.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_tarfile.py Tue May 29 20:35:08 2007 @@ -1,4 +1,4 @@ -# encoding: iso8859-1 +# -*- coding: iso-8859-15 -*- import sys import os @@ -372,9 +372,9 @@ def test_read_longname(self): # Test reading of longname (bug #1471427). - name = self.subdir + "/" + "123/" * 125 + "longname" + longname = self.subdir + "/" + "123/" * 125 + "longname" try: - tarinfo = self.tar.getmember(name) + tarinfo = self.tar.getmember(longname) except KeyError: self.fail("longname not found") self.assert_(tarinfo.type != tarfile.DIRTYPE, "read longname as dirtype") @@ -393,13 +393,24 @@ tarinfo = self.tar.getmember(longname) offset = tarinfo.offset self.tar.fileobj.seek(offset) - fobj = StringIO.StringIO(self.tar.fileobj.read(1536)) + fobj = StringIO.StringIO(self.tar.fileobj.read(3 * 512)) self.assertRaises(tarfile.ReadError, tarfile.open, name="foo.tar", fileobj=fobj) + def test_header_offset(self): + # Test if the start offset of the TarInfo object includes + # the preceding extended header. + longname = self.subdir + "/" + "123/" * 125 + "longname" + offset = self.tar.getmember(longname).offset + fobj = open(tarname) + fobj.seek(offset) + tarinfo = tarfile.TarInfo.frombuf(fobj.read(512)) + self.assertEqual(tarinfo.type, self.longnametype) + class GNUReadTest(LongnameTest): subdir = "gnu" + longnametype = tarfile.GNUTYPE_LONGNAME def test_sparse_file(self): tarinfo1 = self.tar.getmember("ustar/sparse") @@ -410,26 +421,40 @@ "sparse file extraction failed") -class PaxReadTest(ReadTest): +class PaxReadTest(LongnameTest): subdir = "pax" + longnametype = tarfile.XHDTYPE - def test_pax_globheaders(self): + def test_pax_global_headers(self): tar = tarfile.open(tarname, encoding="iso8859-1") + tarinfo = tar.getmember("pax/regtype1") self.assertEqual(tarinfo.uname, "foo") self.assertEqual(tarinfo.gname, "bar") - self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "???????") + self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), u"???????") tarinfo = tar.getmember("pax/regtype2") self.assertEqual(tarinfo.uname, "") self.assertEqual(tarinfo.gname, "bar") - self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "???????") + self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), u"???????") tarinfo = tar.getmember("pax/regtype3") self.assertEqual(tarinfo.uname, "tarfile") self.assertEqual(tarinfo.gname, "tarfile") - self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), "???????") + self.assertEqual(tarinfo.pax_headers.get("VENDOR.umlauts"), u"???????") + + def test_pax_number_fields(self): + # All following number fields are read from the pax header. + tar = tarfile.open(tarname, encoding="iso8859-1") + tarinfo = tar.getmember("pax/regtype4") + self.assertEqual(tarinfo.size, 7011) + self.assertEqual(tarinfo.uid, 123) + self.assertEqual(tarinfo.gid, 123) + self.assertEqual(tarinfo.mtime, 1041808783.0) + self.assertEqual(type(tarinfo.mtime), float) + self.assertEqual(float(tarinfo.pax_headers["atime"]), 1041808783.0) + self.assertEqual(float(tarinfo.pax_headers["ctime"]), 1041808783.0) class WriteTest(unittest.TestCase): @@ -700,68 +725,161 @@ n = tar.getmembers()[0].name self.assert_(name == n, "PAX longname creation failed") - def test_iso8859_15_filename(self): - self._test_unicode_filename("iso8859-15") + def test_pax_global_header(self): + pax_headers = { + u"foo": u"bar", + u"uid": u"0", + u"mtime": u"1.23", + u"test": u"???", + u"???": u"test"} + + tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, \ + pax_headers=pax_headers) + tar.addfile(tarfile.TarInfo("test")) + tar.close() + + # Test if the global header was written correctly. + tar = tarfile.open(tmpname, encoding="iso8859-1") + self.assertEqual(tar.pax_headers, pax_headers) + self.assertEqual(tar.getmembers()[0].pax_headers, pax_headers) + + # Test if all the fields are unicode. + for key, val in tar.pax_headers.iteritems(): + self.assert_(type(key) is unicode) + self.assert_(type(val) is unicode) + if key in tarfile.PAX_NUMBER_FIELDS: + try: + tarfile.PAX_NUMBER_FIELDS[key](val) + except (TypeError, ValueError): + self.fail("unable to convert pax header field") + + def test_pax_extended_header(self): + # The fields from the pax header have priority over the + # TarInfo. + pax_headers = {u"path": u"foo", u"uid": u"123"} + + tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, encoding="iso8859-1") + t = tarfile.TarInfo() + t.name = u"???" # non-ASCII + t.uid = 8**8 # too large + t.pax_headers = pax_headers + tar.addfile(t) + tar.close() + + tar = tarfile.open(tmpname, encoding="iso8859-1") + t = tar.getmembers()[0] + self.assertEqual(t.pax_headers, pax_headers) + self.assertEqual(t.name, "foo") + self.assertEqual(t.uid, 123) + + +class UstarUnicodeTest(unittest.TestCase): + # All *UnicodeTests FIXME + + format = tarfile.USTAR_FORMAT + + def test_iso8859_1_filename(self): + self._test_unicode_filename("iso8859-1") + + def test_utf7_filename(self): + self._test_unicode_filename("utf7") def test_utf8_filename(self): self._test_unicode_filename("utf8") - def test_utf16_filename(self): - self._test_unicode_filename("utf16") - def _test_unicode_filename(self, encoding): - tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT) - name = u"\u20ac".encode(encoding) # Euro sign - tar.encoding = encoding + tar = tarfile.open(tmpname, "w", format=self.format, encoding=encoding, errors="strict") + name = u"???" tar.addfile(tarfile.TarInfo(name)) tar.close() tar = tarfile.open(tmpname, encoding=encoding) - self.assertEqual(tar.getmembers()[0].name, name) + self.assert_(type(tar.getnames()[0]) is not unicode) + self.assertEqual(tar.getmembers()[0].name, name.encode(encoding)) tar.close() def test_unicode_filename_error(self): - # The euro sign filename cannot be translated to iso8859-1 encoding. - tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, encoding="utf8") - name = u"\u20ac".encode("utf8") # Euro sign - tar.addfile(tarfile.TarInfo(name)) + tar = tarfile.open(tmpname, "w", format=self.format, encoding="ascii", errors="strict") + tarinfo = tarfile.TarInfo() + + tarinfo.name = "???" + if self.format == tarfile.PAX_FORMAT: + self.assertRaises(UnicodeError, tar.addfile, tarinfo) + else: + tar.addfile(tarinfo) + + tarinfo.name = u"???" + self.assertRaises(UnicodeError, tar.addfile, tarinfo) + + tarinfo.name = "foo" + tarinfo.uname = u"???" + self.assertRaises(UnicodeError, tar.addfile, tarinfo) + + def test_unicode_argument(self): + tar = tarfile.open(tarname, "r", encoding="iso8859-1", errors="strict") + for t in tar: + self.assert_(type(t.name) is str) + self.assert_(type(t.linkname) is str) + self.assert_(type(t.uname) is str) + self.assert_(type(t.gname) is str) tar.close() - self.assertRaises(UnicodeError, tarfile.open, tmpname, encoding="iso8859-1") + def test_uname_unicode(self): + for name in (u"???", "???"): + t = tarfile.TarInfo("foo") + t.uname = name + t.gname = name - def test_pax_headers(self): - self._test_pax_headers({"foo": "bar", "uid": 0, "mtime": 1.23}) + fobj = StringIO.StringIO() + tar = tarfile.open("foo.tar", mode="w", fileobj=fobj, format=self.format, encoding="iso8859-1") + tar.addfile(t) + tar.close() + fobj.seek(0) - self._test_pax_headers({"euro": u"\u20ac".encode("utf8")}) + tar = tarfile.open("foo.tar", fileobj=fobj, encoding="iso8859-1") + t = tar.getmember("foo") + self.assertEqual(t.uname, "???") + self.assertEqual(t.gname, "???") - self._test_pax_headers({"euro": u"\u20ac"}, - {"euro": u"\u20ac".encode("utf8")}) - self._test_pax_headers({u"\u20ac": "euro"}, - {u"\u20ac".encode("utf8"): "euro"}) +class GNUUnicodeTest(UstarUnicodeTest): - def _test_pax_headers(self, pax_headers, cmp_headers=None): - if cmp_headers is None: - cmp_headers = pax_headers + format = tarfile.GNU_FORMAT - tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, \ - pax_headers=pax_headers, encoding="utf8") - tar.addfile(tarfile.TarInfo("test")) - tar.close() - tar = tarfile.open(tmpname, encoding="utf8") - self.assertEqual(tar.pax_headers, cmp_headers) +class PaxUnicodeTest(UstarUnicodeTest): - def test_truncated_header(self): - tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT) - tarinfo = tarfile.TarInfo("123/" * 126 + "longname") - tar.addfile(tarinfo) + format = tarfile.PAX_FORMAT + + def _create_unicode_name(self, name): + tar = tarfile.open(tmpname, "w", format=self.format) + t = tarfile.TarInfo() + t.pax_headers["path"] = name + tar.addfile(t) tar.close() - # Simulate a premature EOF. - open(tmpname, "rb+").truncate(1536) - tar = tarfile.open(tmpname) - self.assertEqual(tar.getmembers(), []) + def test_error_handlers(self): + # Test if the unicode error handlers work correctly for characters + # that cannot be expressed in a given encoding. + self._create_unicode_name(u"???") + + for handler, name in (("utf-8", u"???".encode("utf8")), + ("replace", "???"), ("ignore", "")): + tar = tarfile.open(tmpname, format=self.format, encoding="ascii", + errors=handler) + self.assertEqual(tar.getnames()[0], name) + + self.assertRaises(UnicodeError, tarfile.open, tmpname, + encoding="ascii", errors="strict") + + def test_error_handler_utf8(self): + # Create a pathname that has one component representable using + # iso8859-1 and the other only in iso8859-15. + self._create_unicode_name(u"???/?") + + tar = tarfile.open(tmpname, format=self.format, encoding="iso8859-1", + errors="utf-8") + self.assertEqual(tar.getnames()[0], "???/" + u"?".encode("utf8")) class AppendTest(unittest.TestCase): @@ -836,63 +954,58 @@ def test_ustar_limits(self): # 100 char name tarinfo = tarfile.TarInfo("0123456789" * 10) - tarinfo.create_ustar_header() + tarinfo.tobuf(tarfile.USTAR_FORMAT) # 101 char name that cannot be stored tarinfo = tarfile.TarInfo("0123456789" * 10 + "0") - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) # 256 char name with a slash at pos 156 tarinfo = tarfile.TarInfo("123/" * 62 + "longname") - tarinfo.create_ustar_header() + tarinfo.tobuf(tarfile.USTAR_FORMAT) # 256 char name that cannot be stored tarinfo = tarfile.TarInfo("1234567/" * 31 + "longname") - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) # 512 char name tarinfo = tarfile.TarInfo("123/" * 126 + "longname") - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) # 512 char linkname tarinfo = tarfile.TarInfo("longlink") tarinfo.linkname = "123/" * 126 + "longname" - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) # uid > 8 digits tarinfo = tarfile.TarInfo("name") tarinfo.uid = 010000000 - self.assertRaises(ValueError, tarinfo.create_ustar_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT) def test_gnu_limits(self): tarinfo = tarfile.TarInfo("123/" * 126 + "longname") - tarinfo.create_gnu_header() + tarinfo.tobuf(tarfile.GNU_FORMAT) tarinfo = tarfile.TarInfo("longlink") tarinfo.linkname = "123/" * 126 + "longname" - tarinfo.create_gnu_header() + tarinfo.tobuf(tarfile.GNU_FORMAT) # uid >= 256 ** 7 tarinfo = tarfile.TarInfo("name") tarinfo.uid = 04000000000000000000L - self.assertRaises(ValueError, tarinfo.create_gnu_header) + self.assertRaises(ValueError, tarinfo.tobuf, tarfile.GNU_FORMAT) def test_pax_limits(self): - # A 256 char name that can be stored without an extended header. - tarinfo = tarfile.TarInfo("123/" * 62 + "longname") - self.assert_(len(tarinfo.create_pax_header("utf8")) == 512, - "create_pax_header attached superfluous extended header") - tarinfo = tarfile.TarInfo("123/" * 126 + "longname") - tarinfo.create_pax_header("utf8") + tarinfo.tobuf(tarfile.PAX_FORMAT) tarinfo = tarfile.TarInfo("longlink") tarinfo.linkname = "123/" * 126 + "longname" - tarinfo.create_pax_header("utf8") + tarinfo.tobuf(tarfile.PAX_FORMAT) tarinfo = tarfile.TarInfo("name") tarinfo.uid = 04000000000000000000L - tarinfo.create_pax_header("utf8") + tarinfo.tobuf(tarfile.PAX_FORMAT) class GzipMiscReadTest(MiscReadTest): @@ -940,6 +1053,9 @@ StreamWriteTest, GNUWriteTest, PaxWriteTest, + UstarUnicodeTest, + GNUUnicodeTest, + PaxUnicodeTest, AppendTest, LimitsTest, ] Modified: python/branches/bcannon-objcap/Lib/test/test_urllib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/test/test_urllib.py (original) +++ python/branches/bcannon-objcap/Lib/test/test_urllib.py Tue May 29 20:35:08 2007 @@ -545,64 +545,75 @@ "url2pathname() failed; %s != %s" % (expect, result)) -def server(evt): - serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - serv.settimeout(3) - serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - serv.bind(("", 9091)) - serv.listen(5) - try: - conn, addr = serv.accept() - except socket.timeout: - pass - else: - conn.send("1 Hola mundo\n") - conn.send("2 No more lines\n") - conn.close() - finally: - serv.close() - evt.set() - -class FTPWrapperTests(unittest.TestCase): - - def setUp(self): - ftplib.FTP.port = 9091 - self.evt = threading.Event() - threading.Thread(target=server, args=(self.evt,)).start() - time.sleep(.1) - - def tearDown(self): - self.evt.wait() - - def testBasic(self): - # connects - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) - ftp.ftp.sock.close() - - def testTimeoutDefault(self): - # default - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, []) - self.assertTrue(ftp.ftp.sock.gettimeout() is None) - ftp.ftp.sock.close() - - def testTimeoutValue(self): - # a value - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) - self.assertEqual(ftp.ftp.sock.gettimeout(), 30) - ftp.ftp.sock.close() - - - def testTimeoutNone(self): - # None, having other default - previous = socket.getdefaulttimeout() - socket.setdefaulttimeout(30) - try: - ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9091, [], timeout=30) - finally: - socket.setdefaulttimeout(previous) - self.assertEqual(ftp.ftp.sock.gettimeout(), 30) - ftp.ftp.close() - +# Just commented them out. +# Can't really tell why keep failing in windows and sparc. +# Everywhere else they work ok, but on those machines, someteimes +# fail in one of the tests, sometimes in other. I have a linux, and +# the tests go ok. +# If anybody has one of the problematic enviroments, please help! +# . Facundo +# +# def server(evt): +# serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +# serv.settimeout(3) +# serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +# serv.bind(("", 9093)) +# serv.listen(5) +# try: +# conn, addr = serv.accept() +# conn.send("1 Hola mundo\n") +# cantdata = 0 +# while cantdata < 13: +# data = conn.recv(13-cantdata) +# cantdata += len(data) +# time.sleep(.3) +# conn.send("2 No more lines\n") +# conn.close() +# except socket.timeout: +# pass +# finally: +# serv.close() +# evt.set() +# +# class FTPWrapperTests(unittest.TestCase): +# +# def setUp(self): +# ftplib.FTP.port = 9093 +# self.evt = threading.Event() +# threading.Thread(target=server, args=(self.evt,)).start() +# time.sleep(.1) +# +# def tearDown(self): +# self.evt.wait() +# +# def testBasic(self): +# # connects +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# ftp.ftp.sock.close() +# +# def testTimeoutDefault(self): +# # default +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# self.assertTrue(ftp.ftp.sock.gettimeout() is None) +# ftp.ftp.sock.close() +# +# def testTimeoutValue(self): +# # a value +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], timeout=30) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.ftp.sock.close() +# +# def testTimeoutNone(self): +# # None, having other default +# previous = socket.getdefaulttimeout() +# socket.setdefaulttimeout(30) +# try: +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# finally: +# socket.setdefaulttimeout(previous) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.ftp.close() +# @@ -615,7 +626,7 @@ UnquotingTests, urlencode_Tests, Pathname_Tests, - FTPWrapperTests, + #FTPWrapperTests, ) Modified: python/branches/bcannon-objcap/Lib/test/testtar.tar ============================================================================== Binary files. No diff available. Modified: python/branches/bcannon-objcap/Misc/NEWS ============================================================================== --- python/branches/bcannon-objcap/Misc/NEWS (original) +++ python/branches/bcannon-objcap/Misc/NEWS Tue May 29 20:35:08 2007 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Add new attribute names for function objects. All the func_* become + __*__ attributes. (Some already existed, e.g., __doc__ and __name__.) + - Add -3 option to the interpreter to warn about features that are deprecated and will be changed/removed in Python 3.0. @@ -217,6 +220,9 @@ Library ------- +- tarfile.py: Improved unicode support. Unicode input names are now + officially supported. Added "errors" argument to the TarFile class. + - urllib.ftpwrapper class now accepts an optional timeout. - shlex.split() now has an optional "posix" parameter. Modified: python/branches/bcannon-objcap/Misc/cheatsheet ============================================================================== --- python/branches/bcannon-objcap/Misc/cheatsheet (original) +++ python/branches/bcannon-objcap/Misc/cheatsheet Tue May 29 20:35:08 2007 @@ -1370,7 +1370,7 @@ setprofile(func) Sets a profile function for performance profiling. Info on exception currently being handled; this is atuple (exc_type, exc_value, exc_traceback).Warning: assigning the -exc_info() traceback return value to a loca variable in a +exc_info() traceback return value to a local variable in a function handling an exception will cause a circular reference. setdefaultencoding Change default Unicode encoding - defaults to 7-bit ASCII. Modified: python/branches/bcannon-objcap/Objects/funcobject.c ============================================================================== --- python/branches/bcannon-objcap/Objects/funcobject.c (original) +++ python/branches/bcannon-objcap/Objects/funcobject.c Tue May 29 20:35:08 2007 @@ -161,10 +161,14 @@ static PyMemberDef func_memberlist[] = { {"func_closure", T_OBJECT, OFF(func_closure), RESTRICTED|READONLY}, + {"__closure__", T_OBJECT, OFF(func_closure), + RESTRICTED|READONLY}, {"func_doc", T_OBJECT, OFF(func_doc), WRITE_RESTRICTED}, {"__doc__", T_OBJECT, OFF(func_doc), WRITE_RESTRICTED}, {"func_globals", T_OBJECT, OFF(func_globals), RESTRICTED|READONLY}, + {"__globals__", T_OBJECT, OFF(func_globals), + RESTRICTED|READONLY}, {"__module__", T_OBJECT, OFF(func_module), WRITE_RESTRICTED}, {NULL} /* Sentinel */ }; @@ -240,7 +244,7 @@ * other than a code object. */ if (value == NULL || !PyCode_Check(value)) { PyErr_SetString(PyExc_TypeError, - "func_code must be set to a code object"); + "__code__ must be set to a code object"); return -1; } nfree = PyCode_GetNumFree((PyCodeObject *)value); @@ -279,7 +283,7 @@ * other than a string object. */ if (value == NULL || !PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, - "func_name must be set to a string object"); + "__name__ must be set to a string object"); return -1; } tmp = op->func_name; @@ -315,7 +319,7 @@ value = NULL; if (value != NULL && !PyTuple_Check(value)) { PyErr_SetString(PyExc_TypeError, - "func_defaults must be set to a tuple object"); + "__defaults__ must be set to a tuple object"); return -1; } tmp = op->func_defaults; @@ -327,8 +331,11 @@ static PyGetSetDef func_getsetlist[] = { {"func_code", (getter)func_get_code, (setter)func_set_code}, + {"__code__", (getter)func_get_code, (setter)func_set_code}, {"func_defaults", (getter)func_get_defaults, (setter)func_set_defaults}, + {"__defaults__", (getter)func_get_defaults, + (setter)func_set_defaults}, {"func_dict", (getter)func_get_dict, (setter)func_set_dict}, {"__dict__", (getter)func_get_dict, (setter)func_set_dict}, {"func_name", (getter)func_get_name, (setter)func_set_name}, Modified: python/branches/bcannon-objcap/PC/WinMain.c ============================================================================== --- python/branches/bcannon-objcap/PC/WinMain.c (original) +++ python/branches/bcannon-objcap/PC/WinMain.c Tue May 29 20:35:08 2007 @@ -1,10 +1,10 @@ /* Minimal main program -- everything is loaded from the library. */ +#include "Python.h" + #define WIN32_LEAN_AND_MEAN #include -#include "Python.h" - int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */ HINSTANCE hPrevInstance, /* handle to previous instance */ Modified: python/branches/bcannon-objcap/PC/_winreg.c ============================================================================== --- python/branches/bcannon-objcap/PC/_winreg.c (original) +++ python/branches/bcannon-objcap/PC/_winreg.c Tue May 29 20:35:08 2007 @@ -12,10 +12,10 @@ */ -#include "windows.h" #include "Python.h" #include "structmember.h" #include "malloc.h" /* for alloca */ +#include "windows.h" static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK); static PyObject *PyHKEY_FromHKEY(HKEY h); Modified: python/branches/bcannon-objcap/PC/dl_nt.c ============================================================================== --- python/branches/bcannon-objcap/PC/dl_nt.c (original) +++ python/branches/bcannon-objcap/PC/dl_nt.c Tue May 29 20:35:08 2007 @@ -7,11 +7,9 @@ forgotten) from the programmer. */ -#include "windows.h" -/* NT and Python share these */ -#include "pyconfig.h" #include "Python.h" +#include "windows.h" char dllVersionBuffer[16] = ""; // a private buffer Modified: python/branches/bcannon-objcap/PC/winsound.c ============================================================================== --- python/branches/bcannon-objcap/PC/winsound.c (original) +++ python/branches/bcannon-objcap/PC/winsound.c Tue May 29 20:35:08 2007 @@ -35,9 +35,9 @@ winsound.PlaySound(None, 0) */ +#include #include #include -#include #ifdef HAVE_CONIO_H #include /* port functions on Win9x */ #endif Modified: python/branches/bcannon-objcap/PCbuild8/pythoncore/pythoncore.vcproj ============================================================================== --- python/branches/bcannon-objcap/PCbuild8/pythoncore/pythoncore.vcproj (original) +++ python/branches/bcannon-objcap/PCbuild8/pythoncore/pythoncore.vcproj Tue May 29 20:35:08 2007 @@ -1518,10 +1518,6 @@ > - - Modified: python/branches/bcannon-objcap/Python/dynload_win.c ============================================================================== --- python/branches/bcannon-objcap/Python/dynload_win.c (original) +++ python/branches/bcannon-objcap/Python/dynload_win.c Tue May 29 20:35:08 2007 @@ -1,7 +1,6 @@ /* Support for dynamic loading of extension modules */ -#include #ifdef HAVE_DIRECT_H #include #endif @@ -9,6 +8,7 @@ #include "Python.h" #include "importdl.h" +#include const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef _DEBUG From python-checkins at python.org Tue May 29 21:16:05 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 21:16:05 +0200 (CEST) Subject: [Python-checkins] r55651 - in python/branches/bcannon-objcap/tests: README fail/builtin_execfile.py fail/builtin_open.py fail/file_constructor.py fail/import_unsafe_builtin.py fail/import_unsafe_extension.py Message-ID: <20070529191605.46FF71E4002@bag.python.org> Author: brett.cannon Date: Tue May 29 21:16:01 2007 New Revision: 55651 Modified: python/branches/bcannon-objcap/tests/README python/branches/bcannon-objcap/tests/fail/builtin_execfile.py python/branches/bcannon-objcap/tests/fail/builtin_open.py python/branches/bcannon-objcap/tests/fail/file_constructor.py python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin.py python/branches/bcannon-objcap/tests/fail/import_unsafe_extension.py Log: Make all 'fail' tests have an 'else' clause for their try/except statements that raise an exception if the expected exception is not caught. Modified: python/branches/bcannon-objcap/tests/README ============================================================================== --- python/branches/bcannon-objcap/tests/README (original) +++ python/branches/bcannon-objcap/tests/README Tue May 29 21:16:01 2007 @@ -17,7 +17,8 @@ * fail Tests that contain code that should not work in a secured interpreter. All - insecure code should be contained with in proper try/except statements. + insecure code should be contained within proper try/except/else statements. The smallest amount of code required to test a security feature should be - within each try/except statement (of which there may be several within a - single file). + within each try/except/else statement (of which there may be several within + a single file). Within the 'else' statement make sure to raise an + exception to flag that the expected exception was not raised. Modified: python/branches/bcannon-objcap/tests/fail/builtin_execfile.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/builtin_execfile.py (original) +++ python/branches/bcannon-objcap/tests/fail/builtin_execfile.py Tue May 29 21:16:01 2007 @@ -3,14 +3,20 @@ _ = execfile except NameError: pass +else: + raise Exception try: import __builtin__ __builtin__.execfile except AttributeError: pass +else: + raise Exception try: __builtins__.execfile except AttributeError: pass +else: + raise Exception Modified: python/branches/bcannon-objcap/tests/fail/builtin_open.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/builtin_open.py (original) +++ python/branches/bcannon-objcap/tests/fail/builtin_open.py Tue May 29 21:16:01 2007 @@ -3,14 +3,20 @@ _ = open except NameError: pass +else: + raise Exception try: import __builtin__ __builtin__.open except AttributeError: pass +else: + raise Exception try: __builtins__.open except AttributeError: pass +else: + raise Exception Modified: python/branches/bcannon-objcap/tests/fail/file_constructor.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/file_constructor.py (original) +++ python/branches/bcannon-objcap/tests/fail/file_constructor.py Tue May 29 21:16:01 2007 @@ -3,3 +3,5 @@ _ = file('README', 'r') except TypeError: pass +else: + raise Exception Modified: python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin.py (original) +++ python/branches/bcannon-objcap/tests/fail/import_unsafe_builtin.py Tue May 29 21:16:01 2007 @@ -3,3 +3,5 @@ import sys except ImportError: pass +else: + raise Exception Modified: python/branches/bcannon-objcap/tests/fail/import_unsafe_extension.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/import_unsafe_extension.py (original) +++ python/branches/bcannon-objcap/tests/fail/import_unsafe_extension.py Tue May 29 21:16:01 2007 @@ -3,3 +3,5 @@ import thread except ImportError: pass +else: + raise Exception From python-checkins at python.org Tue May 29 21:17:44 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 21:17:44 +0200 (CEST) Subject: [Python-checkins] r55652 - python/branches/bcannon-objcap/tests/fail/protect_hidden.py Message-ID: <20070529191744.465DF1E4002@bag.python.org> Author: brett.cannon Date: Tue May 29 21:17:43 2007 New Revision: 55652 Added: python/branches/bcannon-objcap/tests/fail/protect_hidden.py (contents, props changed) Log: Make sure that '.hidden' cannot be imported. Added: python/branches/bcannon-objcap/tests/fail/protect_hidden.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/protect_hidden.py Tue May 29 21:17:43 2007 @@ -0,0 +1,7 @@ +from __future__ import absolute_import +try: + __import__('.hidden', level=0) +except ImportError: + pass +else: + raise Exception From python-checkins at python.org Tue May 29 21:18:10 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 21:18:10 +0200 (CEST) Subject: [Python-checkins] r55653 - python/branches/bcannon-objcap/tests/fail/code_constructor.py Message-ID: <20070529191810.8790B1E4003@bag.python.org> Author: brett.cannon Date: Tue May 29 21:18:10 2007 New Revision: 55653 Added: python/branches/bcannon-objcap/tests/fail/code_constructor.py (contents, props changed) Log: Test that the code type's constructor no longer works. Added: python/branches/bcannon-objcap/tests/fail/code_constructor.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/code_constructor.py Tue May 29 21:18:10 2007 @@ -0,0 +1,11 @@ +"""The constructor for the 'code' type should not work.""" +def fxn(): + pass + +code = type(fxn.func_code) +try: + code(0, 0, 0, 0, '', (), (), (), 'test', '', 0, '') +except TypeError: + pass +else: + raise Exception From python-checkins at python.org Tue May 29 21:18:55 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 21:18:55 +0200 (CEST) Subject: [Python-checkins] r55655 - python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py Message-ID: <20070529191855.EFCA31E4002@bag.python.org> Author: brett.cannon Date: Tue May 29 21:18:55 2007 New Revision: 55655 Added: python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py (contents, props changed) Log: Thoroughly check that no modules that are required to exist for the interpreter to work (and thus imported before importlib takes over) exposes the 'sys' module. Added: python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py Tue May 29 21:18:55 2007 @@ -0,0 +1,70 @@ +"""None of the modules required for the interpreter to work should expose the +'sys' module (nor the modules that they import).""" +import encodings +module_type = type(encodings) +examined = set() +def check_imported_modules(module): + """Recursively check that the module (and the modules it imports) do not + expose the 'sys' module.""" + assert isinstance(module, module_type) + if module.__name__ == 'sys': + raise Exception + for attr in module.__dict__.values(): + if isinstance(attr, module_type) and attr.__name__ not in examined: + examined.add(attr.__name__) + check_imported_modules(attr) + + +try: + import __builtin__ + __builtin__.sys + check_imported_modules(__builtin__) +except AttributeError: + pass +else: + raise Exception + +try: + import __main__ + __main__.sys + check_imported_modules(__main__) +except AttributeError: + pass +else: + raise Exception + +try: + import exceptions + exceptions.sys + check_imported_modules(exceptions) +except AttributeError: + pass +else: + raise Exception + +try: + import encodings + encodings.sys + check_imported_modules(encodings) +except AttributeError: + pass +else: + raise Exception + +try: + import codecs + codecs.sys + check_imported_modules(codecs) +except AttributeError: + pass +else: + raise Exception + +try: + import _codecs + _codecs.sys + check_imported_modules(_codecs) +except AttributeError: + pass +else: + raise Exception From python-checkins at python.org Tue May 29 21:19:17 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 21:19:17 +0200 (CEST) Subject: [Python-checkins] r55656 - python/branches/bcannon-objcap/BRANCH_NOTES Message-ID: <20070529191917.552461E4002@bag.python.org> Author: brett.cannon Date: Tue May 29 21:19:14 2007 New Revision: 55656 Modified: python/branches/bcannon-objcap/BRANCH_NOTES Log: Update notes on what tests need to be written. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Tue May 29 21:19:14 2007 @@ -37,11 +37,8 @@ + Delegate protects importlib. + Whitelisting works. * Name fall-through to alternate implementation. - + '.hidden' cannot be imported. + Removed modules cannot be imported (unless whitelisted). - + 'sys' not exposed on any modules needed for interpreter. - - Types crippled. - + code + - Thoroughly look for open and execfile. ========== From python-checkins at python.org Tue May 29 22:22:36 2007 From: python-checkins at python.org (brett.cannon) Date: Tue, 29 May 2007 22:22:36 +0200 (CEST) Subject: [Python-checkins] r55658 - python/branches/bcannon-objcap/tests/fail/dangerous_things_inaccessible.py python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py Message-ID: <20070529202236.58C861E4002@bag.python.org> Author: brett.cannon Date: Tue May 29 22:22:34 2007 New Revision: 55658 Added: python/branches/bcannon-objcap/tests/fail/dangerous_things_inaccessible.py - copied, changed from r55655, python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py Removed: python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py Log: Change test for 'sys' on required modules for the interpreter to also check for 'open' and 'execfile'. Rename the test accordingly. Copied: python/branches/bcannon-objcap/tests/fail/dangerous_things_inaccessible.py (from r55655, python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py) ============================================================================== --- python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py (original) +++ python/branches/bcannon-objcap/tests/fail/dangerous_things_inaccessible.py Tue May 29 22:22:34 2007 @@ -1,8 +1,14 @@ """None of the modules required for the interpreter to work should expose the -'sys' module (nor the modules that they import).""" +'sys' module, 'open', or 'execfile'. This holds for the modules that they +import as well.""" +# Stuff needed to look for sys. import encodings module_type = type(encodings) examined = set() +# Needed to look for 'open' and 'execfile'. +builtin_fxn_type = type(any) +dangerous_builtins = ('open', 'execfile') + def check_imported_modules(module): """Recursively check that the module (and the modules it imports) do not expose the 'sys' module.""" @@ -10,61 +16,33 @@ if module.__name__ == 'sys': raise Exception for attr in module.__dict__.values(): + # If an object doesn't define __name__ then we don't care about it. + try: + attr_name = attr.__name__ + except AttributeError: + continue if isinstance(attr, module_type) and attr.__name__ not in examined: - examined.add(attr.__name__) + examined.add(attr_name) check_imported_modules(attr) + elif isinstance(attr, builtin_fxn_type): + if attr_name in dangerous_builtins: + raise Exception + + +import __builtin__ +check_imported_modules(__builtin__) + +import __main__ +check_imported_modules(__main__) + +import exceptions +check_imported_modules(exceptions) + +import encodings +check_imported_modules(encodings) +import codecs +check_imported_modules(codecs) -try: - import __builtin__ - __builtin__.sys - check_imported_modules(__builtin__) -except AttributeError: - pass -else: - raise Exception - -try: - import __main__ - __main__.sys - check_imported_modules(__main__) -except AttributeError: - pass -else: - raise Exception - -try: - import exceptions - exceptions.sys - check_imported_modules(exceptions) -except AttributeError: - pass -else: - raise Exception - -try: - import encodings - encodings.sys - check_imported_modules(encodings) -except AttributeError: - pass -else: - raise Exception - -try: - import codecs - codecs.sys - check_imported_modules(codecs) -except AttributeError: - pass -else: - raise Exception - -try: - import _codecs - _codecs.sys - check_imported_modules(_codecs) -except AttributeError: - pass -else: - raise Exception +import _codecs +check_imported_modules(_codecs) Deleted: /python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py ============================================================================== --- /python/branches/bcannon-objcap/tests/fail/sys_inaccessible.py Tue May 29 22:22:34 2007 +++ (empty file) @@ -1,70 +0,0 @@ -"""None of the modules required for the interpreter to work should expose the -'sys' module (nor the modules that they import).""" -import encodings -module_type = type(encodings) -examined = set() -def check_imported_modules(module): - """Recursively check that the module (and the modules it imports) do not - expose the 'sys' module.""" - assert isinstance(module, module_type) - if module.__name__ == 'sys': - raise Exception - for attr in module.__dict__.values(): - if isinstance(attr, module_type) and attr.__name__ not in examined: - examined.add(attr.__name__) - check_imported_modules(attr) - - -try: - import __builtin__ - __builtin__.sys - check_imported_modules(__builtin__) -except AttributeError: - pass -else: - raise Exception - -try: - import __main__ - __main__.sys - check_imported_modules(__main__) -except AttributeError: - pass -else: - raise Exception - -try: - import exceptions - exceptions.sys - check_imported_modules(exceptions) -except AttributeError: - pass -else: - raise Exception - -try: - import encodings - encodings.sys - check_imported_modules(encodings) -except AttributeError: - pass -else: - raise Exception - -try: - import codecs - codecs.sys - check_imported_modules(codecs) -except AttributeError: - pass -else: - raise Exception - -try: - import _codecs - _codecs.sys - check_imported_modules(_codecs) -except AttributeError: - pass -else: - raise Exception From nnorwitz at gmail.com Tue May 29 23:08:09 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 29 May 2007 17:08:09 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20070529210809.GA26085@python.psfb.org> test_popen2 leaked [-26, 26, -26] references, sum=-26 From python-checkins at python.org Wed May 30 00:09:21 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 00:09:21 +0200 (CEST) Subject: [Python-checkins] r55659 - in python/branches/bcannon-objcap: BRANCH_NOTES tests/fail/hidden_modules.py tests/succeed/import_safe_builtin.py Message-ID: <20070529220921.28AC21E4002@bag.python.org> Author: brett.cannon Date: Wed May 30 00:09:13 2007 New Revision: 55659 Added: python/branches/bcannon-objcap/tests/fail/hidden_modules.py (contents, props changed) Modified: python/branches/bcannon-objcap/BRANCH_NOTES python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py Log: Test that modules moved into .hidden cannot be imported again unless they are whitelisted. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Wed May 30 00:09:13 2007 @@ -37,8 +37,6 @@ + Delegate protects importlib. + Whitelisting works. * Name fall-through to alternate implementation. - + Removed modules cannot be imported (unless whitelisted). - - Thoroughly look for open and execfile. ========== Added: python/branches/bcannon-objcap/tests/fail/hidden_modules.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/hidden_modules.py Wed May 30 00:09:13 2007 @@ -0,0 +1,8 @@ +"""Modules that have been hidden (and stored into .hidden) should not be +reachable unless they were whitelisted.""" +try: + import posix +except ImportError: + pass +else: + raise Exception Modified: python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py ============================================================================== --- python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py (original) +++ python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py Wed May 30 00:09:13 2007 @@ -2,6 +2,7 @@ import _ast import _codecs import _sre +# Also tests that modules moved to .hidden can be imported again. import _types import errno import exceptions From python-checkins at python.org Wed May 30 00:15:34 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 00:15:34 +0200 (CEST) Subject: [Python-checkins] r55660 - in python/branches/bcannon-objcap: BRANCH_NOTES tests/fail/delegate_protection.py Message-ID: <20070529221534.9F3111E4002@bag.python.org> Author: brett.cannon Date: Wed May 30 00:15:33 2007 New Revision: 55660 Added: python/branches/bcannon-objcap/tests/fail/delegate_protection.py (contents, props changed) Modified: python/branches/bcannon-objcap/BRANCH_NOTES Log: Make sure the import delegate does not expose anything. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Wed May 30 00:15:33 2007 @@ -34,7 +34,6 @@ ===== * Write tests. - Import - + Delegate protects importlib. + Whitelisting works. * Name fall-through to alternate implementation. Added: python/branches/bcannon-objcap/tests/fail/delegate_protection.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/delegate_protection.py Wed May 30 00:15:33 2007 @@ -0,0 +1,4 @@ +"""The import delegate should not expose anything critical.""" +if [x for x in dir(__import__) + if not x.startswith('__') and not x.endswith('__')]: + raise Exception From python-checkins at python.org Wed May 30 00:42:42 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 00:42:42 +0200 (CEST) Subject: [Python-checkins] r55661 - python/branches/bcannon-objcap/securing_python.txt Message-ID: <20070529224242.3AF6D1E4003@bag.python.org> Author: brett.cannon Date: Wed May 30 00:42:36 2007 New Revision: 55661 Modified: python/branches/bcannon-objcap/securing_python.txt Log: Update with current progress. Modified: python/branches/bcannon-objcap/securing_python.txt ============================================================================== --- python/branches/bcannon-objcap/securing_python.txt (original) +++ python/branches/bcannon-objcap/securing_python.txt Wed May 30 00:42:36 2007 @@ -20,12 +20,12 @@ - frame * do not allow importing 'sys' module to get to sys._getframe(), sys._current_frames(), or setting a trace - or profile function. + or profile function. [done] - object() [done] * Remove object.__subclasses__ (`Mutable Shared State`_) [done] + Sandboxed versions of built-ins (`Sanitizing Built-In Types`_) - open() - - __import__() / PEP 302 importer (`Imports`_) + - __import__() / PEP 302 importer (`Imports`_) [done] * Make sure importing built-in modules can be blocked. * Make sure that no abilities are exposed by importers since they will be accessible from inheritance through sys data @@ -51,8 +51,8 @@ * Just promote removal - exit() * Have SystemExit exit the process only if no other - interpreters are running. [done] -+ Filesystem path hiding (`Filesystem Information`_) + interpreters are running. ++ Filesystem path hiding (`Filesystem Information`_) + Tweaked stdlib modules - mini 'sys' module (`Making the ``sys`` Module Safe`_) - genericpath module (for os.path when C modules blocked) From python-checkins at python.org Wed May 30 00:43:04 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 00:43:04 +0200 (CEST) Subject: [Python-checkins] r55662 - python/branches/bcannon-objcap/BRANCH_NOTES Message-ID: <20070529224304.8CAFF1E4011@bag.python.org> Author: brett.cannon Date: Wed May 30 00:43:01 2007 New Revision: 55662 Modified: python/branches/bcannon-objcap/BRANCH_NOTES Log: Add note about dealing with SystemExit. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Wed May 30 00:43:01 2007 @@ -32,6 +32,7 @@ ===== To Do ===== +* Deal with exit()/SystemExit. * Write tests. - Import + Whitelisting works. From my0820 at globelines.com.ph Wed May 30 00:17:00 2007 From: my0820 at globelines.com.ph (my0820 at globelines.com.ph) Date: Wed, 30 May 2007 06:17:00 +0800 Subject: [Python-checkins] Wednesday, May 30, 2007 - Today's Cars For Sale Message-ID: <0BBE3FCF0B944EFFA7E95853EBAA78E8@simserver> Wednesday, May 30, 2007 - Today's Cars For Sale 1978 Mitsubishi Lancer P55,000.00 1985 Jeep Wrangler P75,000.00 2004 BMW M3 P3,300,000.00 2004 Kia Pregio P530,000.00 1996 Honda Civic VTi P275,000.00 2002 Toyota Revo DLX P378,000.00 1997 Toyota Rav4 P400,000.00 1999 Hyundai Starex P438,000.00 2005 Toyota Granvia P1,290,000.00 2005 Mazda 3S P688,000.00 2002 Kia Sedona P480,000.00 1994 Mercedes Benz E-Class P400,000.00 2005 Toyota Vios P488,000.00 2004 Isuzu Fuego P690,000.00 2002 Ford Taurus P550,000.00 Please click to show more cars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20070530/0c08a820/attachment.html From python-checkins at python.org Wed May 30 05:40:32 2007 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 30 May 2007 05:40:32 +0200 (CEST) Subject: [Python-checkins] r55667 - peps/trunk/pep-3100.txt Message-ID: <20070530034032.3142B1E401A@bag.python.org> Author: guido.van.rossum Date: Wed May 30 05:40:29 2007 New Revision: 55667 Modified: peps/trunk/pep-3100.txt Log: None, True, False are keywords now. Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Wed May 30 05:40:29 2007 @@ -70,7 +70,7 @@ * Replace ``print`` by a function [14]_ [#pep3105]_ [done] * The ``softspace`` attribute of files goes away. [done] * Use ``except E1, E2, E3 as err:`` if you want the error variable. [3]_ -* ``None`` becomes a keyword [4]_ (What about ``True``, ``False``?) +* ``None`` becomes a keyword [4]_ [done; also ``True`` and ``False``] * ``...`` to become a general expression element [16]_ [done] * ``as`` becomes a keyword [5]_ (starting in 2.6 already) [done] * Have list comprehensions be syntactic sugar for passing an From python-checkins at python.org Wed May 30 06:16:15 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 06:16:15 +0200 (CEST) Subject: [Python-checkins] r55669 - in python/branches/bcannon-objcap: BRANCH_NOTES run_security_tests.py tests/succeed/whitelist_fallthrough tests/succeed/whitelist_fallthrough/__init__.py tests/succeed/whitelist_fallthrough/prep.py tests/succeed/whitelist_fallthrough/test.py Message-ID: <20070530041615.142261E4003@bag.python.org> Author: brett.cannon Date: Wed May 30 06:16:13 2007 New Revision: 55669 Added: python/branches/bcannon-objcap/tests/succeed/whitelist_fallthrough/ python/branches/bcannon-objcap/tests/succeed/whitelist_fallthrough/__init__.py (contents, props changed) python/branches/bcannon-objcap/tests/succeed/whitelist_fallthrough/prep.py (contents, props changed) python/branches/bcannon-objcap/tests/succeed/whitelist_fallthrough/test.py (contents, props changed) Modified: python/branches/bcannon-objcap/BRANCH_NOTES python/branches/bcannon-objcap/run_security_tests.py Log: Write test that verifies module import fall-through works. Led to coming up with a system for set up and teardown for tests that need that kind of thing. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Wed May 30 06:16:13 2007 @@ -33,10 +33,6 @@ To Do ===== * Deal with exit()/SystemExit. -* Write tests. - - Import - + Whitelisting works. - * Name fall-through to alternate implementation. ========== Modified: python/branches/bcannon-objcap/run_security_tests.py ============================================================================== --- python/branches/bcannon-objcap/run_security_tests.py (original) +++ python/branches/bcannon-objcap/run_security_tests.py Wed May 30 06:16:13 2007 @@ -2,24 +2,48 @@ import os import re +def exec_test(file_path): + exec_ = './secure_python.exe ' + file_path + proc = subprocess.Popen(exec_, stderr=subprocess.PIPE, shell=True, + universal_newlines=True) + proc.wait() + stderr_output = proc.stderr.read() + return stderr_output + + def run_tests(type_, test_verifier): failures = [] print "Running '%s' tests ..." % type_ - for file_name in (x for x in os.listdir(os.path.join('tests', type_)) - if x.endswith('.py') and not x.startswith('_')): - test_name = file_name[:-3] - print '\t%s ...' % test_name, - - exec_ = './secure_python.exe ' + os.path.join('tests', type_, file_name) - proc = subprocess.Popen(exec_, stderr=subprocess.PIPE, shell=True, - universal_newlines=True) - proc.wait() - stderr_output = proc.stderr.read() - if not test_verifier(test_name, stderr_output): - print 'failed' - failures.append(test_name) - else: - print 'passed' + for path_name in (x for x in os.listdir(os.path.join('tests', type_)) + if not x.startswith('_') and not x.startswith('.')): + path = os.path.join('tests', type_, path_name) + if os.path.isfile(path): + if not path_name.endswith('.py'): + continue + test_name = path_name[:-3] + print '\t%s ...' % test_name, + stderr_output = exec_test(path) + if not test_verifier(test_name, stderr_output): + print 'failed' + failures.append(test_name) + else: + print 'passed' + elif os.path.isdir(path): + print '\t%s ...' % path_name, + module_name = 'tests.%s.%s.prep' % (type_, path_name) + module = __import__(module_name, fromlist=['set_up', 'tear_down'], + level=0) + module.set_up() + try: + stderr_output = exec_test(os.path.join(path, 'test.py')) + if not test_verifier(test_name, stderr_output): + print 'failed' + else: + print 'passed' + finally: + module.tear_down() + + return failures Added: python/branches/bcannon-objcap/tests/succeed/whitelist_fallthrough/__init__.py ============================================================================== Added: python/branches/bcannon-objcap/tests/succeed/whitelist_fallthrough/prep.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/succeed/whitelist_fallthrough/prep.py Wed May 30 06:16:13 2007 @@ -0,0 +1,12 @@ +from __future__ import with_statement + +import os + +file_name = os.path.join('Lib', 'sys.py') + +def set_up(): + with open(file_name, 'w') as py_file: + py_file.write('test_attr = 42') + +def tear_down(): + os.unlink(file_name) Added: python/branches/bcannon-objcap/tests/succeed/whitelist_fallthrough/test.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/succeed/whitelist_fallthrough/test.py Wed May 30 06:16:13 2007 @@ -0,0 +1,4 @@ +"""Importing a module that has the same name as one that is supposed to be +blocked (e.g., sys) should be okay.""" +import sys +sys.test_attr From python-checkins at python.org Wed May 30 06:24:58 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 30 May 2007 06:24:58 +0200 (CEST) Subject: [Python-checkins] r55670 - in python/branches/cpy_merge: Lib/test/test_bytes_io.py Modules/_bytes_iomodule.c setup.py Message-ID: <20070530042458.50E6E1E4003@bag.python.org> Author: alexandre.vassalotti Date: Wed May 30 06:24:49 2007 New Revision: 55670 Added: python/branches/cpy_merge/Lib/test/test_bytes_io.py Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c python/branches/cpy_merge/setup.py Log: BytesIO is now feature complete. Added: python/branches/cpy_merge/Lib/test/test_bytes_io.py ============================================================================== --- (empty file) +++ python/branches/cpy_merge/Lib/test/test_bytes_io.py Wed May 30 06:24:49 2007 @@ -0,0 +1,148 @@ +"""Temporary unit tests for BytesIO""" + +# Based on test_StringIO.py + +import unittest +import _bytes_io +import types +from test import test_support + + +class TestGenericBytesIO(unittest.TestCase): + # use a class variable MODULE to define which module is being tested + + # Line of data to test as string + _line = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!' + + # Constructor to use for the test data (._line is passed to this + # constructor) + constructor = str + + def setUp(self): + self._line = self.constructor(self._line) + self._lines = self.constructor((self._line + '\n') * 5) + self._fp = self.MODULE.BytesIO(self._lines) + + def test_reads(self): + eq = self.assertEqual + self.assertRaises(TypeError, self._fp.seek) + eq(self._fp.read(10), self._line[:10]) + eq(self._fp.readline(), self._line[10:] + '\n') + eq(len(self._fp.readlines(60)), 2) + + def test_writes(self): + f = self.MODULE.BytesIO() + self.assertRaises(TypeError, f.seek) + f.write(self._line[:6]) + f.seek(3) + f.write(self._line[20:26]) + f.write(self._line[52]) + self.assertEqual(f.getvalue(), 'abcuvwxyz!') + + def test_writelines(self): + f = self.MODULE.BytesIO() + f.writelines([self._line[0], self._line[1], self._line[2]]) + f.seek(0) + self.assertEqual(f.getvalue(), 'abc') + + def test_writelines_error(self): + def errorGen(): + yield 'a' + raise KeyboardInterrupt() + f = self.MODULE.BytesIO() + self.assertRaises(KeyboardInterrupt, f.writelines, errorGen()) + + def test_truncate(self): + eq = self.assertEqual + f = self.MODULE.BytesIO() + f.write(self._lines) + f.seek(10) + f.truncate() + eq(f.getvalue(), 'abcdefghij') + f.truncate(5) + eq(f.getvalue(), 'abcde') + f.write('xyz') + eq(f.getvalue(), 'abcdexyz') + self.assertRaises(IOError, f.truncate, -1) + f.close() + self.assertRaises(ValueError, f.write, 'frobnitz') + + def test_closed_flag(self): + f = self.MODULE.BytesIO() + self.assertEqual(f.closed, False) + f.close() + self.assertEqual(f.closed, True) + f = self.MODULE.BytesIO("abc") + self.assertEqual(f.closed, False) + f.close() + self.assertEqual(f.closed, True) + + def test_isatty(self): + f = self.MODULE.BytesIO() + self.assertRaises(TypeError, f.isatty, None) + self.assertEqual(f.isatty(), False) + f.close() + self.assertRaises(ValueError, f.isatty) + + def test_iterator(self): + eq = self.assertEqual + unless = self.failUnless + eq(iter(self._fp), self._fp) + # Does this object support the iteration protocol? + unless(hasattr(self._fp, '__iter__')) + unless(hasattr(self._fp, '__next__')) + i = 0 + for line in self._fp: + eq(line, self._line + '\n') + i += 1 + eq(i, 5) + self._fp.close() + self.assertRaises(ValueError, next, self._fp) + + def test_getvalue(self): + f = self.MODULE.BytesIO() + f.close() + self.assertRaises(ValueError, f.getvalue) + +class TestBytesIO(TestGenericBytesIO): + MODULE = _bytes_io + + def test_unicode(self): + + if not test_support.have_unicode: return + + # The cBytesIO module converts Unicode strings to character + # strings when writing them to cBytesIO objects. + # Check that this works. + + f = self.MODULE.BytesIO() + f.write(unicode(self._line[:5])) + s = f.getvalue() + self.assertEqual(s, 'abcde') + self.assertEqual(type(s), types.StringType) + + f = self.MODULE.BytesIO(unicode(self._line[:5])) + s = f.getvalue() + self.assertEqual(s, 'abcde') + self.assertEqual(type(s), types.StringType) + + self.assertRaises(UnicodeEncodeError, self.MODULE.BytesIO, + unicode('\xf4', 'latin-1')) + +import sys +if sys.platform.startswith('java'): + # Jython doesn't have a buffer object, so we just do a useless + # fake of the buffer tests. + buffer = str + +class TestBufferBytesIO(TestBytesIO): + constructor = buffer + +def test_main(): + test_support.run_unittest( + TestBytesIO, + TestBufferBytesIO, + ) + +if __name__ == '__main__': + test_main() Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_bytes_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_bytes_iomodule.c Wed May 30 06:24:49 2007 @@ -1,5 +1,8 @@ #include "Python.h" +PyDoc_STRVAR(module_doc, +"A fast implementation of BytesIO."); + typedef struct { PyObject_HEAD char *buf; @@ -9,6 +12,8 @@ static PyTypeObject BytesIO_Type; +/* The initial size of the buffer of BytesIO objects */ +#define BUFSIZE 128 static PyObject * err_closed(void) @@ -17,6 +22,76 @@ return NULL; } +/* Internal routine to get a line. Returns the number of bytes read. */ +static Py_ssize_t +get_line(BytesIOObject *self, char **output) +{ + char *n; + const char *str_end; + Py_ssize_t l; + + /* XXX: Should we ckeck here if the object is closed, + for thread-safety? */ + assert(self->buf != NULL); + str_end = self->buf + self->string_size; + + /* Move to the end of the line, up to the end of the string, s. */ + for (n = self->buf + self->pos; n < str_end && *n != '\n'; n++); + + /* Skip the newline character */ + if (n < str_end) + n++; + + /* Get the length from the current position to the end of the line. */ + l = n - (self->buf + self->pos); + *output = self->buf + self->pos; + + assert(self->pos + l < PY_SSIZE_T_MAX); + assert(l >= 0); + self->pos += l; + + return l; +} + +/* Internal routine for writing a string of bytes to the buffer of a BytesIO + object. Returns the number of bytes wrote. */ +static Py_ssize_t +write_bytes(BytesIOObject *self, const char *c, Py_ssize_t l) +{ + Py_ssize_t newl; + + assert(self->buf != NULL); + + newl = self->pos + l; + if (newl >= self->buf_size) { + self->buf_size *= 2; + if (self->buf_size <= newl) { + assert(newl + 1 < PY_SSIZE_T_MAX); + self->buf_size = newl + 1; + } + + PyMem_Resize(self->buf, char, self->buf_size); + if (self->buf == NULL) { + PyErr_SetString(PyExc_MemoryError, "out of memory"); + PyMem_Del(self->buf); + self->buf_size = self->pos = 0; + return -1; + } + } + + memcpy(self->buf + self->pos, c, l); + + assert(self->pos + l < PY_SSIZE_T_MAX); + self->pos += l; + + if (self->string_size < self->pos) { + self->string_size = self->pos; + } + + return l; +} + + static PyObject * bytes_io_get_closed(BytesIOObject *self) { @@ -34,8 +109,7 @@ if (self->buf == NULL) return err_closed(); - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } static PyObject * @@ -53,8 +127,7 @@ if (self->buf == NULL) return err_closed(); - Py_INCREF(Py_False); - return Py_False; + Py_RETURN_FALSE; } static PyObject * @@ -63,6 +136,9 @@ Py_ssize_t l, n = -1; char *output = NULL; + if (self->buf == NULL) + return err_closed(); + if (!PyArg_ParseTuple(args, "|n:read", &n)) return NULL; @@ -80,39 +156,8 @@ return PyString_FromStringAndSize(output, n); } -/* Internal routine to get a line. Return the number of bytes read. */ -static Py_ssize_t -get_line(BytesIOObject *self, char **output) -{ - char *n, *s; - Py_ssize_t l; - - /* XXX: Should we ckeck here if the object is closed, - for thread-safety? */ - assert(self->buf != NULL); - - /* Move to the end of the line, upto the end of the string, s */ - for (n = self->buf + self->pos, - s = self->buf + self->string_size; - n < s && *n != '\n'; n++); - - /* Skip the newline character */ - if (n < s) - n++; - - /* Get the length from the current position to the end of the line */ - l = n - (self->buf + self->pos); - *output = self->buf + self->pos; - - assert(self->pos + l < PY_SSIZE_T_MAX); - assert(l >= 0); - self->pos += l; - - return l; -} - static PyObject * -bytes_io_readline(BytesIOobject *self, PyObject *args) +bytes_io_readline(BytesIOObject *self, PyObject *args) { Py_ssize_t n, m = -1; char *output; @@ -120,9 +165,8 @@ if (self->buf == NULL) return err_closed(); - if (args) /* XXX: Why this is required? */ - if (!PyArg_ParseTuple(args, "|i:readline", &m)) - return NULL; + if (!PyArg_ParseTuple(args, "|i:readline", &m)) + return NULL; n = get_line(self, &output); @@ -146,9 +190,8 @@ if (self->buf == NULL) return err_closed(); - if (args) - if (!PyArg_ParseTuple(args, "|i:readlines", &hint)) - return NULL; + if (!PyArg_ParseTuple(args, "|i:readlines", &hint)) + return NULL; result = PyList_New(0); if (!result) @@ -187,15 +230,16 @@ } static PyObject * -bytes_io_truncate(IOobject *self, PyObject *args) +bytes_io_truncate(BytesIOObject *self, PyObject *args) { Py_ssize_t size; - /* No argument passed, truncate to current position */ + /* Truncate to current position if no argument is passed. */ size = self->pos; if (self->buf == NULL) return err_closed(); + if (!PyArg_ParseTuple(args, "|n:truncate", &size)) return NULL; @@ -205,16 +249,15 @@ return NULL; } - if (self->string_size > pos) - self->string_size = pos; + if (self->string_size > size) + self->string_size = size; self->pos = self->string_size; - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } static PyObject * -bytes_io_iternext(IOobject *self) +bytes_io_iternext(BytesIOObject *self) { char *next; Py_ssize_t n; @@ -232,17 +275,15 @@ return PyString_FromStringAndSize(next, n); } - -/* Read-write object methods */ - static PyObject * -O_seek(Oobject *self, PyObject *args) +bytes_io_seek(BytesIOObject *self, PyObject *args) { Py_ssize_t position; int mode = 0; - if (!IO__opencheck(IOOOBJECT(self))) - return NULL; + if (self->buf == NULL) + return err_closed(); + if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) return NULL; @@ -254,18 +295,16 @@ } if (position > self->buf_size) { - char *newbuf; self->buf_size *= 2; if (self->buf_size <= position) self->buf_size = position + 1; - newbuf = (char *) realloc(self->buf, self->buf_size); - if (!newbuf) { - free(self->buf); - self->buf = 0; + + PyMem_Resize(self->buf, char, self->buf_size); + if (self->buf == NULL) { + PyMem_Del(self->buf); self->buf_size = self->pos = 0; return PyErr_NoMemory(); } - self->buf = newbuf; } else if (position < 0) position = 0; @@ -275,114 +314,54 @@ while (--position >= self->string_size) self->buf[position] = 0; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(O_seek__doc__, -"seek(position) -- set the current position\n" -"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"); - -static int -O_cwrite(PyObject *self, const char *c, Py_ssize_t l) -{ - Py_ssize_t newl; - Oobject *oself; - char *newbuf; - - if (!IO__opencheck(IOOOBJECT(self))) - return -1; - oself = (Oobject *) self; - - newl = oself->pos + l; - if (newl >= oself->buf_size) { - oself->buf_size *= 2; - if (oself->buf_size <= newl) { - assert(newl + 1 < INT_MAX); - oself->buf_size = (int) (newl + 1); - } - newbuf = (char *) realloc(oself->buf, oself->buf_size); - if (!newbuf) { - PyErr_SetString(PyExc_MemoryError, "out of memory"); - free(oself->buf); - oself->buf = 0; - oself->buf_size = oself->pos = 0; - return -1; - } - oself->buf = newbuf; - } - - memcpy(oself->buf + oself->pos, c, l); - - assert(oself->pos + l < INT_MAX); - oself->pos += (int) l; - - if (oself->string_size < oself->pos) { - oself->string_size = oself->pos; - } - - return (int) l; + Py_RETURN_NONE; } static PyObject * -O_write(Oobject *self, PyObject *args) +bytes_io_write(BytesIOObject *self, PyObject *args) { - char *c; + const char *c; int l; + if (self->buf == NULL) + return err_closed(); + if (!PyArg_ParseTuple(args, "t#:write", &c, &l)) return NULL; - if (O_cwrite((PyObject *) self, c, l) < 0) + if (write_bytes(self, c, l) == -1) return NULL; - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } -PyDoc_STRVAR(O_write__doc__, -"write(s) -- Write a string to the file" -"\n\nNote (hack:) writing None resets the buffer"); - static PyObject * -O_close(Oobject *self, PyObject *unused) +bytes_io_writelines(BytesIOObject *self, PyObject *v) { - if (self->buf != NULL) - free(self->buf); - self->buf = NULL; + PyObject *it, *item; - self->pos = self->string_size = self->buf_size = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held."); - -static PyObject * -O_writelines(Oobject *self, PyObject *args) -{ - PyObject *it, *s; + if (self->buf == NULL) + return err_closed(); - it = PyObject_GetIter(args); + it = PyObject_GetIter(v); if (it == NULL) return NULL; - while ((s = PyIter_Next(it)) != NULL) { + + while ((item = PyIter_Next(it)) != NULL) { Py_ssize_t n; char *c; - if (PyString_AsStringAndSize(s, &c, &n) == -1) { + if (PyString_AsStringAndSize(item, &c, &n) == -1) { Py_DECREF(it); - Py_DECREF(s); + Py_DECREF(item); return NULL; } - if (O_cwrite((PyObject *) self, c, n) == -1) { + Py_DECREF(item); + + if (write_bytes(self, c, n) == -1) { Py_DECREF(it); - Py_DECREF(s); return NULL; } - Py_DECREF(s); } - Py_DECREF(it); /* See if PyIter_Next failed */ @@ -392,251 +371,68 @@ Py_RETURN_NONE; } -PyDoc_STRVAR(O_writelines__doc__, -"writelines(sequence_of_strings) -> None. Write the strings to the file.\n" -"\n" -"Note that newlines are not added. The sequence can be any iterable object\n" -"producing strings. This is equivalent to calling write() for each string."); - - -static struct PyMethodDef O_methods[] = { - /* Common methods: */ - {"flush", (PyCFunction) IO_flush, METH_NOARGS, IO_flush__doc__}, - {"getvalue", (PyCFunction) IO_getval, METH_VARARGS, IO_getval__doc__}, - {"isatty", (PyCFunction) IO_isatty, METH_NOARGS, IO_isatty__doc__}, - {"read", (PyCFunction) IO_read, METH_VARARGS, IO_read__doc__}, - {"readline", (PyCFunction) IO_readline, METH_VARARGS, - IO_readline__doc__}, - {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, - IO_readlines__doc__}, - {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, - {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, - IO_truncate__doc__}, - - /* Read-write BytesIO specific methods: */ - {"close", (PyCFunction) O_close, METH_NOARGS, O_close__doc__}, - {"seek", (PyCFunction) O_seek, METH_VARARGS, O_seek__doc__}, - {"write", (PyCFunction) O_write, METH_VARARGS, O_write__doc__}, - {"writelines", (PyCFunction) O_writelines, METH_O, - O_writelines__doc__}, - {NULL, NULL} /* sentinel */ -}; - -static void -O_dealloc(Oobject *self) -{ - if (self->buf != NULL) - free(self->buf); - PyObject_Del(self); -} - - -PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); - -static PyTypeObject Otype = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size */ - "_bytes_io.StringO", /*tp_name */ - sizeof(Oobject), /*tp_basicsize */ - 0, /*tp_itemsize */ - /* methods */ - (destructor) O_dealloc, /*tp_dealloc */ - 0, /*tp_print */ - 0, /*tp_getattr */ - 0, /*tp_setattr */ - 0, /*tp_compare */ - 0, /*tp_repr */ - 0, /*tp_as_number */ - 0, /*tp_as_sequence */ - 0, /*tp_as_mapping */ - 0, /*tp_hash */ - 0, /*tp_call */ - 0, /*tp_str */ - 0, /*tp_getattro */ - 0, /*tp_setattro */ - 0, /*tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /*tp_flags */ - Otype__doc__, /*tp_doc */ - 0, /*tp_traverse */ - 0, /*tp_clear */ - 0, /*tp_richcompare */ - 0, /*tp_weaklistoffset */ - PyObject_SelfIter, /*tp_iter */ - (iternextfunc) IO_iternext, /*tp_iternext */ - O_methods, /*tp_methods */ - 0, /*tp_members */ - file_getsetlist, /*tp_getset */ -}; - -static PyObject * -newOobject(int size) -{ - Oobject *self; - - self = PyObject_New(Oobject, &Otype); - if (self == NULL) - return NULL; - self->pos = 0; - self->string_size = 0; - - self->buf = (char *) malloc(size); - if (!self->buf) { - PyErr_SetString(PyExc_MemoryError, "out of memory"); - self->buf_size = 0; - Py_DECREF(self); - return NULL; - } - - self->buf_size = size; - return (PyObject *) self; -} - -/* End of code for StringO objects */ -/* -------------------------------------------------------- */ - static PyObject * -I_close(Iobject *self, PyObject *unused) +bytes_io_close(BytesIOObject *self) { - Py_XDECREF(self->pbuf); - self->pbuf = NULL; + if (self->buf != NULL) + PyMem_Del(self->buf); self->buf = NULL; - self->pos = self->string_size = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -I_seek(Iobject *self, PyObject *args) -{ - Py_ssize_t position; - int mode = 0; - - if (!IO__opencheck(IOOOBJECT(self))) - return NULL; - if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) - return NULL; - - if (mode == 2) - position += self->string_size; - else if (mode == 1) - position += self->pos; - - if (position < 0) - position = 0; - - self->pos = position; + self->pos = self->string_size = self->buf_size = 0; - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } -static struct PyMethodDef I_methods[] = { - /* Common methods: */ - {"flush", (PyCFunction) IO_flush, METH_NOARGS, IO_flush__doc__}, - {"getvalue", (PyCFunction) IO_getval, METH_VARARGS, IO_getval__doc__}, - {"isatty", (PyCFunction) IO_isatty, METH_NOARGS, IO_isatty__doc__}, - {"read", (PyCFunction) IO_read, METH_VARARGS, IO_read__doc__}, - {"readline", (PyCFunction) IO_readline, METH_VARARGS, - IO_readline__doc__}, - {"readlines", (PyCFunction) IO_readlines, METH_VARARGS, - IO_readlines__doc__}, - {"tell", (PyCFunction) IO_tell, METH_NOARGS, IO_tell__doc__}, - {"truncate", (PyCFunction) IO_truncate, METH_VARARGS, - IO_truncate__doc__}, - - /* Read-only BytesIO specific methods: */ - {"close", (PyCFunction) I_close, METH_NOARGS, O_close__doc__}, - {"seek", (PyCFunction) I_seek, METH_VARARGS, O_seek__doc__}, - {NULL, NULL} -}; - static void -I_dealloc(Iobject *self) +BytesIO_dealloc(BytesIOObject *op) { - Py_XDECREF(self->pbuf); - PyObject_Del(self); -} - -PyDoc_STRVAR(Itype__doc__, - "Simple type for treating strings as input file streams"); + if (op->buf != NULL) + PyMem_Del(op->buf); -static PyTypeObject Itype = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size */ - "_bytes_io.StringI", /*tp_name */ - sizeof(Iobject), /*tp_basicsize */ - 0, /*tp_itemsize */ - /* methods */ - (destructor) I_dealloc, /*tp_dealloc */ - 0, /*tp_print */ - 0, /* tp_getattr */ - 0, /*tp_setattr */ - 0, /*tp_compare */ - 0, /*tp_repr */ - 0, /*tp_as_number */ - 0, /*tp_as_sequence */ - 0, /*tp_as_mapping */ - 0, /*tp_hash */ - 0, /*tp_call */ - 0, /*tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - Itype__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc) IO_iternext, /* tp_iternext */ - I_methods, /* tp_methods */ - 0, /* tp_members */ - file_getsetlist, /* tp_getset */ -}; + op->ob_type->tp_free((PyObject *)op); +} static PyObject * -newIobject(PyObject *s) +BytesIO_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - Iobject *self; - char *buf; - Py_ssize_t size; + BytesIOObject *self; + const char *buf; + Py_ssize_t n = -1, size = BUFSIZE; - if (PyObject_AsCharBuffer(s, (const char **) &buf, &size) != 0) - return NULL; + assert(type != NULL && type->tp_alloc != NULL); - self = PyObject_New(Iobject, &Itype); - if (!self) + if (!PyArg_ParseTuple(args, "|t#:BytesIO", &buf, &n)) return NULL; - Py_INCREF(s); - self->buf = buf; - self->string_size = size; - self->pbuf = s; - self->pos = 0; - return (PyObject *) self; -} + self = (BytesIOObject *)type->tp_alloc(type, 0); -/* End of code for StringI objects */ -/* -------------------------------------------------------- */ + if (self == NULL) + return NULL; -static PyObject * -IO_BytesIO(PyObject *self, PyObject *args) -{ - PyObject *s = 0; + self->buf = PyMem_New(char, size); - if (!PyArg_UnpackTuple(args, "BytesIO", 0, 1, &s)) - return NULL; + /* These variables need to be initialized before attempting to write + anything to the object. */ + self->pos = 0; + self->string_size = 0; + + if (n > 0) { + if (write_bytes(self, buf, n) == -1) + return NULL; + self->pos = 0; + } + if (self->buf == NULL) { + Py_DECREF(self); + return PyErr_NoMemory(); + } + self->buf_size = size; - if (s) - return newIobject(s); - return newOobject(128); + return (PyObject *)self; } -PyDoc_STRVAR(BytesIO_BytesIO_doc, -"BytesIO([s]) -> Return a BytesIO stream for reading or writing"); + +PyDoc_STRVAR(BytesIO_doc, +"BytesIO([s]) -> Return a BytesIO stream for reading and writing."); PyDoc_STRVAR(BytesIO_flush_doc, "flush() -> None. Does nothing."); @@ -657,7 +453,7 @@ "read([size]) -> read at most size bytes, returned as a string.\n" "\n" "If the size argument is negative or omitted, read until EOF is reached.\n" -"Return an empty string at EOF.\n"); +"Return an empty string at EOF."); PyDoc_STRVAR(BytesIO_readline_doc, "readline([size]) -> next line from the file, as a string.\n" @@ -676,28 +472,117 @@ PyDoc_STRVAR(BytesIO_tell_doc, "tell() -> current file position, an integer\n"); -PyDoc_STRVAR(IO_truncate__doc__, +PyDoc_STRVAR(BytesIO_truncate_doc, "truncate([size]) -> None. Truncate the file to at most size bytes.\n" "\n" "Size defaults to the current file position, as returned by tell().\n" "If the specified size exceeds the file's current size, the file\n" "remains unchanged."); -/* List of methods defined in the module */ -static struct PyMethodDef IO_methods[] = { - {"BytesIO", IO_BytesIO, METH_VARARGS, IO_BytesIO_doc}, +PyDoc_STRVAR(BytesIO_close_doc, +"close() -> None. Close the file and release the resources held."); + +PyDoc_STRVAR(BytesIO_seek_doc, +"seek(offset[, whence]) -> None. Set the file's current position.\n" +"\n" +"Argument offset is a byte count. Optional argument whence defaults to\n" +"0 (offset from start of file, offset should be >= 0); other values are 1\n" +"(move relative to current position, positive or negative), and 2 (move\n" +"relative to end of file, usually negative).\n"); + +PyDoc_STRVAR(BytesIO_write_doc, +"write(str) -> None. Write string str to file."); + +PyDoc_STRVAR(BytesIO_writelines_doc, +"writelines(sequence_of_strings) -> None. Write the strings to the file.\n" +"\n" +"Note that newlines are not added. The sequence can be any iterable object\n" +"producing strings. This is equivalent to calling write() for each string."); + + +static PyGetSetDef BytesIO_getsetlist[] = { + {"closed", (getter) bytes_io_get_closed, NULL, + "True if the file is closed"}, + {0}, /* sentinel */ +}; + +static struct PyMethodDef BytesIO_methods[] = { + {"flush", (PyCFunction) bytes_io_flush, METH_NOARGS, + BytesIO_flush_doc}, + {"getvalue", (PyCFunction) bytes_io_getvalue, METH_VARARGS, + BytesIO_getval_doc}, + {"isatty", (PyCFunction) bytes_io_isatty, METH_NOARGS, + BytesIO_isatty_doc}, + {"read", (PyCFunction) bytes_io_read, METH_VARARGS, + BytesIO_read_doc}, + {"readline", (PyCFunction) bytes_io_readline, METH_VARARGS, + BytesIO_readline_doc}, + {"readlines", (PyCFunction) bytes_io_readlines, METH_VARARGS, + BytesIO_readlines_doc}, + {"tell", (PyCFunction) bytes_io_tell, METH_NOARGS, + BytesIO_tell_doc}, + {"truncate", (PyCFunction) bytes_io_truncate, METH_VARARGS, + BytesIO_truncate_doc}, + {"close", (PyCFunction) bytes_io_close, METH_NOARGS, + BytesIO_close_doc}, + {"seek", (PyCFunction) bytes_io_seek, METH_VARARGS, + BytesIO_seek_doc}, + {"write", (PyCFunction) bytes_io_write, METH_VARARGS, + BytesIO_write_doc}, + {"writelines", (PyCFunction) bytes_io_writelines, METH_O, + BytesIO_writelines_doc}, {NULL, NULL} /* sentinel */ }; -static PyGetSetDef bytes_io_getsetlist[] = { - {"closed", (getter) IO_get_closed, NULL, "True if the file is closed"}, - {0}, + +static PyTypeObject BytesIO_Type = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "_bytes_io.BytesIO", /*tp_name*/ + sizeof(BytesIOObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)BytesIO_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BytesIO_doc, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + PyObject_SelfIter, /*tp_iter*/ + (iternextfunc)bytes_io_iternext, /*tp_iternext*/ + BytesIO_methods, /*tp_methods*/ + 0, /*tp_members*/ + BytesIO_getsetlist, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + BytesIO_new, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ }; PyMODINIT_FUNC init_bytes_io(void) { - PyObject *m; if (PyType_Ready(&BytesIO_Type) < 0) Modified: python/branches/cpy_merge/setup.py ============================================================================== --- python/branches/cpy_merge/setup.py (original) +++ python/branches/cpy_merge/setup.py Wed May 30 06:24:49 2007 @@ -472,6 +472,9 @@ exts.append( Extension('cStringIO', ['cStringIO.c']) ) exts.append( Extension('cPickle', ['cPickle.c']) ) + # Fast implementation of BytesIO + exts.append( Extension('_bytes_io', ['_bytes_iomodule.c']) ) + # Memory-mapped files (also works on Win32). if platform not in ['atheos', 'mac']: exts.append( Extension('mmap', ['mmapmodule.c']) ) From python-checkins at python.org Wed May 30 06:53:46 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 30 May 2007 06:53:46 +0200 (CEST) Subject: [Python-checkins] r55671 - python/trunk/Python/import.c Message-ID: <20070530045346.867C81E4003@bag.python.org> Author: neal.norwitz Date: Wed May 30 06:53:41 2007 New Revision: 55671 Modified: python/trunk/Python/import.c Log: Fix indentation (whitespace only). Modified: python/trunk/Python/import.c ============================================================================== --- python/trunk/Python/import.c (original) +++ python/trunk/Python/import.c Wed May 30 06:53:41 2007 @@ -2423,7 +2423,7 @@ if (modules_reloading == NULL) { Py_FatalError("PyImport_ReloadModule: " - "no modules_reloading dictionary!"); + "no modules_reloading dictionary!"); return NULL; } @@ -2467,7 +2467,7 @@ "reload(): parent %.200s not in sys.modules", PyString_AS_STRING(parentname)); Py_DECREF(parentname); - imp_modules_reloading_clear(); + imp_modules_reloading_clear(); return NULL; } Py_DECREF(parentname); From python-checkins at python.org Wed May 30 06:57:12 2007 From: python-checkins at python.org (neal.norwitz) Date: Wed, 30 May 2007 06:57:12 +0200 (CEST) Subject: [Python-checkins] r55672 - peps/trunk/pep-3100.txt Message-ID: <20070530045712.038EC1E400D@bag.python.org> Author: neal.norwitz Date: Wed May 30 06:57:08 2007 New Revision: 55672 Modified: peps/trunk/pep-3100.txt Log: If we remove the reload builtin(), do we really need PyImport_ReloadModule()? Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Wed May 30 06:57:08 2007 @@ -137,6 +137,8 @@ PyString_AsEncodedString, PyString_AsDecodedString PyArg_NoArgs, PyArg_GetInt, intargfunc, intintargfunc + PyImport_ReloadModule ? + Atomic Types ============ From python-checkins at python.org Wed May 30 08:58:32 2007 From: python-checkins at python.org (thomas.heller) Date: Wed, 30 May 2007 08:58:32 +0200 (CEST) Subject: [Python-checkins] r55676 - python/trunk/Modules/_ctypes/callbacks.c Message-ID: <20070530065832.1A8B41E4003@bag.python.org> Author: thomas.heller Date: Wed May 30 08:58:30 2007 New Revision: 55676 Modified: python/trunk/Modules/_ctypes/callbacks.c Log: Fix compiler warnings. Modified: python/trunk/Modules/_ctypes/callbacks.c ============================================================================== --- python/trunk/Modules/_ctypes/callbacks.c (original) +++ python/trunk/Modules/_ctypes/callbacks.c Wed May 30 08:58:30 2007 @@ -384,8 +384,8 @@ } { - PyObject *py_rclsid = PyLong_FromVoidPtr(rclsid); - PyObject *py_riid = PyLong_FromVoidPtr(riid); + PyObject *py_rclsid = PyLong_FromVoidPtr((void *)rclsid); + PyObject *py_riid = PyLong_FromVoidPtr((void *)riid); PyObject *py_ppv = PyLong_FromVoidPtr(ppv); if (!py_rclsid || !py_riid || !py_ppv) { Py_XDECREF(py_rclsid); From python-checkins at python.org Wed May 30 09:01:28 2007 From: python-checkins at python.org (thomas.heller) Date: Wed, 30 May 2007 09:01:28 +0200 (CEST) Subject: [Python-checkins] r55677 - python/trunk/Lib/ctypes/wintypes.py Message-ID: <20070530070128.591D01E4003@bag.python.org> Author: thomas.heller Date: Wed May 30 09:01:25 2007 New Revision: 55677 Modified: python/trunk/Lib/ctypes/wintypes.py Log: Correct the name of a field in the WIN32_FIND_DATAA and WIN32_FIND_DATAW structures. Closes bug #1726026. Modified: python/trunk/Lib/ctypes/wintypes.py ============================================================================== --- python/trunk/Lib/ctypes/wintypes.py (original) +++ python/trunk/Lib/ctypes/wintypes.py Wed May 30 09:01:25 2007 @@ -147,7 +147,7 @@ ("dwReserved0", DWORD), ("dwReserved1", DWORD), ("cFileName", c_char * MAX_PATH), - ("cAlternameFileName", c_char * 14)] + ("cAlternateFileName", c_char * 14)] class WIN32_FIND_DATAW(Structure): _fields_ = [("dwFileAttributes", DWORD), @@ -159,7 +159,7 @@ ("dwReserved0", DWORD), ("dwReserved1", DWORD), ("cFileName", c_wchar * MAX_PATH), - ("cAlternameFileName", c_wchar * 14)] + ("cAlternateFileName", c_wchar * 14)] __all__ = ['ATOM', 'BOOL', 'BOOLEAN', 'BYTE', 'COLORREF', 'DOUBLE', 'DWORD', 'FILETIME', 'HACCEL', 'HANDLE', 'HBITMAP', 'HBRUSH', From python-checkins at python.org Wed May 30 09:07:35 2007 From: python-checkins at python.org (thomas.heller) Date: Wed, 30 May 2007 09:07:35 +0200 (CEST) Subject: [Python-checkins] r55678 - in python/branches/release25-maint: Lib/ctypes Lib/ctypes/wintypes.py Misc/NEWS Message-ID: <20070530070735.8DC591E4003@bag.python.org> Author: thomas.heller Date: Wed May 30 09:07:34 2007 New Revision: 55678 Modified: python/branches/release25-maint/Lib/ctypes/ (props changed) python/branches/release25-maint/Lib/ctypes/wintypes.py python/branches/release25-maint/Misc/NEWS Log: Merged revisions 55677 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk/Lib/ctypes ........ r55677 | thomas.heller | 2007-05-30 09:01:25 +0200 (Mi, 30 Mai 2007) | 2 lines Correct the name of a field in the WIN32_FIND_DATAA and WIN32_FIND_DATAW structures. Closes bug #1726026. ........ Modified: python/branches/release25-maint/Lib/ctypes/wintypes.py ============================================================================== --- python/branches/release25-maint/Lib/ctypes/wintypes.py (original) +++ python/branches/release25-maint/Lib/ctypes/wintypes.py Wed May 30 09:07:34 2007 @@ -141,7 +141,7 @@ ("dwReserved0", DWORD), ("dwReserved1", DWORD), ("cFileName", c_char * MAX_PATH), - ("cAlternameFileName", c_char * 14)] + ("cAlternateFileName", c_char * 14)] class WIN32_FIND_DATAW(Structure): _fields_ = [("dwFileAttributes", DWORD), @@ -153,7 +153,7 @@ ("dwReserved0", DWORD), ("dwReserved1", DWORD), ("cFileName", c_wchar * MAX_PATH), - ("cAlternameFileName", c_wchar * 14)] + ("cAlternateFileName", c_wchar * 14)] __all__ = ['ATOM', 'BOOL', 'BOOLEAN', 'BYTE', 'COLORREF', 'DOUBLE', 'DWORD', 'FILETIME', 'HACCEL', 'HANDLE', 'HBITMAP', 'HBRUSH', Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Wed May 30 09:07:34 2007 @@ -40,6 +40,8 @@ - Bug #1721309: prevent bsddb module from freeing random memory. +- Bug #1726026: Correct the field names of WIN32_FIND_DATAA and + WIN32_FIND_DATAW structures in the ctypes.wintypes module. Documentation ------------- From buildbot at python.org Wed May 30 09:45:58 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 30 May 2007 07:45:58 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070530074558.468D51E4003@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2054 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver sincerely, -The Buildbot From nnorwitz at gmail.com Wed May 30 11:07:22 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 30 May 2007 05:07:22 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20070530090722.GA28476@python.psfb.org> test_popen2 leaked [-26, 0, 0] references, sum=-26 From buildbot at python.org Wed May 30 18:37:00 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 30 May 2007 16:37:00 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070530163700.B385F1E4020@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/469 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,martin.v.loewis,neal.norwitz,thomas.heller Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_winsound ====================================================================== ERROR: test_alias_asterisk (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 64, in test_alias_asterisk winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exclamation (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 74, in test_alias_exclamation winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exit (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 84, in test_alias_exit winsound.PlaySound('SystemExit', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_hand (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 94, in test_alias_hand winsound.PlaySound('SystemHand', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_question (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 104, in test_alias_question winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_stopasync (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot_py25\trunk.mcintyre-windows\build\lib\test\test_winsound.py", line 158, in test_stopasync winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP RuntimeError: Failed to play sound sincerely, -The Buildbot From buildbot at python.org Wed May 30 20:46:47 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 30 May 2007 18:46:47 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20070530184647.C7D901E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-3%2520trunk/builds/6 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: The web-page 'force build' button was pressed by 'theller': moved the buildbot vmware image to the final host. Build Source Stamp: [branch trunk] HEAD Blamelist: BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Wed May 30 21:04:09 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 30 May 2007 19:04:09 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 2.5 Message-ID: <20070530190410.06FAA1E4026@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-3%25202.5/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: The web-page 'force build' button was pressed by 'theller': try a 2.5 build Build Source Stamp: [branch release25-maint] HEAD Blamelist: BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Wed May 30 21:16:56 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 30 May 2007 21:16:56 +0200 (CEST) Subject: [Python-checkins] r55680 - python/branches/cpy_merge/Modules/_bytes_iomodule.c Message-ID: <20070530191656.BBF541E4003@bag.python.org> Author: alexandre.vassalotti Date: Wed May 30 21:16:53 2007 New Revision: 55680 Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c Log: Minor cosmetic changes. Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_bytes_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_bytes_iomodule.c Wed May 30 21:16:53 2007 @@ -72,7 +72,7 @@ PyMem_Resize(self->buf, char, self->buf_size); if (self->buf == NULL) { - PyErr_SetString(PyExc_MemoryError, "out of memory"); + PyErr_SetString(PyExc_MemoryError, "Out of memory"); PyMem_Del(self->buf); self->buf_size = self->pos = 0; return -1; @@ -99,6 +99,7 @@ if (self->buf == NULL) result = Py_True; + Py_INCREF(result); return result; } @@ -131,10 +132,19 @@ } static PyObject * +bytes_io_tell(BytesIOObject *self) +{ + if (self->buf == NULL) + return err_closed(); + + return PyInt_FromSsize_t(self->pos); +} + +static PyObject * bytes_io_read(BytesIOObject *self, PyObject *args) { Py_ssize_t l, n = -1; - char *output = NULL; + char *output; if (self->buf == NULL) return err_closed(); @@ -182,10 +192,9 @@ static PyObject * bytes_io_readlines(BytesIOObject *self, PyObject *args) { - int n; - char *output; + Py_ssize_t n, hint = 0, length = 0; PyObject *result, *line; - int hint = 0, length = 0; + char *output; if (self->buf == NULL) return err_closed(); @@ -221,15 +230,6 @@ } static PyObject * -bytes_io_tell(BytesIOObject *self) -{ - if (self->buf == NULL) - return err_closed(); - - return PyInt_FromSsize_t(self->pos); -} - -static PyObject * bytes_io_truncate(BytesIOObject *self, PyObject *args) { Py_ssize_t size; @@ -321,7 +321,7 @@ bytes_io_write(BytesIOObject *self, PyObject *args) { const char *c; - int l; + Py_ssize_t l; if (self->buf == NULL) return err_closed(); @@ -432,7 +432,7 @@ PyDoc_STRVAR(BytesIO_doc, -"BytesIO([s]) -> Return a BytesIO stream for reading and writing."); +"BytesIO([buffer]) -> Return a BytesIO stream for reading and writing."); PyDoc_STRVAR(BytesIO_flush_doc, "flush() -> None. Does nothing."); From python-checkins at python.org Wed May 30 21:54:29 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 30 May 2007 21:54:29 +0200 (CEST) Subject: [Python-checkins] r55681 - python/branches/cpy_merge/Modules/_string_iomodule.c Message-ID: <20070530195429.801981E4015@bag.python.org> Author: alexandre.vassalotti Date: Wed May 30 21:54:28 2007 New Revision: 55681 Added: python/branches/cpy_merge/Modules/_string_iomodule.c - copied unchanged from r55680, python/branches/cpy_merge/Modules/_bytes_iomodule.c Log: Copy of _bytes_io as the base for the implementation of _string_io. From python-checkins at python.org Wed May 30 21:58:17 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 30 May 2007 21:58:17 +0200 (CEST) Subject: [Python-checkins] r55682 - python/branches/cpy_merge/Modules/_string_iomodule.c Message-ID: <20070530195817.053001E4005@bag.python.org> Author: alexandre.vassalotti Date: Wed May 30 21:58:13 2007 New Revision: 55682 Modified: python/branches/cpy_merge/Modules/_string_iomodule.c Log: Rename bytes_io -> string_io, BytesIO -> StringIO. Modified: python/branches/cpy_merge/Modules/_string_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_string_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_string_iomodule.c Wed May 30 21:58:13 2007 @@ -1,18 +1,18 @@ #include "Python.h" PyDoc_STRVAR(module_doc, -"A fast implementation of BytesIO."); +"A fast implementation of StringIO."); typedef struct { PyObject_HEAD char *buf; Py_ssize_t pos, string_size; Py_ssize_t buf_size; -} BytesIOObject; +} StringIOObject; -static PyTypeObject BytesIO_Type; +static PyTypeObject StringIO_Type; -/* The initial size of the buffer of BytesIO objects */ +/* The initial size of the buffer of StringIO objects */ #define BUFSIZE 128 static PyObject * @@ -24,7 +24,7 @@ /* Internal routine to get a line. Returns the number of bytes read. */ static Py_ssize_t -get_line(BytesIOObject *self, char **output) +get_line(StringIOObject *self, char **output) { char *n; const char *str_end; @@ -53,10 +53,10 @@ return l; } -/* Internal routine for writing a string of bytes to the buffer of a BytesIO +/* Internal routine for writing a string of bytes to the buffer of a StringIO object. Returns the number of bytes wrote. */ static Py_ssize_t -write_bytes(BytesIOObject *self, const char *c, Py_ssize_t l) +write_bytes(StringIOObject *self, const char *c, Py_ssize_t l) { Py_ssize_t newl; @@ -93,7 +93,7 @@ static PyObject * -bytes_io_get_closed(BytesIOObject *self) +string_io_get_closed(StringIOObject *self) { PyObject *result = Py_False; @@ -105,7 +105,7 @@ } static PyObject * -bytes_io_flush(BytesIOObject *self) +string_io_flush(StringIOObject *self) { if (self->buf == NULL) return err_closed(); @@ -114,7 +114,7 @@ } static PyObject * -bytes_io_getvalue(BytesIOObject *self) +string_io_getvalue(StringIOObject *self) { if (self->buf == NULL) return err_closed(); @@ -123,7 +123,7 @@ } static PyObject * -bytes_io_isatty(BytesIOObject *self) +string_io_isatty(StringIOObject *self) { if (self->buf == NULL) return err_closed(); @@ -132,7 +132,7 @@ } static PyObject * -bytes_io_tell(BytesIOObject *self) +string_io_tell(StringIOObject *self) { if (self->buf == NULL) return err_closed(); @@ -141,7 +141,7 @@ } static PyObject * -bytes_io_read(BytesIOObject *self, PyObject *args) +string_io_read(StringIOObject *self, PyObject *args) { Py_ssize_t l, n = -1; char *output; @@ -167,7 +167,7 @@ } static PyObject * -bytes_io_readline(BytesIOObject *self, PyObject *args) +string_io_readline(StringIOObject *self, PyObject *args) { Py_ssize_t n, m = -1; char *output; @@ -190,7 +190,7 @@ } static PyObject * -bytes_io_readlines(BytesIOObject *self, PyObject *args) +string_io_readlines(StringIOObject *self, PyObject *args) { Py_ssize_t n, hint = 0, length = 0; PyObject *result, *line; @@ -230,7 +230,7 @@ } static PyObject * -bytes_io_truncate(BytesIOObject *self, PyObject *args) +string_io_truncate(StringIOObject *self, PyObject *args) { Py_ssize_t size; @@ -257,7 +257,7 @@ } static PyObject * -bytes_io_iternext(BytesIOObject *self) +string_io_iternext(StringIOObject *self) { char *next; Py_ssize_t n; @@ -276,7 +276,7 @@ } static PyObject * -bytes_io_seek(BytesIOObject *self, PyObject *args) +string_io_seek(StringIOObject *self, PyObject *args) { Py_ssize_t position; int mode = 0; @@ -318,7 +318,7 @@ } static PyObject * -bytes_io_write(BytesIOObject *self, PyObject *args) +string_io_write(StringIOObject *self, PyObject *args) { const char *c; Py_ssize_t l; @@ -336,7 +336,7 @@ } static PyObject * -bytes_io_writelines(BytesIOObject *self, PyObject *v) +string_io_writelines(StringIOObject *self, PyObject *v) { PyObject *it, *item; @@ -372,7 +372,7 @@ } static PyObject * -bytes_io_close(BytesIOObject *self) +string_io_close(StringIOObject *self) { if (self->buf != NULL) PyMem_Del(self->buf); @@ -384,7 +384,7 @@ } static void -BytesIO_dealloc(BytesIOObject *op) +StringIO_dealloc(StringIOObject *op) { if (op->buf != NULL) PyMem_Del(op->buf); @@ -393,18 +393,18 @@ } static PyObject * -BytesIO_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +StringIO_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - BytesIOObject *self; + StringIOObject *self; const char *buf; Py_ssize_t n = -1, size = BUFSIZE; assert(type != NULL && type->tp_alloc != NULL); - if (!PyArg_ParseTuple(args, "|t#:BytesIO", &buf, &n)) + if (!PyArg_ParseTuple(args, "|t#:StringIO", &buf, &n)) return NULL; - self = (BytesIOObject *)type->tp_alloc(type, 0); + self = (StringIOObject *)type->tp_alloc(type, 0); if (self == NULL) return NULL; @@ -431,58 +431,58 @@ } -PyDoc_STRVAR(BytesIO_doc, -"BytesIO([buffer]) -> Return a BytesIO stream for reading and writing."); +PyDoc_STRVAR(StringIO_doc, +"StringIO([buffer]) -> Return a StringIO stream for reading and writing."); -PyDoc_STRVAR(BytesIO_flush_doc, +PyDoc_STRVAR(StringIO_flush_doc, "flush() -> None. Does nothing."); -PyDoc_STRVAR(BytesIO_getval_doc, +PyDoc_STRVAR(StringIO_getval_doc, "getvalue() -> string.\n" "\n" -"Retrieve the entire contents of the BytesIO object. Raise an\n" +"Retrieve the entire contents of the StringIO object. Raise an\n" "exception if the object is closed."); -PyDoc_STRVAR(BytesIO_isatty_doc, +PyDoc_STRVAR(StringIO_isatty_doc, "isatty() -> False.\n" "\n" -"Always returns False since BytesIO objects are not connected\n" +"Always returns False since StringIO objects are not connected\n" "to a tty-like device."); -PyDoc_STRVAR(BytesIO_read_doc, +PyDoc_STRVAR(StringIO_read_doc, "read([size]) -> read at most size bytes, returned as a string.\n" "\n" "If the size argument is negative or omitted, read until EOF is reached.\n" "Return an empty string at EOF."); -PyDoc_STRVAR(BytesIO_readline_doc, +PyDoc_STRVAR(StringIO_readline_doc, "readline([size]) -> next line from the file, as a string.\n" "\n" "Retain newline. A non-negative size argument limits the maximum\n" "number of bytes to return (an incomplete line may be returned then).\n" "Return an empty string at EOF.\n"); -PyDoc_STRVAR(BytesIO_readlines_doc, +PyDoc_STRVAR(StringIO_readlines_doc, "readlines([size]) -> list of strings, each a line from the file.\n" "\n" "Call readline() repeatedly and return a list of the lines so read.\n" "The optional size argument, if given, is an approximate bound on the\n" "total number of bytes in the lines returned.\n"); -PyDoc_STRVAR(BytesIO_tell_doc, +PyDoc_STRVAR(StringIO_tell_doc, "tell() -> current file position, an integer\n"); -PyDoc_STRVAR(BytesIO_truncate_doc, +PyDoc_STRVAR(StringIO_truncate_doc, "truncate([size]) -> None. Truncate the file to at most size bytes.\n" "\n" "Size defaults to the current file position, as returned by tell().\n" "If the specified size exceeds the file's current size, the file\n" "remains unchanged."); -PyDoc_STRVAR(BytesIO_close_doc, +PyDoc_STRVAR(StringIO_close_doc, "close() -> None. Close the file and release the resources held."); -PyDoc_STRVAR(BytesIO_seek_doc, +PyDoc_STRVAR(StringIO_seek_doc, "seek(offset[, whence]) -> None. Set the file's current position.\n" "\n" "Argument offset is a byte count. Optional argument whence defaults to\n" @@ -490,59 +490,59 @@ "(move relative to current position, positive or negative), and 2 (move\n" "relative to end of file, usually negative).\n"); -PyDoc_STRVAR(BytesIO_write_doc, +PyDoc_STRVAR(StringIO_write_doc, "write(str) -> None. Write string str to file."); -PyDoc_STRVAR(BytesIO_writelines_doc, +PyDoc_STRVAR(StringIO_writelines_doc, "writelines(sequence_of_strings) -> None. Write the strings to the file.\n" "\n" "Note that newlines are not added. The sequence can be any iterable object\n" "producing strings. This is equivalent to calling write() for each string."); -static PyGetSetDef BytesIO_getsetlist[] = { - {"closed", (getter) bytes_io_get_closed, NULL, +static PyGetSetDef StringIO_getsetlist[] = { + {"closed", (getter) string_io_get_closed, NULL, "True if the file is closed"}, {0}, /* sentinel */ }; -static struct PyMethodDef BytesIO_methods[] = { - {"flush", (PyCFunction) bytes_io_flush, METH_NOARGS, - BytesIO_flush_doc}, - {"getvalue", (PyCFunction) bytes_io_getvalue, METH_VARARGS, - BytesIO_getval_doc}, - {"isatty", (PyCFunction) bytes_io_isatty, METH_NOARGS, - BytesIO_isatty_doc}, - {"read", (PyCFunction) bytes_io_read, METH_VARARGS, - BytesIO_read_doc}, - {"readline", (PyCFunction) bytes_io_readline, METH_VARARGS, - BytesIO_readline_doc}, - {"readlines", (PyCFunction) bytes_io_readlines, METH_VARARGS, - BytesIO_readlines_doc}, - {"tell", (PyCFunction) bytes_io_tell, METH_NOARGS, - BytesIO_tell_doc}, - {"truncate", (PyCFunction) bytes_io_truncate, METH_VARARGS, - BytesIO_truncate_doc}, - {"close", (PyCFunction) bytes_io_close, METH_NOARGS, - BytesIO_close_doc}, - {"seek", (PyCFunction) bytes_io_seek, METH_VARARGS, - BytesIO_seek_doc}, - {"write", (PyCFunction) bytes_io_write, METH_VARARGS, - BytesIO_write_doc}, - {"writelines", (PyCFunction) bytes_io_writelines, METH_O, - BytesIO_writelines_doc}, +static struct PyMethodDef StringIO_methods[] = { + {"flush", (PyCFunction) string_io_flush, METH_NOARGS, + StringIO_flush_doc}, + {"getvalue", (PyCFunction) string_io_getvalue, METH_VARARGS, + StringIO_getval_doc}, + {"isatty", (PyCFunction) string_io_isatty, METH_NOARGS, + StringIO_isatty_doc}, + {"read", (PyCFunction) string_io_read, METH_VARARGS, + StringIO_read_doc}, + {"readline", (PyCFunction) string_io_readline, METH_VARARGS, + StringIO_readline_doc}, + {"readlines", (PyCFunction) string_io_readlines, METH_VARARGS, + StringIO_readlines_doc}, + {"tell", (PyCFunction) string_io_tell, METH_NOARGS, + StringIO_tell_doc}, + {"truncate", (PyCFunction) string_io_truncate, METH_VARARGS, + StringIO_truncate_doc}, + {"close", (PyCFunction) string_io_close, METH_NOARGS, + StringIO_close_doc}, + {"seek", (PyCFunction) string_io_seek, METH_VARARGS, + StringIO_seek_doc}, + {"write", (PyCFunction) string_io_write, METH_VARARGS, + StringIO_write_doc}, + {"writelines", (PyCFunction) string_io_writelines, METH_O, + StringIO_writelines_doc}, {NULL, NULL} /* sentinel */ }; -static PyTypeObject BytesIO_Type = { +static PyTypeObject StringIO_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ - "_bytes_io.BytesIO", /*tp_name*/ - sizeof(BytesIOObject), /*tp_basicsize*/ + "_string_io.StringIO", /*tp_name*/ + sizeof(StringIOObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ - (destructor)BytesIO_dealloc, /*tp_dealloc*/ + (destructor)StringIO_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -558,16 +558,16 @@ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BytesIO_doc, /*tp_doc*/ + StringIO_doc, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ PyObject_SelfIter, /*tp_iter*/ - (iternextfunc)bytes_io_iternext, /*tp_iternext*/ - BytesIO_methods, /*tp_methods*/ + (iternextfunc)string_io_iternext, /*tp_iternext*/ + StringIO_methods, /*tp_methods*/ 0, /*tp_members*/ - BytesIO_getsetlist, /*tp_getset*/ + StringIO_getsetlist, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -575,21 +575,21 @@ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - BytesIO_new, /*tp_new*/ + StringIO_new, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ }; PyMODINIT_FUNC -init_bytes_io(void) +init_string_io(void) { PyObject *m; - if (PyType_Ready(&BytesIO_Type) < 0) + if (PyType_Ready(&StringIO_Type) < 0) return; - m = Py_InitModule3("_bytes_io", NULL, module_doc); + m = Py_InitModule3("_string_io", NULL, module_doc); if (m == NULL) return; - Py_INCREF(&BytesIO_Type); - PyModule_AddObject(m, "BytesIO", (PyObject *)&BytesIO_Type); + Py_INCREF(&StringIO_Type); + PyModule_AddObject(m, "StringIO", (PyObject *)&StringIO_Type); } From python-checkins at python.org Wed May 30 22:16:43 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 22:16:43 +0200 (CEST) Subject: [Python-checkins] r55683 - in python/branches/bcannon-objcap: BRANCH_NOTES secure_python.c tests/fail/dangerous_things_inaccessible.py tests/succeed/import_safe_builtin.py Message-ID: <20070530201643.814091E4003@bag.python.org> Author: brett.cannon Date: Wed May 30 22:16:42 2007 New Revision: 55683 Modified: python/branches/bcannon-objcap/BRANCH_NOTES python/branches/bcannon-objcap/secure_python.c python/branches/bcannon-objcap/tests/fail/dangerous_things_inaccessible.py python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py Log: Remove SystemExit from the built-in namespace. Also block the importation of the 'exceptions' module. This is needed as the interpreter calls Py_Finalize() if SystemExit propagates to the top of the call chain. Don't want that unless finalization on the interpreter is explicitly desired. Modified: python/branches/bcannon-objcap/BRANCH_NOTES ============================================================================== --- python/branches/bcannon-objcap/BRANCH_NOTES (original) +++ python/branches/bcannon-objcap/BRANCH_NOTES Wed May 30 22:16:42 2007 @@ -27,12 +27,13 @@ + Requires sys.setdefaultencoding() which is deleted by site.py . + reload(sys) normally adds it, but hack to do a fresh import on sys is preventing that from happening somehow. + + reload() going away in Python 3.0. ===== To Do ===== -* Deal with exit()/SystemExit. +Nothing. ========== Modified: python/branches/bcannon-objcap/secure_python.c ============================================================================== --- python/branches/bcannon-objcap/secure_python.c (original) +++ python/branches/bcannon-objcap/secure_python.c Wed May 30 22:16:42 2007 @@ -26,11 +26,10 @@ PyObject *hidden_modules; PyObject *import_module; PyObject *import_callable; - Py_ssize_t safe_builtins_count = 7; + Py_ssize_t safe_builtins_count = 6; /* All whitelisted modules should be imported in the proper test file. */ const char *safe_builtins_names[] = {"_ast", "_codecs", "_sre", - "_symtable", "_types", "errno", - "exceptions"}; + "_symtable", "_types", "errno"}; Py_ssize_t safe_frozen_count = 0; const char *safe_frozen_names[] = {}; PyObject *safe_builtins_seq; @@ -89,8 +88,6 @@ Lose this and Python will not run. * __main__ Current scope of execution. - * exceptions - Safe to keep around. * encodings Does dynamic import of encodings which requires globals() to work; globals() fails when the module has been deleted. Also @@ -118,7 +115,6 @@ /* Modules that *must* stay visible. */ if ((strcmp(module_name, "__builtin__") == 0) || (strcmp(module_name, "__main__") == 0) || - (strcmp(module_name, "exceptions") == 0) || (strcmp(module_name, "encodings") == 0) || (strcmp(module_name, "codecs") == 0) || (strcmp(module_name, "_codecs") == 0)) { @@ -148,6 +144,7 @@ /* Remove dangerous built-ins. */ PyDict_DelItemString(interp->builtins, "execfile"); PyDict_DelItemString(interp->builtins, "open"); + PyDict_DelItemString(interp->builtins, "SystemExit"); /* Use interpreter. */ return_val = Py_Main(argc, argv); Modified: python/branches/bcannon-objcap/tests/fail/dangerous_things_inaccessible.py ============================================================================== --- python/branches/bcannon-objcap/tests/fail/dangerous_things_inaccessible.py (original) +++ python/branches/bcannon-objcap/tests/fail/dangerous_things_inaccessible.py Wed May 30 22:16:42 2007 @@ -8,6 +8,9 @@ # Needed to look for 'open' and 'execfile'. builtin_fxn_type = type(any) dangerous_builtins = ('open', 'execfile') +# Needed for SystemExit. +exc_type = type(Exception) +dangerous_exceptions = ('SystemExit',) def check_imported_modules(module): """Recursively check that the module (and the modules it imports) do not @@ -27,6 +30,9 @@ elif isinstance(attr, builtin_fxn_type): if attr_name in dangerous_builtins: raise Exception + elif isinstance(attr, exc_type): + if attr_name in dangerous_exceptions: + raise Exception import __builtin__ @@ -35,9 +41,6 @@ import __main__ check_imported_modules(__main__) -import exceptions -check_imported_modules(exceptions) - import encodings check_imported_modules(encodings) Modified: python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py ============================================================================== --- python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py (original) +++ python/branches/bcannon-objcap/tests/succeed/import_safe_builtin.py Wed May 30 22:16:42 2007 @@ -5,4 +5,3 @@ # Also tests that modules moved to .hidden can be imported again. import _types import errno -import exceptions From python-checkins at python.org Wed May 30 22:22:41 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 22:22:41 +0200 (CEST) Subject: [Python-checkins] r55684 - python/branches/bcannon-objcap/BRANCHNEWS Message-ID: <20070530202241.09C551E4003@bag.python.org> Author: brett.cannon Date: Wed May 30 22:22:33 2007 New Revision: 55684 Modified: python/branches/bcannon-objcap/BRANCHNEWS Log: Clean up to only document direct changes to Python code instead of discussing what secure_python.c does. Modified: python/branches/bcannon-objcap/BRANCHNEWS ============================================================================== --- python/branches/bcannon-objcap/BRANCHNEWS (original) +++ python/branches/bcannon-objcap/BRANCHNEWS Wed May 30 22:22:33 2007 @@ -8,20 +8,13 @@ Core and builtins ----------------- -* Use an instance of importlib.Import as what __import__ delegates to. This - necessitates storing a large chunk of modules into sys.modules['.hidden'] so - that importlib can keep working. - -* Clear out sys.path_importer_cache. - -* Force 'warnings' to be cached by the C code. - * Make importing the sys module after it has been completely deleted use the interpreter's sysdict instead of the cached dict used by the import machinery. This lets the sys module be deleted for security reasons during startup. -* rev. ????: Added a delegate for import that calls sys.import_. +* rev. ????: Added a delegate for import that calls sys.import_ in + sys.import_delegate. * rev. 51679: Remove the constructor for the 'code' type. This means instances of the 'code' type cannot be created directly. You must use the new @@ -40,31 +33,8 @@ with moving object.__subclasses__(). -Extension Modules ------------------ - -* rev. 51958: Fix up handling exceptions. Added exc_matches() exception. - -* rev. 51944: Change sys_dict to a module since that dict is cached somewhere. - -* rev. 51941: Changed exception raised by interpreter.Interpreter().execute() - to RuntimError when something goes bad. Also added the redirect_output() - method. - -* rev. 51914: Changed accessing the built-in namespace dict from an attribute - to a function call. This is because the dict is cached in the execution - frame created when the interpreter is first created and thus setting the dict - to another dict has no affect. - -* rev. 51880: Add access to the 'sys' modules data dict to Interpreter objects. - -* rev. 51875: Introduced the interpreter module. - - Library ------- * Change the codecs module so that it does not import the entire sys module and thus hold a reference to it. - -* rev. 53333: External definition of importlib (from the sandbox) added. From python-checkins at python.org Wed May 30 22:23:57 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 22:23:57 +0200 (CEST) Subject: [Python-checkins] r55685 - python/branches/bcannon-objcap/securing_python.txt Message-ID: <20070530202357.605CA1E4003@bag.python.org> Author: brett.cannon Date: Wed May 30 22:23:53 2007 New Revision: 55685 Modified: python/branches/bcannon-objcap/securing_python.txt Log: Minor update. Modified: python/branches/bcannon-objcap/securing_python.txt ============================================================================== --- python/branches/bcannon-objcap/securing_python.txt (original) +++ python/branches/bcannon-objcap/securing_python.txt Wed May 30 22:23:53 2007 @@ -4,7 +4,7 @@ Status /////////////////////////////////////// -+ Dangerous types (`Constructors`_) ++ Dangerous types (`Constructors`_) [done] - file * Create PyFile_Init() from file_init() [done] * Switch current C-level uses of 'file' constructor to From python-checkins at python.org Wed May 30 22:46:28 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 22:46:28 +0200 (CEST) Subject: [Python-checkins] r55686 - in python/trunk: Lib/MimeWriter.py Lib/test/test_MimeWriter.py Lib/test/test___all__.py Misc/NEWS Message-ID: <20070530204628.3D31D1E4020@bag.python.org> Author: brett.cannon Date: Wed May 30 22:46:26 2007 New Revision: 55686 Modified: python/trunk/Lib/MimeWriter.py python/trunk/Lib/test/test_MimeWriter.py python/trunk/Lib/test/test___all__.py python/trunk/Misc/NEWS Log: Have MimeWriter raise a DeprecationWarning as per PEP 4 and its documentation. Modified: python/trunk/Lib/MimeWriter.py ============================================================================== --- python/trunk/Lib/MimeWriter.py (original) +++ python/trunk/Lib/MimeWriter.py Wed May 30 22:46:26 2007 @@ -14,6 +14,11 @@ __all__ = ["MimeWriter"] +import warnings + +warnings.warn("the MimeWriter module is deprecated; use the email package instead", + DeprecationWarning, 2) + class MimeWriter: """Generic MIME writer. Modified: python/trunk/Lib/test/test_MimeWriter.py ============================================================================== --- python/trunk/Lib/test/test_MimeWriter.py (original) +++ python/trunk/Lib/test/test_MimeWriter.py Wed May 30 22:46:26 2007 @@ -10,6 +10,10 @@ import unittest, sys, StringIO from test.test_support import run_unittest +import warnings +warnings.filterwarnings("ignore", "the MimeWriter module is deprecated.*", + DeprecationWarning) + from MimeWriter import MimeWriter SELLER = '''\ Modified: python/trunk/Lib/test/test___all__.py ============================================================================== --- python/trunk/Lib/test/test___all__.py (original) +++ python/trunk/Lib/test/test___all__.py Wed May 30 22:46:26 2007 @@ -7,6 +7,8 @@ DeprecationWarning, "") warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*", DeprecationWarning) +warnings.filterwarnings("ignore", "the MimeWriter module is deprecated.*", + DeprecationWarning) class AllTest(unittest.TestCase): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed May 30 22:46:26 2007 @@ -220,6 +220,8 @@ Library ------- +- MimeWriter now raises a DeprecationWarning upon import. + - tarfile.py: Improved unicode support. Unicode input names are now officially supported. Added "errors" argument to the TarFile class. From python-checkins at python.org Wed May 30 22:48:19 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 22:48:19 +0200 (CEST) Subject: [Python-checkins] r55687 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Message-ID: <20070530204819.60AE71E4005@bag.python.org> Author: brett.cannon Date: Wed May 30 22:48:17 2007 New Revision: 55687 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Log: Update based on MimeWriter raising a DeprecationWarning. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Wed May 30 22:48:17 2007 @@ -84,7 +84,7 @@ The following modules currently lack a DeprecationWarning: - rfc822, mimetools, MimeWriter, mimify, + rfc822, mimetools, mimify, multifile, md5, sha, buildtools, cfmfile @@ -145,7 +145,8 @@ Rationale: Supplanted by Python 2.2's email package. Date: 18-Mar-2002 Documentation: Documented as "deprecated since release 2.3" since - Python 2.2.2. + Python 2.2.2. Raises a DeprecationWarning as of + Python 2.6. Module name: mimify Rationale: Supplanted by Python 2.2's email package. Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Wed May 30 22:48:17 2007 @@ -63,6 +63,7 @@ - commands.getstatus() - macostools.touched() + - MimeWriter - popen2, os.popen[234]() - posixfile - sets @@ -126,7 +127,6 @@ - rfc822 - mimetools - - MimeWriter - mimify - multifile - md5 From nnorwitz at gmail.com Wed May 30 23:10:17 2007 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 30 May 2007 17:10:17 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20070530211017.GA10297@python.psfb.org> test_popen2 leaked [-26, 26, -26] references, sum=-26 From buildbot at python.org Wed May 30 23:14:50 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 30 May 2007 21:14:50 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20070530211450.3FBE01E400D@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/2234 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '2002-2002-2002-2002-2002' Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '1007-1007-1007-1007-1007' Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 440, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 260, in writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/unittest.py", line 343, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: None != '0004-0004-0004-0004-0004' 1 test failed: test_timeout make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed May 30 23:15:35 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 30 May 2007 21:15:35 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20070530211535.D83231E4017@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/323 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket_ssl sincerely, -The Buildbot From python-checkins at python.org Wed May 30 23:21:11 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 23:21:11 +0200 (CEST) Subject: [Python-checkins] r55689 - peps/trunk/pep-3100.txt Message-ID: <20070530212111.28FF91E4017@bag.python.org> Author: brett.cannon Date: Wed May 30 23:21:10 2007 New Revision: 55689 Modified: peps/trunk/pep-3100.txt Log: Document that MimeWriter has been removed. Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Wed May 30 23:21:10 2007 @@ -211,7 +211,6 @@ ``pcre``, ``pypcre``, ``strop`` [all done] + see PEP 4 [#pep4]_ - ``mimetools``, - ``MimeWriter``, ``mimify``, ``mpz``, ``multifile``, @@ -225,7 +224,7 @@ ``TERMIOS``, ``timing`` [to do] - - ``gopherlib`` [done] + - ``gopherlib``, ``MimeWriter`` [done] - ``cl``, ``sets``, ``xreadlines``, ``rotor``, ``whrandom`` [done] + Everything in lib-old [#pep4]_ [done] - ``Para``, ``addpack``, ``cmp``, ``cmpcache``, ``codehack``, From python-checkins at python.org Wed May 30 23:49:02 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 23:49:02 +0200 (CEST) Subject: [Python-checkins] r55690 - in python/trunk: Lib/mimify.py Lib/test/test___all__.py Lib/test/test_sundry.py Misc/NEWS Message-ID: <20070530214902.83B361E4003@bag.python.org> Author: brett.cannon Date: Wed May 30 23:48:58 2007 New Revision: 55690 Modified: python/trunk/Lib/mimify.py python/trunk/Lib/test/test___all__.py python/trunk/Lib/test/test_sundry.py python/trunk/Misc/NEWS Log: Have mimify raise a DeprecationWarning. The docs and PEP 4 have listed the module as deprecated for a while. Modified: python/trunk/Lib/mimify.py ============================================================================== --- python/trunk/Lib/mimify.py (original) +++ python/trunk/Lib/mimify.py Wed May 30 23:48:58 2007 @@ -29,6 +29,10 @@ import re +import warnings +warnings.warn("the mimify module is deprecated; use the email package instead", + DeprecationWarning, 2) + __all__ = ["mimify","unmimify","mime_encode_header","mime_decode_header"] qp = re.compile('^content-transfer-encoding:\\s*quoted-printable', re.I) Modified: python/trunk/Lib/test/test___all__.py ============================================================================== --- python/trunk/Lib/test/test___all__.py (original) +++ python/trunk/Lib/test/test___all__.py Wed May 30 23:48:58 2007 @@ -9,6 +9,8 @@ DeprecationWarning) warnings.filterwarnings("ignore", "the MimeWriter module is deprecated.*", DeprecationWarning) +warnings.filterwarnings("ignore", "the mimify module is deprecated.*", + DeprecationWarning) class AllTest(unittest.TestCase): Modified: python/trunk/Lib/test/test_sundry.py ============================================================================== --- python/trunk/Lib/test/test_sundry.py (original) +++ python/trunk/Lib/test/test_sundry.py Wed May 30 23:48:58 2007 @@ -6,6 +6,7 @@ with guard_warnings_filter(): warnings.filterwarnings('ignore', r".*posixfile", DeprecationWarning) + warnings.filterwarnings('ignore', r".*mimify", DeprecationWarning) from test.test_support import verbose Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed May 30 23:48:58 2007 @@ -220,6 +220,8 @@ Library ------- +- mimify now raises a DeprecationWarning upon import. + - MimeWriter now raises a DeprecationWarning upon import. - tarfile.py: Improved unicode support. Unicode input names are now From python-checkins at python.org Wed May 30 23:49:51 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 23:49:51 +0200 (CEST) Subject: [Python-checkins] r55691 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Message-ID: <20070530214951.5189D1E4003@bag.python.org> Author: brett.cannon Date: Wed May 30 23:49:50 2007 New Revision: 55691 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Log: Update PEPs to reflect that mimify raises a DeprecationWarning in Python 2.6. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Wed May 30 23:49:50 2007 @@ -84,8 +84,7 @@ The following modules currently lack a DeprecationWarning: - rfc822, mimetools, mimify, - multifile, md5, sha, buildtools, cfmfile + rfc822, mimetools, multifile, md5, sha, buildtools, cfmfile Deprecated modules @@ -152,7 +151,8 @@ Rationale: Supplanted by Python 2.2's email package. Date: 18-Mar-2002 Documentation: Documented as "deprecated since release 2.3" since - Python 2.2.2. + Python 2.2.2. Raises a DeprecationWarning as of + Python 2.6. Module name: rotor Rationale: Uses insecure algorithm. Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Wed May 30 23:49:50 2007 @@ -64,6 +64,7 @@ - commands.getstatus() - macostools.touched() - MimeWriter + - mimify - popen2, os.popen[234]() - posixfile - sets @@ -127,7 +128,6 @@ - rfc822 - mimetools - - mimify - multifile - md5 - sha From python-checkins at python.org Wed May 30 23:53:58 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 23:53:58 +0200 (CEST) Subject: [Python-checkins] r55693 - peps/trunk/pep-3100.txt Message-ID: <20070530215358.2D8E31E4003@bag.python.org> Author: brett.cannon Date: Wed May 30 23:53:55 2007 New Revision: 55693 Modified: peps/trunk/pep-3100.txt Log: Remove mimify in Python 3.0. Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Wed May 30 23:53:55 2007 @@ -211,7 +211,6 @@ ``pcre``, ``pypcre``, ``strop`` [all done] + see PEP 4 [#pep4]_ - ``mimetools``, - ``mimify``, ``mpz``, ``multifile``, ``posixfile``, @@ -224,7 +223,7 @@ ``TERMIOS``, ``timing`` [to do] - - ``gopherlib``, ``MimeWriter`` [done] + - ``gopherlib``, ``MimeWriter``, ``mimify`` [done] - ``cl``, ``sets``, ``xreadlines``, ``rotor``, ``whrandom`` [done] + Everything in lib-old [#pep4]_ [done] - ``Para``, ``addpack``, ``cmp``, ``cmpcache``, ``codehack``, From python-checkins at python.org Wed May 30 23:55:43 2007 From: python-checkins at python.org (brett.cannon) Date: Wed, 30 May 2007 23:55:43 +0200 (CEST) Subject: [Python-checkins] r55694 - peps/trunk/pep-3100.txt Message-ID: <20070530215543.843C11E400C@bag.python.org> Author: brett.cannon Date: Wed May 30 23:55:41 2007 New Revision: 55694 Modified: peps/trunk/pep-3100.txt Log: Update based on current status of md5 and sha. Modified: peps/trunk/pep-3100.txt ============================================================================== --- peps/trunk/pep-3100.txt (original) +++ peps/trunk/pep-3100.txt Wed May 30 23:55:41 2007 @@ -217,13 +217,14 @@ ``regsub``, ``rfc822``, ``rgbimage``, + ``sha``, ``statcache``, ``string``, ``sv``, ``TERMIOS``, ``timing`` [to do] - - ``gopherlib``, ``MimeWriter``, ``mimify`` [done] + - ``gopherlib``, ``md5``, ``MimeWriter``, ``mimify`` [done] - ``cl``, ``sets``, ``xreadlines``, ``rotor``, ``whrandom`` [done] + Everything in lib-old [#pep4]_ [done] - ``Para``, ``addpack``, ``cmp``, ``cmpcache``, ``codehack``, From python-checkins at python.org Thu May 31 00:07:52 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 31 May 2007 00:07:52 +0200 (CEST) Subject: [Python-checkins] r55695 - python/branches/cpy_merge/Modules/_string_iomodule.c Message-ID: <20070530220752.BCBB81E4003@bag.python.org> Author: alexandre.vassalotti Date: Thu May 31 00:07:51 2007 New Revision: 55695 Modified: python/branches/cpy_merge/Modules/_string_iomodule.c Log: Converted char types to Py_UNICODE. Changed PyString function to PyUnicode. Modified: python/branches/cpy_merge/Modules/_string_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_string_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_string_iomodule.c Thu May 31 00:07:51 2007 @@ -5,7 +5,7 @@ typedef struct { PyObject_HEAD - char *buf; + Py_UNICODE *buf; Py_ssize_t pos, string_size; Py_ssize_t buf_size; } StringIOObject; @@ -24,10 +24,10 @@ /* Internal routine to get a line. Returns the number of bytes read. */ static Py_ssize_t -get_line(StringIOObject *self, char **output) +get_line(StringIOObject *self, Py_UNICODE **output) { - char *n; - const char *str_end; + Py_UNICODE *n; + const Py_UNICODE *str_end; Py_ssize_t l; /* XXX: Should we ckeck here if the object is closed, @@ -56,7 +56,7 @@ /* Internal routine for writing a string of bytes to the buffer of a StringIO object. Returns the number of bytes wrote. */ static Py_ssize_t -write_bytes(StringIOObject *self, const char *c, Py_ssize_t l) +write_bytes(StringIOObject *self, const Py_UNICODE *c, Py_ssize_t l) { Py_ssize_t newl; @@ -70,7 +70,7 @@ self->buf_size = newl + 1; } - PyMem_Resize(self->buf, char, self->buf_size); + PyMem_Resize(self->buf, Py_UNICODE, self->buf_size); if (self->buf == NULL) { PyErr_SetString(PyExc_MemoryError, "Out of memory"); PyMem_Del(self->buf); @@ -119,7 +119,7 @@ if (self->buf == NULL) return err_closed(); - return PyString_FromStringAndSize(self->buf, self->string_size); + return PyUnicode_FromUnicode(self->buf, self->string_size); } static PyObject * @@ -144,7 +144,7 @@ string_io_read(StringIOObject *self, PyObject *args) { Py_ssize_t l, n = -1; - char *output; + Py_UNICODE *output; if (self->buf == NULL) return err_closed(); @@ -163,14 +163,14 @@ output = self->buf + self->pos; self->pos += n; - return PyString_FromStringAndSize(output, n); + return PyUnicode_FromUnicode(output, n); } static PyObject * string_io_readline(StringIOObject *self, PyObject *args) { Py_ssize_t n, m = -1; - char *output; + Py_UNICODE *output; if (self->buf == NULL) return err_closed(); @@ -186,7 +186,7 @@ self->pos -= m; } - return PyString_FromStringAndSize(output, n); + return PyUnicode_FromUnicode(output, n); } static PyObject * @@ -194,7 +194,7 @@ { Py_ssize_t n, hint = 0, length = 0; PyObject *result, *line; - char *output; + Py_UNICODE *output; if (self->buf == NULL) return err_closed(); @@ -211,7 +211,7 @@ if (n == 0) break; - line = PyString_FromStringAndSize(output, n); + line = PyUnicode_FromUnicode(output, n); if (!line) goto err; if (PyList_Append(result, line) == -1) { @@ -259,7 +259,7 @@ static PyObject * string_io_iternext(StringIOObject *self) { - char *next; + Py_UNICODE *next; Py_ssize_t n; if (self->buf == NULL) @@ -272,7 +272,7 @@ if (n == 0) return NULL; - return PyString_FromStringAndSize(next, n); + return PyUnicode_FromUnicode(next, n); } static PyObject * @@ -299,7 +299,7 @@ if (self->buf_size <= position) self->buf_size = position + 1; - PyMem_Resize(self->buf, char, self->buf_size); + PyMem_Resize(self->buf, Py_UNICODE, self->buf_size); if (self->buf == NULL) { PyMem_Del(self->buf); self->buf_size = self->pos = 0; @@ -320,13 +320,13 @@ static PyObject * string_io_write(StringIOObject *self, PyObject *args) { - const char *c; + const Py_UNICODE *c; Py_ssize_t l; if (self->buf == NULL) return err_closed(); - if (!PyArg_ParseTuple(args, "t#:write", &c, &l)) + if (!PyArg_ParseTuple(args, "u#:write", &c, &l)) return NULL; if (write_bytes(self, c, l) == -1) @@ -349,7 +349,7 @@ while ((item = PyIter_Next(it)) != NULL) { Py_ssize_t n; - char *c; + Py_UNICODE *c; if (PyString_AsStringAndSize(item, &c, &n) == -1) { Py_DECREF(it); Py_DECREF(item); @@ -396,12 +396,12 @@ StringIO_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { StringIOObject *self; - const char *buf; + const Py_UNICODE *buf; Py_ssize_t n = -1, size = BUFSIZE; assert(type != NULL && type->tp_alloc != NULL); - if (!PyArg_ParseTuple(args, "|t#:StringIO", &buf, &n)) + if (!PyArg_ParseTuple(args, "|u#:StringIO", &buf, &n)) return NULL; self = (StringIOObject *)type->tp_alloc(type, 0); @@ -409,7 +409,7 @@ if (self == NULL) return NULL; - self->buf = PyMem_New(char, size); + self->buf = PyMem_New(Py_UNICODE, size); /* These variables need to be initialized before attempting to write anything to the object. */ From python-checkins at python.org Thu May 31 00:24:38 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 00:24:38 +0200 (CEST) Subject: [Python-checkins] r55696 - in python/trunk: Lib/md5.py Lib/test/test_md5.py Lib/test/test_pep247.py Lib/test/test_tarfile.py Lib/uuid.py Misc/NEWS Message-ID: <20070530222438.205651E400C@bag.python.org> Author: brett.cannon Date: Thu May 31 00:24:28 2007 New Revision: 55696 Modified: python/trunk/Lib/md5.py python/trunk/Lib/test/test_md5.py python/trunk/Lib/test/test_pep247.py python/trunk/Lib/test/test_tarfile.py python/trunk/Lib/uuid.py python/trunk/Misc/NEWS Log: Have md5 raise a DeprecationWarning as per PEP 4. Modified: python/trunk/Lib/md5.py ============================================================================== --- python/trunk/Lib/md5.py (original) +++ python/trunk/Lib/md5.py Thu May 31 00:24:28 2007 @@ -3,6 +3,10 @@ # Copyright (C) 2005 Gregory P. Smith (greg at electricrain.com) # Licensed to PSF under a Contributor Agreement. +import warnings +warnings.warn("the md5 module is deprecated; use hashlib instead", + DeprecationWarning, 2) + from hashlib import md5 new = md5 Modified: python/trunk/Lib/test/test_md5.py ============================================================================== --- python/trunk/Lib/test/test_md5.py (original) +++ python/trunk/Lib/test/test_md5.py Thu May 31 00:24:28 2007 @@ -1,4 +1,7 @@ # Testing md5 module +import warnings +warnings.filterwarnings("ignore", "the md5 module is deprecated.*", + DeprecationWarning) import unittest from md5 import md5 Modified: python/trunk/Lib/test/test_pep247.py ============================================================================== --- python/trunk/Lib/test/test_pep247.py (original) +++ python/trunk/Lib/test/test_pep247.py Thu May 31 00:24:28 2007 @@ -3,6 +3,10 @@ # hashing algorithms. # +import warnings +warnings.filterwarnings("ignore", "the md5 module is deprecated.*", + DeprecationWarning) + import md5, sha, hmac def check_hash_module(module, key=None): Modified: python/trunk/Lib/test/test_tarfile.py ============================================================================== --- python/trunk/Lib/test/test_tarfile.py (original) +++ python/trunk/Lib/test/test_tarfile.py Thu May 31 00:24:28 2007 @@ -5,7 +5,7 @@ import shutil import tempfile import StringIO -import md5 +from hashlib import md5 import errno import unittest @@ -25,7 +25,7 @@ bz2 = None def md5sum(data): - return md5.new(data).hexdigest() + return md5(data).hexdigest() def path(path): return test_support.findfile(path) Modified: python/trunk/Lib/uuid.py ============================================================================== --- python/trunk/Lib/uuid.py (original) +++ python/trunk/Lib/uuid.py Thu May 31 00:24:28 2007 @@ -506,8 +506,8 @@ def uuid3(namespace, name): """Generate a UUID from the MD5 hash of a namespace UUID and a name.""" - import md5 - hash = md5.md5(namespace.bytes + name).digest() + from hashlib import md5 + hash = md5(namespace.bytes + name).digest() return UUID(bytes=hash[:16], version=3) def uuid4(): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu May 31 00:24:28 2007 @@ -220,6 +220,8 @@ Library ------- +- md5 now raises a DeprecationWarning upon import. + - mimify now raises a DeprecationWarning upon import. - MimeWriter now raises a DeprecationWarning upon import. From python-checkins at python.org Thu May 31 00:24:55 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 00:24:55 +0200 (CEST) Subject: [Python-checkins] r55697 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Message-ID: <20070530222455.7C40D1E4003@bag.python.org> Author: brett.cannon Date: Thu May 31 00:24:53 2007 New Revision: 55697 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Log: Doc that md5 raises a DeprecationWarning in Python 2.6. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Thu May 31 00:24:53 2007 @@ -84,7 +84,7 @@ The following modules currently lack a DeprecationWarning: - rfc822, mimetools, multifile, md5, sha, buildtools, cfmfile + rfc822, mimetools, multifile, sha, buildtools, cfmfile Deprecated modules @@ -225,6 +225,7 @@ Date: 15-May-2007 Documentation: Documented as deprecated as of Python 2.5, but listing in this PEP was neglected. + DeprecationWarning raised as of Python 2.6. Module name: sha Rationale: Replaced by the 'hashlib' module. Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Thu May 31 00:24:53 2007 @@ -63,6 +63,7 @@ - commands.getstatus() - macostools.touched() + - md5 - MimeWriter - mimify - popen2, os.popen[234]() @@ -129,7 +130,6 @@ - rfc822 - mimetools - multifile - - md5 - sha - buildtools - cfmfile From python-checkins at python.org Thu May 31 00:26:31 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 00:26:31 +0200 (CEST) Subject: [Python-checkins] r55698 - python/branches/bcannon-objcap/tests/fail/builtin_SystemExit.py Message-ID: <20070530222631.20CA91E4003@bag.python.org> Author: brett.cannon Date: Thu May 31 00:26:30 2007 New Revision: 55698 Added: python/branches/bcannon-objcap/tests/fail/builtin_SystemExit.py (contents, props changed) Log: Add an explicit test to make sure that SytemExit is missing. Added: python/branches/bcannon-objcap/tests/fail/builtin_SystemExit.py ============================================================================== --- (empty file) +++ python/branches/bcannon-objcap/tests/fail/builtin_SystemExit.py Thu May 31 00:26:30 2007 @@ -0,0 +1,23 @@ +"""SystemExit should not be exposed as it will trigger Py_Finalize() if it +propagates to the top of the call chain.""" +try: + _ = SystemExit +except NameError: + pass +else: + raise Exception + +try: + import __builtin__ + __builtin__.SystemExit +except AttributeError: + pass +else: + raise Exception + +try: + __builtins__.SystemExit +except AttributeError: + pass +else: + raise Exception From buildbot at python.org Thu May 31 00:31:35 2007 From: buildbot at python.org (buildbot at python.org) Date: Wed, 30 May 2007 22:31:35 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20070530223135.00DE11E400B@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/2056 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build had warnings: warnings test Excerpt from the test logfile: Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 460, in __bootstrap self.run() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list 1 test failed: test_socketserver sincerely, -The Buildbot From python-checkins at python.org Thu May 31 00:49:40 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 31 May 2007 00:49:40 +0200 (CEST) Subject: [Python-checkins] r55699 - python/branches/cpy_merge/Modules/_string_iomodule.c Message-ID: <20070530224940.03FA41E4003@bag.python.org> Author: alexandre.vassalotti Date: Thu May 31 00:49:35 2007 New Revision: 55699 Modified: python/branches/cpy_merge/Modules/_string_iomodule.c Log: Fixed memcpy() call. Modified: python/branches/cpy_merge/Modules/_string_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_string_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_string_iomodule.c Thu May 31 00:49:35 2007 @@ -79,7 +79,7 @@ } } - memcpy(self->buf + self->pos, c, l); + memcpy(self->buf + self->pos, c, l * sizeof(Py_UNICODE)); assert(self->pos + l < PY_SSIZE_T_MAX); self->pos += l; From python-checkins at python.org Thu May 31 01:28:07 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 31 May 2007 01:28:07 +0200 (CEST) Subject: [Python-checkins] r55700 - python/branches/cpy_merge/Modules/_string_iomodule.c Message-ID: <20070530232807.4C7251E4003@bag.python.org> Author: alexandre.vassalotti Date: Thu May 31 01:28:06 2007 New Revision: 55700 Modified: python/branches/cpy_merge/Modules/_string_iomodule.c Log: Fix string_io_writelines(). Rename a few variables. Modified: python/branches/cpy_merge/Modules/_string_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_string_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_string_iomodule.c Thu May 31 01:28:06 2007 @@ -56,7 +56,7 @@ /* Internal routine for writing a string of bytes to the buffer of a StringIO object. Returns the number of bytes wrote. */ static Py_ssize_t -write_bytes(StringIOObject *self, const Py_UNICODE *c, Py_ssize_t l) +write_str(StringIOObject *self, const Py_UNICODE *ustr, Py_ssize_t l) { Py_ssize_t newl; @@ -79,7 +79,7 @@ } } - memcpy(self->buf + self->pos, c, l * sizeof(Py_UNICODE)); + memcpy(self->buf + self->pos, ustr, l * sizeof(Py_UNICODE)); assert(self->pos + l < PY_SSIZE_T_MAX); self->pos += l; @@ -320,16 +320,18 @@ static PyObject * string_io_write(StringIOObject *self, PyObject *args) { - const Py_UNICODE *c; - Py_ssize_t l; + const Py_UNICODE *ustr; + Py_ssize_t n; if (self->buf == NULL) return err_closed(); - if (!PyArg_ParseTuple(args, "u#:write", &c, &l)) + if (!PyArg_ParseTuple(args, + "u#;write() may only be called on" + "unicode strings", &ustr, &n)) return NULL; - if (write_bytes(self, c, l) == -1) + if (write_str(self, ustr, n) == -1) return NULL; Py_RETURN_NONE; @@ -349,15 +351,18 @@ while ((item = PyIter_Next(it)) != NULL) { Py_ssize_t n; - Py_UNICODE *c; - if (PyString_AsStringAndSize(item, &c, &n) == -1) { + Py_UNICODE *ustr; + if ((ustr = PyUnicode_AsUnicode(item)) == NULL) { + PyErr_SetString(PyExc_TypeError, + "Need a list of unicode objects"); Py_DECREF(it); Py_DECREF(item); return NULL; } + n = PyUnicode_GetSize(item); Py_DECREF(item); - if (write_bytes(self, c, n) == -1) { + if (write_str(self, ustr, n) == -1) { Py_DECREF(it); return NULL; } @@ -417,7 +422,7 @@ self->string_size = 0; if (n > 0) { - if (write_bytes(self, buf, n) == -1) + if (write_str(self, buf, n) == -1) return NULL; self->pos = 0; } From python-checkins at python.org Thu May 31 01:36:07 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 31 May 2007 01:36:07 +0200 (CEST) Subject: [Python-checkins] r55701 - python/branches/cpy_merge/Modules/_bytes_iomodule.c Message-ID: <20070530233607.82E371E4003@bag.python.org> Author: alexandre.vassalotti Date: Thu May 31 01:36:02 2007 New Revision: 55701 Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c Log: Rename a few variables. Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c ============================================================================== --- python/branches/cpy_merge/Modules/_bytes_iomodule.c (original) +++ python/branches/cpy_merge/Modules/_bytes_iomodule.c Thu May 31 01:36:02 2007 @@ -56,7 +56,7 @@ /* Internal routine for writing a string of bytes to the buffer of a BytesIO object. Returns the number of bytes wrote. */ static Py_ssize_t -write_bytes(BytesIOObject *self, const char *c, Py_ssize_t l) +write_bytes(BytesIOObject *self, const char *bytes, Py_ssize_t l) { Py_ssize_t newl; @@ -79,7 +79,7 @@ } } - memcpy(self->buf + self->pos, c, l); + memcpy(self->buf + self->pos, bytes, l); assert(self->pos + l < PY_SSIZE_T_MAX); self->pos += l; @@ -320,16 +320,16 @@ static PyObject * bytes_io_write(BytesIOObject *self, PyObject *args) { - const char *c; - Py_ssize_t l; + const char *bytes; + Py_ssize_t n; if (self->buf == NULL) return err_closed(); - if (!PyArg_ParseTuple(args, "t#:write", &c, &l)) + if (!PyArg_ParseTuple(args, "t#:write", &bytes, &n)) return NULL; - if (write_bytes(self, c, l) == -1) + if (write_bytes(self, bytes, n) == -1) return NULL; Py_RETURN_NONE; From python-checkins at python.org Thu May 31 01:47:58 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 31 May 2007 01:47:58 +0200 (CEST) Subject: [Python-checkins] r55702 - python/branches/cpy_merge/setup.py Message-ID: <20070530234758.4881F1E4003@bag.python.org> Author: alexandre.vassalotti Date: Thu May 31 01:47:36 2007 New Revision: 55702 Modified: python/branches/cpy_merge/setup.py Log: Add _string_io to setup.py Add a temporary unit test for _string_io. Modified: python/branches/cpy_merge/setup.py ============================================================================== --- python/branches/cpy_merge/setup.py (original) +++ python/branches/cpy_merge/setup.py Thu May 31 01:47:36 2007 @@ -472,8 +472,9 @@ exts.append( Extension('cStringIO', ['cStringIO.c']) ) exts.append( Extension('cPickle', ['cPickle.c']) ) - # Fast implementation of BytesIO + # Fast implementation of BytesIO and StringIO exts.append( Extension('_bytes_io', ['_bytes_iomodule.c']) ) + exts.append( Extension('_string_io', ['_string_iomodule.c']) ) # Memory-mapped files (also works on Win32). if platform not in ['atheos', 'mac']: From python-checkins at python.org Thu May 31 01:51:18 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 31 May 2007 01:51:18 +0200 (CEST) Subject: [Python-checkins] r55702 - svn:log Message-ID: <20070530235118.A52FA1E401B@bag.python.org> Author: alexandre.vassalotti Revision: 55702 Property Name: svn:log New Property Value: Add _string_io to setup.py From python-checkins at python.org Thu May 31 01:52:01 2007 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 31 May 2007 01:52:01 +0200 (CEST) Subject: [Python-checkins] r55703 - python/branches/cpy_merge/Lib/test/test_string_io.py Message-ID: <20070530235201.C00641E4003@bag.python.org> Author: alexandre.vassalotti Date: Thu May 31 01:52:00 2007 New Revision: 55703 Added: python/branches/cpy_merge/Lib/test/test_string_io.py Log: Add a temporary unit test for _string_io. Added: python/branches/cpy_merge/Lib/test/test_string_io.py ============================================================================== --- (empty file) +++ python/branches/cpy_merge/Lib/test/test_string_io.py Thu May 31 01:52:00 2007 @@ -0,0 +1,132 @@ +"""Temporary unit tests for StringIO""" + +# Based on test_StringIO.py + +import unittest +import _string_io +import types +from test import test_support + + +class TestGenericStringIO(unittest.TestCase): + # use a class variable MODULE to define which module is being tested + + # Line of data to test as string + _line = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!' + + # Constructor to use for the test data (._line is passed to this + # constructor) + constructor = unicode + + def setUp(self): + self._line = self.constructor(self._line) + self._lines = self.constructor((self._line + '\n') * 5) + self._fp = self.MODULE.StringIO(self._lines) + + def test_reads(self): + eq = self.assertEqual + self.assertRaises(TypeError, self._fp.seek) + eq(self._fp.read(10), self._line[:10]) + eq(self._fp.readline(), self._line[10:] + '\n') + eq(len(self._fp.readlines(60)), 2) + + def test_writes(self): + f = self.MODULE.StringIO() + self.assertRaises(TypeError, f.seek) + f.write(self._line[:6]) + f.seek(3) + f.write(self._line[20:26]) + f.write(self._line[52]) + self.assertEqual(f.getvalue(), u'abcuvwxyz!') + + def test_writelines(self): + f = self.MODULE.StringIO() + f.writelines(map(self.constructor, [self._line[0], self._line[1], self._line[2]])) + f.seek(0) + self.assertEqual(f.getvalue(), u'abc') + + def test_writelines_error(self): + def errorGen(): + yield u'a' + raise KeyboardInterrupt() + f = self.MODULE.StringIO() + self.assertRaises(KeyboardInterrupt, f.writelines, errorGen()) + + def test_truncate(self): + eq = self.assertEqual + f = self.MODULE.StringIO() + f.write(self._lines) + f.seek(10) + f.truncate() + eq(f.getvalue(), u'abcdefghij') + f.truncate(5) + eq(f.getvalue(), u'abcde') + f.write(u'xyz') + eq(f.getvalue(), u'abcdexyz') + self.assertRaises(IOError, f.truncate, -1) + f.close() + self.assertRaises(ValueError, f.write, u'frobnitz') + + def test_closed_flag(self): + f = self.MODULE.StringIO() + self.assertEqual(f.closed, False) + f.close() + self.assertEqual(f.closed, True) + f = self.MODULE.StringIO(u"abc") + self.assertEqual(f.closed, False) + f.close() + self.assertEqual(f.closed, True) + + def test_isatty(self): + f = self.MODULE.StringIO() + self.assertRaises(TypeError, f.isatty, None) + self.assertEqual(f.isatty(), False) + f.close() + self.assertRaises(ValueError, f.isatty) + + def test_iterator(self): + eq = self.assertEqual + unless = self.failUnless + eq(iter(self._fp), self._fp) + # Does this object support the iteration protocol? + unless(hasattr(self._fp, '__iter__')) + unless(hasattr(self._fp, '__next__')) + i = 0 + for line in self._fp: + eq(line, self._line + '\n') + i += 1 + eq(i, 5) + self._fp.close() + self.assertRaises(ValueError, next, self._fp) + + def test_getvalue(self): + f = self.MODULE.StringIO() + f.close() + self.assertRaises(ValueError, f.getvalue) + +class TestStringIO(TestGenericStringIO): + MODULE = _string_io + + def test_unicode(self): + + if not test_support.have_unicode: return + + # The StringIO module also supports concatenating Unicode + # snippets to larger Unicode strings. This is tested by this + # method. + + f = self.MODULE.StringIO() + f.write(self._line[:6]) + f.seek(3) + f.write(unicode(self._line[20:26])) + f.write(unicode(self._line[52])) + s = f.getvalue() + self.assertEqual(s, unicode('abcuvwxyz!')) + self.assertEqual(type(s), types.UnicodeType) + + +def test_main(): + test_support.run_unittest(TestStringIO) + +if __name__ == '__main__': + test_main() From python-checkins at python.org Thu May 31 02:36:56 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 02:36:56 +0200 (CEST) Subject: [Python-checkins] r55704 - python/branches/bcannon-objcap/secure_python.c Message-ID: <20070531003656.5010F1E4003@bag.python.org> Author: brett.cannon Date: Thu May 31 02:36:51 2007 New Revision: 55704 Modified: python/branches/bcannon-objcap/secure_python.c Log: Clear sys.meta_path and sys.path_hooks. Modified: python/branches/bcannon-objcap/secure_python.c ============================================================================== --- python/branches/bcannon-objcap/secure_python.c (original) +++ python/branches/bcannon-objcap/secure_python.c Thu May 31 02:36:51 2007 @@ -22,6 +22,7 @@ int return_val; PyInterpreterState *interp; Py_ssize_t module_count, x; + PyObject *obj; PyObject *module_names_list; PyObject *hidden_modules; PyObject *import_module; @@ -52,12 +53,24 @@ /* Initialize interpreter. */ Py_Initialize(); + interp = PyThreadState_GET()->interp; + + /* Clear sys.meta_path and sys.path_hooks. + This needs to be done before importlib is called as it sets values in + both attributes. */ + obj = PyDict_GetItemString(interp->sysdict, "meta_path"); + x = PyList_Size(obj); + PyList_SetSlice(obj, 0, x, NULL); + + obj = PyDict_GetItemString(interp->sysdict, "path_hooks"); + x = PyList_Size(obj); + PyList_SetSlice(obj, 0, x, NULL); + /* Create lists of modules safe to import. */ CREATE_SAFE_LIST(builtins); CREATE_SAFE_LIST(frozen); CREATE_SAFE_LIST(extensions); - interp = PyThreadState_GET()->interp; /* Get importer from importlib. */ import_module = PyImport_ImportModule("controlled_importlib"); From python-checkins at python.org Thu May 31 06:14:29 2007 From: python-checkins at python.org (neal.norwitz) Date: Thu, 31 May 2007 06:14:29 +0200 (CEST) Subject: [Python-checkins] r55705 - python/trunk/Doc/lib/libpickle.tex Message-ID: <20070531041429.EB87E1E4003@bag.python.org> Author: neal.norwitz Date: Thu May 31 06:14:22 2007 New Revision: 55705 Modified: python/trunk/Doc/lib/libpickle.tex Log: Add some spaces in the example code. Modified: python/trunk/Doc/lib/libpickle.tex ============================================================================== --- python/trunk/Doc/lib/libpickle.tex (original) +++ python/trunk/Doc/lib/libpickle.tex Thu May 31 06:14:22 2007 @@ -799,7 +799,7 @@ del odict['fh'] # remove filehandle entry return odict - def __setstate__(self,dict): + def __setstate__(self, dict): fh = open(dict['file']) # reopen file count = dict['lineno'] # read from file... while count: # until line count is restored @@ -820,7 +820,7 @@ ... obj.readline() '7: class TextReader:' >>> import pickle ->>> pickle.dump(obj,open('save.p','w')) +>>> pickle.dump(obj,open('save.p', 'wb')) \end{verbatim} If you want to see that \refmodule{pickle} works across Python @@ -829,7 +829,7 @@ \begin{verbatim} >>> import pickle ->>> reader = pickle.load(open('save.p')) +>>> reader = pickle.load(open('save.p', 'rb')) >>> reader.readline() '8: "Print and number lines in a text file."' \end{verbatim} From python-checkins at python.org Thu May 31 19:20:59 2007 From: python-checkins at python.org (phillip.eby) Date: Thu, 31 May 2007 19:20:59 +0200 (CEST) Subject: [Python-checkins] r55711 - in sandbox/trunk/setuptools: EasyInstall.txt pkg_resources.py setuptools.txt setuptools/__init__.py setuptools/package_index.py Message-ID: <20070531172059.E48921E400B@bag.python.org> Author: phillip.eby Date: Thu May 31 19:20:56 2007 New Revision: 55711 Modified: sandbox/trunk/setuptools/EasyInstall.txt sandbox/trunk/setuptools/pkg_resources.py sandbox/trunk/setuptools/setuptools.txt sandbox/trunk/setuptools/setuptools/__init__.py sandbox/trunk/setuptools/setuptools/package_index.py Log: Misc. fixes: * Don't treat directories with a '.' in the name as packages * Don't include ez_setup in find_packages() * HTML-decode URLs scraped from web pages (d'oh!) * Fix cache dir defaults on Windows when multiple env vars used * Doc updates Modified: sandbox/trunk/setuptools/EasyInstall.txt ============================================================================== --- sandbox/trunk/setuptools/EasyInstall.txt (original) +++ sandbox/trunk/setuptools/EasyInstall.txt Thu May 31 19:20:56 2007 @@ -442,6 +442,19 @@ below, and also the section on `Package Index "API"`_. +Password-Protected Sites +------------------------ + +If a site you want to download from is password-protected using HTTP "Basic" +authentication, you can specify your credentials in the URL, like so:: + + http://some_userid:some_password at some.example.com/some_path/ + +You can do this with both index page URLs and direct download URLs. As long +as any HTML pages read by easy_install use *relative* links to point to the +downloads, the same user ID and password will be used to do the downloading. + + Controlling Build Options ~~~~~~~~~~~~~~~~~~~~~~~~~ Modified: sandbox/trunk/setuptools/pkg_resources.py ============================================================================== --- sandbox/trunk/setuptools/pkg_resources.py (original) +++ sandbox/trunk/setuptools/pkg_resources.py Thu May 31 19:20:56 2007 @@ -1052,7 +1052,7 @@ dirname = '' for key in keys: if key in os.environ: - dirname = os.path.join(os.environ[key]) + dirname = os.path.join(dirname, os.environ[key]) else: break else: Modified: sandbox/trunk/setuptools/setuptools.txt ============================================================================== --- sandbox/trunk/setuptools/setuptools.txt (original) +++ sandbox/trunk/setuptools/setuptools.txt Thu May 31 19:20:56 2007 @@ -1463,8 +1463,10 @@ you use any option at all. (By the way, if you're using some other revision control system, you might -consider submitting a patch to the ``setuptools.command.sdist`` module, -so we can include support for your system.) +consider creating and publishing a `revision control plugin for setuptools`_.) + + +.. _revision control plugin for setuptools: `Adding Support for Other Revision Control Systems`_ Making your package available for EasyInstall Modified: sandbox/trunk/setuptools/setuptools/__init__.py ============================================================================== --- sandbox/trunk/setuptools/setuptools/__init__.py (original) +++ sandbox/trunk/setuptools/setuptools/__init__.py Thu May 31 19:20:56 2007 @@ -30,11 +30,11 @@ where,prefix = stack.pop(0) for name in os.listdir(where): fn = os.path.join(where,name) - if (os.path.isdir(fn) and + if ('.' not in name and os.path.isdir(fn) and os.path.isfile(os.path.join(fn,'__init__.py')) ): out.append(prefix+name); stack.append((fn,prefix+name+'.')) - for pat in exclude: + for pat in list(exclude)+['ez_setup']: from fnmatch import fnmatchcase out = [item for item in out if not fnmatchcase(item,pat)] return out Modified: sandbox/trunk/setuptools/setuptools/package_index.py ============================================================================== --- sandbox/trunk/setuptools/setuptools/package_index.py (original) +++ sandbox/trunk/setuptools/setuptools/package_index.py Thu May 31 19:20:56 2007 @@ -132,14 +132,14 @@ rels = map(str.strip, rel.lower().split(',')) if 'homepage' in rels or 'download' in rels: for match in HREF.finditer(tag): - yield urlparse.urljoin(url, match.group(1)) + yield urlparse.urljoin(url, htmldecode(match.group(1))) for tag in ("
%s
') Modified: python/branches/bcannon-objcap/Lib/cgitb.py ============================================================================== --- python/branches/bcannon-objcap/Lib/cgitb.py (original) +++ python/branches/bcannon-objcap/Lib/cgitb.py Fri May 25 22:13:08 2007 @@ -167,7 +167,7 @@ exception = ['

%s: %s' % (strong(pydoc.html.escape(str(etype))), pydoc.html.escape(str(evalue)))] - if type(evalue) is types.InstanceType: + if isinstance(evalue, BaseException): for name in dir(evalue): if name[:1] == '_': continue value = pydoc.html.repr(getattr(evalue, name)) @@ -183,7 +183,8 @@ %s --> -''' % ''.join(traceback.format_exception(etype, evalue, etb)) +''' % pydoc.html.escape( + ''.join(traceback.format_exception(etype, evalue, etb))) def text((etype, evalue, etb), context=5): """Return a plain text document describing a given traceback.""" @@ -239,7 +240,7 @@ frames.append('\n%s\n' % '\n'.join(rows)) exception = ['%s: %s' % (str(etype), str(evalue))] - if type(evalue) is types.InstanceType: + if isinstance(evalue, BaseException): for name in dir(evalue): value = pydoc.text.repr(getattr(evalue, name)) exception.append('\n%s%s = %s' % (" "*4, name, value)) Modified: python/branches/bcannon-objcap/Lib/commands.py ============================================================================== --- python/branches/bcannon-objcap/Lib/commands.py (original) +++ python/branches/bcannon-objcap/Lib/commands.py Fri May 25 22:13:08 2007 @@ -32,6 +32,8 @@ # def getstatus(file): """Return output of "ls -ld " in a string.""" + import warnings + warnings.warn("commands.getstatus() is deprecated", DeprecationWarning) return getoutput('ls -ld' + mkarg(file)) Modified: python/branches/bcannon-objcap/Lib/compiler/transformer.py ============================================================================== --- python/branches/bcannon-objcap/Lib/compiler/transformer.py (original) +++ python/branches/bcannon-objcap/Lib/compiler/transformer.py Fri May 25 22:13:08 2007 @@ -930,7 +930,7 @@ for i in range(3, len(nodelist), 3): node = nodelist[i] if node[0] == symbol.except_clause: - # except_clause: 'except' [expr [',' expr]] */ + # except_clause: 'except' [expr [(',' | 'as') expr]] */ if len(node) > 2: expr1 = self.com_node(node[2]) if len(node) > 4: Modified: python/branches/bcannon-objcap/Lib/copy_reg.py ============================================================================== --- python/branches/bcannon-objcap/Lib/copy_reg.py (original) +++ python/branches/bcannon-objcap/Lib/copy_reg.py Fri May 25 22:13:08 2007 @@ -48,7 +48,8 @@ obj = object.__new__(cls) else: obj = base.__new__(cls, state) - base.__init__(obj, state) + if base.__init__ != object.__init__: + base.__init__(obj, state) return obj _HEAPTYPE = 1<<9 Modified: python/branches/bcannon-objcap/Lib/csv.py ============================================================================== --- python/branches/bcannon-objcap/Lib/csv.py (original) +++ python/branches/bcannon-objcap/Lib/csv.py Fri May 25 22:13:08 2007 @@ -115,9 +115,10 @@ def _dict_to_list(self, rowdict): if self.extrasaction == "raise": - for k in rowdict.keys(): - if k not in self.fieldnames: - raise ValueError, "dict contains fields not in fieldnames" + wrong_fields = [k for k in rowdict if k not in self.fieldnames] + if wrong_fields: + raise ValueError("dict contains fields not in fieldnames: " + + ", ".join(wrong_fields)) return [rowdict.get(key, self.restval) for key in self.fieldnames] def writerow(self, rowdict): Modified: python/branches/bcannon-objcap/Lib/ctypes/__init__.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ctypes/__init__.py (original) +++ python/branches/bcannon-objcap/Lib/ctypes/__init__.py Fri May 25 22:13:08 2007 @@ -233,6 +233,9 @@ c_voidp = c_void_p # backwards compatibility (to a bug) _check_size(c_void_p) +class c_bool(_SimpleCData): + _type_ = "t" + # This cache maps types to pointers to them. _pointer_type_cache = {} @@ -480,7 +483,7 @@ return _cast(obj, obj, typ) _string_at = CFUNCTYPE(py_object, c_void_p, c_int)(_string_at_addr) -def string_at(ptr, size=0): +def string_at(ptr, size=-1): """string_at(addr[, size]) -> string Return the string at addr.""" @@ -492,7 +495,7 @@ pass else: _wstring_at = CFUNCTYPE(py_object, c_void_p, c_int)(_wstring_at_addr) - def wstring_at(ptr, size=0): + def wstring_at(ptr, size=-1): """wstring_at(addr[, size]) -> string Return the string at addr.""" Modified: python/branches/bcannon-objcap/Lib/ctypes/test/test_checkretval.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ctypes/test/test_checkretval.py (original) +++ python/branches/bcannon-objcap/Lib/ctypes/test/test_checkretval.py Fri May 25 22:13:08 2007 @@ -34,7 +34,7 @@ def test_oledll(self): self.failUnlessRaises(WindowsError, oledll.oleaut32.CreateTypeLib2, - 0, 0, 0) + 0, None, None) if __name__ == "__main__": unittest.main() Modified: python/branches/bcannon-objcap/Lib/ctypes/test/test_functions.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ctypes/test/test_functions.py (original) +++ python/branches/bcannon-objcap/Lib/ctypes/test/test_functions.py Fri May 25 22:13:08 2007 @@ -21,7 +21,9 @@ class POINT(Structure): _fields_ = [("x", c_int), ("y", c_int)] - +class RECT(Structure): + _fields_ = [("left", c_int), ("top", c_int), + ("right", c_int), ("bottom", c_int)] class FunctionTestCase(unittest.TestCase): def test_mro(self): @@ -379,5 +381,15 @@ self.failUnlessEqual((s8i.a, s8i.b, s8i.c, s8i.d, s8i.e, s8i.f, s8i.g, s8i.h), (9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9)) + def test_sf1651235(self): + # see http://www.python.org/sf/1651235 + + proto = CFUNCTYPE(c_int, RECT, POINT) + def callback(*args): + return 0 + + callback = proto(callback) + self.failUnlessRaises(ArgumentError, lambda: callback((1, 2, 3, 4), POINT())) + if __name__ == '__main__': unittest.main() Modified: python/branches/bcannon-objcap/Lib/ctypes/test/test_loading.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ctypes/test/test_loading.py (original) +++ python/branches/bcannon-objcap/Lib/ctypes/test/test_loading.py Fri May 25 22:13:08 2007 @@ -73,5 +73,33 @@ self.failUnlessRaises(AttributeError, dll.__getitem__, 1234) + if os.name == "nt": + def test_1703286_A(self): + from _ctypes import LoadLibrary, FreeLibrary + # On winXP 64-bit, advapi32 loads at an address that does + # NOT fit into a 32-bit integer. FreeLibrary must be able + # to accept this address. + + # These are tests for http://www.python.org/sf/1703286 + handle = LoadLibrary("advapi32") + FreeLibrary(handle) + + def test_1703286_B(self): + # Since on winXP 64-bit advapi32 loads like described + # above, the (arbitrarily selected) CloseEventLog function + # also has a high address. 'call_function' should accept + # addresses so large. + from _ctypes import call_function + advapi32 = windll.advapi32 + # Calling CloseEventLog with a NULL argument should fail, + # but the call should not segfault or so. + self.failUnlessEqual(0, advapi32.CloseEventLog(None)) + windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p + windll.kernel32.GetProcAddress.restype = c_void_p + proc = windll.kernel32.GetProcAddress(advapi32._handle, "CloseEventLog") + self.failUnless(proc) + # This is the real test: call the function via 'call_function' + self.failUnlessEqual(0, call_function(proc, (None,))) + if __name__ == "__main__": unittest.main() Modified: python/branches/bcannon-objcap/Lib/ctypes/test/test_memfunctions.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ctypes/test/test_memfunctions.py (original) +++ python/branches/bcannon-objcap/Lib/ctypes/test/test_memfunctions.py Fri May 25 22:13:08 2007 @@ -14,6 +14,7 @@ self.failUnlessEqual(string_at(result), "Hello, World") self.failUnlessEqual(string_at(result, 5), "Hello") self.failUnlessEqual(string_at(result, 16), "Hello, World\0\0\0\0") + self.failUnlessEqual(string_at(result, 0), "") def test_memset(self): a = create_string_buffer(1000000) @@ -54,6 +55,7 @@ self.failUnlessEqual(wstring_at(a), "Hello, World") self.failUnlessEqual(wstring_at(a, 5), "Hello") self.failUnlessEqual(wstring_at(a, 16), "Hello, World\0\0\0\0") + self.failUnlessEqual(wstring_at(a, 0), "") if __name__ == "__main__": unittest.main() Modified: python/branches/bcannon-objcap/Lib/ctypes/test/test_numbers.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ctypes/test/test_numbers.py (original) +++ python/branches/bcannon-objcap/Lib/ctypes/test/test_numbers.py Fri May 25 22:13:08 2007 @@ -24,6 +24,8 @@ unsigned_types = [c_ubyte, c_ushort, c_uint, c_ulong] signed_types = [c_byte, c_short, c_int, c_long, c_longlong] +bool_types = [] + float_types = [c_double, c_float] try: @@ -35,8 +37,16 @@ unsigned_types.append(c_ulonglong) signed_types.append(c_longlong) +try: + c_bool +except NameError: + pass +else: + bool_types.append(c_bool) + unsigned_ranges = valid_ranges(*unsigned_types) signed_ranges = valid_ranges(*signed_types) +bool_values = [True, False, 0, 1, -1, 5000, 'test', [], [1]] ################################################################ @@ -60,6 +70,11 @@ self.failUnlessEqual(t(l).value, l) self.failUnlessEqual(t(h).value, h) + def test_bool_values(self): + from operator import truth + for t, v in zip(bool_types, bool_values): + self.failUnlessEqual(t(v).value, truth(v)) + def test_typeerror(self): # Only numbers are allowed in the contructor, # otherwise TypeError is raised @@ -82,7 +97,7 @@ def test_byref(self): # calling byref returns also a PyCArgObject instance - for t in signed_types + unsigned_types + float_types: + for t in signed_types + unsigned_types + float_types + bool_types: parm = byref(t()) self.failUnlessEqual(ArgType, type(parm)) @@ -101,7 +116,7 @@ self.assertRaises(TypeError, t, 3.14) def test_sizes(self): - for t in signed_types + unsigned_types + float_types: + for t in signed_types + unsigned_types + float_types + bool_types: size = struct.calcsize(t._type_) # sizeof of the type... self.failUnlessEqual(sizeof(t), size) @@ -164,6 +179,18 @@ a[0] = '?' self.failUnlessEqual(v.value, a[0]) + # array does not support c_bool / 't' + # def test_bool_from_address(self): + # from ctypes import c_bool + # from array import array + # a = array(c_bool._type_, [True]) + # v = t.from_address(a.buffer_info()[0]) + # self.failUnlessEqual(v.value, a[0]) + # self.failUnlessEqual(type(v) is t) + # a[0] = False + # self.failUnlessEqual(v.value, a[0]) + # self.failUnlessEqual(type(v) is t) + def test_init(self): # c_int() can be initialized from Python's int, and c_int. # Not from c_long or so, which seems strange, abd should Modified: python/branches/bcannon-objcap/Lib/ctypes/test/test_python_api.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ctypes/test/test_python_api.py (original) +++ python/branches/bcannon-objcap/Lib/ctypes/test/test_python_api.py Fri May 25 22:13:08 2007 @@ -10,7 +10,10 @@ ################################################################ from sys import getrefcount as grc - +if sys.version_info > (2, 4): + c_py_ssize_t = c_size_t +else: + c_py_ssize_t = c_int class PythonAPITestCase(unittest.TestCase): @@ -18,7 +21,7 @@ PyString_FromStringAndSize = pythonapi.PyString_FromStringAndSize PyString_FromStringAndSize.restype = py_object - PyString_FromStringAndSize.argtypes = c_char_p, c_int + PyString_FromStringAndSize.argtypes = c_char_p, c_py_ssize_t self.failUnlessEqual(PyString_FromStringAndSize("abcdefghi", 3), "abc") @@ -66,7 +69,7 @@ def test_PyOS_snprintf(self): PyOS_snprintf = pythonapi.PyOS_snprintf - PyOS_snprintf.argtypes = POINTER(c_char), c_int, c_char_p + PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p buf = c_buffer(256) PyOS_snprintf(buf, sizeof(buf), "Hello from %s", "ctypes") Modified: python/branches/bcannon-objcap/Lib/ctypes/test/test_random_things.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ctypes/test/test_random_things.py (original) +++ python/branches/bcannon-objcap/Lib/ctypes/test/test_random_things.py Fri May 25 22:13:08 2007 @@ -13,6 +13,10 @@ def test(self): from _ctypes import call_function + windll.kernel32.LoadLibraryA.restype = c_void_p + windll.kernel32.GetProcAddress.argtypes = c_void_p, c_char_p + windll.kernel32.GetProcAddress.restype = c_void_p + hdll = windll.kernel32.LoadLibraryA("kernel32") funcaddr = windll.kernel32.GetProcAddress(hdll, "GetModuleHandleA") Modified: python/branches/bcannon-objcap/Lib/ctypes/test/test_repr.py ============================================================================== --- python/branches/bcannon-objcap/Lib/ctypes/test/test_repr.py (original) +++ python/branches/bcannon-objcap/Lib/ctypes/test/test_repr.py Fri May 25 22:13:08 2007 @@ -4,7 +4,7 @@ subclasses = [] for base in [c_byte, c_short, c_int, c_long, c_longlong, c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong, - c_float, c_double]: + c_float, c_double, c_bool]: class X(base): pass subclasses.append(X) Modified: python/branches/bcannon-objcap/Lib/decimal.py ============================================================================== --- python/branches/bcannon-objcap/Lib/decimal.py (original) +++ python/branches/bcannon-objcap/Lib/decimal.py Fri May 25 22:13:08 2007 @@ -29,8 +29,8 @@ Decimal floating point has finite precision with arbitrarily large bounds. -The purpose of the module is to support arithmetic using familiar -"schoolhouse" rules and to avoid the some of tricky representation +The purpose of this module is to support arithmetic using familiar +"schoolhouse" rules and to avoid some of the tricky representation issues associated with binary floating point. The package is especially useful for financial applications or for contexts where users have expectations that are at odds with binary floating point (for instance, @@ -136,7 +136,7 @@ import copy as _copy -#Rounding +# Rounding ROUND_DOWN = 'ROUND_DOWN' ROUND_HALF_UP = 'ROUND_HALF_UP' ROUND_HALF_EVEN = 'ROUND_HALF_EVEN' @@ -145,11 +145,11 @@ ROUND_UP = 'ROUND_UP' ROUND_HALF_DOWN = 'ROUND_HALF_DOWN' -#Rounding decision (not part of the public API) +# Rounding decision (not part of the public API) NEVER_ROUND = 'NEVER_ROUND' # Round in division (non-divmod), sqrt ONLY ALWAYS_ROUND = 'ALWAYS_ROUND' # Every operation rounds at end. -#Errors +# Errors class DecimalException(ArithmeticError): """Base exception class. @@ -179,9 +179,9 @@ This occurs and signals clamped if the exponent of a result has been altered in order to fit the constraints of a specific concrete - representation. This may occur when the exponent of a zero result would - be outside the bounds of a representation, or when a large normal - number would have an encoded exponent that cannot be represented. In + representation. This may occur when the exponent of a zero result would + be outside the bounds of a representation, or when a large normal + number would have an encoded exponent that cannot be represented. In this latter case, the exponent is reduced to fit and the corresponding number of zero digits are appended to the coefficient ("fold-down"). """ @@ -194,8 +194,8 @@ Something creates a signaling NaN -INF + INF - 0 * (+-)INF - (+-)INF / (+-)INF + 0 * (+-)INF + (+-)INF / (+-)INF x % 0 (+-)INF % x x._rescale( non-integer ) @@ -207,7 +207,7 @@ """ def handle(self, context, *args): if args: - if args[0] == 1: #sNaN, must drop 's' but keep diagnostics + if args[0] == 1: # sNaN, must drop 's' but keep diagnostics return Decimal( (args[1]._sign, args[1]._int, 'n') ) return NaN @@ -216,11 +216,11 @@ This occurs and signals invalid-operation if an string is being converted to a number and it does not conform to the numeric string - syntax. The result is [0,qNaN]. + syntax. The result is [0,qNaN]. """ def handle(self, context, *args): - return (0, (0,), 'n') #Passed to something which uses a tuple. + return (0, (0,), 'n') # Passed to something which uses a tuple. class DivisionByZero(DecimalException, ZeroDivisionError): """Division by 0. @@ -245,7 +245,7 @@ This occurs and signals invalid-operation if the integer result of a divide-integer or remainder operation had too many digits (would be - longer than precision). The result is [0,qNaN]. + longer than precision). The result is [0,qNaN]. """ def handle(self, context, *args): @@ -256,12 +256,12 @@ This occurs and signals invalid-operation if division by zero was attempted (during a divide-integer, divide, or remainder operation), and - the dividend is also zero. The result is [0,qNaN]. + the dividend is also zero. The result is [0,qNaN]. """ def handle(self, context, tup=None, *args): if tup is not None: - return (NaN, NaN) #for 0 %0, 0 // 0 + return (NaN, NaN) # for 0 %0, 0 // 0 return NaN class Inexact(DecimalException): @@ -269,7 +269,7 @@ This occurs and signals inexact whenever the result of an operation is not exact (that is, it needed to be rounded and any discarded digits - were non-zero), or if an overflow or underflow condition occurs. The + were non-zero), or if an overflow or underflow condition occurs. The result in all cases is unchanged. The inexact signal may be tested (or trapped) to determine if a given @@ -281,11 +281,11 @@ """Invalid context. Unknown rounding, for example. This occurs and signals invalid-operation if an invalid context was - detected during an operation. This can occur if contexts are not checked + detected during an operation. This can occur if contexts are not checked on creation and either the precision exceeds the capability of the underlying concrete representation or an unknown or unsupported rounding - was specified. These aspects of the context need only be checked when - the values are required to be used. The result is [0,qNaN]. + was specified. These aspects of the context need only be checked when + the values are required to be used. The result is [0,qNaN]. """ def handle(self, context, *args): @@ -296,7 +296,7 @@ This occurs and signals rounded whenever the result of an operation is rounded (that is, some zero or non-zero digits were discarded from the - coefficient), or if an overflow or underflow condition occurs. The + coefficient), or if an overflow or underflow condition occurs. The result in all cases is unchanged. The rounded signal may be tested (or trapped) to determine if a given @@ -309,7 +309,7 @@ This occurs and signals subnormal whenever the result of a conversion or operation is subnormal (that is, its adjusted exponent is less than - Emin, before any rounding). The result in all cases is unchanged. + Emin, before any rounding). The result in all cases is unchanged. The subnormal signal may be tested (or trapped) to determine if a given or operation (or sequence of operations) yielded a subnormal result. @@ -328,13 +328,13 @@ For round-half-up and round-half-even (and for round-half-down and round-up, if implemented), the result of the operation is [sign,inf], - where sign is the sign of the intermediate result. For round-down, the + where sign is the sign of the intermediate result. For round-down, the result is the largest finite number that can be represented in the - current precision, with the sign of the intermediate result. For + current precision, with the sign of the intermediate result. For round-ceiling, the result is the same as for round-down if the sign of - the intermediate result is 1, or is [0,inf] otherwise. For round-floor, + the intermediate result is 1, or is [0,inf] otherwise. For round-floor, the result is the same as for round-down if the sign of the intermediate - result is 0, or is [1,inf] otherwise. In all cases, Inexact and Rounded + result is 0, or is [1,inf] otherwise. In all cases, Inexact and Rounded will also be raised. """ @@ -360,10 +360,10 @@ This occurs and signals underflow if a result is inexact and the adjusted exponent of the result would be smaller (more negative) than the smallest value that can be handled by the implementation (the value - Emin). That is, the result is both inexact and subnormal. + Emin). That is, the result is both inexact and subnormal. The result after an underflow will be a subnormal number rounded, if - necessary, so that its exponent is not less than Etiny. This may result + necessary, so that its exponent is not less than Etiny. This may result in 0 with the sign of the intermediate result and an exponent of Etiny. In all cases, Inexact, Rounded, and Subnormal will also be raised. @@ -379,7 +379,7 @@ DivisionUndefined:InvalidOperation, InvalidContext:InvalidOperation} -##### Context Functions ####################################### +##### Context Functions ################################################## # The getcontext() and setcontext() function manage access to a thread-local # current context. Py2.4 offers direct support for thread locals. If that @@ -392,7 +392,7 @@ except ImportError: # Python was compiled without threads; create a mock object instead import sys - class MockThreading: + class MockThreading(object): def local(self, sys=sys): return sys.modules[__name__] threading = MockThreading() @@ -403,8 +403,8 @@ except AttributeError: - #To fix reloading, force it to create a new context - #Old contexts have different exceptions in their dicts, making problems. + # To fix reloading, force it to create a new context + # Old contexts have different exceptions in their dicts, making problems. if hasattr(threading.currentThread(), '__decimal_context__'): del threading.currentThread().__decimal_context__ @@ -469,14 +469,14 @@ ctx.prec += 2 # Rest of sin calculation algorithm # uses a precision 2 greater than normal - return +s # Convert result to normal precision + return +s # Convert result to normal precision def sin(x): with localcontext(ExtendedContext): # Rest of sin calculation algorithm # uses the Extended Context from the # General Decimal Arithmetic Specification - return +s # Convert result to normal context + return +s # Convert result to normal context """ # The string below can't be included in the docstring until Python 2.6 @@ -487,7 +487,7 @@ 28 >>> with localcontext(): ... ctx = getcontext() - ... ctx.prec() += 2 + ... ctx.prec += 2 ... print ctx.prec ... 30 @@ -502,7 +502,7 @@ return _ContextManager(ctx) -##### Decimal class ########################################### +##### Decimal class ####################################################### class Decimal(object): """Floating point class for decimal arithmetic.""" @@ -518,7 +518,7 @@ >>> Decimal('3.14') # string input Decimal("3.14") - >>> Decimal((0, (3, 1, 4), -2)) # tuple input (sign, digit_tuple, exponent) + >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent) Decimal("3.14") >>> Decimal(314) # int or long Decimal("314") @@ -557,13 +557,13 @@ # tuple/list conversion (possibly from as_tuple()) if isinstance(value, (list,tuple)): if len(value) != 3: - raise ValueError, 'Invalid arguments' + raise ValueError('Invalid arguments') if value[0] not in (0,1): - raise ValueError, 'Invalid sign' + raise ValueError('Invalid sign') for digit in value[1]: if not isinstance(digit, (int,long)) or digit < 0: - raise ValueError, "The second value in the tuple must be composed of non negative integer elements." - + raise ValueError("The second value in the tuple must be" + "composed of non negative integer elements.") self._sign = value[0] self._int = tuple(value[1]) if value[2] in ('F','n','N'): @@ -596,22 +596,23 @@ if _isnan(value): sig, sign, diag = _isnan(value) self._is_special = True - if len(diag) > context.prec: #Diagnostic info too long + if len(diag) > context.prec: # Diagnostic info too long self._sign, self._int, self._exp = \ context._raise_error(ConversionSyntax) return self if sig == 1: - self._exp = 'n' #qNaN - else: #sig == 2 - self._exp = 'N' #sNaN + self._exp = 'n' # qNaN + else: # sig == 2 + self._exp = 'N' # sNaN self._sign = sign - self._int = tuple(map(int, diag)) #Diagnostic info + self._int = tuple(map(int, diag)) # Diagnostic info return self try: self._sign, self._int, self._exp = _string2exact(value) except ValueError: self._is_special = True - self._sign, self._int, self._exp = context._raise_error(ConversionSyntax) + self._sign, self._int, self._exp = \ + context._raise_error(ConversionSyntax) return self raise TypeError("Cannot convert %r to Decimal" % value) @@ -694,15 +695,15 @@ if self._is_special or other._is_special: ans = self._check_nans(other, context) if ans: - return 1 # Comparison involving NaN's always reports self > other + return 1 # Comparison involving NaN's always reports self > other # INF = INF return cmp(self._isinfinity(), other._isinfinity()) if not self and not other: - return 0 #If both 0, sign comparison isn't certain. + return 0 # If both 0, sign comparison isn't certain. - #If different signs, neg one is less + # If different signs, neg one is less if other._sign < self._sign: return -1 if self._sign < other._sign: @@ -713,7 +714,7 @@ if self_adjusted == other_adjusted and \ self._int + (0,)*(self._exp - other._exp) == \ other._int + (0,)*(other._exp - self._exp): - return 0 #equal, except in precision. ([0]*(-x) = []) + return 0 # equal, except in precision. ([0]*(-x) = []) elif self_adjusted > other_adjusted and self._int[0] != 0: return (-1)**self._sign elif self_adjusted < other_adjusted and other._int[0] != 0: @@ -724,7 +725,7 @@ context = getcontext() context = context._shallow_copy() - rounding = context._set_rounding(ROUND_UP) #round away from 0 + rounding = context._set_rounding(ROUND_UP) # round away from 0 flags = context._ignore_all_flags() res = self.__sub__(other, context=context) @@ -762,7 +763,7 @@ if other is NotImplemented: return other - #compare(NaN, NaN) = NaN + # Compare(NaN, NaN) = NaN if (self._is_special or other and other._is_special): ans = self._check_nans(other, context) if ans: @@ -823,11 +824,11 @@ tmp = map(str, self._int) numdigits = len(self._int) leftdigits = self._exp + numdigits - if eng and not self: #self = 0eX wants 0[.0[0]]eY, not [[0]0]0eY - if self._exp < 0 and self._exp >= -6: #short, no need for e/E + if eng and not self: # self = 0eX wants 0[.0[0]]eY, not [[0]0]0eY + if self._exp < 0 and self._exp >= -6: # short, no need for e/E s = '-'*self._sign + '0.' + '0'*(abs(self._exp)) return s - #exp is closest mult. of 3 >= self._exp + # exp is closest mult. of 3 >= self._exp exp = ((self._exp - 1)// 3 + 1) * 3 if exp != self._exp: s = '0.'+'0'*(exp - self._exp) @@ -839,7 +840,7 @@ else: s += 'e' if exp > 0: - s += '+' #0.0e+3, not 0.0e3 + s += '+' # 0.0e+3, not 0.0e3 s += str(exp) s = '-'*self._sign + s return s @@ -979,19 +980,19 @@ return ans if self._isinfinity(): - #If both INF, same sign => same as both, opposite => error. + # If both INF, same sign => same as both, opposite => error. if self._sign != other._sign and other._isinfinity(): return context._raise_error(InvalidOperation, '-INF + INF') return Decimal(self) if other._isinfinity(): - return Decimal(other) #Can't both be infinity here + return Decimal(other) # Can't both be infinity here shouldround = context._rounding_decision == ALWAYS_ROUND exp = min(self._exp, other._exp) negativezero = 0 if context.rounding == ROUND_FLOOR and self._sign != other._sign: - #If the answer is 0, the sign should be negative, in this case. + # If the answer is 0, the sign should be negative, in this case. negativezero = 1 if not self and not other: @@ -1026,19 +1027,19 @@ return Decimal((negativezero, (0,), exp)) if op1.int < op2.int: op1, op2 = op2, op1 - #OK, now abs(op1) > abs(op2) + # OK, now abs(op1) > abs(op2) if op1.sign == 1: result.sign = 1 op1.sign, op2.sign = op2.sign, op1.sign else: result.sign = 0 - #So we know the sign, and op1 > 0. + # So we know the sign, and op1 > 0. elif op1.sign == 1: result.sign = 1 op1.sign, op2.sign = (0, 0) else: result.sign = 0 - #Now, op1 > abs(op2) > 0 + # Now, op1 > abs(op2) > 0 if op2.sign == 0: result.int = op1.int + op2.int @@ -1096,7 +1097,8 @@ if ans: return ans - return Decimal(self) # Must be infinite, and incrementing makes no difference + # Must be infinite, and incrementing makes no difference + return Decimal(self) L = list(self._int) L[-1] += 1 @@ -1152,7 +1154,7 @@ if not self or not other: ans = Decimal((resultsign, (0,), resultexp)) if shouldround: - #Fixing in case the exponent is out of bounds + # Fixing in case the exponent is out of bounds ans = ans._fix(context) return ans @@ -1171,7 +1173,7 @@ op1 = _WorkRep(self) op2 = _WorkRep(other) - ans = Decimal( (resultsign, map(int, str(op1.int * op2.int)), resultexp)) + ans = Decimal((resultsign, map(int, str(op1.int * op2.int)), resultexp)) if shouldround: ans = ans._fix(context) @@ -1264,12 +1266,11 @@ sign, 1) return context._raise_error(DivisionByZero, 'x / 0', sign) - #OK, so neither = 0, INF or NaN - + # OK, so neither = 0, INF or NaN shouldround = context._rounding_decision == ALWAYS_ROUND - #If we're dividing into ints, and self < other, stop. - #self.__abs__(0) does not round. + # If we're dividing into ints, and self < other, stop. + # self.__abs__(0) does not round. if divmod and (self.__abs__(0, context) < other.__abs__(0, context)): if divmod == 1 or divmod == 3: @@ -1281,7 +1282,7 @@ ans2) elif divmod == 2: - #Don't round the mod part, if we don't need it. + # Don't round the mod part, if we don't need it. return (Decimal( (sign, (0,), 0) ), Decimal(self)) op1 = _WorkRep(self) @@ -1330,7 +1331,7 @@ op1.exp -= 1 if res.exp == 0 and divmod and op2.int > op1.int: - #Solves an error in precision. Same as a previous block. + # Solves an error in precision. Same as a previous block. if res.int >= prec_limit and shouldround: return context._raise_error(DivisionImpossible) @@ -1416,7 +1417,7 @@ # ignored in the calling function. context = context._shallow_copy() flags = context._ignore_flags(Rounded, Inexact) - #keep DivisionImpossible flags + # Keep DivisionImpossible flags (side, r) = self.__divmod__(other, context=context) if r._isnan(): @@ -1439,7 +1440,7 @@ if r < comparison: r._sign, comparison._sign = s1, s2 - #Get flags now + # Get flags now self.__divmod__(other, context=context) return r._fix(context) r._sign, comparison._sign = s1, s2 @@ -1461,7 +1462,8 @@ if r > comparison or decrease and r == comparison: r._sign, comparison._sign = s1, s2 context.prec += 1 - if len(side.__add__(Decimal(1), context=context)._int) >= context.prec: + numbsquant = len(side.__add__(Decimal(1), context=context)._int) + if numbsquant >= context.prec: context.prec -= 1 return context._raise_error(DivisionImpossible)[1] context.prec -= 1 @@ -1496,7 +1498,7 @@ context = getcontext() return context._raise_error(InvalidContext) elif self._isinfinity(): - raise OverflowError, "Cannot convert infinity to long" + raise OverflowError("Cannot convert infinity to long") if self._exp >= 0: s = ''.join(map(str, self._int)) + '0'*self._exp else: @@ -1550,13 +1552,13 @@ context._raise_error(Clamped) return ans ans = ans._rescale(Etiny, context=context) - #It isn't zero, and exp < Emin => subnormal + # It isn't zero, and exp < Emin => subnormal context._raise_error(Subnormal) if context.flags[Inexact]: context._raise_error(Underflow) else: if ans: - #Only raise subnormal if non-zero. + # Only raise subnormal if non-zero. context._raise_error(Subnormal) else: Etop = context.Etop() @@ -1573,7 +1575,8 @@ return ans context._raise_error(Inexact) context._raise_error(Rounded) - return context._raise_error(Overflow, 'above Emax', ans._sign) + c = context._raise_error(Overflow, 'above Emax', ans._sign) + return c return ans def _round(self, prec=None, rounding=None, context=None): @@ -1633,18 +1636,18 @@ ans = Decimal( (temp._sign, tmp, temp._exp - expdiff)) return ans - #OK, but maybe all the lost digits are 0. + # OK, but maybe all the lost digits are 0. lostdigits = self._int[expdiff:] if lostdigits == (0,) * len(lostdigits): ans = Decimal( (temp._sign, temp._int[:prec], temp._exp - expdiff)) - #Rounded, but not Inexact + # Rounded, but not Inexact context._raise_error(Rounded) return ans # Okay, let's round and lose data this_function = getattr(temp, self._pick_rounding_function[rounding]) - #Now we've got the rounding function + # Now we've got the rounding function if prec != context.prec: context = context._shallow_copy() @@ -1740,7 +1743,7 @@ context = getcontext() if self._is_special or n._is_special or n.adjusted() > 8: - #Because the spot << doesn't work with really big exponents + # Because the spot << doesn't work with really big exponents if n._isinfinity() or n.adjusted() > 8: return context._raise_error(InvalidOperation, 'x ** INF') @@ -1770,9 +1773,10 @@ return Infsign[sign] return Decimal( (sign, (0,), 0) ) - #with ludicrously large exponent, just raise an overflow and return inf. - if not modulo and n > 0 and (self._exp + len(self._int) - 1) * n > context.Emax \ - and self: + # With ludicrously large exponent, just raise an overflow + # and return inf. + if not modulo and n > 0 and \ + (self._exp + len(self._int) - 1) * n > context.Emax and self: tmp = Decimal('inf') tmp._sign = sign @@ -1792,7 +1796,7 @@ context = context._shallow_copy() context.prec = firstprec + elength + 1 if n < 0: - #n is a long now, not Decimal instance + # n is a long now, not Decimal instance n = -n mul = Decimal(1).__div__(mul, context=context) @@ -1801,7 +1805,7 @@ spot <<= 1 spot >>= 1 - #Spot is the highest power of 2 less than n + # spot is the highest power of 2 less than n while spot: val = val.__mul__(val, context=context) if val._isinfinity(): @@ -1859,7 +1863,7 @@ if exp._isinfinity() or self._isinfinity(): if exp._isinfinity() and self._isinfinity(): - return self #if both are inf, it is OK + return self # if both are inf, it is OK if context is None: context = getcontext() return context._raise_error(InvalidOperation, @@ -1963,13 +1967,13 @@ return Decimal(self) if not self: - #exponent = self._exp / 2, using round_down. - #if self._exp < 0: + # exponent = self._exp / 2, using round_down. + # if self._exp < 0: # exp = (self._exp+1) // 2 - #else: + # else: exp = (self._exp) // 2 if self._sign == 1: - #sqrt(-0) = -0 + # sqrt(-0) = -0 return Decimal( (1, (0,), exp)) else: return Decimal( (0, (0,), exp)) @@ -2004,8 +2008,7 @@ context=context), context=context) ans._exp -= 1 + tmp.adjusted() // 2 - #ans is now a linear approximation. - + # ans is now a linear approximation. Emax, Emin = context.Emax, context.Emin context.Emax, context.Emin = DefaultContext.Emax, DefaultContext.Emin @@ -2020,12 +2023,12 @@ if context.prec == maxp: break - #round to the answer's precision-- the only error can be 1 ulp. + # Round to the answer's precision-- the only error can be 1 ulp. context.prec = firstprec prevexp = ans.adjusted() ans = ans._round(context=context) - #Now, check if the other last digits are better. + # Now, check if the other last digits are better. context.prec = firstprec + 1 # In case we rounded up another digit and we should actually go lower. if prevexp != ans.adjusted(): @@ -2057,10 +2060,10 @@ context._raise_error(Rounded) context._raise_error(Inexact) else: - #Exact answer, so let's set the exponent right. - #if self._exp < 0: + # Exact answer, so let's set the exponent right. + # if self._exp < 0: # exp = (self._exp +1)// 2 - #else: + # else: exp = self._exp // 2 context.prec += ans._exp - exp ans = ans._rescale(exp, context=context) @@ -2081,7 +2084,7 @@ return other if self._is_special or other._is_special: - # if one operand is a quiet NaN and the other is number, then the + # If one operand is a quiet NaN and the other is number, then the # number is always returned sn = self._isnan() on = other._isnan() @@ -2095,13 +2098,13 @@ ans = self c = self.__cmp__(other) if c == 0: - # if both operands are finite and equal in numerical value + # If both operands are finite and equal in numerical value # then an ordering is applied: # - # if the signs differ then max returns the operand with the + # If the signs differ then max returns the operand with the # positive sign and min returns the operand with the negative sign # - # if the signs are the same then the exponent is used to select + # If the signs are the same then the exponent is used to select # the result. if self._sign != other._sign: if self._sign: @@ -2122,7 +2125,7 @@ def min(self, other, context=None): """Returns the smaller value. - like min(self, other) except if one is not a number, returns + Like min(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds. """ other = _convert_other(other) @@ -2130,7 +2133,7 @@ return other if self._is_special or other._is_special: - # if one operand is a quiet NaN and the other is number, then the + # If one operand is a quiet NaN and the other is number, then the # number is always returned sn = self._isnan() on = other._isnan() @@ -2144,13 +2147,13 @@ ans = self c = self.__cmp__(other) if c == 0: - # if both operands are finite and equal in numerical value + # If both operands are finite and equal in numerical value # then an ordering is applied: # - # if the signs differ then max returns the operand with the + # If the signs differ then max returns the operand with the # positive sign and min returns the operand with the negative sign # - # if the signs are the same then the exponent is used to select + # If the signs are the same then the exponent is used to select # the result. if self._sign != other._sign: if other._sign: @@ -2185,11 +2188,11 @@ """Return the adjusted exponent of self""" try: return self._exp + len(self._int) - 1 - #If NaN or Infinity, self._exp is string + # If NaN or Infinity, self._exp is string except TypeError: return 0 - # support for pickling, copy, and deepcopy + # Support for pickling, copy, and deepcopy def __reduce__(self): return (self.__class__, (str(self),)) @@ -2203,13 +2206,14 @@ return self # My components are also immutable return self.__class__(str(self)) -##### Context class ########################################### +##### Context class ####################################################### # get rounding method function: -rounding_functions = [name for name in Decimal.__dict__.keys() if name.startswith('_round_')] +rounding_functions = [name for name in Decimal.__dict__.keys() + if name.startswith('_round_')] for name in rounding_functions: - #name is like _round_half_even, goes to the global ROUND_HALF_EVEN value. + # name is like _round_half_even, goes to the global ROUND_HALF_EVEN value. globalname = name[1:].upper() val = globals()[globalname] Decimal._pick_rounding_function[val] = name @@ -2236,7 +2240,7 @@ Contains: prec - precision (for use in rounding, division, square roots..) - rounding - rounding type. (how you round) + rounding - rounding type (how you round) _rounding_decision - ALWAYS_ROUND, NEVER_ROUND -- do you round? traps - If traps[exception] = 1, then the exception is raised when it is caused. Otherwise, a value is @@ -2277,9 +2281,13 @@ def __repr__(self): """Show the current context.""" s = [] - s.append('Context(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d' % vars(self)) - s.append('flags=[' + ', '.join([f.__name__ for f, v in self.flags.items() if v]) + ']') - s.append('traps=[' + ', '.join([t.__name__ for t, v in self.traps.items() if v]) + ']') + s.append('Context(prec=%(prec)d, rounding=%(rounding)s, ' + 'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d' + % vars(self)) + names = [f.__name__ for f, v in self.flags.items() if v] + s.append('flags=[' + ', '.join(names) + ']') + names = [t.__name__ for t, v in self.traps.items() if v] + s.append('traps=[' + ', '.join(names) + ']') return ', '.join(s) + ')' def clear_flags(self): @@ -2296,9 +2304,9 @@ def copy(self): """Returns a deep copy from self.""" - nc = Context(self.prec, self.rounding, self.traps.copy(), self.flags.copy(), - self._rounding_decision, self.Emin, self.Emax, - self.capitals, self._clamp, self._ignored_flags) + nc = Context(self.prec, self.rounding, self.traps.copy(), + self.flags.copy(), self._rounding_decision, self.Emin, + self.Emax, self.capitals, self._clamp, self._ignored_flags) return nc __copy__ = copy @@ -2312,16 +2320,16 @@ """ error = _condition_map.get(condition, condition) if error in self._ignored_flags: - #Don't touch the flag + # Don't touch the flag return error().handle(self, *args) self.flags[error] += 1 if not self.traps[error]: - #The errors define how to handle themselves. + # The errors define how to handle themselves. return condition().handle(self, *args) # Errors should only be risked on copies of the context - #self._ignored_flags = [] + # self._ignored_flags = [] raise error, explanation def _ignore_all_flags(self): @@ -2345,7 +2353,7 @@ def __hash__(self): """A Context cannot be hashed.""" # We inherit object.__hash__, so we must deny this explicitly - raise TypeError, "Cannot hash a Context." + raise TypeError("Cannot hash a Context.") def Etiny(self): """Returns Etiny (= Emin - prec + 1)""" @@ -2400,12 +2408,12 @@ d = Decimal(num, context=self) return d._fix(self) - #Methods + # Methods def abs(self, a): """Returns the absolute value of the operand. If the operand is negative, the result is the same as using the minus - operation on the operand. Otherwise, the result is the same as using + operation on the operand. Otherwise, the result is the same as using the plus operation on the operand. >>> ExtendedContext.abs(Decimal('2.1')) @@ -2507,8 +2515,8 @@ If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as as though by the compare - operation. If they are numerically equal then the left-hand operand - is chosen as the result. Otherwise the maximum (closer to positive + operation. If they are numerically equal then the left-hand operand + is chosen as the result. Otherwise the maximum (closer to positive infinity) of the two operands is chosen as the result. >>> ExtendedContext.max(Decimal('3'), Decimal('2')) @@ -2527,8 +2535,8 @@ If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as as though by the compare - operation. If they are numerically equal then the left-hand operand - is chosen as the result. Otherwise the minimum (closer to negative + operation. If they are numerically equal then the left-hand operand + is chosen as the result. Otherwise the minimum (closer to negative infinity) of the two operands is chosen as the result. >>> ExtendedContext.min(Decimal('3'), Decimal('2')) @@ -2617,14 +2625,14 @@ The right-hand operand must be a whole number whose integer part (after any exponent has been applied) has no more than 9 digits and whose - fractional part (if any) is all zeros before any rounding. The operand + fractional part (if any) is all zeros before any rounding. The operand may be positive, negative, or zero; if negative, the absolute value of the power is used, and the left-hand operand is inverted (divided into 1) before use. If the increased precision needed for the intermediate calculations - exceeds the capabilities of the implementation then an Invalid operation - condition is raised. + exceeds the capabilities of the implementation then an Invalid + operation condition is raised. If, when raising to a negative power, an underflow occurs during the division into 1, the operation is not halted at that point but @@ -2662,18 +2670,18 @@ return a.__pow__(b, modulo, context=self) def quantize(self, a, b): - """Returns a value equal to 'a' (rounded) and having the exponent of 'b'. + """Returns a value equal to 'a' (rounded), having the exponent of 'b'. The coefficient of the result is derived from that of the left-hand - operand. It may be rounded using the current rounding setting (if the + operand. It may be rounded using the current rounding setting (if the exponent is being increased), multiplied by a positive power of ten (if the exponent is being decreased), or is unchanged (if the exponent is already equal to that of the right-hand operand). Unlike other operations, if the length of the coefficient after the quantize operation would be greater than precision then an Invalid - operation condition is raised. This guarantees that, unless there is an - error condition, the exponent of the result of a quantize is always + operation condition is raised. This guarantees that, unless there is + an error condition, the exponent of the result of a quantize is always equal to that of the right-hand operand. Also unlike other operations, quantize will never raise Underflow, even @@ -2716,9 +2724,9 @@ """Returns the remainder from integer division. The result is the residue of the dividend after the operation of - calculating integer division as described for divide-integer, rounded to - precision digits if necessary. The sign of the result, if non-zero, is - the same as that of the original dividend. + calculating integer division as described for divide-integer, rounded + to precision digits if necessary. The sign of the result, if + non-zero, is the same as that of the original dividend. This operation will fail under the same conditions as integer division (that is, if integer division on the same two operands would fail, the @@ -2742,7 +2750,7 @@ def remainder_near(self, a, b): """Returns to be "a - b * n", where n is the integer nearest the exact value of "x / b" (if two integers are equally near then the even one - is chosen). If the result is equal to 0 then its sign will be the + is chosen). If the result is equal to 0 then its sign will be the sign of a. This operation will fail under the same conditions as integer division @@ -2784,7 +2792,7 @@ return a.same_quantum(b) def sqrt(self, a): - """Returns the square root of a non-negative number to context precision. + """Square root of a non-negative number to context precision. If the result must be inexact, it is rounded using the round-half-even algorithm. @@ -2845,7 +2853,7 @@ as using the quantize() operation using the given operand as the left-hand-operand, 1E+0 as the right-hand-operand, and the precision of the operand as the precision setting, except that no flags will - be set. The rounding mode is taken from the context. + be set. The rounding mode is taken from the context. >>> ExtendedContext.to_integral(Decimal('2.1')) Decimal("2") @@ -2920,8 +2928,9 @@ other_len = len(str(other.int)) if numdigits > (other_len + prec + 1 - tmp_len): # If the difference in adjusted exps is > prec+1, we know - # other is insignificant, so might as well put a 1 after the precision. - # (since this is only for addition.) Also stops use of massive longs. + # other is insignificant, so might as well put a 1 after the + # precision (since this is only for addition). Also stops + # use of massive longs. extend = prec + 2 - tmp_len if extend <= 0: @@ -2944,13 +2953,13 @@ Used on _WorkRep instances during division. """ adjust = 0 - #If op1 is smaller, make it larger + # If op1 is smaller, make it larger while op2.int > op1.int: op1.int *= 10 op1.exp -= 1 adjust += 1 - #If op2 is too small, make it larger + # If op2 is too small, make it larger while op1.int >= (10 * op2.int): op2.int *= 10 op2.exp -= 1 @@ -2958,7 +2967,7 @@ return op1, op2, adjust -##### Helper Functions ######################################## +##### Helper Functions #################################################### def _convert_other(other): """Convert other to Decimal. @@ -2999,16 +3008,16 @@ if not num: return 0 - #get the sign, get rid of trailing [+-] + # Get the sign, get rid of trailing [+-] sign = 0 if num[0] == '+': num = num[1:] - elif num[0] == '-': #elif avoids '+-nan' + elif num[0] == '-': # elif avoids '+-nan' num = num[1:] sign = 1 if num.startswith('nan'): - if len(num) > 3 and not num[3:].isdigit(): #diagnostic info + if len(num) > 3 and not num[3:].isdigit(): # diagnostic info return 0 return (1, sign, num[3:].lstrip('0')) if num.startswith('snan'): @@ -3018,7 +3027,7 @@ return 0 -##### Setup Specific Contexts ################################ +##### Setup Specific Contexts ############################################ # The default context prototype used by Context() # Is mutable, so that new contexts can have different default values @@ -3051,19 +3060,19 @@ ) -##### Useful Constants (internal use only) #################### +##### Useful Constants (internal use only) ################################ -#Reusable defaults +# Reusable defaults Inf = Decimal('Inf') negInf = Decimal('-Inf') -#Infsign[sign] is infinity w/ that sign +# Infsign[sign] is infinity w/ that sign Infsign = (Inf, negInf) NaN = Decimal('NaN') -##### crud for parsing strings ################################# +##### crud for parsing strings ############################################# import re # There's an optional sign at the start, and an optional exponent @@ -3083,13 +3092,15 @@ ([eE](?P[-+]? \d+))? # \s* $ -""", re.VERBOSE).match #Uncomment the \s* to allow leading or trailing spaces. +""", re.VERBOSE).match # Uncomment the \s* to allow leading or trailing spaces. del re -# return sign, n, p s.t. float string value == -1**sign * n * 10**p exactly - def _string2exact(s): + """Return sign, n, p s.t. + + Float string value == -1**sign * n * 10**p exactly + """ m = _parser(s) if m is None: raise ValueError("invalid literal for Decimal: %r" % s) Modified: python/branches/bcannon-objcap/Lib/difflib.py ============================================================================== --- python/branches/bcannon-objcap/Lib/difflib.py (original) +++ python/branches/bcannon-objcap/Lib/difflib.py Fri May 25 22:13:08 2007 @@ -1945,8 +1945,7 @@ fromlist,tolist,flaglist,next_href,next_id = self._convert_flags( fromlist,tolist,flaglist,context,numlines) - import cStringIO - s = cStringIO.StringIO() + s = [] fmt = '

%s%s
Home Page", "Download URL"): pos = page.find(tag) if pos!=-1: match = HREF.search(page,pos) if match: - yield urlparse.urljoin(url, match.group(1)) + yield urlparse.urljoin(url, htmldecode(match.group(1))) user_agent = "Python-urllib/%s setuptools/%s" % ( urllib2.__version__, require('setuptools')[0].version @@ -200,7 +200,7 @@ if url.startswith(self.index_url) and getattr(f,'code',None)!=404: page = self.process_index(url, page) for match in HREF.finditer(page): - link = urlparse.urljoin(base, match.group(1)) + link = urlparse.urljoin(base, htmldecode(match.group(1))) self.process_url(link) def process_filename(self, fn, nested=False): @@ -262,7 +262,7 @@ # process an index page into the package-page index for match in HREF.finditer(page): - scan( urlparse.urljoin(url, match.group(1)) ) + scan( urlparse.urljoin(url, htmldecode(match.group(1))) ) pkg, ver = scan(url) # ensure this page is in the page index if pkg: @@ -611,6 +611,8 @@ self.url_ok(url, True) # raises error if not allowed return self._attempt_download(url, filename) + + def scan_url(self, url): self.process_url(url, True) @@ -652,6 +654,44 @@ def warn(self, msg, *args): log.warn(msg, *args) +# This pattern matches a character entity reference (a decimal numeric +# references, a hexadecimal numeric reference, or a named reference). +entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub + +def uchr(c): + if not isinstance(c, int): + return c + if c>255: return unichr(c) + return chr(c) + +def decode_entity(match): + what = match.group(1) + if what.startswith('#x'): + what = int(what[2:], 16) + elif what.startswith('#'): + what = int(what[1:]) + else: + from htmlentitydefs import name2codepoint + what = name2codepoint.get(what, match.group(0)) + return uchr(what) + +def htmldecode(text): + """Decode HTML entities in the given text.""" + return entity_sub(decode_entity, text) + + + + + + + + + + + + + + From python-checkins at python.org Thu May 31 19:30:57 2007 From: python-checkins at python.org (phillip.eby) Date: Thu, 31 May 2007 19:30:57 +0200 (CEST) Subject: [Python-checkins] r55712 - in sandbox/branches/setuptools-0.6: EasyInstall.txt pkg_resources.py pkg_resources.txt setuptools.txt setuptools/__init__.py setuptools/package_index.py Message-ID: <20070531173057.BEFE31E400D@bag.python.org> Author: phillip.eby Date: Thu May 31 19:30:55 2007 New Revision: 55712 Modified: sandbox/branches/setuptools-0.6/EasyInstall.txt sandbox/branches/setuptools-0.6/pkg_resources.py sandbox/branches/setuptools-0.6/pkg_resources.txt sandbox/branches/setuptools-0.6/setuptools.txt sandbox/branches/setuptools-0.6/setuptools/__init__.py sandbox/branches/setuptools-0.6/setuptools/package_index.py Log: Backport fixes and doc updates; prep for 0.6c6 release Modified: sandbox/branches/setuptools-0.6/EasyInstall.txt ============================================================================== --- sandbox/branches/setuptools-0.6/EasyInstall.txt (original) +++ sandbox/branches/setuptools-0.6/EasyInstall.txt Thu May 31 19:30:55 2007 @@ -442,6 +442,19 @@ below, and also the section on the `Package Index "API"`_. +Password-Protected Sites +------------------------ + +If a site you want to download from is password-protected using HTTP "Basic" +authentication, you can specify your credentials in the URL, like so:: + + http://some_userid:some_password at some.example.com/some_path/ + +You can do this with both index page URLs and direct download URLs. As long +as any HTML pages read by easy_install use *relative* links to point to the +downloads, the same user ID and password will be used to do the downloading. + + Controlling Build Options ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1230,6 +1243,8 @@ * Added ``--local-snapshots-ok`` flag, to allow building eggs from projects installed using ``setup.py develop``. + + * Fixed not HTML-decoding URLs scraped from web pages 0.6c5 * Fixed ``.dll`` files on Cygwin not having executable permisions when an egg Modified: sandbox/branches/setuptools-0.6/pkg_resources.py ============================================================================== --- sandbox/branches/setuptools-0.6/pkg_resources.py (original) +++ sandbox/branches/setuptools-0.6/pkg_resources.py Thu May 31 19:30:55 2007 @@ -1052,7 +1052,7 @@ dirname = '' for key in keys: if key in os.environ: - dirname = os.path.join(os.environ[key]) + dirname = os.path.join(dirname, os.environ[key]) else: break else: Modified: sandbox/branches/setuptools-0.6/pkg_resources.txt ============================================================================== --- sandbox/branches/setuptools-0.6/pkg_resources.txt (original) +++ sandbox/branches/setuptools-0.6/pkg_resources.txt Thu May 31 19:30:55 2007 @@ -1697,6 +1697,9 @@ * Allow ``.egg-link`` files to contain relative paths. + * Fix cache dir defaults on Windows when multiple environment vars are needed + to construct a path. + 0.6c4 * Fix "dev" versions being considered newer than release candidates. Modified: sandbox/branches/setuptools-0.6/setuptools.txt ============================================================================== --- sandbox/branches/setuptools-0.6/setuptools.txt (original) +++ sandbox/branches/setuptools-0.6/setuptools.txt Thu May 31 19:30:55 2007 @@ -1485,8 +1485,10 @@ you use any option at all. (By the way, if you're using some other revision control system, you might -consider submitting a patch to the ``setuptools.command.sdist`` module, -so we can include support for your system.) +consider creating and publishing a `revision control plugin for setuptools`_.) + + +.. _revision control plugin for setuptools: `Adding Support for Other Revision Control Systems`_ Making your package available for EasyInstall @@ -2626,6 +2628,9 @@ * Fix ``test`` command possibly failing if an older version of the project being tested was installed on ``sys.path`` ahead of the test source directory. + + * Fix ``find_packages()`` treating ``ez_setup`` and directories with ``.`` in + their names as packages. 0.6c5 * Fix uploaded ``bdist_rpm`` packages being described as ``bdist_egg`` Modified: sandbox/branches/setuptools-0.6/setuptools/__init__.py ============================================================================== --- sandbox/branches/setuptools-0.6/setuptools/__init__.py (original) +++ sandbox/branches/setuptools-0.6/setuptools/__init__.py Thu May 31 19:30:55 2007 @@ -30,11 +30,11 @@ where,prefix = stack.pop(0) for name in os.listdir(where): fn = os.path.join(where,name) - if (os.path.isdir(fn) and + if ('.' not in name and os.path.isdir(fn) and os.path.isfile(os.path.join(fn,'__init__.py')) ): out.append(prefix+name); stack.append((fn,prefix+name+'.')) - for pat in exclude: + for pat in list(exclude)+['ez_setup']: from fnmatch import fnmatchcase out = [item for item in out if not fnmatchcase(item,pat)] return out Modified: sandbox/branches/setuptools-0.6/setuptools/package_index.py ============================================================================== --- sandbox/branches/setuptools-0.6/setuptools/package_index.py (original) +++ sandbox/branches/setuptools-0.6/setuptools/package_index.py Thu May 31 19:30:55 2007 @@ -132,14 +132,14 @@ rels = map(str.strip, rel.lower().split(',')) if 'homepage' in rels or 'download' in rels: for match in HREF.finditer(tag): - yield urlparse.urljoin(url, match.group(1)) + yield urlparse.urljoin(url, htmldecode(match.group(1))) for tag in ("Home Page", "Download URL"): pos = page.find(tag) if pos!=-1: match = HREF.search(page,pos) if match: - yield urlparse.urljoin(url, match.group(1)) + yield urlparse.urljoin(url, htmldecode(match.group(1))) user_agent = "Python-urllib/%s setuptools/%s" % ( urllib2.__version__, require('setuptools')[0].version @@ -200,7 +200,7 @@ if url.startswith(self.index_url) and getattr(f,'code',None)!=404: page = self.process_index(url, page) for match in HREF.finditer(page): - link = urlparse.urljoin(base, match.group(1)) + link = urlparse.urljoin(base, htmldecode(match.group(1))) self.process_url(link) def process_filename(self, fn, nested=False): @@ -262,7 +262,7 @@ # process an index page into the package-page index for match in HREF.finditer(page): - scan( urlparse.urljoin(url, match.group(1)) ) + scan( urlparse.urljoin(url, htmldecode(match.group(1))) ) pkg, ver = scan(url) # ensure this page is in the page index if pkg: @@ -611,6 +611,8 @@ self.url_ok(url, True) # raises error if not allowed return self._attempt_download(url, filename) + + def scan_url(self, url): self.process_url(url, True) @@ -652,6 +654,44 @@ def warn(self, msg, *args): log.warn(msg, *args) +# This pattern matches a character entity reference (a decimal numeric +# references, a hexadecimal numeric reference, or a named reference). +entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub + +def uchr(c): + if not isinstance(c, int): + return c + if c>255: return unichr(c) + return chr(c) + +def decode_entity(match): + what = match.group(1) + if what.startswith('#x'): + what = int(what[2:], 16) + elif what.startswith('#'): + what = int(what[1:]) + else: + from htmlentitydefs import name2codepoint + what = name2codepoint.get(what, match.group(0)) + return uchr(what) + +def htmldecode(text): + """Decode HTML entities in the given text.""" + return entity_sub(decode_entity, text) + + + + + + + + + + + + + + From python-checkins at python.org Thu May 31 19:48:34 2007 From: python-checkins at python.org (phillip.eby) Date: Thu, 31 May 2007 19:48:34 +0200 (CEST) Subject: [Python-checkins] r55713 - in sandbox/branches/setuptools-0.6: ez_setup.py release.sh setup.py setuptools/__init__.py version.dat Message-ID: <20070531174834.B56C61E4003@bag.python.org> Author: phillip.eby Date: Thu May 31 19:48:28 2007 New Revision: 55713 Modified: sandbox/branches/setuptools-0.6/ez_setup.py sandbox/branches/setuptools-0.6/release.sh sandbox/branches/setuptools-0.6/setup.py sandbox/branches/setuptools-0.6/setuptools/__init__.py sandbox/branches/setuptools-0.6/version.dat Log: bump version Modified: sandbox/branches/setuptools-0.6/ez_setup.py ============================================================================== --- sandbox/branches/setuptools-0.6/ez_setup.py (original) +++ sandbox/branches/setuptools-0.6/ez_setup.py Thu May 31 19:48:28 2007 @@ -14,7 +14,7 @@ This file can also be run as a script to install or upgrade setuptools. """ import sys -DEFAULT_VERSION = "0.6c6" +DEFAULT_VERSION = "0.6c7" DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { Modified: sandbox/branches/setuptools-0.6/release.sh ============================================================================== --- sandbox/branches/setuptools-0.6/release.sh (original) +++ sandbox/branches/setuptools-0.6/release.sh Thu May 31 19:48:28 2007 @@ -7,7 +7,7 @@ # If your initials aren't PJE, don't run it. :) # -export VERSION="0.6c6" +export VERSION="0.6c7" python2.3 setup.py -q release source --target-version=2.3 upload && \ python2.4 setup.py -q release binary --target-version=2.4 upload && \ Modified: sandbox/branches/setuptools-0.6/setup.py ============================================================================== --- sandbox/branches/setuptools-0.6/setup.py (original) +++ sandbox/branches/setuptools-0.6/setup.py Thu May 31 19:48:28 2007 @@ -7,7 +7,7 @@ execfile(convert_path('setuptools/command/__init__.py'), d) SETUP_COMMANDS = d['__all__'] -VERSION = "0.6c6" +VERSION = "0.6c7" from setuptools import setup, find_packages import sys Modified: sandbox/branches/setuptools-0.6/setuptools/__init__.py ============================================================================== --- sandbox/branches/setuptools-0.6/setuptools/__init__.py (original) +++ sandbox/branches/setuptools-0.6/setuptools/__init__.py Thu May 31 19:48:28 2007 @@ -7,7 +7,7 @@ from distutils.util import convert_path import os.path -__version__ = '0.6c6' +__version__ = '0.6c7' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' Modified: sandbox/branches/setuptools-0.6/version.dat ============================================================================== --- sandbox/branches/setuptools-0.6/version.dat (original) +++ sandbox/branches/setuptools-0.6/version.dat Thu May 31 19:48:28 2007 @@ -1,6 +1,6 @@ [setuptools] status = 'release candidate' major = 0 -build = 6 +build = 7 minor = 6 From python-checkins at python.org Thu May 31 21:20:06 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 21:20:06 +0200 (CEST) Subject: [Python-checkins] r55716 - in python/trunk: Lib/sha.py Lib/test/test_hmac.py Lib/test/test_pep247.py Lib/test/test_sha.py Lib/uuid.py Misc/NEWS Message-ID: <20070531192006.1E97F1E400C@bag.python.org> Author: brett.cannon Date: Thu May 31 21:20:00 2007 New Revision: 55716 Modified: python/trunk/Lib/sha.py python/trunk/Lib/test/test_hmac.py python/trunk/Lib/test/test_pep247.py python/trunk/Lib/test/test_sha.py python/trunk/Lib/uuid.py python/trunk/Misc/NEWS Log: Have the sha module raise a DeprecationWarning as specified in PEP 4. Modified: python/trunk/Lib/sha.py ============================================================================== --- python/trunk/Lib/sha.py (original) +++ python/trunk/Lib/sha.py Thu May 31 21:20:00 2007 @@ -3,6 +3,10 @@ # Copyright (C) 2005 Gregory P. Smith (greg at electricrain.com) # Licensed to PSF under a Contributor Agreement. +import warnings +warnings.warn("the sha module is deprecated; use the hashlib module instead", + DeprecationWarning, 2) + from hashlib import sha1 as sha new = sha Modified: python/trunk/Lib/test/test_hmac.py ============================================================================== --- python/trunk/Lib/test/test_hmac.py (original) +++ python/trunk/Lib/test/test_hmac.py Thu May 31 21:20:00 2007 @@ -1,5 +1,5 @@ import hmac -import sha +from hashlib import sha1 import unittest from test import test_support @@ -43,7 +43,7 @@ def test_sha_vectors(self): def shatest(key, data, digest): - h = hmac.HMAC(key, data, digestmod=sha) + h = hmac.HMAC(key, data, digestmod=sha1) self.assertEqual(h.hexdigest().upper(), digest.upper()) shatest(chr(0x0b) * 20, @@ -95,11 +95,11 @@ def test_withmodule(self): # Constructor call with text and digest module. - import sha + from hashlib import sha1 try: - h = hmac.HMAC("key", "", sha) + h = hmac.HMAC("key", "", sha1) except: - self.fail("Constructor call with sha module raised exception.") + self.fail("Constructor call with hashlib.sha1 raised exception.") class SanityTestCase(unittest.TestCase): Modified: python/trunk/Lib/test/test_pep247.py ============================================================================== --- python/trunk/Lib/test/test_pep247.py (original) +++ python/trunk/Lib/test/test_pep247.py Thu May 31 21:20:00 2007 @@ -6,6 +6,8 @@ import warnings warnings.filterwarnings("ignore", "the md5 module is deprecated.*", DeprecationWarning) +warnings.filterwarnings("ignore", "the sha module is deprecated.*", + DeprecationWarning) import md5, sha, hmac Modified: python/trunk/Lib/test/test_sha.py ============================================================================== --- python/trunk/Lib/test/test_sha.py (original) +++ python/trunk/Lib/test/test_sha.py Thu May 31 21:20:00 2007 @@ -4,6 +4,10 @@ # Publication 180-1, Secure Hash Standard, 1995 April 17 # http://www.itl.nist.gov/div897/pubs/fip180-1.htm +import warnings +warnings.filterwarnings("ignore", "the sha module is deprecated.*", + DeprecationWarning) + import sha import unittest from test import test_support Modified: python/trunk/Lib/uuid.py ============================================================================== --- python/trunk/Lib/uuid.py (original) +++ python/trunk/Lib/uuid.py Thu May 31 21:20:00 2007 @@ -529,8 +529,8 @@ def uuid5(namespace, name): """Generate a UUID from the SHA-1 hash of a namespace UUID and a name.""" - import sha - hash = sha.sha(namespace.bytes + name).digest() + from hashlib import sha1 + hash = sha1(namespace.bytes + name).digest() return UUID(bytes=hash[:16], version=5) # The following standard UUIDs are for use with uuid3() or uuid5(). Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu May 31 21:20:00 2007 @@ -220,6 +220,8 @@ Library ------- +- sha now raises a DeprecationWarning upon import. + - md5 now raises a DeprecationWarning upon import. - mimify now raises a DeprecationWarning upon import. From python-checkins at python.org Thu May 31 21:20:57 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 21:20:57 +0200 (CEST) Subject: [Python-checkins] r55717 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Message-ID: <20070531192057.0A71A1E4013@bag.python.org> Author: brett.cannon Date: Thu May 31 21:20:54 2007 New Revision: 55717 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Log: Update PEPs to reflect the raising of a DeprecationWarning by the sha module. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Thu May 31 21:20:54 2007 @@ -84,7 +84,7 @@ The following modules currently lack a DeprecationWarning: - rfc822, mimetools, multifile, sha, buildtools, cfmfile + rfc822, mimetools, multifile, buildtools, cfmfile Deprecated modules @@ -232,6 +232,7 @@ Date: 15-May-2007 Documentation: Documented as deprecated as of Python 2.5, but listing in this PEP was neglected. + DeprecationWarning added in Python 2.6. Module name: plat-freebsd2/IN and plat-freebsd3/IN Rationale: Platforms are obsolete (last released in 2000) Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Thu May 31 21:20:54 2007 @@ -69,6 +69,7 @@ - popen2, os.popen[234]() - posixfile - sets + - sha Modules removed from the standard library: @@ -130,7 +131,6 @@ - rfc822 - mimetools - multifile - - sha - buildtools - cfmfile - compiler package From python-checkins at python.org Thu May 31 21:40:48 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 21:40:48 +0200 (CEST) Subject: [Python-checkins] r55719 - in python/trunk: Lib/plat-mac/buildtools.py Misc/NEWS Message-ID: <20070531194048.676FD1E402B@bag.python.org> Author: brett.cannon Date: Thu May 31 21:40:42 2007 New Revision: 55719 Modified: python/trunk/Lib/plat-mac/buildtools.py python/trunk/Misc/NEWS Log: Cause buildtools to raise a DeprecationWarning. Modified: python/trunk/Lib/plat-mac/buildtools.py ============================================================================== --- python/trunk/Lib/plat-mac/buildtools.py (original) +++ python/trunk/Lib/plat-mac/buildtools.py Thu May 31 21:40:42 2007 @@ -14,6 +14,9 @@ import EasyDialogs import shutil +import warnings +warnings.warn("the buildtools module is deprecated", DeprecationWarning, 2) + BuildError = "BuildError" Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu May 31 21:40:42 2007 @@ -909,6 +909,8 @@ Mac --- +- buildtools now raises a DeprecationWarning. + - Removed the macfs module. It had been deprecated since Python 2.5. This lead to the deprecation of macostools.touched() as it relied solely on macfs and was a no-op under OS X. From python-checkins at python.org Thu May 31 21:41:44 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 21:41:44 +0200 (CEST) Subject: [Python-checkins] r55720 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Message-ID: <20070531194144.201D61E4003@bag.python.org> Author: brett.cannon Date: Thu May 31 21:41:41 2007 New Revision: 55720 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Log: Update PEPs about buildtools raising a DeprecationWarning. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Thu May 31 21:41:41 2007 @@ -84,7 +84,7 @@ The following modules currently lack a DeprecationWarning: - rfc822, mimetools, multifile, buildtools, cfmfile + rfc822, mimetools, multifile, cfmfile Deprecated modules @@ -205,7 +205,8 @@ Rationale: Unknown. Date: 15-May-2007 Documentation: Documented as deprecated as of Python 2.3, but - listing in this PEP was neglected. + listing in this PEP was neglected. Raised a + DeprecationWarning as of Python 2.6. Module name: cfmfile Rationale: Unknown. Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Thu May 31 21:41:41 2007 @@ -61,6 +61,7 @@ Deprecated modules and functions in the standard library: + - buildtools - commands.getstatus() - macostools.touched() - md5 @@ -131,7 +132,6 @@ - rfc822 - mimetools - multifile - - buildtools - cfmfile - compiler package From python-checkins at python.org Thu May 31 22:01:16 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 22:01:16 +0200 (CEST) Subject: [Python-checkins] r55721 - in python/trunk: Lib/plat-mac/cfmfile.py Misc/NEWS Message-ID: <20070531200116.664611E4003@bag.python.org> Author: brett.cannon Date: Thu May 31 22:01:11 2007 New Revision: 55721 Modified: python/trunk/Lib/plat-mac/cfmfile.py python/trunk/Misc/NEWS Log: Have cfmfile raise a DeprecationWarning as per PEP 4. Modified: python/trunk/Lib/plat-mac/cfmfile.py ============================================================================== --- python/trunk/Lib/plat-mac/cfmfile.py (original) +++ python/trunk/Lib/plat-mac/cfmfile.py Thu May 31 22:01:11 2007 @@ -11,6 +11,9 @@ import os import sys +import warnings +warnings.warn("the cfmfile module is deprecated", DeprecationWarning, 2) + DEBUG = 0 error = "cfm.error" Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu May 31 22:01:11 2007 @@ -909,6 +909,8 @@ Mac --- +- cfmfile now raises a DeprecationWarning. + - buildtools now raises a DeprecationWarning. - Removed the macfs module. It had been deprecated since Python 2.5. This From python-checkins at python.org Thu May 31 22:01:46 2007 From: python-checkins at python.org (brett.cannon) Date: Thu, 31 May 2007 22:01:46 +0200 (CEST) Subject: [Python-checkins] r55722 - peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Message-ID: <20070531200146.83A0F1E4006@bag.python.org> Author: brett.cannon Date: Thu May 31 22:01:43 2007 New Revision: 55722 Modified: peps/trunk/pep-0004.txt peps/trunk/pep-0361.txt Log: Update PEPs to reflect that cfmfile now raises a DeprecationWarning. Modified: peps/trunk/pep-0004.txt ============================================================================== --- peps/trunk/pep-0004.txt (original) +++ peps/trunk/pep-0004.txt Thu May 31 22:01:43 2007 @@ -84,7 +84,7 @@ The following modules currently lack a DeprecationWarning: - rfc822, mimetools, multifile, cfmfile + rfc822, mimetools, multifile Deprecated modules @@ -212,7 +212,8 @@ Rationale: Unknown. Date: 15-May-2007 Documentation: Documented as deprecated as of Python 2.4, but - listing in this PEP was neglected. + listing in this PEP was neglected. A + DeprecationWarning was added in Python 2.6. Module name: macfs Rationale: Unknown. Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Thu May 31 22:01:43 2007 @@ -62,6 +62,7 @@ Deprecated modules and functions in the standard library: - buildtools + - cfmfile - commands.getstatus() - macostools.touched() - md5 @@ -132,8 +133,7 @@ - rfc822 - mimetools - multifile - - cfmfile - - compiler package + - compiler package (or a Py3K warning instead?) - warnings module implemented in C * Convert Parser/*.c to use warnings module rather than printf From buildbot at python.org Thu May 31 22:13:27 2007 From: buildbot at python.org (buildbot at python.org) Date: Thu, 31 May 2007 20:13:27 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20070531201327.6FC701E401C@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/474 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon,neal.norwitz Build had warnings: warnings failed slave lost sincerely, -The Buildbot